[olsr-dev] How to check if a node is MPR-node from a plugin?

Roar Bjørgum Rotvik (spam-protected)
Fri Dec 16 08:24:09 CET 2005


Andreas Tønnesen wrote:
> Hei Roar,

Hei Andreas,

> 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.

Yes, this was the same conclusion I made, that's why I asked on this list :)

> 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);
> }

Yes, please add such a function.
I don't known why the above code should  indicate that the current node
is an MPR, as I'm not that familiar with the core olsrd data structures.
But I trust you :)

> 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.

I understand this completely. I will fix this myself in the plugin if
you add the is_mpr() function to CVS.

Thanks Andreas!

-- 
Roar Bjørgum Rotvik




More information about the Olsr-dev mailing list