Updated to the latest uip-ds6-route API
This commit is contained in:
parent
4218a733c9
commit
99f541e8fd
|
@ -307,25 +307,27 @@ PT_THREAD(neighbors(struct httpd_state *s, char *ptr))
|
||||||
static unsigned short
|
static unsigned short
|
||||||
make_routes(void *p)
|
make_routes(void *p)
|
||||||
{
|
{
|
||||||
static const char httpd_cgi_rtes1[] HTTPD_STRING_ATTR = "(%u (via ";
|
static const char httpd_cgi_rtes1[] HTTPD_STRING_ATTR = "(%u (via ";
|
||||||
static const char httpd_cgi_rtes2[] HTTPD_STRING_ATTR = ") %us<br>";
|
static const char httpd_cgi_rtes2[] HTTPD_STRING_ATTR = ") %lus<br>";
|
||||||
static const char httpd_cgi_rtes3[] HTTPD_STRING_ATTR = ")<br>";
|
static const char httpd_cgi_rtes3[] HTTPD_STRING_ATTR = ")<br>";
|
||||||
uint8_t i,j=0;
|
uint8_t i,j=0;
|
||||||
uint16_t numprinted;
|
uint16_t numprinted;
|
||||||
|
uip_ds6_route_t *r;
|
||||||
|
|
||||||
numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh);
|
numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh);
|
||||||
for (i=0; i<UIP_DS6_ROUTE_NB;i++) {
|
for(r = uip_ds6_route_list_head();
|
||||||
if (uip_ds6_routing_table[i].isused) {
|
r != NULL;
|
||||||
|
r = list_item_next(r)) {
|
||||||
j++;
|
j++;
|
||||||
numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].ipaddr, uip_appdata + numprinted);
|
numprinted += httpd_cgi_sprint_ip6(r->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_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length);
|
||||||
numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].nexthop, uip_appdata + numprinted);
|
numprinted += httpd_cgi_sprint_ip6(r->nexthop, uip_appdata + numprinted);
|
||||||
if(uip_ds6_routing_table[i].state.lifetime < 3600*24) {
|
if(r->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_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, r->state.lifetime);
|
||||||
} else {
|
} else {
|
||||||
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes3);
|
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn);
|
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_ROUTE_NB-j);
|
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_ROUTE_NB-j);
|
||||||
return numprinted;
|
return numprinted;
|
||||||
|
|
|
@ -149,6 +149,7 @@ static
|
||||||
PT_THREAD(generate_routes(struct httpd_state *s))
|
PT_THREAD(generate_routes(struct httpd_state *s))
|
||||||
{
|
{
|
||||||
static int i;
|
static int i;
|
||||||
|
static uip_ds6_route_t *r;
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
|
|
||||||
SEND_STRING(&s->sout, TOP);
|
SEND_STRING(&s->sout, TOP);
|
||||||
|
@ -169,20 +170,20 @@ PT_THREAD(generate_routes(struct httpd_state *s))
|
||||||
ADD("</pre>Routes<pre>");
|
ADD("</pre>Routes<pre>");
|
||||||
SEND_STRING(&s->sout, buf);
|
SEND_STRING(&s->sout, buf);
|
||||||
blen = 0;
|
blen = 0;
|
||||||
for(i = 0; i < UIP_DS6_ROUTE_NB; i++) {
|
for(r = uip_ds6_route_list_head();
|
||||||
if(uip_ds6_routing_table[i].isused) {
|
r != NULL;
|
||||||
ipaddr_add(&uip_ds6_routing_table[i].ipaddr);
|
r = list_item_next(r)) {
|
||||||
ADD("/%u (via ", uip_ds6_routing_table[i].length);
|
ipaddr_add(&r->ipaddr);
|
||||||
ipaddr_add(&uip_ds6_routing_table[i].nexthop);
|
ADD("/%u (via ", r->length);
|
||||||
if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
ipaddr_add(&r->nexthop);
|
||||||
ADD(") %lus\n", (unsigned long)uip_ds6_routing_table[i].state.lifetime);
|
if(r->state.lifetime < 600) {
|
||||||
|
ADD(") %lus\n", (unsigned long)r->state.lifetime);
|
||||||
} else {
|
} else {
|
||||||
ADD(")\n");
|
ADD(")\n");
|
||||||
}
|
}
|
||||||
SEND_STRING(&s->sout, buf);
|
SEND_STRING(&s->sout, buf);
|
||||||
blen = 0;
|
blen = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ADD("</pre>");
|
ADD("</pre>");
|
||||||
//if(blen > 0) {
|
//if(blen > 0) {
|
||||||
SEND_STRING(&s->sout, buf);
|
SEND_STRING(&s->sout, buf);
|
||||||
|
|
|
@ -70,7 +70,8 @@ void
|
||||||
collect_common_net_print(void)
|
collect_common_net_print(void)
|
||||||
{
|
{
|
||||||
rpl_dag_t *dag;
|
rpl_dag_t *dag;
|
||||||
int i;
|
uip_ds6_route_t *r;
|
||||||
|
|
||||||
/* Let's suppose we have only one instance */
|
/* Let's suppose we have only one instance */
|
||||||
dag = rpl_get_any_dag();
|
dag = rpl_get_any_dag();
|
||||||
if(dag->preferred_parent != NULL) {
|
if(dag->preferred_parent != NULL) {
|
||||||
|
@ -78,12 +79,10 @@ collect_common_net_print(void)
|
||||||
PRINT6ADDR(&dag->preferred_parent->addr);
|
PRINT6ADDR(&dag->preferred_parent->addr);
|
||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
}
|
}
|
||||||
PRINTF("Route entries:\n");
|
for(r = uip_ds6_route_list_head();
|
||||||
for(i = 0; i < UIP_DS6_ROUTE_NB; i++) {
|
r != NULL;
|
||||||
if(uip_ds6_routing_table[i].isused) {
|
r = list_item_next(r)) {
|
||||||
PRINT6ADDR(&uip_ds6_routing_table[i].ipaddr);
|
PRINT6ADDR(&r->ipaddr);
|
||||||
PRINTF("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PRINTF("---\n");
|
PRINTF("---\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,17 +536,22 @@ extern uip_ds6_netif_t uip_ds6_if;
|
||||||
}
|
}
|
||||||
if (j) PRINTF(" <none>");
|
if (j) PRINTF(" <none>");
|
||||||
PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB);
|
PRINTF("\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_ds6_route_t *r;
|
||||||
ipaddr_add(&uip_ds6_routing_table[i].ipaddr);
|
PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB);
|
||||||
PRINTF("/%u (via ", uip_ds6_routing_table[i].length);
|
j = 1;
|
||||||
ipaddr_add(&uip_ds6_routing_table[i].nexthop);
|
for(r = uip_ds6_route_list_head();
|
||||||
|
r != NULL;
|
||||||
|
r = list_item_next(r)) {
|
||||||
|
ipaddr_add(&r->ipaddr);
|
||||||
|
PRINTF("/%u (via ", r->length);
|
||||||
|
ipaddr_add(&r->nexthop);
|
||||||
// if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
// if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
||||||
PRINTF(") %lus\n", uip_ds6_routing_table[i].state.lifetime);
|
PRINTF(") %lus\n", r->state.lifetime);
|
||||||
// } else {
|
// } else {
|
||||||
// PRINTF(")\n");
|
// PRINTF(")\n");
|
||||||
// }
|
// }
|
||||||
j=0;
|
j = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j) PRINTF(" <none>");
|
if (j) PRINTF(" <none>");
|
||||||
|
|
|
@ -354,25 +354,27 @@ PT_THREAD(neighbors(struct httpd_state *s, char *ptr))
|
||||||
static unsigned short
|
static unsigned short
|
||||||
make_routes(void *p)
|
make_routes(void *p)
|
||||||
{
|
{
|
||||||
static const char httpd_cgi_rtes1[] HTTPD_STRING_ATTR = "(%u (via ";
|
static const char httpd_cgi_rtes1[] HTTPD_STRING_ATTR = "(%u (via ";
|
||||||
static const char httpd_cgi_rtes2[] HTTPD_STRING_ATTR = ") %lus<br>";
|
static const char httpd_cgi_rtes2[] HTTPD_STRING_ATTR = ") %lus<br>";
|
||||||
static const char httpd_cgi_rtes3[] HTTPD_STRING_ATTR = ")<br>";
|
static const char httpd_cgi_rtes3[] HTTPD_STRING_ATTR = ")<br>";
|
||||||
uint8_t i,j=0;
|
uint8_t i,j=0;
|
||||||
uint16_t numprinted;
|
uint16_t numprinted;
|
||||||
|
uip_ds6_route_t *r;
|
||||||
|
|
||||||
numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh);
|
numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh);
|
||||||
for (i=0; i<UIP_DS6_ROUTE_NB;i++) {
|
for(r = uip_ds6_route_list_head();
|
||||||
if (uip_ds6_routing_table[i].isused) {
|
r != NULL;
|
||||||
|
r = list_item_next(r)) {
|
||||||
j++;
|
j++;
|
||||||
numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].ipaddr, uip_appdata + numprinted);
|
numprinted += httpd_cgi_sprint_ip6(r->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_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length);
|
||||||
numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].nexthop, uip_appdata + numprinted);
|
numprinted += httpd_cgi_sprint_ip6(r->nexthop, uip_appdata + numprinted);
|
||||||
if(uip_ds6_routing_table[i].state.lifetime < 3600) {
|
if(r->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_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, r->state.lifetime);
|
||||||
} else {
|
} else {
|
||||||
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes3);
|
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn);
|
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_ROUTE_NB-j);
|
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_ROUTE_NB-j);
|
||||||
return numprinted;
|
return numprinted;
|
||||||
|
|
|
@ -531,18 +531,22 @@ extern uip_ds6_netif_t uip_ds6_if;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j) PRINTF(" <none>");
|
if (j) PRINTF(" <none>");
|
||||||
|
{
|
||||||
|
uip_ds6_route_t *r;
|
||||||
PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB);
|
PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB);
|
||||||
for(i = 0,j=1; i < UIP_DS6_ROUTE_NB; i++) {
|
j = 1;
|
||||||
if(uip_ds6_routing_table[i].isused) {
|
for(r = uip_ds6_route_list_head();
|
||||||
ipaddr_add(&uip_ds6_routing_table[i].ipaddr);
|
r != NULL;
|
||||||
PRINTF("/%u (via ", uip_ds6_routing_table[i].length);
|
r = list_item_next(r)) {
|
||||||
ipaddr_add(&uip_ds6_routing_table[i].nexthop);
|
ipaddr_add(&r->ipaddr);
|
||||||
|
PRINTF("/%u (via ", r->length);
|
||||||
|
ipaddr_add(&r->nexthop);
|
||||||
// if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
// if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
||||||
PRINTF(") %lus\n", uip_ds6_routing_table[i].state.lifetime);
|
PRINTF(") %lus\n", r->state.lifetime);
|
||||||
// } else {
|
// } else {
|
||||||
// PRINTF(")\n");
|
// PRINTF(")\n");
|
||||||
// }
|
// }
|
||||||
j=0;
|
j = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j) PRINTF(" <none>");
|
if (j) PRINTF(" <none>");
|
||||||
|
|
|
@ -614,18 +614,23 @@ extern uip_ds6_netif_t uip_ds6_if;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j) printf(" <none>");
|
if (j) printf(" <none>");
|
||||||
printf("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB);
|
PRINTF("\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_ds6_route_t *r;
|
||||||
uip_debug_ipaddr_print(&uip_ds6_routing_table[i].ipaddr);
|
PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB);
|
||||||
printf("/%u (via ", uip_ds6_routing_table[i].length);
|
j = 1;
|
||||||
uip_debug_ipaddr_print(&uip_ds6_routing_table[i].nexthop);
|
for(r = uip_ds6_route_list_head();
|
||||||
|
r != NULL;
|
||||||
|
r = list_item_next(r)) {
|
||||||
|
ipaddr_add(&r->ipaddr);
|
||||||
|
PRINTF("/%u (via ", r->length);
|
||||||
|
ipaddr_add(&r->nexthop);
|
||||||
// if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
// if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
||||||
printf(") %lus\n", uip_ds6_routing_table[i].state.lifetime);
|
PRINTF(") %lus\n", r->state.lifetime);
|
||||||
// } else {
|
// } else {
|
||||||
// printf(")\n");
|
// PRINTF(")\n");
|
||||||
// }
|
// }
|
||||||
j=0;
|
j = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j) printf(" <none>");
|
if (j) printf(" <none>");
|
||||||
|
|
Loading…
Reference in a new issue