43 #include "contiki-net.h"
50 #define PRINTF(...) printf(__VA_ARGS__)
51 #define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((u8_t *)addr)[0], ((u8_t *)addr)[1], ((u8_t *)addr)[2], ((u8_t *)addr)[3], ((u8_t *)addr)[4], ((u8_t *)addr)[5], ((u8_t *)addr)[6], ((u8_t *)addr)[7], ((u8_t *)addr)[8], ((u8_t *)addr)[9], ((u8_t *)addr)[10], ((u8_t *)addr)[11], ((u8_t *)addr)[12], ((u8_t *)addr)[13], ((u8_t *)addr)[14], ((u8_t *)addr)[15])
52 #define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",lladdr.u8[0], lladdr.u8[1], lladdr.u8[2], lladdr.u8[3],lladdr.u8[4], lladdr.u8[5], lladdr.u8[6], lladdr.u8[7])
55 #define PRINT6ADDR(addr)
56 #define PRINTLLADDR(addr)
63 for(i = 0; i < 7; ++i) {
64 printf(
"%02x%02x:", lladdr->ipaddr.u8[i * 2], lladdr->ipaddr.u8[i * 2 + 1]);
66 printf(
"%02x%02x", lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]);
70 void print_addresses(
void)
75 printf(
"link-local IPv6 address: ");
77 lladdr = uip_ds6_get_link_local(-1);
79 print_address(lladdr);
85 printf(
"global IPv6 address: ");
87 lladdr = uip_ds6_get_global(-1);
89 print_address(lladdr);
99 #include "net/rpl/rpl.h"
102 void set_net_address(
void)
105 #if RPL_BORDER_ROUTER
109 uip_ip6addr(&ipaddr, NET_ADDR_A, NET_ADDR_B, NET_ADDR_C, NET_ADDR_D, 0, 0, 0, 0);
122 #if RPL_BORDER_ROUTER
123 dag = rpl_set_root(&ipaddr);
125 PRINTF(
"This node is setted as root of a DAG.\r\n");
128 PRINTF(
"Error while setting this node as root of a DAG.\r\n");