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
|
@ -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 {
|
||||
|
|
|
@ -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");
|
||||
// }
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue