Fix various issues, bad ages, etc. with ez80+uIP webserver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1638 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
5cc7066b41
commit
85d77c281b
@ -603,6 +603,14 @@ CONFIG_NX_BLOCKING=y
|
||||
CONFIG_NX_MXSERVERMSGS=32
|
||||
CONFIG_NX_MXCLIENTMSGS=16
|
||||
|
||||
#
|
||||
# Settings for netutils/httpd
|
||||
CONFIG_NETUTILS_HTTPDSTACKSIZE=2048
|
||||
CONFIG_NETUTILS_HTTPDFILESTATS=y
|
||||
CONFIG_NETUTILS_HTTPDNETSTATS=y
|
||||
CONFIG_NETUTILS_HTTPD_DUMPBUFFER=n
|
||||
CONFIG_NETUTILS_HTTPD_DUMPPSTATE=n
|
||||
|
||||
#
|
||||
# Settings for examples/poll
|
||||
CONFIG_EXAMPLE_POLL_NOMAC=y
|
||||
@ -789,6 +797,6 @@ CONFIG_STACK_POINTER=
|
||||
CONFIG_IDLETHREAD_STACKSIZE=1024
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_PTHREAD_STACK_MIN=256
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=2048
|
||||
CONFIG_HEAP_BASE=
|
||||
CONFIG_HEAP_SIZE=
|
||||
|
@ -441,6 +441,14 @@ CONFIG_USBSTRG_PRODUCTSTR="USBdev Storage"
|
||||
CONFIG_USBSTRG_VERSIONNO=0x0399
|
||||
CONFIG_USBSTRG_REMOVABLE=y
|
||||
|
||||
#
|
||||
# Settings for netutils/httpd
|
||||
CONFIG_NETUTILS_HTTPDSTACKSIZE=4096
|
||||
CONFIG_NETUTILS_HTTPDFILESTATS=y
|
||||
CONFIG_NETUTILS_HTTPDNETSTATS=y
|
||||
CONFIG_NETUTILS_HTTPD_DUMPBUFFER=n
|
||||
CONFIG_NETUTILS_HTTPD_DUMPPSTATE=n
|
||||
|
||||
#
|
||||
# Settings for examples/uip
|
||||
CONFIG_EXAMPLE_UIP_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||
|
@ -249,9 +249,17 @@ examples/udp
|
||||
examples/uip
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This is a port of uIP example application. It includes
|
||||
conditionally compiled logic to exercise the uIP webserver,
|
||||
webclient, telnet, smtp, dncpc, and resolver.
|
||||
This is a port of uIP example application. It includes conditionally
|
||||
compiled logic to exercise the uIP webserver, webclient, telnet, smtp,
|
||||
dncpc, and resolver.
|
||||
|
||||
Other configuratin items apply also to the selected network utility.
|
||||
For example, the additional relevant settings for the uIP webserver
|
||||
are:
|
||||
|
||||
CONFIG_NETUTILS_HTTPDSTACKSIZE
|
||||
CONFIG_NETUTILS_HTTPDFILESTATS
|
||||
CONFIG_NETUTILS_HTTPDNETSTATS
|
||||
|
||||
examples/usbserial
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# Make.defs
|
||||
#
|
||||
# Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -76,9 +76,6 @@
|
||||
#define ISO_slash 0x2f
|
||||
#define ISO_colon 0x3a
|
||||
|
||||
#undef CONFIG_NETUTILS_HTTPD_DUMPBUFFER
|
||||
#undef CONFIG_NETUTILS_HTTPD_DUMPPSTATE
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@ -353,8 +350,10 @@ static int httpd_sendfile(struct httpd_state *pstate)
|
||||
|
||||
pstate->ht_sndlen = 0;
|
||||
|
||||
nvdbg("[%d] sending file '%s'\n", pstate->ht_sockfd, pstate->ht_filename);
|
||||
if (!httpd_fs_open(pstate->ht_filename, &pstate->ht_file))
|
||||
{
|
||||
ndbg("[%d] '%s' not found\n", pstate->ht_sockfd, pstate->ht_filename);
|
||||
memcpy(pstate->ht_filename, g_http404path, strlen(g_http404path));
|
||||
httpd_fs_open(g_http404path, &pstate->ht_file);
|
||||
if (send_headers(pstate, g_httpheader404, strlen(g_httpheader404)) == OK)
|
||||
@ -465,9 +464,6 @@ static void *httpd_handler(void *arg)
|
||||
/* Verify that the state structure was successfully allocated */
|
||||
|
||||
if (pstate)
|
||||
{
|
||||
/* Loop processing each HTTP command */
|
||||
// do
|
||||
{
|
||||
/* Re-initialize the thread state structure */
|
||||
|
||||
@ -477,8 +473,6 @@ static void *httpd_handler(void *arg)
|
||||
/* Then handle the next httpd command */
|
||||
|
||||
ret = httpd_cmd(pstate);
|
||||
}
|
||||
// while (ret == OK);
|
||||
|
||||
/* End of command processing -- Clean up and exit */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* netutils/webserver/httpd.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
@ -53,7 +53,20 @@
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define HTTPD_FS_STATISTICS 1
|
||||
/* As threads are created to handle each request, a stack must be allocated
|
||||
* for the thread. Use a default if the user provided no stacksize.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NETUTILS_HTTPDSTACKSIZE
|
||||
# define CONFIG_NETUTILS_HTTPDSTACKSIZE 4096
|
||||
#endif
|
||||
|
||||
#undef CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
#define CONFIG_NETUTILS_HTTPDFSSTATS 1
|
||||
|
||||
#ifndef CONFIG_NET_STATISTICS
|
||||
# undef CONFIG_NETUTILS_HTTPDNETSTATS
|
||||
#endif
|
||||
|
||||
/* For efficiency reasons, the size of the IO buffer should be a multiple
|
||||
* of the TCP MSS value. Also, the current design requires that the IO
|
||||
@ -66,14 +79,6 @@
|
||||
|
||||
#define HTTPD_MAX_FILENAME 20
|
||||
|
||||
/* As threads are created to handle each request, a stack must be allocated
|
||||
* for the thread. Use a default if the user provided no stacksize.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NETUTILS_HTTPDSTACKSIZE
|
||||
# define CONFIG_NETUTILS_HTTPDSTACKSIZE 4096
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
@ -99,11 +104,11 @@ struct httpd_state
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HTTPD_FS_STATISTICS
|
||||
#if HTTPD_FS_STATISTICS == 1
|
||||
#ifdef CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
#if CONFIG_NETUTILS_HTTPDFSSTATS == 1
|
||||
extern uint16 httpd_fs_count(char *name);
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
|
||||
/* file must be allocated by caller and will be filled in by the function. */
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* httpd_cgi.c
|
||||
/****************************************************************************
|
||||
* httpd_cgi.c
|
||||
* Web server script interface
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
@ -28,7 +29,12 @@
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -41,33 +47,29 @@
|
||||
|
||||
#include "httpd_cgi.h"
|
||||
|
||||
#define CONFIG_HTTPDCGI_FILESTATS 1
|
||||
#undef CONFIG_HTTPDCGI_DCPSTATS
|
||||
#define CONFIG_HTTPDCGI_NETSTATS 1
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
HTTPD_CGI_CALL(file, "file-stats", file_stats);
|
||||
#if CONFIG_HTTPDCGI_TCPSTATS
|
||||
HTTPD_CGI_CALL(tcp, "tcp-connections", tcp_stats);
|
||||
#endif
|
||||
#ifdef CONFIG_NETUTILS_HTTPDNETSTATS
|
||||
HTTPD_CGI_CALL(net, "net-stats", net_stats);
|
||||
#endif
|
||||
|
||||
#if 0 /* Revisit */
|
||||
static const struct httpd_cgi_call *calls[] = { &file, &tcp, &net, NULL };
|
||||
#else
|
||||
static const struct httpd_cgi_call *calls[] = {
|
||||
|
||||
#ifdef CONFIG_HTTPDCGI_FILESTATS
|
||||
static const struct httpd_cgi_call *calls[] =
|
||||
{
|
||||
#ifdef CONFIG_NETUTILS_HTTPDFILESTATS
|
||||
&file,
|
||||
#endif
|
||||
#ifdef CONFIG_HTTPDCGI_DCPSTATS
|
||||
&tcp,
|
||||
#endif
|
||||
#ifdef CONFIG_HTTPDCGI_NETSTATS
|
||||
#ifdef CONFIG_NETUTILS_HTTPDNETSTATS
|
||||
&net,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
static const char closed[] = /* "CLOSED",*/
|
||||
{0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0};
|
||||
@ -88,87 +90,17 @@ static const char time_wait[] = /* "TIME-WAIT,"*/
|
||||
static const char last_ack[] = /* "LAST-ACK"*/
|
||||
{0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43, 0x4b, 0};
|
||||
|
||||
#if CONFIG_HTTPDCGI_TCPSTATS
|
||||
static const char *states[] =
|
||||
{
|
||||
closed,
|
||||
syn_rcvd,
|
||||
syn_sent,
|
||||
established,
|
||||
fin_wait_1,
|
||||
fin_wait_2,
|
||||
closing,
|
||||
time_wait,
|
||||
last_ack
|
||||
};
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static void nullfunction(struct httpd_state *pstate, char *ptr)
|
||||
{
|
||||
}
|
||||
|
||||
httpd_cgifunction httpd_cgi(char *name)
|
||||
{
|
||||
const struct httpd_cgi_call **f;
|
||||
|
||||
/* Find the matching name in the table, return the function. */
|
||||
for(f = calls; *f != NULL; ++f) {
|
||||
if(strncmp((*f)->name, name, strlen((*f)->name)) == 0) {
|
||||
return (*f)->function;
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_CPP_HAVE_WARNING
|
||||
# warning REVISIT -- must wait to return
|
||||
#endif
|
||||
return nullfunction;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HTTPDCGI_FILESTATS
|
||||
static void file_stats(struct httpd_state *pstate, char *ptr)
|
||||
{
|
||||
char buffer[16];
|
||||
char *pcount = strchr(ptr, ' ') + 1;
|
||||
snprintf(buffer, 16, "%5u", httpd_fs_count(pcount));
|
||||
(void)send(pstate->ht_sockfd, buffer, strlen(buffer), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_HTTPDCGI_TCPSTATS
|
||||
static void tcp_stats(struct httpd_state *pstate, char *ptr)
|
||||
{
|
||||
struct uip_conn *conn;
|
||||
struct httpd_state *pstate = (struct httpd_state *)arg;
|
||||
char buffer[256];
|
||||
|
||||
for(pstate->count = 0; pstate->count < CONFIG_NET_TCP_CONNS; ++pstate->count)
|
||||
{
|
||||
conn = &uip_conns[pstate->count];
|
||||
if((conn->tcpstateflags & UIP_TS_MASK) != UIP_CLOSED)
|
||||
{
|
||||
snprintf(buffer, 25t,
|
||||
"<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
||||
htons(conn->lport),
|
||||
htons(conn->ripaddr[0]) >> 8,
|
||||
htons(conn->ripaddr[0]) & 0xff,
|
||||
htons(conn->ripaddr[1]) >> 8,
|
||||
htons(conn->ripaddr[1]) & 0xff,
|
||||
htons(conn->rport),
|
||||
states[conn->tcpstateflags & UIP_TS_MASK],
|
||||
conn->nrtx,
|
||||
conn->timer,
|
||||
(uip_outstanding(conn))? '*':' ',
|
||||
(uip_stopped(conn))? '!':' ');
|
||||
|
||||
(void)send(pstate->sockout, buffer, strlen(buffer), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HTTPDCGI_NETSTATS
|
||||
#ifdef CONFIG_NETUTILS_HTTPDNETSTATS
|
||||
static void net_stats(struct httpd_state *pstate, char *ptr)
|
||||
{
|
||||
#ifdef CONFIG_NET_STATISTICS
|
||||
char buffer[16];
|
||||
int i;
|
||||
|
||||
@ -177,6 +109,35 @@ static void net_stats(struct httpd_state *pstate, char *ptr)
|
||||
snprintf(buffer, 16, "%5u\n", ((uip_stats_t *)&uip_stat)[i]);
|
||||
send(pstate->ht_sockfd, buffer, strlen(buffer), 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
httpd_cgifunction httpd_cgi(char *name)
|
||||
{
|
||||
const struct httpd_cgi_call **f;
|
||||
|
||||
/* Find the matching name in the table, return the function. */
|
||||
|
||||
for(f = calls; *f != NULL; ++f)
|
||||
{
|
||||
if(strncmp((*f)->name, name, strlen((*f)->name)) == 0)
|
||||
{
|
||||
return (*f)->function;
|
||||
}
|
||||
}
|
||||
return nullfunction;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NETUTILS_HTTPDFILESTATS
|
||||
static void file_stats(struct httpd_state *pstate, char *ptr)
|
||||
{
|
||||
char buffer[16];
|
||||
char *pcount = strchr(ptr, ' ') + 1;
|
||||
snprintf(buffer, 16, "%5u", httpd_fs_count(pcount));
|
||||
(void)send(pstate->ht_sockfd, buffer, strlen(buffer), 0);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* netutils/webserver/httpd_fs.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
@ -38,7 +38,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
* Included Header Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -48,15 +48,27 @@
|
||||
#include "httpd.h"
|
||||
#include "httpd_fsdata.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif /* NULL */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#include "httpd_fsdata.c"
|
||||
|
||||
#if HTTPD_FS_STATISTICS
|
||||
#if CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
static uint16 count[HTTPD_FS_NUMFILES];
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static uint8 httpd_fs_strcmp(const char *str1, const char *str2)
|
||||
{
|
||||
@ -79,11 +91,15 @@ static uint8 httpd_fs_strcmp(const char *str1, const char *str2)
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int httpd_fs_open(const char *name, struct httpd_fs_file *file)
|
||||
{
|
||||
#if HTTPD_FS_STATISTICS
|
||||
#if CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
uint16 i = 0;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
struct httpd_fsdata_file_noconst *f;
|
||||
|
||||
for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
|
||||
@ -94,30 +110,30 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file)
|
||||
{
|
||||
file->data = f->data;
|
||||
file->len = f->len;
|
||||
#if HTTPD_FS_STATISTICS
|
||||
#if CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
++count[i];
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
return 1;
|
||||
}
|
||||
#if HTTPD_FS_STATISTICS
|
||||
#if CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
++i;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void httpd_fs_init(void)
|
||||
{
|
||||
#if HTTPD_FS_STATISTICS
|
||||
#if CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
uint16 i;
|
||||
for(i = 0; i < HTTPD_FS_NUMFILES; i++)
|
||||
{
|
||||
count[i] = 0;
|
||||
}
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
}
|
||||
|
||||
#if HTTPD_FS_STATISTICS
|
||||
#if CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
uint16 httpd_fs_count(char *name)
|
||||
{
|
||||
struct httpd_fsdata_file_noconst *f;
|
||||
@ -136,4 +152,4 @@ uint16 httpd_fs_count(char *name)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
|
@ -1,5 +1,7 @@
|
||||
static const unsigned char data_processes_shtml[] = {
|
||||
static const unsigned char data_processes_shtml[] =
|
||||
{
|
||||
/* /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,
|
||||
0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x0a, 0x3c, 0x68, 0x31,
|
||||
@ -21,10 +23,13 @@ static const unsigned char data_processes_shtml[] = {
|
||||
0x74, 0x68, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0x0a, 0x25,
|
||||
0x21, 0x20, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65,
|
||||
0x73, 0x0a, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, 0x6f, 0x6f,
|
||||
0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0};
|
||||
0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0
|
||||
};
|
||||
|
||||
static const unsigned char data_404_html[] = {
|
||||
static const unsigned char data_404_html[] =
|
||||
{
|
||||
/* /404.html */
|
||||
|
||||
0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0x0a, 0x20, 0x20, 0x3c,
|
||||
0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c,
|
||||
@ -42,10 +47,13 @@ static const unsigned char data_404_html[] = {
|
||||
0x20, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65,
|
||||
0x72, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64,
|
||||
0x79, 0x3e, 0x0a, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e,
|
||||
0};
|
||||
0
|
||||
};
|
||||
|
||||
static const unsigned char data_files_shtml[] = {
|
||||
static const unsigned char data_files_shtml[] =
|
||||
{
|
||||
/* /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,
|
||||
0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x0a, 0x3c, 0x68, 0x31,
|
||||
@ -172,16 +180,22 @@ static const unsigned char data_files_shtml[] = {
|
||||
0x61, 0x62, 0x6c, 0x65, 0x3e, 0x0a, 0x3c, 0x2f, 0x63, 0x65,
|
||||
0x6e, 0x74, 0x65, 0x72, 0x3e, 0x0a, 0x25, 0x21, 0x3a, 0x20,
|
||||
0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74,
|
||||
0x6d, 0x6c, 0x0a, 0};
|
||||
0x6d, 0x6c, 0x0a, 0
|
||||
};
|
||||
|
||||
static const unsigned char data_footer_html[] = {
|
||||
static const unsigned 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, 0x0a,
|
||||
0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0};
|
||||
0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0
|
||||
};
|
||||
|
||||
static const unsigned char data_header_html[] = {
|
||||
static const unsigned 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,
|
||||
@ -245,10 +259,13 @@ static const unsigned char data_header_html[] = {
|
||||
0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x20, 0x20, 0x0a, 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, 0x0a, 0};
|
||||
0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3e, 0x0a, 0
|
||||
};
|
||||
|
||||
static const unsigned char data_index_html[] = {
|
||||
static const unsigned char data_index_html[] =
|
||||
{
|
||||
/* /index.html */
|
||||
|
||||
0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 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,
|
||||
@ -337,10 +354,13 @@ static const unsigned char data_index_html[] = {
|
||||
0x73, 0x74, 0x69, 0x63, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x3c,
|
||||
0x2f, 0x70, 0x3e, 0x0a, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x62,
|
||||
0x6f, 0x64, 0x79, 0x3e, 0x0a, 0x3c, 0x2f, 0x68, 0x74, 0x6d,
|
||||
0x6c, 0x3e, 0x0a, 0};
|
||||
0x6c, 0x3e, 0x0a, 0
|
||||
};
|
||||
|
||||
static const unsigned char data_style_css[] = {
|
||||
static const unsigned char data_style_css[] =
|
||||
{
|
||||
/* /style.css */
|
||||
|
||||
0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0,
|
||||
0x68, 0x31, 0x20, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x74, 0x65,
|
||||
0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x20,
|
||||
@ -443,36 +463,13 @@ static const unsigned char data_style_css[] = {
|
||||
0x70, 0x2e, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x7b, 0x0a,
|
||||
0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69,
|
||||
0x67, 0x6e, 0x3a, 0x72, 0x69, 0x67, 0x68, 0x74, 0x3b, 0x20,
|
||||
0x0a, 0x7d, 0x0a, 0x0a, 0};
|
||||
0x0a, 0x7d, 0x0a, 0x0a, 0
|
||||
};
|
||||
|
||||
static const unsigned char data_tcp_shtml[] = {
|
||||
/* /tcp.shtml */
|
||||
0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65,
|
||||
0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x0a, 0x3c, 0x68, 0x31,
|
||||
0x3e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x63,
|
||||
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x3c, 0x2f, 0x68, 0x31, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x3c,
|
||||
0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64, 0x74,
|
||||
0x68, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0x0a,
|
||||
0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x4c, 0x6f,
|
||||
0x63, 0x61, 0x6c, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74,
|
||||
0x68, 0x3e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x3c, 0x2f,
|
||||
0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68,
|
||||
0x3e, 0x52, 0x65, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69,
|
||||
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x74, 0x68,
|
||||
0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x54, 0x69, 0x6d, 0x65, 0x72,
|
||||
0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x46,
|
||||
0x6c, 0x61, 0x67, 0x73, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c,
|
||||
0x2f, 0x74, 0x72, 0x3e, 0x0a, 0x25, 0x21, 0x20, 0x74, 0x63,
|
||||
0x70, 0x2d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x0a, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66,
|
||||
0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c,
|
||||
0};
|
||||
|
||||
static const unsigned char data_fade_png[] = {
|
||||
static const unsigned char data_fade_png[] =
|
||||
{
|
||||
/* /fade.png */
|
||||
|
||||
0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x00,
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x04,
|
||||
@ -493,10 +490,13 @@ static const unsigned char data_fade_png[] = {
|
||||
0x01, 0xf8, 0x29, 0x58, 0xc8, 0xbf, 0x48, 0xc4, 0x81, 0x74,
|
||||
0x0b, 0xa3, 0x0f, 0x7c, 0xdb, 0x04, 0xe8, 0x40, 0x05, 0xdf,
|
||||
0xa1, 0xf3, 0xfc, 0x73, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
|
||||
0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0};
|
||||
0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0
|
||||
};
|
||||
|
||||
static const unsigned char data_stats_shtml[] = {
|
||||
static const unsigned char data_stats_shtml[] =
|
||||
{
|
||||
/* /stats.shtml */
|
||||
|
||||
0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65,
|
||||
0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x0a, 0x3c, 0x68, 0x31,
|
||||
@ -580,7 +580,8 @@ static const unsigned char data_stats_shtml[] = {
|
||||
0x6c, 0x65, 0x3e, 0x0a, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x3e, 0x0a, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66,
|
||||
0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c,
|
||||
0x0a, 0};
|
||||
0x0a, 0
|
||||
};
|
||||
|
||||
const struct httpd_fsdata_file file_processes_shtml[] =
|
||||
{{NULL, data_processes_shtml, data_processes_shtml + 17, sizeof(data_processes_shtml) - 18}};
|
||||
@ -603,15 +604,11 @@ const struct httpd_fsdata_file file_index_html[] =
|
||||
const struct httpd_fsdata_file file_style_css[] =
|
||||
{{file_index_html, data_style_css, data_style_css + 11, sizeof(data_style_css) - 12}};
|
||||
|
||||
const struct httpd_fsdata_file file_tcp_shtml[] =
|
||||
{{file_style_css, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 12}};
|
||||
|
||||
const struct httpd_fsdata_file file_fade_png[] =
|
||||
{{file_tcp_shtml, data_fade_png, data_fade_png + 10, sizeof(data_fade_png) - 11}};
|
||||
{{file_style_css, data_fade_png, data_fade_png + 10, sizeof(data_fade_png) - 11}};
|
||||
|
||||
const struct httpd_fsdata_file file_stats_shtml[] =
|
||||
{{file_fade_png, data_stats_shtml, data_stats_shtml + 13, sizeof(data_stats_shtml) - 14}};
|
||||
|
||||
#define HTTPD_FS_ROOT file_stats_shtml
|
||||
|
||||
#define HTTPD_FS_NUMFILES 10
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* netutils/webserver/httpd_fsdata.h
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
@ -56,11 +56,11 @@ struct httpd_fsdata_file
|
||||
FAR const ubyte *name;
|
||||
FAR const ubyte *data;
|
||||
int len;
|
||||
#ifdef HTTPD_FS_STATISTICS
|
||||
#if HTTPD_FS_STATISTICS == 1
|
||||
#ifdef CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
#if CONFIG_NETUTILS_HTTPDFSSTATS == 1
|
||||
uint16 count;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
};
|
||||
|
||||
struct httpd_fsdata_file_noconst
|
||||
@ -69,11 +69,11 @@ struct httpd_fsdata_file_noconst
|
||||
FAR char *name;
|
||||
FAR char *data;
|
||||
int len;
|
||||
#ifdef HTTPD_FS_STATISTICS
|
||||
#if HTTPD_FS_STATISTICS == 1
|
||||
#ifdef CONFIG_NETUTILS_HTTPDFSSTATS
|
||||
#if CONFIG_NETUTILS_HTTPDFSSTATS == 1
|
||||
uint16 count;
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
#endif /* CONFIG_NETUTILS_HTTPDFSSTATS */
|
||||
};
|
||||
|
||||
#endif /* __HTTPD_FSDATA_H__ */
|
||||
|
@ -33,27 +33,24 @@ foreach $file (@files) {
|
||||
$fvar =~ s-/-_-g;
|
||||
$fvar =~ s-\.-_-g;
|
||||
# for AVR, add PROGMEM here
|
||||
print(OUTPUT "static const unsigned char data".$fvar."[] = {\n");
|
||||
print(OUTPUT "\t/* $file */\n\t");
|
||||
print(OUTPUT "static const unsigned char data".$fvar."[] =\n");
|
||||
print(OUTPUT "{\n /* $file */\n\n ");
|
||||
for($j = 0; $j < length($file); $j++) {
|
||||
printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1)));
|
||||
}
|
||||
printf(OUTPUT "0,\n");
|
||||
|
||||
printf(OUTPUT "0x00,\n ");
|
||||
|
||||
$i = 0;
|
||||
while(read(FILE, $data, 1)) {
|
||||
if($i == 0) {
|
||||
print(OUTPUT "\t");
|
||||
}
|
||||
printf(OUTPUT "%#02x, ", unpack("C", $data));
|
||||
$i++;
|
||||
if($i == 10) {
|
||||
print(OUTPUT "\n");
|
||||
$i = 0;
|
||||
print(OUTPUT " ");
|
||||
}
|
||||
}
|
||||
print(OUTPUT "0};\n\n");
|
||||
print(OUTPUT "0x00\n};\n\n");
|
||||
close(FILE);
|
||||
push(@fvars, $fvar);
|
||||
push(@pfiles, $file);
|
||||
|
Loading…
x
Reference in New Issue
Block a user