Clarified the function naming for neighbor information callbacks - names now indicate where the information is from.

This commit is contained in:
nvt-se 2010-06-14 18:35:04 +00:00
parent 6eadf2522f
commit fad2b1def9
3 changed files with 25 additions and 23 deletions

View file

@ -32,7 +32,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: rpl-dag.c,v 1.28 2010/06/14 13:07:09 nifi Exp $ * $Id: rpl-dag.c,v 1.29 2010/06/14 18:35:04 nvt-se Exp $
*/ */
/** /**
* \file * \file
@ -682,22 +682,4 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
p->dtsn = dio->dtsn; p->dtsn = dio->dtsn;
} }
/************************************************************************/ /************************************************************************/
void
rpl_ds6_neighbor_callback(uip_ds6_nbr_t *nbr)
{
rpl_dag_t *dag;
rpl_parent_t *p;
dag = rpl_get_dag(RPL_ANY_INSTANCE);
if(!nbr->isused && dag) {
PRINTF("RPL: Removing neighbor ");
PRINT6ADDR(&nbr->ipaddr);
PRINTF("\n");
p = rpl_find_parent(dag, &nbr->ipaddr);
if(p != NULL) {
p->rank = INFINITE_RANK;
/* Trigger DAG rank recalculation. */
p->updated = 1;
}
}
}

View file

@ -32,7 +32,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: rpl.c,v 1.7 2010/06/14 12:44:37 nvt-se Exp $ * $Id: rpl.c,v 1.8 2010/06/14 18:35:04 nvt-se Exp $
*/ */
/** /**
* \file * \file
@ -117,7 +117,7 @@ rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix, int prefix_len,
} }
/************************************************************************/ /************************************************************************/
static void static void
neighbor_callback(const rimeaddr_t *addr, int known, int etx) rpl_link_neighbor_callback(const rimeaddr_t *addr, int known, int etx)
{ {
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
rpl_dag_t *dag; rpl_dag_t *dag;
@ -165,11 +165,31 @@ neighbor_callback(const rimeaddr_t *addr, int known, int etx)
} }
/************************************************************************/ /************************************************************************/
void void
rpl_ipv6_neighbor_callback(uip_ds6_nbr_t *nbr)
{
rpl_dag_t *dag;
rpl_parent_t *p;
dag = rpl_get_dag(RPL_ANY_INSTANCE);
if(!nbr->isused && dag) {
PRINTF("RPL: Removing neighbor ");
PRINT6ADDR(&nbr->ipaddr);
PRINTF("\n");
p = rpl_find_parent(dag, &nbr->ipaddr);
if(p != NULL) {
p->rank = INFINITE_RANK;
/* Trigger DAG rank recalculation. */
p->updated = 1;
}
}
}
/************************************************************************/
void
rpl_init(void) rpl_init(void)
{ {
PRINTF("RPL started\n"); PRINTF("RPL started\n");
rpl_reset_periodic_timer(); rpl_reset_periodic_timer();
neighbor_info_subscribe(neighbor_callback); neighbor_info_subscribe(rpl_link_neighbor_callback);
} }
/************************************************************************/ /************************************************************************/

View file

@ -235,7 +235,7 @@ typedef struct rpl_route_entry {
} rpl_route_entry_t; } rpl_route_entry_t;
#endif /* UIP_DS6_ROUTE_STATE_TYPE */ #endif /* UIP_DS6_ROUTE_STATE_TYPE */
#ifndef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED #ifndef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED
#define UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED rpl_ds6_neighbor_callback #define UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED rpl_ipv6_neighbor_callback
#endif /* UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED */ #endif /* UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED */
/* #endif /\* UIP_CONF_IPV6_RPL *\/ */ /* #endif /\* UIP_CONF_IPV6_RPL *\/ */