From 3f394fe92778da68be050ce4b88c7d0385042383 Mon Sep 17 00:00:00 2001 From: julienabeille Date: Tue, 14 Oct 2008 09:40:11 +0000 Subject: [PATCH] applications updates for uIPv6 --- apps/webserver/httpd-cgi.c | 130 ++++++++-- apps/webserver/httpd-cgi.h | 4 +- apps/webserver/httpd-fs.c | 10 +- apps/webserver/httpd-fs.h | 8 +- apps/webserver/httpd-fs/header.html | 1 + apps/webserver/httpd-fs/index.html | 1 + apps/webserver/httpd-fsdata.c | 371 ++++++++++++++++------------ apps/webserver/httpd.c | 73 ++++-- apps/webserver/webserver-nogui.h | 3 +- 9 files changed, 387 insertions(+), 214 deletions(-) diff --git a/apps/webserver/httpd-cgi.c b/apps/webserver/httpd-cgi.c index 3d0fce4d6..915f3e695 100644 --- a/apps/webserver/httpd-cgi.c +++ b/apps/webserver/httpd-cgi.c @@ -28,7 +28,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: httpd-cgi.c,v 1.12 2008/02/24 20:59:51 adamdunkels Exp $ + * $Id: httpd-cgi.c,v 1.13 2008/10/14 09:40:11 julienabeille Exp $ * */ @@ -40,7 +40,7 @@ * non-zero value indicates that the function has completed and that * the web server should move along to the next script line. * - */ + */ #include #include @@ -51,6 +51,8 @@ #include "httpd-fs.h" #include "lib/petsciiconv.h" + +#include "sensors.h" static struct httpd_cgi_call *calls = NULL; @@ -96,7 +98,11 @@ static const char tcp_name[] = /* "tcp-connections"*/ 0x73, 0}; static const char proc_name[] = /* "processes"*/ {0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, - 0x65, 0x73, 0}; + 0x65, 0x73, 0}; + +static const char sensor_name[] = "sensors"; + +char sensor_temperature[12]; static const char *states[] = { closed, @@ -110,7 +116,16 @@ static const char *states[] = { last_ack, none, running, - called}; + called}; + + uint8_t sprint_ip6(uip_ip6addr_t addr, char * result); + + +void +web_set_temp(char *s) +{ + strcpy(sensor_temperature, s); +} /*---------------------------------------------------------------------------*/ static @@ -156,21 +171,26 @@ make_tcp_stats(void *arg) { struct uip_conn *conn; struct httpd_state *s = (struct httpd_state *)arg; - - conn = &uip_conns[s->u.count]; - return snprintf((char *)uip_appdata, uip_mss(), - "%d%u.%u.%u.%u:%u%s%u%u%c %c\r\n", - htons(conn->lport), - conn->ripaddr.u8[0], - conn->ripaddr.u8[1], - conn->ripaddr.u8[2], - conn->ripaddr.u8[3], - htons(conn->rport), - states[conn->tcpstateflags & UIP_TS_MASK], - conn->nrtx, - conn->timer, - (uip_outstanding(conn))? '*':' ', - (uip_stopped(conn))? '!':' '); + + uint16_t numprinted; + + conn = &uip_conns[s->u.count]; + + numprinted = snprintf((char *)uip_appdata, uip_mss(), + "%d", + htons(conn->lport)); + + numprinted += sprint_ip6(conn->ripaddr, uip_appdata + numprinted); + numprinted += snprintf((char *)uip_appdata + numprinted, uip_mss() - numprinted, + "-%u%s%u%u%c %c\r\n", + htons(conn->rport), + states[conn->tcpstateflags & UIP_TS_MASK], + conn->nrtx, + conn->timer, + (uip_outstanding(conn))? '*':' ', + (uip_stopped(conn))? '!':' '); + + return numprinted; } /*---------------------------------------------------------------------------*/ static @@ -210,6 +230,22 @@ PT_THREAD(processes(struct httpd_state *s, char *ptr)) for(s->u.ptr = PROCESS_LIST(); s->u.ptr != NULL; s->u.ptr = ((struct process *)s->u.ptr)->next) { PSOCK_GENERATOR_SEND(&s->sout, make_processes, s->u.ptr); } + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static unsigned short +generate_sensor_readings(void *arg) +{ + return snprintf((char *)uip_appdata, uip_mss(), "Temperature: %s\n", sensor_temperature); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(sensor_readings(struct httpd_state *s, char *ptr)) +{ + PSOCK_BEGIN(&s->sout); + + PSOCK_GENERATOR_SEND(&s->sout, generate_sensor_readings, s); + PSOCK_END(&s->sout); } /*---------------------------------------------------------------------------*/ @@ -230,13 +266,65 @@ httpd_cgi_add(struct httpd_cgi_call *c) HTTPD_CGI_CALL(file, file_name, file_stats); HTTPD_CGI_CALL(tcp, tcp_name, tcp_stats); -HTTPD_CGI_CALL(proc, proc_name, processes); +HTTPD_CGI_CALL(proc, proc_name, processes); +HTTPD_CGI_CALL(sensors, sensor_name, sensor_readings); void httpd_cgi_init(void) { httpd_cgi_add(&file); httpd_cgi_add(&tcp); - httpd_cgi_add(&proc); + httpd_cgi_add(&proc); + httpd_cgi_add(&sensors); } /*---------------------------------------------------------------------------*/ + + + +uint8_t sprint_ip6(uip_ip6addr_t addr, char * result) + { + unsigned char zerocnt = 0; + unsigned char numprinted = 0; + char * starting = result; + + unsigned char i = 0; + + while (numprinted < 8) + { + //Address is zero, have we used our ability to + //replace a bunch with : yet? + if ((addr.u16[i] == 0) && (zerocnt == 0)) + { + //How mant zeros? + zerocnt = 0; + while(addr.u16[zerocnt + i] == 0) + zerocnt++; + + //just one, don't waste our zeros... + if (zerocnt == 1) + { + *result++ = '0'; + numprinted++; + break; + } + + //Cool - can replace a bunch of zeros + i += zerocnt; + numprinted += zerocnt; + } + //Normal address, just print it + else + { + result += sprintf(result, "%x", (unsigned int)(ntohs(addr.u16[i]))); + i++; + numprinted++; + } + + //Don't print : on last one + if (numprinted != 8) + *result++ = ':'; + } + + return (result - starting); + } + diff --git a/apps/webserver/httpd-cgi.h b/apps/webserver/httpd-cgi.h index e68a67d47..ce09d057e 100644 --- a/apps/webserver/httpd-cgi.h +++ b/apps/webserver/httpd-cgi.h @@ -28,7 +28,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: httpd-cgi.h,v 1.1 2006/06/17 22:41:14 adamdunkels Exp $ + * $Id: httpd-cgi.h,v 1.2 2008/10/14 09:40:11 julienabeille Exp $ * */ @@ -54,4 +54,6 @@ void httpd_cgi_add(struct httpd_cgi_call *c); static struct httpd_cgi_call name = {NULL, str, function} void httpd_cgi_init(void); +void web_set_temp(char *s); + #endif /* __HTTPD_CGI_H__ */ diff --git a/apps/webserver/httpd-fs.c b/apps/webserver/httpd-fs.c index 24d109543..96f0d6319 100644 --- a/apps/webserver/httpd-fs.c +++ b/apps/webserver/httpd-fs.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: httpd-fs.c,v 1.3 2007/04/22 09:53:50 oliverschmidt Exp $ + * $Id: httpd-fs.c,v 1.4 2008/10/14 09:40:11 julienabeille Exp $ */ #include "contiki-net.h" @@ -38,7 +38,7 @@ #include "httpd-fs.h" #include "httpd-fsdata.h" -#include "httpd-fsdata.c" +#include "httpd-fsdata.c" #if HTTPD_FS_STATISTICS static u16_t count[HTTPD_FS_NUMFILES]; @@ -52,14 +52,14 @@ httpd_fs_strcmp(const char *str1, const char *str2) i = 0; loop: - if(str2[i] == 0 || + if( pgm_read_byte(str2 + i) == 0 || str1[i] == '\r' || str1[i] == '\n') { return 0; } - if(str1[i] != str2[i]) { - return 1; + if(str1[i] != pgm_read_byte(str2 + i)) { + return 1; } ++i; diff --git a/apps/webserver/httpd-fs.h b/apps/webserver/httpd-fs.h index 37483e1e3..2421ef972 100644 --- a/apps/webserver/httpd-fs.h +++ b/apps/webserver/httpd-fs.h @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: httpd-fs.h,v 1.1 2006/06/17 22:41:14 adamdunkels Exp $ + * $Id: httpd-fs.h,v 1.2 2008/10/14 09:40:11 julienabeille Exp $ */ #ifndef __HTTPD_FS_H__ #define __HTTPD_FS_H__ @@ -39,6 +39,8 @@ #define HTTPD_FS_STATISTICS 1 +#include + struct httpd_fs_file { char *data; int len; @@ -56,4 +58,8 @@ u16_t httpd_fs_count(char *name); void httpd_fs_init(void); +#define httpd_fs_cpy memcpy_P +#define httpd_fs_strchr strchr_P +#define httpd_fs_getchar(x) pgm_read_byte(x) + #endif /* __HTTPD_FS_H__ */ diff --git a/apps/webserver/httpd-fs/header.html b/apps/webserver/httpd-fs/header.html index 65d967cb8..ed782924e 100644 --- a/apps/webserver/httpd-fs/header.html +++ b/apps/webserver/httpd-fs/header.html @@ -16,6 +16,7 @@ File statistics
Network connections
System processes
+ Sensor Readings

