[Olsr-users] Plugins and the api
Jonathan P. Chapman
(spam-protected)
Tue Sep 21 19:20:18 CEST 2010
Hi!
Am 21.09.2010 11:36, schrieb Sergio López:
> A message can only have one parser? Can I add more parsers, for
> example, to hello message?
Yes we can! ;-)
Check src/parser.c:~370 - it loops over all registered parsers and
checks whether they are registered for the type of a given message and
executes the parser, if the type matches. I.e. you can have an arbitrary
number of parsers for each type.
> Actually, what I need is to add a parser to every single message. Is
> this possible?
There is a match for the "PROMISC"-type - this sounds pretty much like
what you want to do :-)
> How is the parser order defined if more than one parser can be added?
The later the entry is added, the earlier it will be executed (see
src/parser.c:~130), but notice that you cannot abort the parsing, if you
want a second parser to be called only under certain conditions, you
have to unregister it and call it through the first parser, if the
conditions are met. Technically, you could also change the message type
or zero the message to (try to) disable parsing by other parsers, but
that puts you in a dangerous place since you cannot predict the
behaviour of other parsers under such conditions.
Best regards!
Jonathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.olsr.org/pipermail/olsr-users/attachments/20100921/d485af61/attachment.sig>
More information about the Olsr-users
mailing list