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

@ -51,7 +51,7 @@ do{\
uip_ipaddr_t ipaddr_local, ipaddr_global;\
NODE_IP(node_global, GLOBAL, &ipaddr_global);\
NODE_IP(node_local, LOCAL, &ipaddr_local);\
uip_ds6_route_add(&ipaddr_global, 128, &ipaddr_local, 0);\
uip_ds6_route_add(&ipaddr_global, 128, &ipaddr_local);\
}while(0)
void set_global_address(void);

View File

@ -50,6 +50,7 @@
#include "httpd-fs.h"
#include "httpd-fsdata.h"
#include "lib/petsciiconv.h"
#include "net/neighbor-table.h"
#include "sensors.h"
@ -479,7 +480,6 @@ PT_THREAD(addresses(struct httpd_state *s, char *ptr))
#endif /* WEBSERVER_CONF_ADDRESSES */
#if WEBSERVER_CONF_NEIGHBORS
extern uip_ds6_nbr_t uip_ds6_nbr_cache[];
/*---------------------------------------------------------------------------*/
static unsigned short
make_neighbors(void *p)
@ -487,11 +487,13 @@ make_neighbors(void *p)
uint8_t i,j;
uint16_t numprinted=0;
struct httpd_state *s=p;
static uip_ds6_nbr_t *nbr;
/* Span generator calls over tcp segments */
/* Note retransmissions will execute thise code multiple times for a segment */
i=s->starti;j=s->startj;
for (;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), i++) {
j++;
#if WEBSERVER_CONF_NEIGHBOR_STATUS
@ -501,32 +503,31 @@ static const char httpd_cgi_nbrs3[] HTTPD_STRING_ATTR = " STALE";
static const char httpd_cgi_nbrs4[] HTTPD_STRING_ATTR = " DELAY";
static const char httpd_cgi_nbrs5[] HTTPD_STRING_ATTR = " NBR_PROBE";
{uint16_t k=numprinted+25;
numprinted += httpd_cgi_sprint_ip6(uip_ds6_nbr_cache[i].ipaddr, uip_appdata + numprinted);
numprinted += httpd_cgi_sprint_ip6(nbr->ipaddr, uip_appdata + numprinted);
while (numprinted < k) {*((char *)uip_appdata+numprinted++) = ' ';}
switch (uip_ds6_nbr_cache[i].state) {
switch (nbr->state) {
case NBR_INCOMPLETE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs1);break;
case NBR_REACHABLE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs2);break;
case NBR_STALE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs3);break;
case NBR_STALE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs3);break;
case NBR_DELAY: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs4);break;
case NBR_PROBE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs5);break;
}
}
#else
numprinted += httpd_cgi_sprint_ip6(uip_ds6_nbr_cache[i].ipaddr, uip_appdata + numprinted);
numprinted += httpd_cgi_sprint_ip6(nbr->ipaddr, uip_appdata + numprinted);
#endif
*((char *)uip_appdata+numprinted++) = '\n';
/* If buffer near full, send it and wait for the next call. Could be a retransmission, or the next segment */
if(numprinted > (uip_mss() - 50)) {
s->savei=i;s->savej=j;
s->savei=i;s->savej=j;
return numprinted;
}
}
}
#if WEBSERVER_CONF_SHOW_ROOM
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);
#else
if(UIP_DS6_NBR_NB == j) {
if(NEIGHBOR_TABLE_MAX_NEIGHBORS == j) {
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf);
}
#endif
@ -554,7 +555,6 @@ PT_THREAD(neighbors(struct httpd_state *s, char *ptr))
#endif
#if WEBSERVER_CONF_ROUTES
extern uip_ds6_route_t uip_ds6_routing_table[];
#if WEBSERVER_CONF_ROUTE_LINKS
static const char httpd_cgi_rtesl1[] HTTPD_STRING_ATTR = "<a href=http://[";
static const char httpd_cgi_rtesl2[] HTTPD_STRING_ATTR = "]/status.shtml>";
@ -570,27 +570,29 @@ static const char httpd_cgi_rtes3[] HTTPD_STRING_ATTR = ")\n";
uint8_t i,j;
uint16_t numprinted=0;
struct httpd_state *s=p;
uip_ds6_route_t *r;
/* Span generator calls over tcp segments */
/* Note retransmissions will execute thise code multiple times for a segment */
i=s->starti;j=s->startj;
for (;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++;
#if WEBSERVER_CONF_ROUTE_LINKS
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtesl1);
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_rtesl2);
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_rtesl3);
#else
numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].ipaddr, uip_appdata + numprinted);
numprinted += httpd_cgi_sprint_ip6(r->ipaddr, uip_appdata + numprinted);
#endif
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(1 || uip_ds6_routing_table[i].state.lifetime < 3600) {
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, (long unsigned int)uip_ds6_routing_table[i].state.lifetime);
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(1 || r->state.lifetime < 3600) {
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, (long unsigned int)r->state.lifetime);
} else {
numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes3);
}