diff --git a/apps/webserver/httpd-fs/index.html b/apps/webserver/httpd-fs/index.html index 6d3be9b7d..5386ec193 100644 --- a/apps/webserver/httpd-fs/index.html +++ b/apps/webserver/httpd-fs/index.html @@ -16,6 +16,7 @@ File statistics
Network connections
System processes
+ Sensor Readings

diff --git a/apps/webserver/httpd-fsdata.c b/apps/webserver/httpd-fsdata.c index 02596adf1..2c1dae14a 100644 --- a/apps/webserver/httpd-fsdata.c +++ b/apps/webserver/httpd-fsdata.c @@ -1,4 +1,4 @@ -static const char data_processes_shtml[] = { +static const char data_processes_shtml[] PROGMEM = { /* /processes.shtml */ 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, @@ -19,28 +19,91 @@ static const char data_processes_shtml[] = { 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0}; -static const char data_404_html[] = { - /* /404.html */ - 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x20, 0x20, 0x3c, - 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c, - 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22, - 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x63, 0x65, 0x6e, - 0x74, 0x65, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, - 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, - 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, - 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x68, 0x33, - 0x3e, 0x47, 0x6f, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, - 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x68, 0x65, 0x72, 0x65, - 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, - 0x61, 0x64, 0x2e, 0x3c, 0x2f, 0x68, 0x33, 0x3e, 0xa, 0x20, - 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, - 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, - 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, -0}; +static const char data_header_html[] PROGMEM = { + /* /header.html */ + 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, + 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, + 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, + 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, + 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, + 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, + 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, + 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, + 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, + 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x69, + 0x6b, 0x69, 0x2d, 0x64, 0x65, 0x6d, 0x6f, 0x20, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x21, 0x3c, 0x2f, 0x74, 0x69, 0x74, + 0x6c, 0x65, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x6c, + 0x69, 0x6e, 0x6b, 0x20, 0x72, 0x65, 0x6c, 0x3d, 0x22, 0x73, + 0x74, 0x79, 0x6c, 0x65, 0x73, 0x68, 0x65, 0x65, 0x74, 0x22, + 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x74, 0x65, 0x78, + 0x74, 0x2f, 0x63, 0x73, 0x73, 0x22, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, + 0x63, 0x73, 0x73, 0x22, 0x3e, 0x20, 0x20, 0xa, 0x20, 0x20, + 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, 0x20, + 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, + 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x65, + 0x65, 0x63, 0x22, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3d, 0x22, + 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0xa, 0x20, + 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x22, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, + 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, + 0x6d, 0x65, 0x6e, 0x75, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, + 0x70, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x62, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2d, 0x74, 0x69, 0x74, 0x6c, + 0x65, 0x22, 0x3e, 0x4d, 0x65, 0x6e, 0x75, 0x3c, 0x2f, 0x70, + 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x70, 0x20, 0x63, 0x6c, 0x61, + 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x22, 0x3e, + 0xa, 0x20, 0x20, 0xa, 0x20, 0x20, 0x3c, 0x61, 0x20, 0x68, + 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x46, 0x72, + 0x6f, 0x6e, 0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, 0x2f, + 0x61, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, + 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x66, 0x69, + 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, + 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, + 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x61, 0x3e, + 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x61, 0x20, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, 0x70, 0x2e, + 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x61, 0x3e, + 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x61, 0x20, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x70, 0x72, 0x6f, 0x63, + 0x65, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, + 0x6c, 0x22, 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x3c, + 0x2f, 0x61, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, + 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, + 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x2e, 0x73, 0x68, 0x74, 0x6d, + 0x6c, 0x22, 0x3e, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x20, + 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x3c, 0x2f, + 0x61, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, 0xa, + 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, + 0x73, 0x73, 0x3d, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0x20, + 0x20, 0x3c, 0x70, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, + 0x22, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2d, 0x74, 0x69, + 0x74, 0x6c, 0x65, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x57, 0x65, + 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, + 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, + 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, + 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x2f, 0x22, + 0x3e, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x3c, 0x2f, + 0x61, 0x3e, 0x20, 0xa, 0x20, 0x20, 0x77, 0x65, 0x62, 0x20, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x21, 0xa, 0x20, 0x20, + 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0}; -static const char data_files_shtml[] = { +static const char data_files_shtml[] PROGMEM = { /* /files.shtml */ 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, @@ -121,93 +184,7 @@ static const char data_files_shtml[] = { 0x65, 0x3e, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0}; -static const char data_footer_html[] = { - /* /footer.html */ - 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, - 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0}; - -static const char data_header_html[] = { - /* /header.html */ - 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, - 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, - 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, - 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, - 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, - 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, - 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, - 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, - 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, - 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, - 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, - 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, - 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x69, - 0x6b, 0x69, 0x2d, 0x64, 0x65, 0x6d, 0x6f, 0x20, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x21, 0x3c, 0x2f, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x6c, - 0x69, 0x6e, 0x6b, 0x20, 0x72, 0x65, 0x6c, 0x3d, 0x22, 0x73, - 0x74, 0x79, 0x6c, 0x65, 0x73, 0x68, 0x65, 0x65, 0x74, 0x22, - 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x74, 0x65, 0x78, - 0x74, 0x2f, 0x63, 0x73, 0x73, 0x22, 0x20, 0x68, 0x72, 0x65, - 0x66, 0x3d, 0x22, 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, - 0x63, 0x73, 0x73, 0x22, 0x3e, 0x20, 0x20, 0xa, 0x20, 0x20, - 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, 0x20, - 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, - 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x66, 0x66, 0x66, 0x65, - 0x65, 0x63, 0x22, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3d, 0x22, - 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0xa, 0x20, - 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, - 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x22, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, - 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, - 0x6d, 0x65, 0x6e, 0x75, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, - 0x70, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x62, - 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2d, 0x74, 0x69, 0x74, 0x6c, - 0x65, 0x22, 0x3e, 0x4d, 0x65, 0x6e, 0x75, 0x3c, 0x2f, 0x70, - 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x70, 0x20, 0x63, 0x6c, 0x61, - 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x22, 0x3e, - 0xa, 0x20, 0x20, 0xa, 0x20, 0x20, 0x3c, 0x61, 0x20, 0x68, - 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x46, 0x72, - 0x6f, 0x6e, 0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, 0x2f, - 0x61, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, - 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x66, 0x69, - 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, - 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, - 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x61, 0x3e, - 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x61, 0x20, - 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, 0x70, 0x2e, - 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x61, 0x3e, - 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x61, 0x20, - 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x70, 0x72, 0x6f, 0x63, - 0x65, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, - 0x6c, 0x22, 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, - 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x3c, - 0x2f, 0x61, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0xa, 0x20, - 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, - 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x64, - 0x69, 0x76, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, - 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x70, 0x20, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x62, 0x6f, 0x72, 0x64, - 0x65, 0x72, 0x2d, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x22, 0x3e, - 0xa, 0x20, 0x20, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, - 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x3c, 0x61, - 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, - 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, - 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x74, - 0x69, 0x6b, 0x69, 0x2f, 0x22, 0x3e, 0x43, 0x6f, 0x6e, 0x74, - 0x69, 0x6b, 0x69, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0xa, 0x20, - 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x21, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, -0}; - -static const char data_index_html[] = { +static const char data_index_html[] PROGMEM = { /* /index.html */ 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, @@ -267,49 +244,54 @@ static const char data_index_html[] = { 0x73, 0x73, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x3c, 0x2f, - 0x61, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0xa, 0x20, 0x20, - 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x64, - 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x69, - 0x76, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, - 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x70, 0x20, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x3d, 0x22, 0x62, 0x6f, 0x72, 0x64, 0x65, - 0x72, 0x2d, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x22, 0x3e, 0xa, - 0x20, 0x20, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, - 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x3c, 0x61, 0x20, - 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, - 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, - 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x69, - 0x6b, 0x69, 0x2f, 0x22, 0x3e, 0x43, 0x6f, 0x6e, 0x74, 0x69, - 0x6b, 0x69, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0xa, 0x20, 0x20, - 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x21, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0x9, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa, 0x9, 0x20, 0x20, + 0x61, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, + 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, 0x65, + 0x6e, 0x73, 0x6f, 0x72, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, + 0x22, 0x3e, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x20, 0x52, + 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x3c, 0x2f, 0x61, + 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, + 0x20, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, 0xa, 0x20, + 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x3d, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x70, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, - 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x22, 0x3e, 0xa, 0x9, 0x20, - 0x20, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x77, 0x65, 0x62, - 0x20, 0x70, 0x61, 0x67, 0x65, 0x73, 0x20, 0x79, 0x6f, 0x75, - 0x20, 0x61, 0x72, 0x65, 0x20, 0x77, 0x61, 0x74, 0x63, 0x68, - 0x69, 0x6e, 0x67, 0x20, 0x61, 0x72, 0x65, 0x20, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x20, - 0x77, 0x65, 0x62, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x72, 0x75, 0x6e, 0x6e, - 0x69, 0x6e, 0x67, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x3c, 0x61, 0xa, 0x9, 0x20, 0x20, - 0x20, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, - 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, - 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x63, 0x6f, 0x6e, - 0x74, 0x69, 0x6b, 0x69, 0x2f, 0x22, 0x3e, 0x43, 0x6f, 0x6e, - 0x74, 0x69, 0x6b, 0x69, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, - 0x74, 0x69, 0x6e, 0x67, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x3c, 0x2f, 0x61, 0x3e, - 0x2e, 0xa, 0x9, 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, - 0xa, 0x9, 0x20, 0x20, 0xa, 0x9, 0x20, 0xa, 0x20, 0x20, - 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, - 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0}; + 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2d, 0x74, 0x69, 0x74, + 0x6c, 0x65, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x57, 0x65, 0x6c, + 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, + 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, + 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x2f, 0x22, 0x3e, + 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x3c, 0x2f, 0x61, + 0x3e, 0x20, 0xa, 0x20, 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x21, 0xa, 0x20, 0x20, 0x3c, + 0x2f, 0x70, 0x3e, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0xa, 0x9, 0x20, 0x20, 0x3c, 0x70, 0x20, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x3d, 0x22, 0x69, 0x6e, 0x74, 0x72, 0x6f, + 0x22, 0x3e, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x54, 0x68, + 0x65, 0x20, 0x77, 0x65, 0x62, 0x20, 0x70, 0x61, 0x67, 0x65, + 0x73, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x61, 0x72, 0x65, 0x20, + 0x77, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x61, + 0x72, 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, + 0x62, 0x79, 0x20, 0x61, 0x20, 0x77, 0x65, 0x62, 0xa, 0x9, + 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x75, + 0x6e, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x3c, + 0x61, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, + 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, + 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x2f, + 0x22, 0x3e, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x20, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0xa, + 0x9, 0x20, 0x20, 0x20, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x3c, 0x2f, 0x61, 0x3e, 0x2e, 0xa, 0x9, 0x20, 0x20, + 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0xa, 0x9, 0x20, 0x20, 0xa, + 0x9, 0x20, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, + 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, + 0xa, 0}; -static const char data_style_css[] = { +static const char data_style_css[] PROGMEM = { /* /style.css */ 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0, 0x68, 0x31, 0x20, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x74, 0x65, @@ -570,7 +552,13 @@ static const char data_style_css[] = { 0x3b, 0xa, 0xa, 0x7d, 0x20, 0xa, 0xa, 0xa, 0xa, 0xa, 0}; -static const char data_tcp_shtml[] = { +static const char data_footer_html[] PROGMEM = { + /* /footer.html */ + 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, + 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0}; + +static const char data_tcp_shtml[] PROGMEM = { /* /tcp.shtml */ 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, @@ -596,22 +584,83 @@ static const char data_tcp_shtml[] = { 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0}; +static const char data_404_html[] PROGMEM = { + /* /404.html */ + 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x20, 0x20, 0x3c, + 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c, + 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22, + 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x63, 0x65, 0x6e, + 0x74, 0x65, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, + 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, + 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, + 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x68, 0x33, + 0x3e, 0x47, 0x6f, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x68, 0x65, 0x72, 0x65, + 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, + 0x61, 0x64, 0x2e, 0x3c, 0x2f, 0x68, 0x33, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, + 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, + 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, +0}; + +static const char data_sensor_shtml[] PROGMEM = { + /* /sensor.shtml */ + 0x2f, 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, + 0x3e, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x20, 0x52, 0x65, + 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x3c, 0x2f, 0x68, 0x31, + 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x20, 0x73, + 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x73, 0xa, 0x25, 0x21, 0x3a, + 0x20, 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, + 0x74, 0x6d, 0x6c, 0xa, 0xa, 0}; + +static const char data_upload_html[] PROGMEM = { + /* /upload.html */ + 0x2f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c, 0x62, 0x6f, + 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x66, 0x6f, 0x72, 0x6d, 0x20, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x75, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22, + 0x20, 0x65, 0x6e, 0x63, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x61, 0x72, 0x74, 0x2f, + 0x66, 0x6f, 0x72, 0x6d, 0x2d, 0x64, 0x61, 0x74, 0x61, 0x22, + 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3d, 0x22, 0x70, + 0x6f, 0x73, 0x74, 0x22, 0x3e, 0xa, 0x3c, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x75, + 0x73, 0x65, 0x72, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x20, 0x74, + 0x79, 0x70, 0x65, 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x22, + 0x20, 0x73, 0x69, 0x7a, 0x65, 0x3d, 0x22, 0x35, 0x30, 0x22, + 0x20, 0x2f, 0x3e, 0xa, 0x3c, 0x69, 0x6e, 0x70, 0x75, 0x74, + 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3d, 0x22, 0x55, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, + 0x3d, 0x22, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x22, 0x20, + 0x2f, 0x3e, 0xa, 0x3c, 0x2f, 0x66, 0x6f, 0x72, 0x6d, 0x3e, + 0xa, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, + 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0}; + const struct httpd_fsdata_file file_processes_shtml[] = {{NULL, data_processes_shtml, data_processes_shtml + 17, sizeof(data_processes_shtml) - 17}}; -const struct httpd_fsdata_file file_404_html[] = {{file_processes_shtml, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}}; +const struct httpd_fsdata_file file_header_html[] = {{file_processes_shtml, data_header_html, data_header_html + 13, sizeof(data_header_html) - 13}}; -const struct httpd_fsdata_file file_files_shtml[] = {{file_404_html, data_files_shtml, data_files_shtml + 13, sizeof(data_files_shtml) - 13}}; +const struct httpd_fsdata_file file_files_shtml[] = {{file_header_html, data_files_shtml, data_files_shtml + 13, sizeof(data_files_shtml) - 13}}; -const struct httpd_fsdata_file file_footer_html[] = {{file_files_shtml, data_footer_html, data_footer_html + 13, sizeof(data_footer_html) - 13}}; - -const struct httpd_fsdata_file file_header_html[] = {{file_footer_html, data_header_html, data_header_html + 13, sizeof(data_header_html) - 13}}; - -const struct httpd_fsdata_file file_index_html[] = {{file_header_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}}; +const struct httpd_fsdata_file file_index_html[] = {{file_files_shtml, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}}; const struct httpd_fsdata_file file_style_css[] = {{file_index_html, data_style_css, data_style_css + 11, sizeof(data_style_css) - 11}}; -const struct httpd_fsdata_file file_tcp_shtml[] = {{file_style_css, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 11}}; +const struct httpd_fsdata_file file_footer_html[] = {{file_style_css, data_footer_html, data_footer_html + 13, sizeof(data_footer_html) - 13}}; -#define HTTPD_FS_ROOT file_tcp_shtml +const struct httpd_fsdata_file file_tcp_shtml[] = {{file_footer_html, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 11}}; -#define HTTPD_FS_NUMFILES 8 +const struct httpd_fsdata_file file_404_html[] = {{file_tcp_shtml, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}}; + +const struct httpd_fsdata_file file_sensor_shtml[] = {{file_404_html, data_sensor_shtml, data_sensor_shtml + 14, sizeof(data_sensor_shtml) - 14}}; + +const struct httpd_fsdata_file file_upload_html[] = {{file_sensor_shtml, data_upload_html, data_upload_html + 13, sizeof(data_upload_html) - 13}}; + +#define HTTPD_FS_ROOT file_upload_html + +#define HTTPD_FS_NUMFILES 10 diff --git a/apps/webserver/httpd.c b/apps/webserver/httpd.c index dad7bd73e..58116cf8e 100644 --- a/apps/webserver/httpd.c +++ b/apps/webserver/httpd.c @@ -30,11 +30,11 @@ * * Author: Adam Dunkels * - * $Id: httpd.c,v 1.9 2007/11/26 21:36:35 oliverschmidt Exp $ + * $Id: httpd.c,v 1.10 2008/10/14 09:40:11 julienabeille Exp $ */ #include - + #include "contiki-net.h" #include "webserver.h" @@ -76,7 +76,8 @@ generate(void *state) } else { s->len = s->file.len; } - memcpy(uip_appdata, s->file.data, s->len); + + httpd_fs_cpy(uip_appdata, s->file.data, s->len); return s->len; } @@ -86,7 +87,7 @@ PT_THREAD(send_file(struct httpd_state *s)) { PSOCK_BEGIN(&s->sout); - do { + do { PSOCK_GENERATOR_SEND(&s->sout, generate, s); s->file.len -= s->len; s->file.data += s->len; @@ -99,8 +100,27 @@ static PT_THREAD(send_part_of_file(struct httpd_state *s)) { PSOCK_BEGIN(&s->sout); - - PSOCK_SEND(&s->sout, (uint8_t *)s->file.data, s->len); + + static int oldfilelen, oldlen; + static char * olddata; + + //Store stuff that gets clobbered... + oldfilelen = s->file.len; + oldlen = s->len; + olddata = s->file.data; + + //How much to send + s->file.len = s->len; + + do { + PSOCK_GENERATOR_SEND(&s->sout, generate, s); + s->file.len -= s->len; + s->file.data += s->len; + } while(s->file.len > 0); + + s->len = oldlen; + s->file.len = oldfilelen; + s->file.data = olddata; PSOCK_END(&s->sout); } @@ -110,7 +130,7 @@ next_scriptstate(struct httpd_state *s) { char *p; - if((p = strchr(s->scriptptr, ISO_nl)) != NULL) { + if((p = (char *)httpd_fs_strchr(s->scriptptr, ISO_nl)) != NULL) { p += 1; s->scriptlen -= (unsigned short)(p - s->scriptptr); s->scriptptr = p; @@ -126,23 +146,28 @@ next_scriptstate(struct httpd_state *s) static PT_THREAD(handle_script(struct httpd_state *s)) { - char *ptr; + char *ptr; + + char filenamebuf[25]; PT_BEGIN(&s->scriptpt); while(s->file.len > 0) { /* Check if we should start executing a script. */ - if(*s->file.data == ISO_percent && - *(s->file.data + 1) == ISO_bang) { + if(httpd_fs_getchar(s->file.data) == ISO_percent && + httpd_fs_getchar(s->file.data + 1) == ISO_bang) { s->scriptptr = s->file.data + 3; - s->scriptlen = s->file.len - 3; - if(*(s->scriptptr - 1) == ISO_colon) { - httpd_fs_open(s->scriptptr + 1, &s->file); - PT_WAIT_THREAD(&s->scriptpt, send_file(s)); + s->scriptlen = s->file.len - 3; + + memcpy_P(filenamebuf, s->scriptptr, 25); + + if(httpd_fs_getchar(s->scriptptr - 1) == ISO_colon) { + httpd_fs_open(filenamebuf + 1, &s->file); + PT_WAIT_THREAD(&s->scriptpt, send_file(s)); } else { - PT_WAIT_THREAD(&s->scriptpt, - httpd_cgi(s->scriptptr)(s, s->scriptptr)); + PT_WAIT_THREAD(&s->scriptpt, + httpd_cgi(filenamebuf)(s, s->scriptptr)); } next_scriptstate(s); @@ -157,16 +182,16 @@ PT_THREAD(handle_script(struct httpd_state *s)) if(s->file.len > uip_mss()) { s->len = uip_mss(); } else { - s->len = s->file.len; + s->len = s->file.len; } - if(*s->file.data == ISO_percent) { - ptr = strchr(s->file.data + 1, ISO_percent); + if(httpd_fs_getchar(s->file.data) == ISO_percent) { + ptr = (char *) httpd_fs_strchr(s->file.data + 1, ISO_percent); } else { - ptr = strchr(s->file.data, ISO_percent); + ptr = (char *) httpd_fs_strchr(s->file.data, ISO_percent); } if(ptr != NULL && - ptr != s->file.data) { + ptr != s->file.data) { s->len = (int)(ptr - s->file.data); if(s->len >= uip_mss()) { s->len = uip_mss(); @@ -177,7 +202,7 @@ PT_THREAD(handle_script(struct httpd_state *s)) s->file.len -= s->len; } } - + PT_END(&s->scriptpt); } /*---------------------------------------------------------------------------*/ @@ -243,8 +268,8 @@ PT_THREAD(handle_output(struct httpd_state *s)) /*---------------------------------------------------------------------------*/ static PT_THREAD(handle_input(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sin); +{ + PSOCK_BEGIN(&s->sin); PSOCK_READTO(&s->sin, ISO_space); diff --git a/apps/webserver/webserver-nogui.h b/apps/webserver/webserver-nogui.h index cf96ea8db..53b9649b5 100644 --- a/apps/webserver/webserver-nogui.h +++ b/apps/webserver/webserver-nogui.h @@ -29,7 +29,7 @@ * * This file is part of the Contiki OS * - * $Id: webserver-nogui.h,v 1.2 2007/04/23 21:19:55 oliverschmidt Exp $ + * $Id: webserver-nogui.h,v 1.3 2008/10/14 09:40:11 julienabeille Exp $ * */ #ifndef __WEBSERVER_NOGUI_H__ @@ -38,6 +38,7 @@ #include "contiki-net.h" PROCESS_NAME(webserver_nogui_process); +PROCESS_NAME(raven_lcd_process); void webserver_log(char *msg); void webserver_log_file(uip_ipaddr_t *requester, char *file);