Added a function uip_ds6_nbr_num() for getting the number of neighbors

This commit is contained in:
Adam Dunkels 2013-08-11 23:55:08 +02:00 committed by Simon Duquennoy
parent a027832f94
commit 08761dfd8a
2 changed files with 16 additions and 1 deletions

View file

@ -137,7 +137,21 @@ uip_ds6_nbr_get_ll(uip_ds6_nbr_t *nbr)
{
return (uip_lladdr_t *)nbr_table_get_lladdr(ds6_neighbors, nbr);
}
/*---------------------------------------------------------------------------*/
int
uip_ds6_nbr_num(void)
{
uip_ds6_nbr_t *nbr;
int num;
num = 0;
for(nbr = nbr_table_head(ds6_neighbors);
nbr != NULL;
nbr = nbr_table_next(ds6_neighbors, nbr)) {
num++;
}
return num;
}
/*---------------------------------------------------------------------------*/
uip_ds6_nbr_t *
uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr)

View file

@ -93,7 +93,8 @@ uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr);
uip_ipaddr_t *uip_ds6_nbr_ipaddr_from_lladdr(uip_lladdr_t *lladdr);
uip_lladdr_t *uip_ds6_nbr_lladdr_from_ipaddr(uip_ipaddr_t *ipaddr);
void uip_ds6_link_neighbor_callback(int status, int numtx);
void uip_ds6_neighbor_periodic();
void uip_ds6_neighbor_periodic(void);
int uip_ds6_nbr_num(void);
/**
* \brief