[olsr-dev] How to check if a node is MPR-node from a plugin?
Andreas Tønnesen
(spam-protected)
Thu Dec 15 22:14:12 CET 2005
Hei Roar,
The way I see this there are two solutions. If you plan on using the
olsr_lookup_mprs_set function you must provide the main address of the
MPR selector, so this is not a good solution as you would have to
traverse the link set and check all main addresses.
The first one solution would be to create a function BOOL is_mpr() which
you can poll. I can add such a function to cvs if needed. What you need
is basically(in mpr_selector_set.c):
OLSR_BOOL
olsr_is_mpr()
{
return (mprs_list.next == &mprs_list ? OLSR_FALSE : OLSR_TRUE);
}
The non pollbased way would be to add a callback event for mpr selector
change, meaning that plugins can register callbacks to be triggered upon
changes. I don't think we want to do this in the main code for now, so
you'll have to maintain this yourself IMO.
- Andreas
Roar Bjørgum Rotvik wrote:
> Hi,
>
> I'm about to create a plug in that need to know if the olsrd node the
> plug in is operating on is an MPR or not and the plug in will also need
> to detect changes in MPR status.
>
> One way to do it (I think) is to send the node main address into
> olsr_lookup_mprs_set() and check if it is an MPR or not.
>
> But if I need to detect changes in MPR status, the plug in will need to
> do this regularly. And if I'm using the approach I described above, I
> guess I would need to "poll" the change each second or so, but I don't
> know if this is recommended or not.
>
> Is there a better way for a plug in to obtain MPR status and MPR status
> changes (within a short time frame, lets say 1 sec max)?
>
More information about the Olsr-dev
mailing list