Updated to the latest uip-ds6-route API

This commit is contained in:
Adam Dunkels 2012-11-26 21:30:01 +01:00
parent 4218a733c9
commit 99f541e8fd
7 changed files with 101 additions and 83 deletions

View file

@ -149,6 +149,7 @@ static
PT_THREAD(generate_routes(struct httpd_state *s))
{
static int i;
static uip_ds6_route_t *r;
PSOCK_BEGIN(&s->sout);
SEND_STRING(&s->sout, TOP);
@ -169,19 +170,19 @@ PT_THREAD(generate_routes(struct httpd_state *s))
ADD("</pre>Routes<pre>");
SEND_STRING(&s->sout, buf);
blen = 0;
for(i = 0; i < UIP_DS6_ROUTE_NB; i++) {
if(uip_ds6_routing_table[i].isused) {
ipaddr_add(&uip_ds6_routing_table[i].ipaddr);
ADD("/%u (via ", uip_ds6_routing_table[i].length);
ipaddr_add(&uip_ds6_routing_table[i].nexthop);
if(uip_ds6_routing_table[i].state.lifetime < 600) {
ADD(") %lus\n", (unsigned long)uip_ds6_routing_table[i].state.lifetime);
} else {
ADD(")\n");
}
SEND_STRING(&s->sout, buf);
blen = 0;
for(r = uip_ds6_route_list_head();
r != NULL;
r = list_item_next(r)) {
ipaddr_add(&r->ipaddr);
ADD("/%u (via ", r->length);
ipaddr_add(&r->nexthop);
if(r->state.lifetime < 600) {
ADD(") %lus\n", (unsigned long)r->state.lifetime);
} else {
ADD(")\n");
}
SEND_STRING(&s->sout, buf);
blen = 0;
}
ADD("</pre>");
//if(blen > 0) {

View file

@ -70,7 +70,8 @@ void
collect_common_net_print(void)
{
rpl_dag_t *dag;
int i;
uip_ds6_route_t *r;
/* Let's suppose we have only one instance */
dag = rpl_get_any_dag();
if(dag->preferred_parent != NULL) {
@ -78,12 +79,10 @@ collect_common_net_print(void)
PRINT6ADDR(&dag->preferred_parent->addr);
PRINTF("\n");
}
PRINTF("Route entries:\n");
for(i = 0; i < UIP_DS6_ROUTE_NB; i++) {
if(uip_ds6_routing_table[i].isused) {
PRINT6ADDR(&uip_ds6_routing_table[i].ipaddr);
PRINTF("\n");
}
for(r = uip_ds6_route_list_head();
r != NULL;
r = list_item_next(r)) {
PRINT6ADDR(&r->ipaddr);
}
PRINTF("---\n");
}