Port apps, examples, platforms and tools so they use the new neighbor and route API.

This commit is contained in:
Simon Duquennoy 2013-07-03 20:26:54 +02:00
parent ff093a2b50
commit 5dc05e7913
21 changed files with 262 additions and 257 deletions

View file

@ -290,8 +290,6 @@ static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = "<code>";
static const char httpd_cgi_addrf[] HTTPD_STRING_ATTR = "</code>[Room for %u more]";
static const char httpd_cgi_addrb[] HTTPD_STRING_ATTR = "<br>";
static const char httpd_cgi_addrn[] HTTPD_STRING_ATTR = "(none)<br>";
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; i<UIP_DS6_NBR_NB;i++) {
if (uip_ds6_nbr_cache[i].isused) {
j++;
numprinted += httpd_cgi_sprint_ip6(uip_ds6_nbr_cache[i].ipaddr, uip_appdata + numprinted);
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb);
}
uip_ds6_nbr_t *nbr;
for(nbr = nbr_table_head(ds6_neighbors);
nbr != NULL;
nbr = nbr_table_next(ds6_neighbors, nbr)) {
j++;
numprinted += httpd_cgi_sprint_ip6(nbr->ipaddr, 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<br>";
static const char httpd_cgi_rtes3[] HTTPD_STRING_ATTR = ")<br>";
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; i<UIP_DS6_ROUTE_NB;i++) {
if (uip_ds6_routing_table[i].isused) {
for(r = uip_ds6_route_head();
r != NULL;
r = uip_ds6_route_next(r)) {
j++;
numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].ipaddr, uip_appdata + numprinted);
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(uip_ds6_routing_table[i].state.lifetime < 3600) {
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, uip_ds6_routing_table[i].state.lifetime);
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(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);
}

View file

@ -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(" <none>");
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;
}
}

View file

@ -291,8 +291,6 @@ static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = "<code>";
static const char httpd_cgi_addrf[] HTTPD_STRING_ATTR = "</code>[Room for %u more]";
static const char httpd_cgi_addrb[] HTTPD_STRING_ATTR = "<br>";
static const char httpd_cgi_addrn[] HTTPD_STRING_ATTR = "(none)<br>";
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; i<UIP_DS6_NBR_NB;i++) {
if (uip_ds6_nbr_cache[i].isused) {
j++;
numprinted += httpd_cgi_sprint_ip6(uip_ds6_nbr_cache[i].ipaddr, uip_appdata + numprinted);
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb);
}
for(nbr = nbr_table_head(ds6_neighbors);
nbr != NULL;
nbr = nbr_table_next(ds6_neighbors, nbr)) {
j++;
numprinted += httpd_cgi_sprint_ip6(nbr->ipaddr, 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 {

View file

@ -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(" <none>");
{
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;
}
}

View file

@ -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;i<UIP_DS6_ADDR_NB;i++) {
if (uip_ds6_if.addr_list[i].isused) {
@ -591,21 +590,24 @@ extern uip_ds6_netif_t uip_ds6_if;
PRINTF_P(PSTR("\n\r"));
}
}
PRINTF_P(PSTR("\n\rNeighbors [%u max]\n\r"),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_P(PSTR("\n\r"));
j=0;
}
PRINTF_P(PSTR("\n\rNeighbors [%u max]\n\r"),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_P(PSTR("\n\r"));
j=0;
}
if (j) PRINTF_P(PSTR(" <none>"));
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 {

View file

@ -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;i<UIP_DS6_ADDR_NB;i++) {
if (uip_ds6_if.addr_list[i].isused) {
@ -665,23 +665,27 @@ extern uip_ds6_netif_t uip_ds6_if;
PRINTA("\n");
}
}
PRINTA("\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);
PRINTA("\n");
j=0;
}
PRINTA("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS);
for(nbr = nbr_table_head(ds6_neighbors);
nbr != NULL;
nbr = nbr_table_next(ds6_neighbors, nbr)) {
uip_debug_ipaddr_print(&nbr->ipaddr);
PRINTA("\n");
j=0;
}
if (j) PRINTA(" <none>");
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");
// }

View file

@ -243,10 +243,6 @@ ipaddr_add(const uip_ipaddr_t *addr)
const char TOP1[] PROGMEM = "<html><head><title>ContikiRPL(Jackdaw)";
const char TOP2[] PROGMEM = "</title></head><body>";
const char BOTTOM[] PROGMEM = "</body></html>";
#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("<h2>Neighbors [%u max]</h2>",UIP_DS6_NBR_NB);
ADD("<h2>Neighbors [%u max]</h2>",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("<br>");
// if(blen > sizeof(buf) - 45) {
PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
blen = 0;
// }
}
}
ADD("<h2>Routes [%u max]</h2>",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;

View file

@ -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();

View file

@ -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,

View file

@ -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(" <none>");
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;
}
}

View file

@ -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();