[Olsr-dev] How to programming OLSR plug-in

Henning Rogge (spam-protected)
Fri Jul 24 11:27:19 CEST 2009


Am Freitag 24 Juli 2009 10:58:06 schrieb chaiwat yanaprasop:
> Hello everybordy,
>    I'm newbie in programming a OLSR plug-in , I would like to know
> about "what are the files and functions pattern when we want to
> implement a OLSR plug-in".  Could you help me, please? I saw each
> exist plug-in in OLSR but I still understand the pattern of it.
Okay, there are two plugin interfaces in OLSRd... one in 0.5.6 and another one 
in the development version (the development version can work with the old one 
too, but the new one is easier to use).

The easiest way to learn about the 0.5.6 plugin structure is to look at the 
"mini" plugin. It's just the necessary code wrapper for the plugin V5 
infrastructure.

The V6 plugin system is based on a single macro in src/plugin_loader.h:

DEFINE_PLUGIN6(descr, author, pre_init, post_init, pre_cleanup, post_cleanup, 
deactivate, parameter)

descr: Text description of the plugin
author: Name of the plugins author
pre_init: callback which is called before plugin is initialized
  (and parameters are loaded)
post_init: callback after parameters have been loaded by plugin core
pre_cleanup: callback before the plugin will be removed from the plugin core
post_cleanup: callback after the plugin has been removed from the core
deactivate: true if the plugin can be removed during runtime, false otherwise
parameter: NULL or pointer to olsrd_plugin_parameters array.

All callbacks can be NULL or a pointer to a function without parameters which 
returns a boolean (true if an error happened, false otherwise).


The other thing you need for V5 and V6 plugins is an array of 
olsrd_plugin_parameters. With this array you can define the parameters of your 
plugin, so they can be parsed by the core.

Just look into some of the existing plugins for examples.

Henning
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20090724/ba5761a4/attachment.sig>


More information about the Olsr-dev mailing list