View File

@ -244,8 +244,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
@ -282,15 +280,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;
}
/*---------------------------------------------------------------------------*/
@ -315,13 +314,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

@ -63,9 +63,6 @@
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
extern uip_ds6_nbr_t uip_ds6_nbr_cache[];
extern uip_ds6_route_t uip_ds6_routing_table[];
extern long slip_sent;
extern long slip_received;
@ -150,32 +147,34 @@ PT_THREAD(generate_routes(struct httpd_state *s))
{
static int i;
static uip_ds6_route_t *r;
static uip_ds6_nbr_t *nbr;
PSOCK_BEGIN(&s->sout);
SEND_STRING(&s->sout, TOP);
blen = 0;
ADD("Neighbors<pre>");
for(i = 0; i < UIP_DS6_NBR_NB; i++) {
if(uip_ds6_nbr_cache[i].isused) {
ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
ADD("\n");
if(blen > sizeof(buf) - 45) {
SEND_STRING(&s->sout, buf);
blen = 0;
}
for(nbr = nbr_table_head(ds6_neighbors);
nbr != NULL;
nbr = nbr_table_next(ds6_neighbors, nbr)) {
ipaddr_add(&nbr->ipaddr;);
ADD("\n");
if(blen > sizeof(buf) - 45) {
SEND_STRING(&s->sout, buf);
blen = 0;
}
}
ADD("</pre>Routes<pre>");
SEND_STRING(&s->sout, buf);
blen = 0;
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);
ADD("/%u (via ", r->length);
ipaddr_add(&r->nexthop);
ipaddr_add(uip_ds6_route_nexthop(r));
if(r->state.lifetime < 600) {
ADD(") %lus\n", (unsigned long)r->state.lifetime);
} else {

View File

@ -56,8 +56,6 @@
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
extern uip_ds6_nbr_t uip_ds6_nbr_cache[];
static uip_ipaddr_t prefix;
static uint8_t prefix_set;
@ -149,6 +147,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
{
static int i;
static uip_ds6_route_t *r;
static uip_ds6_nbr_t *nbr;
#if BUF_USES_STACK
char buf[256];
#endif
@ -166,15 +165,17 @@ PT_THREAD(generate_routes(struct httpd_state *s))
blen = 0;
#endif
ADD("Neighbors<pre>");
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)) {
#if WEBSERVER_CONF_NEIGHBOR_STATUS
#if BUF_USES_STACK
{char* j=bufptr+25;
ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
ipaddr_add(&nbr->ipaddr);
while (bufptr < j) ADD(" ");
switch (uip_ds6_nbr_cache[i].state) {
switch (nbr->state) {
case NBR_INCOMPLETE: ADD(" INCOMPLETE");break;
case NBR_REACHABLE: ADD(" REACHABLE");break;
case NBR_STALE: ADD(" STALE");break;
@ -184,9 +185,9 @@ PT_THREAD(generate_routes(struct httpd_state *s))
}
#else
{uint8_t j=blen+25;
ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
ipaddr_add(&nbr->ipaddr);
while (blen < j) ADD(" ");
switch (uip_ds6_nbr_cache[i].state) {
switch (nbr->state) {
case NBR_INCOMPLETE: ADD(" INCOMPLETE");break;
case NBR_REACHABLE: ADD(" REACHABLE");break;
case NBR_STALE: ADD(" STALE");break;
@ -196,7 +197,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
}
#endif
#else
ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
ipaddr_add(&nbr->ipaddr);
#endif
ADD("\n");
@ -211,7 +212,6 @@ PT_THREAD(generate_routes(struct httpd_state *s))
blen = 0;
}
#endif
}
}
ADD("</pre>Routes<pre>");
SEND_STRING(&s->sout, buf);
@ -221,7 +221,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
blen = 0;
#endif
for(r = uip_ds6_route_list_head(); r != NULL; r = list_item_next(r)) {
for(r = uip_ds6_route_head(); r != NULL; r = uip_ds6_route_next(r)) {
#if BUF_USES_STACK
#if WEBSERVER_CONF_ROUTE_LINKS
@ -247,7 +247,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
#endif
#endif
ADD("/%u (via ", r->length);
ipaddr_add(&r->nexthop);
ipaddr_add(uip_ds6_route_nexthop(r));
if(1 || (r->state.lifetime < 600)) {
ADD(") %lus\n", r->state.lifetime);
} else {

View File

@ -31,7 +31,6 @@
#include "net/uip.h"
#include "net/uip-ds6.h"
#include "net/uip-udp-packet.h"
#include "net/neighbor-info.h"
#include "net/rpl/rpl.h"
#include "dev/serial-line.h"
#if CONTIKI_TARGET_Z1
@ -64,7 +63,6 @@ collect_common_set_sink(void)
/* A udp client can never become sink */
}
/*---------------------------------------------------------------------------*/
extern uip_ds6_route_t uip_ds6_routing_table[UIP_DS6_ROUTE_NB];
void
collect_common_net_print(void)
@ -76,12 +74,12 @@ collect_common_net_print(void)
dag = rpl_get_any_dag();
if(dag->preferred_parent != NULL) {
PRINTF("Preferred parent: ");
PRINT6ADDR(&dag->preferred_parent->addr);
PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent));
PRINTF("\n");
}
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)) {
PRINT6ADDR(&r->ipaddr);
}
PRINTF("---\n");
@ -134,12 +132,12 @@ collect_common_send(void)
preferred_parent = dag->preferred_parent;
if(preferred_parent != NULL) {
uip_ds6_nbr_t *nbr;
nbr = uip_ds6_nbr_lookup(&preferred_parent->addr);
nbr = uip_ds6_nbr_lookup(rpl_get_parent_ipaddr(preferred_parent));
if(nbr != NULL) {
/* Use parts of the IPv6 address as the parent address, in reversed byte order. */
parent.u8[RIMEADDR_SIZE - 1] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 2];
parent.u8[RIMEADDR_SIZE - 2] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 1];
parent_etx = neighbor_info_get_metric((rimeaddr_t *) &nbr->lladdr) / 2;
parent_etx = rpl_get_parent_rank((rimeaddr_t *) uip_ds6_nbr_get_ll(nbr)) / 2;
}
}
rtmetric = dag->rank;

View File

@ -131,3 +131,9 @@ uip_icmp6chksum(void)
{
return upper_layer_chksum(UIP_PROTO_ICMP6);
}
/*---------------------------------------------------------------------------*/
void
uip_ds6_link_neighbor_callback(int status, int numtx)
{
}

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

View File

@ -127,3 +127,10 @@ uip_icmp6chksum(void)
{
return upper_layer_chksum(UIP_PROTO_ICMP6);
}
/*---------------------------------------------------------------------------*/
void
uip_ds6_link_neighbor_callback(int status, int numtx)
{
}

View File

@ -127,3 +127,9 @@ uip_icmp6chksum(void)
{
return upper_layer_chksum(UIP_PROTO_ICMP6);
}
/*---------------------------------------------------------------------------*/
void
uip_ds6_link_neighbor_callback(int status, int numtx)
{
}

View File

@ -73,3 +73,9 @@ uip_icmp6chksum(void)
{
return upper_layer_chksum(UIP_PROTO_ICMP6);
}
/*---------------------------------------------------------------------------*/
void
uip_ds6_link_neighbor_callback(int status, int numtx)
{
}