Contiki find neighbors

379 views Asked by At

I want to find or list all of my neighbor nodes. It should be broadcast or unicast process for nodes. How can I find them with Contiki? Are there any functions for that?

1

There are 1 answers

0
kfx On

IPv6 neighbors are stored in list ds6_neighbors. To iterate over this list you can use this code:

For Contiki:

#include "net/ipv6/uip-ds6.h"

uip_ds6_nbr_t *nbr;
for(nbr = nbr_table_head(ds6_neighbors);
    nbr != NULL;
    nbr = nbr_table_next(ds6_neighbors, nbr)) {
   /* process nbr here */
}

For Contiki-NG:

#include "net/ipv6/uip-ds6-nbr.h"

uip_ds6_nbr_t *nbr;
for(nbr = uip_ds6_nbr_head();
    nbr != NULL;
    nbr = uip_ds6_nbr_next(nbr)) {
     /* process nbr here */
}

Other network layers have their own notions of neighbors. There are TSCH neighbors, RPL neighbors (called "parents"), and link layer neighbors, each in a separate list.