diff --git a/apps/rest-common/static-routing.h b/apps/rest-common/static-routing.h index fc255ba4f..c4b757893 100644 --- a/apps/rest-common/static-routing.h +++ b/apps/rest-common/static-routing.h @@ -51,7 +51,7 @@ do{\ uip_ipaddr_t ipaddr_local, ipaddr_global;\ NODE_IP(node_global, GLOBAL, &ipaddr_global);\ NODE_IP(node_local, LOCAL, &ipaddr_local);\ - uip_ds6_route_add(&ipaddr_global, 128, &ipaddr_local, 0);\ + uip_ds6_route_add(&ipaddr_global, 128, &ipaddr_local);\ }while(0) void set_global_address(void); diff --git a/apps/webserver-nano/httpd-cgi.c b/apps/webserver-nano/httpd-cgi.c index cf85697ec..55cdafd8b 100644 --- a/apps/webserver-nano/httpd-cgi.c +++ b/apps/webserver-nano/httpd-cgi.c @@ -50,6 +50,7 @@ #include "httpd-fs.h" #include "httpd-fsdata.h" #include "lib/petsciiconv.h" +#include "net/neighbor-table.h" #include "sensors.h" @@ -479,7 +480,6 @@ PT_THREAD(addresses(struct httpd_state *s, char *ptr)) #endif /* WEBSERVER_CONF_ADDRESSES */ #if WEBSERVER_CONF_NEIGHBORS -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; /*---------------------------------------------------------------------------*/ static unsigned short make_neighbors(void *p) @@ -487,11 +487,13 @@ make_neighbors(void *p) uint8_t i,j; uint16_t numprinted=0; struct httpd_state *s=p; +static uip_ds6_nbr_t *nbr; /* Span generator calls over tcp segments */ /* Note retransmissions will execute thise code multiple times for a segment */ i=s->starti;j=s->startj; - for (;iipaddr, uip_appdata + numprinted); while (numprinted < k) {*((char *)uip_appdata+numprinted++) = ' ';} - switch (uip_ds6_nbr_cache[i].state) { + switch (nbr->state) { case NBR_INCOMPLETE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs1);break; case NBR_REACHABLE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs2);break; - case NBR_STALE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs3);break; + case NBR_STALE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs3);break; case NBR_DELAY: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs4);break; case NBR_PROBE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs5);break; } } #else - numprinted += httpd_cgi_sprint_ip6(uip_ds6_nbr_cache[i].ipaddr, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(nbr->ipaddr, uip_appdata + numprinted); #endif *((char *)uip_appdata+numprinted++) = '\n'; /* If buffer near full, send it and wait for the next call. Could be a retransmission, or the next segment */ if(numprinted > (uip_mss() - 50)) { - s->savei=i;s->savej=j; + s->savei=i;s->savej=j; return numprinted; } - } } #if WEBSERVER_CONF_SHOW_ROOM - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_NBR_NB-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); #else - if(UIP_DS6_NBR_NB == j) { + if(NEIGHBOR_TABLE_MAX_NEIGHBORS == j) { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf); } #endif @@ -554,7 +555,6 @@ PT_THREAD(neighbors(struct httpd_state *s, char *ptr)) #endif #if WEBSERVER_CONF_ROUTES -extern uip_ds6_route_t uip_ds6_routing_table[]; #if WEBSERVER_CONF_ROUTE_LINKS static const char httpd_cgi_rtesl1[] HTTPD_STRING_ATTR = "starti;j=s->startj; - for (;iipaddr, uip_appdata + numprinted); numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtesl2); - numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].ipaddr, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(r->ipaddr, uip_appdata + numprinted); numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtesl3); #else - numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].ipaddr, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(r->ipaddr, uip_appdata + numprinted); #endif - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, uip_ds6_routing_table[i].length); - numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].nexthop, uip_appdata + numprinted); - if(1 || uip_ds6_routing_table[i].state.lifetime < 3600) { - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, (long unsigned int)uip_ds6_routing_table[i].state.lifetime); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length); + numprinted += httpd_cgi_sprint_ip6(uip_ds6_route_nexthop(r), uip_appdata + numprinted); + if(1 || r->state.lifetime < 3600) { + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, (long unsigned int)r->state.lifetime); } else { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes3); } diff --git a/apps/webserver/httpd-cgi.c b/apps/webserver/httpd-cgi.c index 85ce3a521..c11a8770a 100644 --- a/apps/webserver/httpd-cgi.c +++ b/apps/webserver/httpd-cgi.c @@ -244,8 +244,6 @@ static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = ""; static const char httpd_cgi_addrf[] HTTPD_STRING_ATTR = "[Room for %u more]"; static const char httpd_cgi_addrb[] HTTPD_STRING_ATTR = "
"; static const char httpd_cgi_addrn[] HTTPD_STRING_ATTR = "(none)
"; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; static unsigned short @@ -282,15 +280,16 @@ make_neighbors(void *p) uint8_t i,j=0; uint16_t numprinted; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for (i=0; iipaddr, uip_appdata + numprinted); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb); } //if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn); - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_NBR_NB-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); return numprinted; } /*---------------------------------------------------------------------------*/ @@ -315,13 +314,13 @@ make_routes(void *p) uip_ds6_route_t *r; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { j++; numprinted += httpd_cgi_sprint_ip6(r->ipaddr, uip_appdata + numprinted); numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length); - numprinted += httpd_cgi_sprint_ip6(r->nexthop, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(uip_ds6_route_nexthop(r), uip_appdata + numprinted); if(r->state.lifetime < 3600) { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, r->state.lifetime); } else { diff --git a/examples/ipv6/native-border-router/border-router.c b/examples/ipv6/native-border-router/border-router.c index b8d01f2bb..6fb2f9168 100644 --- a/examples/ipv6/native-border-router/border-router.c +++ b/examples/ipv6/native-border-router/border-router.c @@ -63,9 +63,6 @@ uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011}; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; - extern long slip_sent; extern long slip_received; @@ -150,32 +147,34 @@ PT_THREAD(generate_routes(struct httpd_state *s)) { static int i; static uip_ds6_route_t *r; + static uip_ds6_nbr_t *nbr; + PSOCK_BEGIN(&s->sout); SEND_STRING(&s->sout, TOP); blen = 0; ADD("Neighbors
");
-  for(i = 0; i < UIP_DS6_NBR_NB; i++) {
-    if(uip_ds6_nbr_cache[i].isused) {
-      ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
-      ADD("\n");
-      if(blen > sizeof(buf) - 45) {
-        SEND_STRING(&s->sout, buf);
-        blen = 0;
-      }
+  for(nbr = nbr_table_head(ds6_neighbors);
+      nbr != NULL;
+      nbr = nbr_table_next(ds6_neighbors, nbr)) {
+    ipaddr_add(&nbr->ipaddr;);
+    ADD("\n");
+    if(blen > sizeof(buf) - 45) {
+      SEND_STRING(&s->sout, buf);
+      blen = 0;
     }
   }
 
   ADD("
Routes
");
   SEND_STRING(&s->sout, buf);
   blen = 0;
-  for(r = uip_ds6_route_list_head();
+  for(r = uip_ds6_route_head();
       r != NULL;
-      r = list_item_next(r)) {
+      r = uip_ds6_route_next(r)) {
     ipaddr_add(&r->ipaddr);
     ADD("/%u (via ", r->length);
-    ipaddr_add(&r->nexthop);
+    ipaddr_add(uip_ds6_route_nexthop(r));
     if(r->state.lifetime < 600) {
       ADD(") %lus\n", (unsigned long)r->state.lifetime);
     } else {
diff --git a/examples/ipv6/rpl-border-router/border-router.c b/examples/ipv6/rpl-border-router/border-router.c
index 9a40f84a1..4128cac38 100644
--- a/examples/ipv6/rpl-border-router/border-router.c
+++ b/examples/ipv6/rpl-border-router/border-router.c
@@ -56,8 +56,6 @@
 
 uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
 
-extern uip_ds6_nbr_t uip_ds6_nbr_cache[];
-
 static uip_ipaddr_t prefix;
 static uint8_t prefix_set;
 
@@ -149,6 +147,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
 {
   static int i;
   static uip_ds6_route_t *r;
+  static uip_ds6_nbr_t *nbr;
 #if BUF_USES_STACK
   char buf[256];
 #endif
@@ -166,15 +165,17 @@ PT_THREAD(generate_routes(struct httpd_state *s))
   blen = 0;
 #endif
   ADD("Neighbors
");
-  for(i = 0; i < UIP_DS6_NBR_NB; i++) {
-    if(uip_ds6_nbr_cache[i].isused) {
+
+  for(nbr = nbr_table_head(ds6_neighbors);
+      nbr != NULL;
+      nbr = nbr_table_next(ds6_neighbors, nbr)) {
 
 #if WEBSERVER_CONF_NEIGHBOR_STATUS
 #if BUF_USES_STACK
 {char* j=bufptr+25;
-      ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
+      ipaddr_add(&nbr->ipaddr);
       while (bufptr < j) ADD(" ");
-      switch (uip_ds6_nbr_cache[i].state) {
+      switch (nbr->state) {
       case NBR_INCOMPLETE: ADD(" INCOMPLETE");break;
       case NBR_REACHABLE: ADD(" REACHABLE");break;
       case NBR_STALE: ADD(" STALE");break;      
@@ -184,9 +185,9 @@ PT_THREAD(generate_routes(struct httpd_state *s))
 }
 #else
 {uint8_t j=blen+25;
-      ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
+      ipaddr_add(&nbr->ipaddr);
       while (blen < j) ADD(" ");
-      switch (uip_ds6_nbr_cache[i].state) {
+      switch (nbr->state) {
       case NBR_INCOMPLETE: ADD(" INCOMPLETE");break;
       case NBR_REACHABLE: ADD(" REACHABLE");break;
       case NBR_STALE: ADD(" STALE");break;      
@@ -196,7 +197,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
 }
 #endif
 #else
-      ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
+      ipaddr_add(&nbr->ipaddr);
 #endif
 
       ADD("\n");
@@ -211,7 +212,6 @@ PT_THREAD(generate_routes(struct httpd_state *s))
         blen = 0;
       }
 #endif
-    }
   }
   ADD("
Routes
");
   SEND_STRING(&s->sout, buf);
@@ -221,7 +221,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
   blen = 0;
 #endif
 
-  for(r = uip_ds6_route_list_head(); r != NULL; r = list_item_next(r)) {
+  for(r = uip_ds6_route_head(); r != NULL; r = uip_ds6_route_next(r)) {
 
 #if BUF_USES_STACK
 #if WEBSERVER_CONF_ROUTE_LINKS
@@ -247,7 +247,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
 #endif
 #endif
     ADD("/%u (via ", r->length);
-    ipaddr_add(&r->nexthop);
+    ipaddr_add(uip_ds6_route_nexthop(r));
     if(1 || (r->state.lifetime < 600)) {
       ADD(") %lus\n", r->state.lifetime);
     } else {
diff --git a/examples/ipv6/rpl-collect/udp-sender.c b/examples/ipv6/rpl-collect/udp-sender.c
index 113afdc4a..75d63e806 100644
--- a/examples/ipv6/rpl-collect/udp-sender.c
+++ b/examples/ipv6/rpl-collect/udp-sender.c
@@ -31,7 +31,6 @@
 #include "net/uip.h"
 #include "net/uip-ds6.h"
 #include "net/uip-udp-packet.h"
-#include "net/neighbor-info.h"
 #include "net/rpl/rpl.h"
 #include "dev/serial-line.h"
 #if CONTIKI_TARGET_Z1
@@ -64,7 +63,6 @@ collect_common_set_sink(void)
   /* A udp client can never become sink */
 }
 /*---------------------------------------------------------------------------*/
-extern uip_ds6_route_t uip_ds6_routing_table[UIP_DS6_ROUTE_NB];
 
 void
 collect_common_net_print(void)
@@ -76,12 +74,12 @@ collect_common_net_print(void)
   dag = rpl_get_any_dag();
   if(dag->preferred_parent != NULL) {
     PRINTF("Preferred parent: ");
-    PRINT6ADDR(&dag->preferred_parent->addr);
+    PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent));
     PRINTF("\n");
   }
-  for(r = uip_ds6_route_list_head();
+  for(r = uip_ds6_route_head();
       r != NULL;
-      r = list_item_next(r)) {
+      r = uip_ds6_route_next(r)) {
     PRINT6ADDR(&r->ipaddr);
   }
   PRINTF("---\n");
@@ -134,12 +132,12 @@ collect_common_send(void)
     preferred_parent = dag->preferred_parent;
     if(preferred_parent != NULL) {
       uip_ds6_nbr_t *nbr;
-      nbr = uip_ds6_nbr_lookup(&preferred_parent->addr);
+      nbr = uip_ds6_nbr_lookup(rpl_get_parent_ipaddr(preferred_parent));
       if(nbr != NULL) {
         /* Use parts of the IPv6 address as the parent address, in reversed byte order. */
         parent.u8[RIMEADDR_SIZE - 1] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 2];
         parent.u8[RIMEADDR_SIZE - 2] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 1];
-        parent_etx = neighbor_info_get_metric((rimeaddr_t *) &nbr->lladdr) / 2;
+        parent_etx = rpl_get_parent_rank((rimeaddr_t *) uip_ds6_nbr_get_ll(nbr)) / 2;
       }
     }
     rtmetric = dag->rank;
diff --git a/examples/ravenusbstick/fakeuip.c b/examples/ravenusbstick/fakeuip.c
index 0b8bd57d6..f7d4fff81 100644
--- a/examples/ravenusbstick/fakeuip.c
+++ b/examples/ravenusbstick/fakeuip.c
@@ -131,3 +131,9 @@ uip_icmp6chksum(void)
 {
   return upper_layer_chksum(UIP_PROTO_ICMP6); 
 }
+
+/*---------------------------------------------------------------------------*/
+void
+uip_ds6_link_neighbor_callback(int status, int numtx)
+{
+}
diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c
index 8bf7687c7..58c1f9649 100644
--- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c
+++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c
@@ -290,8 +290,6 @@ static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = "";
 static const char httpd_cgi_addrf[] HTTPD_STRING_ATTR = "[Room for %u more]";
 static const char httpd_cgi_addrb[] HTTPD_STRING_ATTR = "
"; static const char httpd_cgi_addrn[] HTTPD_STRING_ATTR = "(none)
"; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; static unsigned short @@ -328,15 +326,16 @@ make_neighbors(void *p) uint8_t i,j=0; uint16_t numprinted; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for (i=0; iipaddr, uip_appdata + numprinted); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb); } //if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn); - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_NBR_NB-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); return numprinted; } /*---------------------------------------------------------------------------*/ @@ -358,15 +357,17 @@ static const char httpd_cgi_rtes2[] HTTPD_STRING_ATTR = ") %lus
"; static const char httpd_cgi_rtes3[] HTTPD_STRING_ATTR = ")
"; uint8_t i,j=0; uint16_t numprinted; +uip_ds6_route_t *r; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for (i=0; iipaddr, uip_appdata + numprinted); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length); + numprinted += httpd_cgi_sprint_ip6(uip_ds6_route_nexthop(r), uip_appdata + numprinted); + if(r->state.lifetime < 3600) { + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, r->state.lifetime); } else { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes3); } diff --git a/platform/avr-atmega128rfa1/contiki-main.c b/platform/avr-atmega128rfa1/contiki-main.c index 05a9ee392..cecc176db 100644 --- a/platform/avr-atmega128rfa1/contiki-main.c +++ b/platform/avr-atmega128rfa1/contiki-main.c @@ -419,6 +419,9 @@ ipaddr_add(const uip_ipaddr_t *addr) int main(void) { +#if UIP_CONF_IPV6 + uip_ds6_nbr_t *nbr; +#endif /* UIP_CONF_IPV6 */ initialize(); while(1) { @@ -514,8 +517,6 @@ if ((clocktime%PINGS)==1) { #if ROUTES && UIP_CONF_IPV6 if ((clocktime%ROUTES)==2) { -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; uint8_t i,j; @@ -526,13 +527,14 @@ extern uip_ds6_netif_t uip_ds6_if; PRINTF("\n"); } } - PRINTF("\nNeighbors [%u max]\n",UIP_DS6_NBR_NB); - for(i = 0,j=1; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); - PRINTF("\n"); - j=0; - } + PRINTF("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + ipaddr_add(&nbr->ipaddr); + PRINTF("\n"); + j=0; } if (j) PRINTF(" "); PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); @@ -540,17 +542,13 @@ extern uip_ds6_netif_t uip_ds6_if; uip_ds6_route_t *r; PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); j = 1; - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { ipaddr_add(&r->ipaddr); PRINTF("/%u (via ", r->length); - ipaddr_add(&r->nexthop); - // if(uip_ds6_routing_table[i].state.lifetime < 600) { + ipaddr_add(uip_ds6_route_nexthop(r)); PRINTF(") %lus\n", r->state.lifetime); - // } else { - // PRINTF(")\n"); - // } j = 0; } } diff --git a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c index a9ed784f8..d6961f17d 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c +++ b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c @@ -291,8 +291,6 @@ static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = ""; static const char httpd_cgi_addrf[] HTTPD_STRING_ATTR = "[Room for %u more]"; static const char httpd_cgi_addrb[] HTTPD_STRING_ATTR = "
"; static const char httpd_cgi_addrn[] HTTPD_STRING_ATTR = "(none)
"; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; static unsigned short @@ -328,16 +326,18 @@ make_neighbors(void *p) { uint8_t i,j=0; uint16_t numprinted; +uip_ds6_nbr_t *nbr; + numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for (i=0; iipaddr, uip_appdata + numprinted); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb); } //if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn); - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_NBR_NB-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); return numprinted; } /*---------------------------------------------------------------------------*/ @@ -362,13 +362,13 @@ make_routes(void *p) uip_ds6_route_t *r; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { j++; numprinted += httpd_cgi_sprint_ip6(r->ipaddr, uip_appdata + numprinted); numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length); - numprinted += httpd_cgi_sprint_ip6(r->nexthop, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(uip_ds6_route_nexthop(r), uip_appdata + numprinted); if(r->state.lifetime < 3600) { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, r->state.lifetime); } else { diff --git a/platform/avr-raven/contiki-raven-main.c b/platform/avr-raven/contiki-raven-main.c index c9521c124..6294c68a2 100644 --- a/platform/avr-raven/contiki-raven-main.c +++ b/platform/avr-raven/contiki-raven-main.c @@ -429,6 +429,9 @@ ipaddr_add(const uip_ipaddr_t *addr) int main(void) { +#if UIP_CONF_IPV6 + uip_ds6_nbr_t *nbr; +#endif /* UIP_CONF_IPV6 */ initialize(); while(1) { @@ -510,8 +513,6 @@ if ((clocktime%PINGS)==1) { #if ROUTES && UIP_CONF_IPV6 if ((clocktime%ROUTES)==2) { -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; uint8_t i,j; @@ -522,30 +523,26 @@ extern uip_ds6_netif_t uip_ds6_if; PRINTF("\n"); } } - PRINTF("\nNeighbors [%u max]\n",UIP_DS6_NBR_NB); - for(i = 0,j=1; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); - PRINTF("\n"); - j=0; - } + PRINTF("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + ipaddr_add(&nbr->ipaddr); + PRINTF("\n"); + j=0; } if (j) PRINTF(" "); { uip_ds6_route_t *r; PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); j = 1; - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { ipaddr_add(&r->ipaddr); PRINTF("/%u (via ", r->length); - ipaddr_add(&r->nexthop); - // if(uip_ds6_routing_table[i].state.lifetime < 600) { - PRINTF(") %lus\n", r->state.lifetime); - // } else { - // PRINTF(")\n"); - // } + ipaddr_add(uip_ds6_route_nexthop(r)); + PRINTF(") %lus\n", r->state.lifetime); j = 0; } } diff --git a/platform/avr-ravenusb/cdc_task.c b/platform/avr-ravenusb/cdc_task.c index e7a402997..47da86baa 100644 --- a/platform/avr-ravenusb/cdc_task.c +++ b/platform/avr-ravenusb/cdc_task.c @@ -579,11 +579,10 @@ void menu_process(char c) #if UIP_CONF_IPV6_RPL #include "rpl.h" -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; case 'N': { uint8_t i,j; + uip_ds6_nbr_t *nbr; PRINTF_P(PSTR("\n\rAddresses [%u max]\n\r"),UIP_DS6_ADDR_NB); for (i=0;iipaddr); + PRINTF_P(PSTR("\n\r")); + j=0; } if (j) PRINTF_P(PSTR(" ")); PRINTF_P(PSTR("\n\rRoutes [%u max]\n\r"),UIP_DS6_ROUTE_NB); uip_ds6_route_t *route; - for(route = uip_ds6_route_list_head(),j=1; route != NULL; route = list_item_next(route)) { + for(route = uip_ds6_route_head(); + route != NULL; + route = uip_ds6_route_next(r)) { ipaddr_add(&route->ipaddr); PRINTF_P(PSTR("/%u (via "), route->length); - ipaddr_add(&route->nexthop); + ipaddr_add(uip_ds6_route_nexthop(route)); if(route->state.lifetime < 600) { PRINTF_P(PSTR(") %lus\n\r"), route->state.lifetime); } else { diff --git a/platform/avr-ravenusb/contiki-raven-main.c b/platform/avr-ravenusb/contiki-raven-main.c index 37fdf49da..929ca56b6 100644 --- a/platform/avr-ravenusb/contiki-raven-main.c +++ b/platform/avr-ravenusb/contiki-raven-main.c @@ -652,12 +652,12 @@ if ((rtime%PINGS)==1) { #if ROUTES && UIP_CONF_IPV6_RPL if ((rtime%ROUTES)==2) { - -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; + extern uip_ds6_netif_t uip_ds6_if; uint8_t i,j; + uip_ds6_nbr_t *nbr; + PRINTA("\nAddresses [%u max]\n",UIP_DS6_ADDR_NB); for (i=0;iipaddr); + PRINTA("\n"); + j=0; } if (j) PRINTA(" "); PRINTA("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); - for(i = 0,j=1; i < UIP_DS6_ROUTE_NB; i++) { - if(uip_ds6_routing_table[i].isused) { - uip_debug_ipaddr_print(&uip_ds6_routing_table[i].ipaddr); - PRINTA("/%u (via ", uip_ds6_routing_table[i].length); - uip_debug_ipaddr_print(&uip_ds6_routing_table[i].nexthop); - // if(uip_ds6_routing_table[i].state.lifetime < 600) { - PRINTA(") %lus\n", uip_ds6_routing_table[i].state.lifetime); + uip_ds6_route_t *r; + for(r = uip_ds6_route_head(); + r != NULL; + r = uip_ds6_route_next(r)) { + if(r->isused) { + uip_debug_ipaddr_print(&r->ipaddr); + PRINTA("/%u (via ", r->length); + uip_debug_ipaddr_print(uip_ds6_route_nexthop(r)); + // if(r->state.lifetime < 600) { + PRINTA(") %lus\n", r->state.lifetime); // } else { // PRINTA(")\n"); // } diff --git a/platform/avr-ravenusb/httpd-simple-avr.c b/platform/avr-ravenusb/httpd-simple-avr.c index 8b48443ba..7c2ac9b03 100644 --- a/platform/avr-ravenusb/httpd-simple-avr.c +++ b/platform/avr-ravenusb/httpd-simple-avr.c @@ -243,10 +243,6 @@ ipaddr_add(const uip_ipaddr_t *addr) const char TOP1[] PROGMEM = "ContikiRPL(Jackdaw)"; const char TOP2[] PROGMEM = ""; const char BOTTOM[] PROGMEM = ""; -#if UIP_CONF_IPV6 -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; -#endif static PT_THREAD(generate_routes(struct httpd_state *s)) @@ -259,30 +255,33 @@ PT_THREAD(generate_routes(struct httpd_state *s)) #if UIP_CONF_IPV6 //allow ip4 builds blen = 0; - ADD("

Neighbors [%u max]

",UIP_DS6_NBR_NB); + ADD("

Neighbors [%u max]

",NEIGHBOR_CONF_MAX_NEIGHBORS); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; - for(i = 0; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); + uip_ds6_nbr_t *nbr; + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + ipaddr_add(&nbr->ipaddr); ADD("
"); // if(blen > sizeof(buf) - 45) { PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; // } - } } ADD("

Routes [%u max]

",UIP_DS6_ROUTE_NB); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; uip_ds6_route_t *route; - for(route = uip_ds6_route_list_head(); route != NULL; route = list_item_next(route)) { + for(route = uip_ds6_route_head(); + route != NULL; + route = uip_ds6_route_next(route)) { ipaddr_add(&route->ipaddr); ADD("/%u (via ", route->length); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen=0; - ipaddr_add(&route->nexthop); + ipaddr_add(uip_ds6_route_nexthop(route)); if(route->state.lifetime < 600) { PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen=0; diff --git a/platform/cc2530dk/viztool.c b/platform/cc2530dk/viztool.c index 4c37fc114..a88b08790 100644 --- a/platform/cc2530dk/viztool.c +++ b/platform/cc2530dk/viztool.c @@ -69,7 +69,6 @@ static int8_t len; #define REQUEST_TYPE_TOTALS 0xFF extern uip_ds6_netif_t uip_ds6_if; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[UIP_DS6_NBR_NB]; static uip_ds6_route_t *rt; static uip_ds6_defrt_t *defrt; static uip_ipaddr_t *addr; @@ -82,6 +81,7 @@ process_request() CC_NON_BANKED uint8_t i; uint8_t left; uint8_t entry_size; + uip_ds6_nbr_t *nbr; left = VIZTOOL_MAX_PAYLOAD_LEN - 1; len = 2; /* start filling the buffer from position [2] */ @@ -89,46 +89,44 @@ process_request() CC_NON_BANKED if(buf[0] == REQUEST_TYPE_ND) { /* Neighbors */ PRINTF("Neighbors\n"); - for(i = buf[1]; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - entry_size = sizeof(i) + sizeof(uip_ipaddr_t) + sizeof(uip_lladdr_t) - + sizeof(uip_ds6_nbr_cache[i].state); - PRINTF("%02u: ", i); - PRINT6ADDR(&uip_ds6_nbr_cache[i].ipaddr); - PRINTF(" - "); - PRINTLLADDR(&uip_ds6_nbr_cache[i].lladdr); - PRINTF(" - %u\n", uip_ds6_nbr_cache[i].state); + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + entry_size = sizeof(i) + sizeof(uip_ipaddr_t) + sizeof(uip_lladdr_t) + + sizeof(nbr->state); + PRINTF("%02u: ", i); + PRINT6ADDR(&nbr->ipaddr); + PRINTF(" - "); + PRINTLLADDR(&nbr->lladdr); + PRINTF(" - %u\n", nbr->state); - memcpy(buf + len, &i, sizeof(i)); - len += sizeof(i); - memcpy(buf + len, &uip_ds6_nbr_cache[i].ipaddr, sizeof(uip_ipaddr_t)); - len += sizeof(uip_ipaddr_t); - memcpy(buf + len, &uip_ds6_nbr_cache[i].lladdr, sizeof(uip_lladdr_t)); - len += sizeof(uip_lladdr_t); - memcpy(buf + len, &uip_ds6_nbr_cache[i].state, - sizeof(uip_ds6_nbr_cache[i].state)); - len += sizeof(uip_ds6_nbr_cache[i].state); + memcpy(buf + len, &i, sizeof(i)); + len += sizeof(i); + memcpy(buf + len, uip_ds6_nbr_get_ipaddr(nbr), sizeof(uip_ipaddr_t)); + len += sizeof(uip_ipaddr_t); + memcpy(buf + len, uip_ds6_nbr_get_ll(nbr), sizeof(uip_lladdr_t)); + len += sizeof(uip_lladdr_t); + memcpy(buf + len, &nbr->state, + sizeof(nbr->state)); + len += sizeof(nbr->state); - count++; - left -= entry_size; + count++; + left -= entry_size; - if(left < entry_size) { - break; - } + if(left < entry_size) { + break; } } } else if(buf[0] == REQUEST_TYPE_RT) { uint32_t flip = 0; PRINTF("Routing table\n"); - rt = uip_ds6_route_list_head(); + rt = uip_ds6_route_head(); for(i = buf[1]; i < uip_ds6_route_num_routes(); i++) { if(rt != NULL) { entry_size = sizeof(i) + sizeof(rt->ipaddr) + sizeof(rt->length) - + sizeof(rt->metric) - + sizeof(rt->nexthop) + sizeof(rt->state.lifetime) + sizeof(rt->state.learned_from); @@ -138,16 +136,11 @@ process_request() CC_NON_BANKED len += sizeof(rt->ipaddr); memcpy(buf + len, &rt->length, sizeof(rt->length)); len += sizeof(rt->length); - memcpy(buf + len, &rt->metric, sizeof(rt->metric)); - len += sizeof(rt->metric); - memcpy(buf + len, &rt->nexthop, sizeof(rt->nexthop)); - len += sizeof(rt->nexthop); PRINT6ADDR(&rt->ipaddr); PRINTF(" - %02x", rt->length); - PRINTF(" - %02x", rt->metric); PRINTF(" - "); - PRINT6ADDR(&rt->nexthop); + PRINT6ADDR(uip_ds6_route_nexthop(rt)); flip = uip_htonl(rt->state.lifetime); memcpy(buf + len, &flip, sizeof(flip)); @@ -163,7 +156,7 @@ process_request() CC_NON_BANKED count++; left -= entry_size; - rt = list_item_next(rt); + rt = uip_ds6_route_next(rt); if(left < entry_size) { break; @@ -226,10 +219,10 @@ process_request() CC_NON_BANKED buf[2]++; } } - for(i = 0; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { buf[3]++; - } } buf[4] = uip_ds6_route_num_routes(); diff --git a/platform/cooja/net/radio-uip-uaodv.c b/platform/cooja/net/radio-uip-uaodv.c index 05cecd225..dd9a606e1 100644 --- a/platform/cooja/net/radio-uip-uaodv.c +++ b/platform/cooja/net/radio-uip-uaodv.c @@ -239,7 +239,7 @@ radio_uip_uaodv_send(void) } /* Add header and buffer packet for persistent transmission */ - uip_len = radio_uip_uaodv_add_header(&uip_buf[UIP_LLH_LEN], uip_len, &route->nexthop); /* TODO Correct? */ + uip_len = radio_uip_uaodv_add_header(&uip_buf[UIP_LLH_LEN], uip_len, uip_ds6_route_nexthop(route)); /* TODO Correct? */ return radio_uip_buffer_outgoing_packet( &uip_buf[UIP_LLH_LEN], uip_len, diff --git a/platform/redbee-econotag/contiki-mc1322x-main.c b/platform/redbee-econotag/contiki-mc1322x-main.c index d43d34661..9ad210ef2 100644 --- a/platform/redbee-econotag/contiki-mc1322x-main.c +++ b/platform/redbee-econotag/contiki-mc1322x-main.c @@ -593,8 +593,6 @@ if ((clocktime%PINGS)==1) { #if ROUTES && UIP_CONF_IPV6 if ((clocktime%ROUTES)==2) { -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; uint8_t i,j; @@ -605,13 +603,14 @@ extern uip_ds6_netif_t uip_ds6_if; printf("\n"); } } - printf("\nNeighbors [%u max]\n",UIP_DS6_NBR_NB); - for(i = 0,j=1; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - uip_debug_ipaddr_print(&uip_ds6_nbr_cache[i].ipaddr); + printf("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + uip_ds6_nbr_t *nbr; + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + uip_debug_ipaddr_print(&nbr->ipaddr); printf("\n"); j=0; - } } if (j) printf(" "); PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); @@ -619,17 +618,13 @@ extern uip_ds6_netif_t uip_ds6_if; uip_ds6_route_t *r; PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); j = 1; - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { ipaddr_add(&r->ipaddr); PRINTF("/%u (via ", r->length); - ipaddr_add(&r->nexthop); - // if(uip_ds6_routing_table[i].state.lifetime < 600) { - PRINTF(") %lus\n", r->state.lifetime); - // } else { - // PRINTF(")\n"); - // } + ipaddr_add(uip_ds6_route_nexthop(r)); + PRINTF(") %lus\n", r->state.lifetime); j = 0; } } diff --git a/platform/sensinode/viztool.c b/platform/sensinode/viztool.c index 4c37fc114..a88b08790 100644 --- a/platform/sensinode/viztool.c +++ b/platform/sensinode/viztool.c @@ -69,7 +69,6 @@ static int8_t len; #define REQUEST_TYPE_TOTALS 0xFF extern uip_ds6_netif_t uip_ds6_if; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[UIP_DS6_NBR_NB]; static uip_ds6_route_t *rt; static uip_ds6_defrt_t *defrt; static uip_ipaddr_t *addr; @@ -82,6 +81,7 @@ process_request() CC_NON_BANKED uint8_t i; uint8_t left; uint8_t entry_size; + uip_ds6_nbr_t *nbr; left = VIZTOOL_MAX_PAYLOAD_LEN - 1; len = 2; /* start filling the buffer from position [2] */ @@ -89,46 +89,44 @@ process_request() CC_NON_BANKED if(buf[0] == REQUEST_TYPE_ND) { /* Neighbors */ PRINTF("Neighbors\n"); - for(i = buf[1]; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - entry_size = sizeof(i) + sizeof(uip_ipaddr_t) + sizeof(uip_lladdr_t) - + sizeof(uip_ds6_nbr_cache[i].state); - PRINTF("%02u: ", i); - PRINT6ADDR(&uip_ds6_nbr_cache[i].ipaddr); - PRINTF(" - "); - PRINTLLADDR(&uip_ds6_nbr_cache[i].lladdr); - PRINTF(" - %u\n", uip_ds6_nbr_cache[i].state); + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + entry_size = sizeof(i) + sizeof(uip_ipaddr_t) + sizeof(uip_lladdr_t) + + sizeof(nbr->state); + PRINTF("%02u: ", i); + PRINT6ADDR(&nbr->ipaddr); + PRINTF(" - "); + PRINTLLADDR(&nbr->lladdr); + PRINTF(" - %u\n", nbr->state); - memcpy(buf + len, &i, sizeof(i)); - len += sizeof(i); - memcpy(buf + len, &uip_ds6_nbr_cache[i].ipaddr, sizeof(uip_ipaddr_t)); - len += sizeof(uip_ipaddr_t); - memcpy(buf + len, &uip_ds6_nbr_cache[i].lladdr, sizeof(uip_lladdr_t)); - len += sizeof(uip_lladdr_t); - memcpy(buf + len, &uip_ds6_nbr_cache[i].state, - sizeof(uip_ds6_nbr_cache[i].state)); - len += sizeof(uip_ds6_nbr_cache[i].state); + memcpy(buf + len, &i, sizeof(i)); + len += sizeof(i); + memcpy(buf + len, uip_ds6_nbr_get_ipaddr(nbr), sizeof(uip_ipaddr_t)); + len += sizeof(uip_ipaddr_t); + memcpy(buf + len, uip_ds6_nbr_get_ll(nbr), sizeof(uip_lladdr_t)); + len += sizeof(uip_lladdr_t); + memcpy(buf + len, &nbr->state, + sizeof(nbr->state)); + len += sizeof(nbr->state); - count++; - left -= entry_size; + count++; + left -= entry_size; - if(left < entry_size) { - break; - } + if(left < entry_size) { + break; } } } else if(buf[0] == REQUEST_TYPE_RT) { uint32_t flip = 0; PRINTF("Routing table\n"); - rt = uip_ds6_route_list_head(); + rt = uip_ds6_route_head(); for(i = buf[1]; i < uip_ds6_route_num_routes(); i++) { if(rt != NULL) { entry_size = sizeof(i) + sizeof(rt->ipaddr) + sizeof(rt->length) - + sizeof(rt->metric) - + sizeof(rt->nexthop) + sizeof(rt->state.lifetime) + sizeof(rt->state.learned_from); @@ -138,16 +136,11 @@ process_request() CC_NON_BANKED len += sizeof(rt->ipaddr); memcpy(buf + len, &rt->length, sizeof(rt->length)); len += sizeof(rt->length); - memcpy(buf + len, &rt->metric, sizeof(rt->metric)); - len += sizeof(rt->metric); - memcpy(buf + len, &rt->nexthop, sizeof(rt->nexthop)); - len += sizeof(rt->nexthop); PRINT6ADDR(&rt->ipaddr); PRINTF(" - %02x", rt->length); - PRINTF(" - %02x", rt->metric); PRINTF(" - "); - PRINT6ADDR(&rt->nexthop); + PRINT6ADDR(uip_ds6_route_nexthop(rt)); flip = uip_htonl(rt->state.lifetime); memcpy(buf + len, &flip, sizeof(flip)); @@ -163,7 +156,7 @@ process_request() CC_NON_BANKED count++; left -= entry_size; - rt = list_item_next(rt); + rt = uip_ds6_route_next(rt); if(left < entry_size) { break; @@ -226,10 +219,10 @@ process_request() CC_NON_BANKED buf[2]++; } } - for(i = 0; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { buf[3]++; - } } buf[4] = uip_ds6_route_num_routes(); diff --git a/tools/sky/uip6-bridge/fakeuip.c b/tools/sky/uip6-bridge/fakeuip.c index 0b1592efc..af4c8ad3a 100644 --- a/tools/sky/uip6-bridge/fakeuip.c +++ b/tools/sky/uip6-bridge/fakeuip.c @@ -127,3 +127,10 @@ uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); } + +/*---------------------------------------------------------------------------*/ +void +uip_ds6_link_neighbor_callback(int status, int numtx) +{ + +} diff --git a/tools/stm32w/uip6_bridge/fakeuip.c b/tools/stm32w/uip6_bridge/fakeuip.c index f52c77ef5..9702cce57 100644 --- a/tools/stm32w/uip6_bridge/fakeuip.c +++ b/tools/stm32w/uip6_bridge/fakeuip.c @@ -127,3 +127,9 @@ uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); } + +/*---------------------------------------------------------------------------*/ +void +uip_ds6_link_neighbor_callback(int status, int numtx) +{ +} diff --git a/tools/stm32w/wpcapslip6/fakeuip.c b/tools/stm32w/wpcapslip6/fakeuip.c index 3072bda84..401b60770 100644 --- a/tools/stm32w/wpcapslip6/fakeuip.c +++ b/tools/stm32w/wpcapslip6/fakeuip.c @@ -73,3 +73,9 @@ uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); } + +/*---------------------------------------------------------------------------*/ +void +uip_ds6_link_neighbor_callback(int status, int numtx) +{ +}