From 171c1290c368b13b0426659dec1657b0856e95dc Mon Sep 17 00:00:00 2001 From: Harald Pichler Date: Thu, 28 Nov 2013 10:19:17 +0100 Subject: [PATCH] update boarder router to new rpl tables --- examples/osd/rpl-border-router/Makefile | 3 +-- .../osd/rpl-border-router/border-router.c | 24 +++++++++---------- examples/osd/rpl-border-router/httpd-simple.h | 6 ++--- examples/osd/rpl-border-router/project-conf.h | 15 +++--------- platform/osd-merkur/params.h | 3 +-- 5 files changed, 20 insertions(+), 31 deletions(-) diff --git a/examples/osd/rpl-border-router/Makefile b/examples/osd/rpl-border-router/Makefile index 04007ff5b..f296b0bb3 100644 --- a/examples/osd/rpl-border-router/Makefile +++ b/examples/osd/rpl-border-router/Makefile @@ -3,9 +3,8 @@ all: $(CONTIKI_PROJECT) CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 -CFLAGS+= -DUIP_CONF_IPV6_RPL -DUIP_CONF_IPV6 +CFLAGS+= -DUIP_CONF_IPV6_RPL #linker optimizations SMALL=1 diff --git a/examples/osd/rpl-border-router/border-router.c b/examples/osd/rpl-border-router/border-router.c index 9a40f84a1..4128cac38 100644 --- a/examples/osd/rpl-border-router/border-router.c +++ b/examples/osd/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/osd/rpl-border-router/httpd-simple.h b/examples/osd/rpl-border-router/httpd-simple.h
index 4a2efa30f..a16dbd99e 100644
--- a/examples/osd/rpl-border-router/httpd-simple.h
+++ b/examples/osd/rpl-border-router/httpd-simple.h
@@ -37,8 +37,8 @@
  *         Joakim Eriksson 
  */
 
-#ifndef __HTTPD_SIMPLE_H__
-#define __HTTPD_SIMPLE_H__
+#ifndef HTTPD_SIMPLE_H_
+#define HTTPD_SIMPLE_H_
 
 #include "contiki-net.h"
 
@@ -71,4 +71,4 @@ httpd_simple_script_t httpd_simple_get_script(const char *name);
 
 #define SEND_STRING(s, str) PSOCK_SEND(s, (uint8_t *)str, strlen(str))
 
-#endif /* __HTTPD_SIMPLE_H__ */
+#endif /* HTTPD_SIMPLE_H_ */
diff --git a/examples/osd/rpl-border-router/project-conf.h b/examples/osd/rpl-border-router/project-conf.h
index 3cc05fe90..9d9116795 100644
--- a/examples/osd/rpl-border-router/project-conf.h
+++ b/examples/osd/rpl-border-router/project-conf.h
@@ -28,22 +28,13 @@
  *
  */
 
-#ifndef __PROJECT_ROUTER_CONF_H__
-#define __PROJECT_ROUTER_CONF_H__
+#ifndef PROJECT_ROUTER_CONF_H_
+#define PROJECT_ROUTER_CONF_H_
 
 #ifndef UIP_FALLBACK_INTERFACE
 #define UIP_FALLBACK_INTERFACE rpl_interface
 #endif
 
-/* Save some memory for the sky platform. */
-#undef UIP_CONF_DS6_NBR_NBU
-#define UIP_CONF_DS6_NBR_NBU     15
-#undef UIP_CONF_DS6_ROUTE_NBU
-#define UIP_CONF_DS6_ROUTE_NBU   50
-
-#undef UIP_CONF_TCP
-#define UIP_CONF_TCP              1
-
 #ifndef QUEUEBUF_CONF_NUM
 #define QUEUEBUF_CONF_NUM          4
 #endif
@@ -60,4 +51,4 @@
 #define WEBSERVER_CONF_CFS_CONNS 2
 #endif
 
-#endif /* __PROJECT_ROUTER_CONF_H__ */
+#endif /* PROJECT_ROUTER_CONF_H_ */
diff --git a/platform/osd-merkur/params.h b/platform/osd-merkur/params.h
index f91ce5759..9bf2f433e 100644
--- a/platform/osd-merkur/params.h
+++ b/platform/osd-merkur/params.h
@@ -74,9 +74,8 @@ extern uint8_t eemem_domain_name[30];
 /* This form of of EUI64 mac allows full 6LoWPAN header compression from mac address */
 #if UIP_CONF_LL_802154
 //#define PARAMS_EUI64ADDR {0x02, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN}
-//#define PARAMS_EUI64ADDR {0x02, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x01}
-#define PARAMS_EUI64ADDR {0x00, 0x21, 0x2e, 0xff, 0xff, 0x00, 0x27, 0x0d}
 //#define PARAMS_EUI64ADDR {0x00, 0x21, 0x2e, 0xff, 0xff, 0x00, 0x1E, 0xFB}
+#define PARAMS_EUI64ADDR {0x02, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x01}
 #else
 //#define PARAMS_EUI64ADDR {0x02, 0xNN, 0xNN, 0xff, 0xfe, 0xNN, 0xNN, 0xNN}
 #define PARAMS_EUI64ADDR {0x00, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x03}