我想查找或列出我所有的邻居节点。对于节点,它应该是广播或单播过程。我怎么才能用Contiki找到它们?有没有什么函数可以解决这个问题?
发布于 2021-05-31 17:15:16
IPv6邻居存储在列表ds6_neighbors中。要遍历此列表,可以使用以下代码:
对于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 */
}对于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 */
}其他网络层也有自己的邻居概念。有TSCH邻居、RPL邻居(称为“双亲”)和链路层邻居,每一个都在单独的列表中。
https://stackoverflow.com/questions/67756480
复制相似问题