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