diff --git a/examples/ipv6/rpl-border-router/border-router.c b/examples/ipv6/rpl-border-router/border-router.c index 84943e68f..90b1fdf23 100644 --- a/examples/ipv6/rpl-border-router/border-router.c +++ b/examples/ipv6/rpl-border-router/border-router.c @@ -41,7 +41,10 @@ #include "net/ip/uip.h" #include "net/ipv6/uip-ds6.h" #include "net/rpl/rpl.h" - +#include "net/rpl/rpl-private.h" +#if RPL_WITH_NON_STORING +#include "net/rpl/rpl-ns.h" +#endif /* RPL_WITH_NON_STORING */ #include "net/netstack.h" #include "dev/button-sensor.h" #include "dev/slip.h" @@ -144,6 +147,9 @@ static PT_THREAD(generate_routes(struct httpd_state *s)) { static uip_ds6_route_t *r; +#if RPL_WITH_NON_STORING + static rpl_ns_node_t *link; +#endif /* RPL_WITH_NON_STORING */ static uip_ds6_nbr_t *nbr; #if BUF_USES_STACK char buf[256]; @@ -210,7 +216,7 @@ PT_THREAD(generate_routes(struct httpd_state *s)) } #endif } - ADD("Routes
");
+  ADD("
Routes
\n");
   SEND_STRING(&s->sout, buf);
 #if BUF_USES_STACK
   bufptr = buf; bufend = bufptr + sizeof(buf);
@@ -259,6 +265,65 @@ PT_THREAD(generate_routes(struct httpd_state *s))
   }
   ADD("
"); +#if RPL_WITH_NON_STORING + ADD("Links
\n");
+  SEND_STRING(&s->sout, buf);
+#if BUF_USES_STACK
+  bufptr = buf; bufend = bufptr + sizeof(buf);
+#else
+  blen = 0;
+#endif
+  for(link = rpl_ns_node_head(); link != NULL; link = rpl_ns_node_next(link)) {
+    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);
+
+#if BUF_USES_STACK
+#if WEBSERVER_CONF_ROUTE_LINKS
+      ADD("");
+      ipaddr_add(&child_ipaddr);
+      ADD("");
+#else
+      ipaddr_add(&child_ipaddr);
+#endif
+#else
+#if WEBSERVER_CONF_ROUTE_LINKS
+      ADD("");
+      SEND_STRING(&s->sout, buf); //TODO: why tunslip6 needs an output here, wpcapslip does not
+      blen = 0;
+      ipaddr_add(&child_ipaddr);
+      ADD("");
+#else
+      ipaddr_add(&child_ipaddr);
+#endif
+#endif
+
+      ADD(" (parent: ");
+      ipaddr_add(&parent_ipaddr);
+      if(1 || (link->lifetime < 600)) {
+        ADD(") %us\n", (unsigned int)link->lifetime); // iotlab printf does not have %lu
+        //ADD(") %lus\n", (unsigned long)r->state.lifetime);
+      } else {
+        ADD(")\n");
+      }
+      SEND_STRING(&s->sout, buf);
+#if BUF_USES_STACK
+      bufptr = buf; bufend = bufptr + sizeof(buf);
+#else
+      blen = 0;
+#endif
+    }
+  }
+  ADD("
"); +#endif /* RPL_WITH_NON_STORING */ + #if WEBSERVER_CONF_FILESTATS static uint16_t numtimes; ADD("
This page sent %u times",++numtimes);