我想查找或列出我所有的邻居节点。它应该是节点的广播或单播过程。如何使用 Contiki 找到它们?有什么功能吗?
问问题
90 次
1 回答
1
IPv6 邻居存储在 list 中ds6_neighbors
。要遍历此列表,您可以使用以下代码:
对于康蒂基:
#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 邻居(称为“父母”)和链路层邻居,每个都在一个单独的列表中。
于 2021-05-31T09:15:16.113 回答