Port apps, examples, platforms and tools so they use the new neighbor and route API.
This commit is contained in:
parent
ff093a2b50
commit
5dc05e7913
21 changed files with 262 additions and 257 deletions
|
@ -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<pre>");
|
||||
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("</pre>Routes<pre>");
|
||||
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 {
|
||||
|
|
|
@ -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<pre>");
|
||||
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("</pre>Routes<pre>");
|
||||
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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue