RPL: added callback for parent switches
This commit is contained in:
parent
b6d599b712
commit
08bcfd6972
|
@ -60,6 +60,11 @@
|
|||
#define DEBUG DEBUG_NONE
|
||||
#include "net/ip/uip-debug.h"
|
||||
|
||||
/* A configurable function called after every RPL parent switch */
|
||||
#ifdef RPL_CALLBACK_PARENT_SWITCH
|
||||
void RPL_CALLBACK_PARENT_SWITCH(rpl_parent_t *old, rpl_parent_t *new);
|
||||
#endif /* RPL_CALLBACK_PARENT_SWITCH */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern rpl_of_t RPL_OF;
|
||||
static rpl_of_t * const objective_functions[] = {&RPL_OF};
|
||||
|
@ -188,6 +193,10 @@ rpl_set_preferred_parent(rpl_dag_t *dag, rpl_parent_t *p)
|
|||
}
|
||||
PRINTF("\n");
|
||||
|
||||
#ifdef RPL_CALLBACK_PARENT_SWITCH
|
||||
RPL_CALLBACK_PARENT_SWITCH(dag->preferred_parent, p);
|
||||
#endif /* RPL_CALLBACK_PARENT_SWITCH */
|
||||
|
||||
/* Always keep the preferred parent locked, so it remains in the
|
||||
* neighbor table. */
|
||||
nbr_table_unlock(rpl_parents, dag->preferred_parent);
|
||||
|
|
Loading…
Reference in a new issue