On Wed, 2007-07-18 at 12:32 +0200, Sven-Ola Tuecke wrote:
> Hi all,
> 
> really not a showstopper, but this time someone has fiddeled with the plugin 

Yup, /me.

> interface. For at least half of the plugins included with 
> olsrd-0.5.2.tar.bz2, the transition from PLUG_VER 4 to 5 is not complete 
> currently. Example: nameservice, bmf, quagga etc will not load out of the 
> box.
> 
> @package-maintainers: Please compile with:
> make DEFINES='-DSUPPORT_OLD_PLUGIN_VERSIONS=1'

Ooops, .....
Fixed in CVS-HEAD.

> @Bernd: Can we introduce a simple "smoke test procedure"? And a wish: Can 

^^^^^^^^^^^^^^^^^^^^
What do you mean with this?

> the plugin-iface-maintainer write down a small note on what to change for 
> external plugins?

Of course:

The plugin should export the function
----  snip  ----
void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size)
----  snip  ----
(replacing  completely "olsrd_plugin_register_param").

It exports a pointer to a table of (to be found in src/olsrd_plugin.h)
----  snip  ----
struct olsrd_plugin_parameters {
    const char *name;
    set_plugin_parameter set_plugin_parameter;
    void *data;
};
----  snip  ----
containing the name of the parameter, a function to be called if the
parameter is found and some address where to store the result. And the
"int *" gives the size of the table (as I don't like tables with
terminating "0" rows if the row is more an an int or pointer).

It is a function and not the table (+size) as such so that the plugin
could e.g. generate the table at run-time (for whatever reason and
motivation).

The function is a
----  snip  ----
typedef int (*set_plugin_parameter)(const char *value, void *data);
----  snip  ----
and gets the value of the parameter from olsrd.conf and the "data" from
the table above (so one can use the same function twice for two
different parameters of the same type).

The parameter name is case-insensitive since now (so all old
configurations should work with that respect).
The interpretation of the value depends obviously on the function. And I
intend to put more often used functions somewhere central to be used by
all plugins (do that "parse a port number" is one piece of code and thus
consistent through all plugins).

Use e.g. the txtinfo plugin as a "template" (hmm, not to self: I should
migrate the "mini" plugin too).

The simple solution is to put them into the main program even if they
are not really needed there. Another is to put each of them in
separate .c files (in a special directory) and plugins #include or link
against them (which also leads to "bloat" but in a different way).

The problem is ATM in the back of my head and waiting for a "nice
solution"(TM) ...

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services




