diff --git a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c index 089866287..4a8d6c6e2 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c +++ b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c @@ -28,7 +28,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: httpd-cgi.c,v 1.8 2010/10/19 18:29:05 adamdunkels Exp $ + * $Id: httpd-cgi.c,v 1.9 2010/12/02 15:37:13 dak664 Exp $ * */ @@ -75,6 +75,9 @@ static const char file_name[] HTTPD_STRING_ATTR = "file-stats"; static const char tcp_name[] HTTPD_STRING_ATTR = "tcp-connections"; static const char proc_name[] HTTPD_STRING_ATTR = "processes"; static const char sensor_name[] HTTPD_STRING_ATTR = "sensors"; +static const char adrs_name[] HTTPD_STRING_ATTR = "addresses"; +static const char nbrs_name[] HTTPD_STRING_ATTR = "neighbors"; +static const char rtes_name[] HTTPD_STRING_ATTR = "routes"; /*Process states for processes cgi*/ static const char closed[] HTTPD_STRING_ATTR = "CLOSED"; @@ -267,7 +270,6 @@ make_processes(void *p) petsciiconv_toascii(name, 40); httpd_strcpy(tstate,states[9 + ((struct process *)p)->state]); return httpd_snprintf((char *)uip_appdata, uip_mss(), httpd_cgi_proc, p, name, -// *((char **)&(((struct process *)p)->thread)), *(char *)(&(((struct process *)p)->thread)), tstate); @@ -283,6 +285,108 @@ PT_THREAD(processes(struct httpd_state *s, char *ptr)) PSOCK_END(&s->sout); } /*---------------------------------------------------------------------------*/ +static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = ""; +static const char httpd_cgi_addrf[] HTTPD_STRING_ATTR = "[Room for %u more]"; +static const char httpd_cgi_addrb[] HTTPD_STRING_ATTR = "
"; +static const char httpd_cgi_addrn[] HTTPD_STRING_ATTR = "(none)
"; +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; +#include "rpl.h" + +static unsigned short +make_addresses(void *p) +{ +uint8_t i,j=0; +uint16_t numprinted; + numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); + for (i=0; isout); + + PSOCK_GENERATOR_SEND(&s->sout, make_addresses, s->u.ptr); + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static unsigned short +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; isout); + + PSOCK_GENERATOR_SEND(&s->sout, make_neighbors, s->u.ptr); + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static unsigned short +make_routes(void *p) +{ +static const char httpd_cgi_rtes1[] HTTPD_STRING_ATTR = "(%u (via "; +static const char httpd_cgi_rtes2[] HTTPD_STRING_ATTR = ") %lus
"; +static const char httpd_cgi_rtes3[] HTTPD_STRING_ATTR = ")
"; +uint8_t i,j=0; +uint16_t numprinted; + numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); + for (i=0; isout); + + PSOCK_GENERATOR_SEND(&s->sout, make_routes, s->u.ptr); + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ static unsigned short generate_sensor_readings(void *arg) { @@ -383,6 +487,9 @@ HTTPD_CGI_CALL( file, file_name, file_stats); #endif HTTPD_CGI_CALL( tcp, tcp_name, tcp_stats ); HTTPD_CGI_CALL( proc, proc_name, processes ); +HTTPD_CGI_CALL( adrs, adrs_name, addresses ); +HTTPD_CGI_CALL( nbrs, nbrs_name, neighbors ); +HTTPD_CGI_CALL( rtes, rtes_name, routes ); HTTPD_CGI_CALL(sensors, sensor_name, sensor_readings); void @@ -393,6 +500,9 @@ httpd_cgi_init(void) #endif httpd_cgi_add( &tcp); httpd_cgi_add( &proc); + httpd_cgi_add( &adrs); + httpd_cgi_add( &nbrs); + httpd_cgi_add( &rtes); httpd_cgi_add(&sensors); } /*---------------------------------------------------------------------------*/