rpl-tsch example: use RPL non-storing mode
This commit is contained in:
parent
00f2344b4a
commit
7a1576815e
5 changed files with 61 additions and 22 deletions
|
@ -41,6 +41,7 @@
|
|||
#include "net/rpl/rpl.h"
|
||||
#include "net/ipv6/uip-ds6-route.h"
|
||||
#include "net/mac/tsch/tsch.h"
|
||||
#include "net/rpl/rpl-private.h"
|
||||
#if WITH_ORCHESTRA
|
||||
#include "orchestra.h"
|
||||
#endif /* WITH_ORCHESTRA */
|
||||
|
@ -68,46 +69,73 @@ print_network_status(void)
|
|||
int i;
|
||||
uint8_t state;
|
||||
uip_ds6_defrt_t *default_route;
|
||||
#if RPL_WITH_STORING
|
||||
uip_ds6_route_t *route;
|
||||
#endif /* RPL_WITH_STORING */
|
||||
#if RPL_WITH_NON_STORING
|
||||
rpl_ns_node_t *link;
|
||||
#endif /* RPL_WITH_NON_STORING */
|
||||
|
||||
PRINTA("--- Network status ---\n");
|
||||
PRINTF("--- Network status ---\n");
|
||||
|
||||
/* Our IPv6 addresses */
|
||||
PRINTA("- Server IPv6 addresses:\n");
|
||||
PRINTF("- Server IPv6 addresses:\n");
|
||||
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
|
||||
state = uip_ds6_if.addr_list[i].state;
|
||||
if(uip_ds6_if.addr_list[i].isused &&
|
||||
(state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
|
||||
PRINTA("-- ");
|
||||
uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr);
|
||||
PRINTA("\n");
|
||||
PRINTF("-- ");
|
||||
PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
|
||||
PRINTF("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Our default route */
|
||||
PRINTA("- Default route:\n");
|
||||
PRINTF("- Default route:\n");
|
||||
default_route = uip_ds6_defrt_lookup(uip_ds6_defrt_choose());
|
||||
if(default_route != NULL) {
|
||||
PRINTA("-- ");
|
||||
uip_debug_ipaddr_print(&default_route->ipaddr);
|
||||
PRINTA(" (lifetime: %lu seconds)\n", (unsigned long)default_route->lifetime.interval);
|
||||
PRINTF("-- ");
|
||||
PRINT6ADDR(&default_route->ipaddr);
|
||||
PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)default_route->lifetime.interval);
|
||||
} else {
|
||||
PRINTA("-- None\n");
|
||||
PRINTF("-- None\n");
|
||||
}
|
||||
|
||||
#if RPL_WITH_STORING
|
||||
/* Our routing entries */
|
||||
PRINTA("- Routing entries (%u in total):\n", uip_ds6_route_num_routes());
|
||||
PRINTF("- Routing entries (%u in total):\n", uip_ds6_route_num_routes());
|
||||
route = uip_ds6_route_head();
|
||||
while(route != NULL) {
|
||||
PRINTA("-- ");
|
||||
uip_debug_ipaddr_print(&route->ipaddr);
|
||||
PRINTA(" via ");
|
||||
uip_debug_ipaddr_print(uip_ds6_route_nexthop(route));
|
||||
PRINTA(" (lifetime: %lu seconds)\n", (unsigned long)route->state.lifetime);
|
||||
PRINTF("-- ");
|
||||
PRINT6ADDR(&route->ipaddr);
|
||||
PRINTF(" via ");
|
||||
PRINT6ADDR(uip_ds6_route_nexthop(route));
|
||||
PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)route->state.lifetime);
|
||||
route = uip_ds6_route_next(route);
|
||||
}
|
||||
#endif
|
||||
|
||||
PRINTA("----------------------\n");
|
||||
#if RPL_WITH_NON_STORING
|
||||
/* Our routing links */
|
||||
PRINTF("- Routing links (%u in total):\n", rpl_ns_num_nodes());
|
||||
link = rpl_ns_node_head();
|
||||
while(link != NULL) {
|
||||
if(link->parent != NULL) {
|
||||
uip_ipaddr_t child_ipaddr;
|
||||
uip_ipaddr_t parent_ipaddr;
|
||||
rpl_ns_get_node_global_addr(&child_ipaddr, link);
|
||||
rpl_ns_get_node_global_addr(&parent_ipaddr, link->parent);
|
||||
PRINTF("-- ");
|
||||
PRINT6ADDR(&child_ipaddr);
|
||||
PRINTF(" to ");
|
||||
PRINT6ADDR(&parent_ipaddr);
|
||||
PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)link->lifetime);
|
||||
}
|
||||
link = rpl_ns_node_next(link);
|
||||
}
|
||||
#endif
|
||||
|
||||
PRINTF("----------------------\n");
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue