Table of Contents

Olsrd internals

Olsrd plugin

olsrd's IPC Socket parser

A plugin register it's IPC socket with olsrd. The olsrd scheduler periodically checks all registered socket for pending actions (read/write) then calls the registered funtion.

Scheduler

main.c/main() starts scheduler.c/olsr_scheduler().

olsrscheduler starts a loop and call scheduler.c/pollsockets() periodically…

Registering plugin socket

olsrd's Package parser

Olsrd also registers its socket for core messages (port 689) with the scheduler. When a message arrives, the function parser.c/olsrinput() is called. There the message is processed and forwarded to parser.c/parsepacket(). This function checks the message for type and loop through the registered parser functions and forward the message to the appropriate one.

A plugin wishing to process a message should register its parser function and the respective message type with olsrd.

Olsrd plugin mdns

InitMDNS()

...
463   //Tells OLSR to launch olsr_parser when the packets for this plugin arrive
464   olsr_parser_add_function(&olsr_parser, PARSER_TYPE);
465   //Creates captures sockets and register them to the OLSR scheduler
466   CreateBmfNetworkInterfaces(skipThisIntf);
...

'olsrparseraddfunction()' registers &olsrparser, which will be called when a message of PARSER_TYPE is received.

'CreateBmfNetworkInterfaces(skipThisIntf)' prepares the interfaces (non olsrd??) prior to forwarding dns messages.

CreateBmfNetworkInterfaces(struct interface *skipThisIntf)

DoMDNS

DoMDNS is registerd with olsrd socket parser and is called whenever a packet is capture on registered interfaces. DoMDNS inspects the captured packet and call BmfPacketCaptured to process it.

BmfPacketCaptured

This function check if the packet is a MDNS packet (UDP 5353). If yes it pass the packet to olsrmdnsgen(encapsulationUdpData, nBytes); to forward it in olsrd network.

olsr_mdns_gen(encapsulationUdpData, nBytes)