From a54b0d55f452e6c62409d90e950e9db1d64f5291 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 22 Sep 2007 18:44:53 +0000 Subject: Refactoring netutils strings git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@351 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/netutils/smtp/makestrings | 40 --- nuttx/netutils/smtp/smtp-strings | 11 - nuttx/netutils/smtp/smtp-strings.c | 33 --- nuttx/netutils/smtp/smtp-strings.h | 11 - nuttx/netutils/uiplib/makestrings.c | 372 +++++++++++++++++++++++++++ nuttx/netutils/uiplib/netutil-strings | 46 ++++ nuttx/netutils/webclient/makestrings | 40 --- nuttx/netutils/webclient/webclient-strings | 31 --- nuttx/netutils/webclient/webclient-strings.c | 93 ------- nuttx/netutils/webclient/webclient-strings.h | 31 --- nuttx/netutils/webserver/http-strings | 35 --- nuttx/netutils/webserver/http-strings.c | 102 -------- nuttx/netutils/webserver/http-strings.h | 34 --- nuttx/netutils/webserver/makestrings | 40 --- 14 files changed, 418 insertions(+), 501 deletions(-) delete mode 100755 nuttx/netutils/smtp/makestrings delete mode 100644 nuttx/netutils/smtp/smtp-strings delete mode 100644 nuttx/netutils/smtp/smtp-strings.c delete mode 100644 nuttx/netutils/smtp/smtp-strings.h create mode 100755 nuttx/netutils/uiplib/makestrings.c create mode 100644 nuttx/netutils/uiplib/netutil-strings delete mode 100755 nuttx/netutils/webclient/makestrings delete mode 100644 nuttx/netutils/webclient/webclient-strings delete mode 100644 nuttx/netutils/webclient/webclient-strings.c delete mode 100644 nuttx/netutils/webclient/webclient-strings.h delete mode 100644 nuttx/netutils/webserver/http-strings delete mode 100644 nuttx/netutils/webserver/http-strings.c delete mode 100644 nuttx/netutils/webserver/http-strings.h delete mode 100755 nuttx/netutils/webserver/makestrings (limited to 'nuttx') diff --git a/nuttx/netutils/smtp/makestrings b/nuttx/netutils/smtp/makestrings deleted file mode 100755 index bea18a6c3..000000000 --- a/nuttx/netutils/smtp/makestrings +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - - -sub stringify { - my $name = shift(@_); - open(OUTPUTC, "> $name.c"); - open(OUTPUTH, "> $name.h"); - - open(FILE, "$name"); - - while() { - if(/(.+) "(.+)"/) { - $var = $1; - $data = $2; - - $datan = $data; - $datan =~ s/\\r/\r/g; - $datan =~ s/\\n/\n/g; - $datan =~ s/\\01/\01/g; - $datan =~ s/\\0/\0/g; - - printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); - printf(OUTPUTC "/* \"$data\" */\n"); - printf(OUTPUTC "{"); - for($j = 0; $j < length($datan); $j++) { - printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); - } - printf(OUTPUTC "};\n"); - - printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); - - } - } - close(OUTPUTC); - close(OUTPUTH); -} -stringify("smtp-strings"); - -exit 0; - diff --git a/nuttx/netutils/smtp/smtp-strings b/nuttx/netutils/smtp/smtp-strings deleted file mode 100644 index 27f639c2e..000000000 --- a/nuttx/netutils/smtp/smtp-strings +++ /dev/null @@ -1,11 +0,0 @@ -smtp_220 "220" -smtp_helo "HELO " -smtp_mail_from "MAIL FROM: " -smtp_rcpt_to "RCPT TO: " -smtp_data "DATA\r\n" -smtp_to "To: " -smtp_from "From: " -smtp_subject "Subject: " -smtp_quit "QUIT\r\n" -smtp_crnl "\r\n" -smtp_crnlperiodcrnl "\r\n.\r\n" \ No newline at end of file diff --git a/nuttx/netutils/smtp/smtp-strings.c b/nuttx/netutils/smtp/smtp-strings.c deleted file mode 100644 index ab216ef0b..000000000 --- a/nuttx/netutils/smtp/smtp-strings.c +++ /dev/null @@ -1,33 +0,0 @@ -const char smtp_220[4] = -/* "220" */ -{0x32, 0x32, 0x30, }; -const char smtp_helo[6] = -/* "HELO " */ -{0x48, 0x45, 0x4c, 0x4f, 0x20, }; -const char smtp_mail_from[12] = -/* "MAIL FROM: " */ -{0x4d, 0x41, 0x49, 0x4c, 0x20, 0x46, 0x52, 0x4f, 0x4d, 0x3a, 0x20, }; -const char smtp_rcpt_to[10] = -/* "RCPT TO: " */ -{0x52, 0x43, 0x50, 0x54, 0x20, 0x54, 0x4f, 0x3a, 0x20, }; -const char smtp_data[7] = -/* "DATA\r\n" */ -{0x44, 0x41, 0x54, 0x41, 0xd, 0xa, }; -const char smtp_to[5] = -/* "To: " */ -{0x54, 0x6f, 0x3a, 0x20, }; -const char smtp_from[7] = -/* "From: " */ -{0x46, 0x72, 0x6f, 0x6d, 0x3a, 0x20, }; -const char smtp_subject[10] = -/* "Subject: " */ -{0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x3a, 0x20, }; -const char smtp_quit[7] = -/* "QUIT\r\n" */ -{0x51, 0x55, 0x49, 0x54, 0xd, 0xa, }; -const char smtp_crnl[3] = -/* "\r\n" */ -{0xd, 0xa, }; -const char smtp_crnlperiodcrnl[6] = -/* "\r\n.\r\n" */ -{0xd, 0xa, 0x2e, 0xd, 0xa, }; diff --git a/nuttx/netutils/smtp/smtp-strings.h b/nuttx/netutils/smtp/smtp-strings.h deleted file mode 100644 index 4bff8583c..000000000 --- a/nuttx/netutils/smtp/smtp-strings.h +++ /dev/null @@ -1,11 +0,0 @@ -extern const char smtp_220[4]; -extern const char smtp_helo[6]; -extern const char smtp_mail_from[12]; -extern const char smtp_rcpt_to[10]; -extern const char smtp_data[7]; -extern const char smtp_to[5]; -extern const char smtp_from[7]; -extern const char smtp_subject[10]; -extern const char smtp_quit[7]; -extern const char smtp_crnl[3]; -extern const char smtp_crnlperiodcrnl[6]; diff --git a/nuttx/netutils/uiplib/makestrings.c b/nuttx/netutils/uiplib/makestrings.c new file mode 100755 index 000000000..ff7df83db --- /dev/null +++ b/nuttx/netutils/uiplib/makestrings.c @@ -0,0 +1,372 @@ +/**************************************************************************** + * net/recv.c + * + * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Based loosely on a uIP perl script by Adam Dunkels + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, 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 +#include +#include +#include +#include + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +enum eaction { GENSRC=0, SRCLIST=1 }; + + /**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char *g_progname; +static const char *g_stringfile; +static enum eaction g_action; + +static char g_line[1024]; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Function: parse_stringfile_line + ****************************************************************************/ + +void unescape_value(char *pvalue) +{ + const char *pin; + char *pout; + + pin = pvalue; + pout = pvalue; + while (*pin) + { + if (*pin == '\\') + { + pin++; + if ( *pin >= 0 && *pin <= 0) + { + char *pend; + unsigned long val = strtoul(pin, &pend, 0); + if (pend != pin) + { + *pout++ = (char)val; + pin = pend; + } + else + { + *pout++ = '\\'; + *pout++ = *pin++; + } + } + else + { + switch (*pin) + { + case 'a': + *pout++ = 0x07; + break; + case 'b': + *pout++ = 0x08; + break; + case 't': + *pout++ = 0x09; + break; + case 'n': + *pout++ = 0x0a; + break; + case 'v': + *pout++ = 0x0b; + case 'f': + *pout++ = 0x0c; + break; + case 'r': + *pout++ = 0x0d; + break; + default: + *pout++ = *pin; + break; + } + pin++; + } + } + else + { + *pout++ = *pin++; + } + } + *pout = '\0'; +} + +/**************************************************************************** + * Function: parse_stringfile_line + ****************************************************************************/ + +int parse_stringfile_line(const char **ppname, const char **ppvalue) +{ + char *ptmp; + char *pname; + char *pvalue; + + pname = g_line; + ptmp = strchr(g_line, ' '); + if (ptmp) + { + *ptmp++ = '\0'; + pvalue = strchr(ptmp, '"'); + if (pvalue) + { + pvalue++; + ptmp = strchr(pvalue, '"'); + if (ptmp) + { + *ptmp = '\0'; + unescape_value(pvalue); + if (ppname) + { + *ppname = pname; + } + if (ppvalue) + { + *ppvalue = pvalue; + } + return 0; + } + } + } + return 1; +} + +/**************************************************************************** + * Function: open_stringfile + ****************************************************************************/ + +FILE *open_stringfile(void) +{ + FILE *stream = fopen(g_stringfile, "r"); + if (!stream) + { + fprintf(stderr, "Failed to open %s for reading: %s\n", g_stringfile, strerror(errno)); + } + return stream; +} + +/**************************************************************************** + * Function: open_outfile + ****************************************************************************/ + +FILE *open_outfile(const char *filename) +{ + FILE *stream = fopen(filename, "w"); + if (!stream) + { + fprintf(stderr, "Failed to open %s for writing: %s\n", filename, strerror(errno)); + } + return stream; +} + +/**************************************************************************** + * Function: generate_sourcefile_list + ****************************************************************************/ + +int generate_sourcefile_list(void) +{ + int ret = 1; + FILE *stream; + + if (( stream = open_stringfile())) + { + ret = 0; + while (fgets(g_line, 1024, stream) && !ret) + { + const char *pname; + ret = parse_stringfile_line(&pname, NULL); + if (!ret) + { + printf("%s.c ", pname); + } + } + fclose(stream); + } + return ret; +} + +/**************************************************************************** + * Function: generate_sourcefiles + ****************************************************************************/ + +int generate_sourcefiles(void) +{ + FILE *instream; + FILE *hstream; + FILE *cstream; + const char *pname; + const char *pvalue; + char buffer[512]; + int len; + int ndx; + int ret = 1; + + if (( instream = open_stringfile())) + { + snprintf(buffer, 512, "%s.h", g_stringfile); + hstream = open_outfile(buffer); + if (hstream) + { + fprintf(hstream, "#ifndef __NETUTIL_STRINGS\n#define __NETUTIL_STRINGS\n\n"); + + ret = 0; + while (fgets(g_line, 1024, instream) && !ret) + { + ret = parse_stringfile_line(&pname, &pvalue); + if (!ret) + { + snprintf(buffer, 512, "%s.c", pname); + cstream = open_outfile(buffer); + if (cstream) + { + len = strlen(pvalue); + fprintf(cstream, "const char %s[%d] = {", pname, len); + for (ndx = 0; ndx < len; ndx++) + { + if (ndx > 0) + { + fprintf(cstream, ", "); + } + fprintf(cstream, "0x%02x", pvalue[ndx]); + } + fprintf(cstream, "}\n"); + fclose(cstream); + } + fprintf(hstream, "extern const char %s[%d];\n", pname, len); + } + } + fprintf(hstream, "\n#endif /* __NETUTIL_STRINGS */\n"); + fclose(hstream); + } + fclose(instream); + } + return ret; +} + +/**************************************************************************** + * Function: show_usage + ****************************************************************************/ + +static void show_usage( void ) +{ + fprintf(stderr, "USAGE: %s [OPTIONS] \n\n", g_progname ); + fprintf(stderr, "Where [OPTIONS] include:\n"); + fprintf(stderr, "\t-s: Output string source file list on stdout"); + exit(1); +} + +/**************************************************************************** + * Function: show_usage + ****************************************************************************/ + +static void parse_commandline( int argc, char **argv ) +{ + int option; + g_progname = argv[0]; + while ((option = getopt(argc, argv, ":s")) >= 0) + { + switch (option) + { + case 's': + g_action = SRCLIST; + break; + + case ':': + fprintf(stderr, "Missing command argument\n"); + show_usage(); + break; + + case '?': + option = optopt; + default: + fprintf(stderr, "Unrecognized option: %c\n", option); + show_usage(); + break; + } + } + + if (optind < argc) + { + g_stringfile = argv[optind]; + optind++; + } + else + { + fprintf(stderr, "Missing path\n"); + show_usage(); + } + + if (optind < argc) + { + fprintf(stderr, "Garbage on command line after \n"); + show_usage(); + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Function: main + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ + int ret = 0; + parse_commandline(argc, argv); + switch (g_action) + { + case GENSRC: + ret = generate_sourcefiles(); + break; + case SRCLIST: + ret = generate_sourcefile_list(); + break; + } + return ret; +} + diff --git a/nuttx/netutils/uiplib/netutil-strings b/nuttx/netutils/uiplib/netutil-strings new file mode 100644 index 000000000..56b89c8f0 --- /dev/null +++ b/nuttx/netutils/uiplib/netutil-strings @@ -0,0 +1,46 @@ +http_10 "HTTP/1.0" +http_11 "HTTP/1.1" +http_200 "200 " +http_301 "301 " +http_302 "302 " +http_404_html "/404.html" +http_content_type "content-type: " +http_content_type_binary "Content-type: application/octet-stream\r\n\r\n" +http_content_type_css "Content-type: text/css\r\n\r\n" +http_content_type_gif "Content-type: image/gif\r\n\r\n" +http_content_type_html "Content-type: text/html\r\n\r\n" +http_content_type_jpg "Content-type: image/jpeg\r\n\r\n" +http_content_type_plain "Content-type: text/plain\r\n\r\n" +http_content_type_png "Content-type: image/png\r\n\r\n" +http_content_type_text "Content-type: text/text\r\n\r\n" +http_crnl "\r\n" +http_css ".css" +http_get "GET " +http_gif ".gif" +http_header_200 "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" +http_header_404 "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" +http_host "host: " +http_htm ".htm" +http_html ".html" +http_http "http://" +http_index_html "/index.html" +http_jpg ".jpg" +http_location "location: " +http_png ".png" +http_referer "Referer:" +http_shtml ".shtml" +http_text ".text" +http_texthtml "text/html" +http_txt ".txt" +http_user_agent_fields "Connection: close\r\nUser-Agent: uIP/1.0 (; http://www.sics.se/~adam/uip/)\r\n\r\n" +smtp_220 "220" +smtp_crnl "\r\n" +smtp_crnlperiodcrnl "\r\n.\r\n"http_http "http://" +smtp_data "DATA\r\n" +smtp_from "From: " +smtp_helo "HELO " +smtp_mail_from "MAIL FROM: " +smtp_quit "QUIT\r\n" +smtp_rcpt_to "RCPT TO: " +smtp_subject "Subject: " +smtp_to "To: " diff --git a/nuttx/netutils/webclient/makestrings b/nuttx/netutils/webclient/makestrings deleted file mode 100755 index 6dec075dd..000000000 --- a/nuttx/netutils/webclient/makestrings +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - - -sub stringify { - my $name = shift(@_); - open(OUTPUTC, "> $name.c"); - open(OUTPUTH, "> $name.h"); - - open(FILE, "$name"); - - while() { - if(/(.+) "(.+)"/) { - $var = $1; - $data = $2; - - $datan = $data; - $datan =~ s/\\r/\r/g; - $datan =~ s/\\n/\n/g; - $datan =~ s/\\01/\01/g; - $datan =~ s/\\0/\0/g; - - printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); - printf(OUTPUTC "/* \"$data\" */\n"); - printf(OUTPUTC "{"); - for($j = 0; $j < length($datan); $j++) { - printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); - } - printf(OUTPUTC "0 };\n"); - - printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); - - } - } - close(OUTPUTC); - close(OUTPUTH); -} -stringify("webclient-strings"); - -exit 0; - diff --git a/nuttx/netutils/webclient/webclient-strings b/nuttx/netutils/webclient/webclient-strings deleted file mode 100644 index a33139723..000000000 --- a/nuttx/netutils/webclient/webclient-strings +++ /dev/null @@ -1,31 +0,0 @@ -http_http "http://" -http_200 "200 " -http_301 "301 " -http_302 "302 " -http_get "GET " -http_10 "HTTP/1.0" -http_11 "HTTP/1.1" -http_content_type "content-type: " -http_texthtml "text/html" -http_location "location: " -http_host "host: " -http_crnl "\r\n" -http_index_html "/index.html" -http_404_html "/404.html" -http_content_type_html "Content-type: text/html\r\n\r\n" -http_content_type_css "Content-type: text/css\r\n\r\n" -http_content_type_text "Content-type: text/text\r\n\r\n" -http_content_type_png "Content-type: image/png\r\n\r\n" -http_content_type_gif "Content-type: image/gif\r\n\r\n" -http_content_type_jpg "Content-type: image/jpeg\r\n\r\n" -http_content_type_binary "Content-type: application/octet-stream\r\n\r\n" -http_html ".html" -http_shtml ".shtml" -http_htm ".htm" -http_css ".css" -http_png ".png" -http_gif ".gif" -http_jpg ".jpg" -http_text ".text" -http_txt ".txt" -http_user_agent_fields "Connection: close\r\nUser-Agent: uIP/1.0 (; http://www.sics.se/~adam/uip/)\r\n\r\n" diff --git a/nuttx/netutils/webclient/webclient-strings.c b/nuttx/netutils/webclient/webclient-strings.c deleted file mode 100644 index 94723308e..000000000 --- a/nuttx/netutils/webclient/webclient-strings.c +++ /dev/null @@ -1,93 +0,0 @@ -const char http_http[8] = -/* "http://" */ -{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0 }; -const char http_200[5] = -/* "200 " */ -{0x32, 0x30, 0x30, 0x20, 0 }; -const char http_301[5] = -/* "301 " */ -{0x33, 0x30, 0x31, 0x20, 0 }; -const char http_302[5] = -/* "302 " */ -{0x33, 0x30, 0x32, 0x20, 0 }; -const char http_get[5] = -/* "GET " */ -{0x47, 0x45, 0x54, 0x20, 0 }; -const char http_10[9] = -/* "HTTP/1.0" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0 }; -const char http_11[9] = -/* "HTTP/1.1" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, 0 }; -const char http_content_type[15] = -/* "content-type: " */ -{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0 }; -const char http_texthtml[10] = -/* "text/html" */ -{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_location[11] = -/* "location: " */ -{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0 }; -const char http_host[7] = -/* "host: " */ -{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, 0 }; -const char http_crnl[3] = -/* "\r\n" */ -{0xd, 0xa, 0 }; -const char http_index_html[12] = -/* "/index.html" */ -{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_404_html[10] = -/* "/404.html" */ -{0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_content_type_html[28] = -/* "Content-type: text/html\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_css [27] = -/* "Content-type: text/css\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_text[28] = -/* "Content-type: text/text\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x74, 0x65, 0x78, 0x74, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_png [28] = -/* "Content-type: image/png\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_gif [28] = -/* "Content-type: image/gif\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_jpg [29] = -/* "Content-type: image/jpeg\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x65, 0x67, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_binary[43] = -/* "Content-type: application/octet-stream\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x2d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_html[6] = -/* ".html" */ -{0x2e, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_shtml[7] = -/* ".shtml" */ -{0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_htm[5] = -/* ".htm" */ -{0x2e, 0x68, 0x74, 0x6d, 0 }; -const char http_css[5] = -/* ".css" */ -{0x2e, 0x63, 0x73, 0x73, 0 }; -const char http_png[5] = -/* ".png" */ -{0x2e, 0x70, 0x6e, 0x67, 0 }; -const char http_gif[5] = -/* ".gif" */ -{0x2e, 0x67, 0x69, 0x66, 0 }; -const char http_jpg[5] = -/* ".jpg" */ -{0x2e, 0x6a, 0x70, 0x67, 0 }; -const char http_text[6] = -/* ".text" */ -{0x2e, 0x74, 0x65, 0x78, 0x74, 0 }; -const char http_txt[5] = -/* ".txt" */ -{0x2e, 0x74, 0x78, 0x74, 0 }; -const char http_user_agent_fields[77] = -/* "Connection: close\r\nUser-Agent: uIP/1.0 (; http://www.sics.se/~adam/uip/)\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x28, 0x3b, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0x29, 0xd, 0xa, 0xd, 0xa, 0 }; diff --git a/nuttx/netutils/webclient/webclient-strings.h b/nuttx/netutils/webclient/webclient-strings.h deleted file mode 100644 index 9e3ec9347..000000000 --- a/nuttx/netutils/webclient/webclient-strings.h +++ /dev/null @@ -1,31 +0,0 @@ -extern const char http_http[8]; -extern const char http_200[5]; -extern const char http_301[5]; -extern const char http_302[5]; -extern const char http_get[5]; -extern const char http_10[9]; -extern const char http_11[9]; -extern const char http_content_type[15]; -extern const char http_texthtml[10]; -extern const char http_location[11]; -extern const char http_host[7]; -extern const char http_crnl[3]; -extern const char http_index_html[12]; -extern const char http_404_html[10]; -extern const char http_content_type_html[28]; -extern const char http_content_type_css [27]; -extern const char http_content_type_text[28]; -extern const char http_content_type_png [28]; -extern const char http_content_type_gif [28]; -extern const char http_content_type_jpg [29]; -extern const char http_content_type_binary[43]; -extern const char http_html[6]; -extern const char http_shtml[7]; -extern const char http_htm[5]; -extern const char http_css[5]; -extern const char http_png[5]; -extern const char http_gif[5]; -extern const char http_jpg[5]; -extern const char http_text[6]; -extern const char http_txt[5]; -extern const char http_user_agent_fields[77]; diff --git a/nuttx/netutils/webserver/http-strings b/nuttx/netutils/webserver/http-strings deleted file mode 100644 index d0b9121be..000000000 --- a/nuttx/netutils/webserver/http-strings +++ /dev/null @@ -1,35 +0,0 @@ -http_http "http://" -http_200 "200 " -http_301 "301 " -http_302 "302 " -http_get "GET " -http_10 "HTTP/1.0" -http_11 "HTTP/1.1" -http_content_type "content-type: " -http_texthtml "text/html" -http_location "location: " -http_host "host: " -http_crnl "\r\n" -http_index_html "/index.html" -http_404_html "/404.html" -http_referer "Referer:" -http_header_200 "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" -http_header_404 "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" -http_content_type_plain "Content-type: text/plain\r\n\r\n" -http_content_type_html "Content-type: text/html\r\n\r\n" -http_content_type_css "Content-type: text/css\r\n\r\n" -http_content_type_text "Content-type: text/text\r\n\r\n" -http_content_type_png "Content-type: image/png\r\n\r\n" -http_content_type_gif "Content-type: image/gif\r\n\r\n" -http_content_type_jpg "Content-type: image/jpeg\r\n\r\n" -http_content_type_binary "Content-type: application/octet-stream\r\n\r\n" -http_html ".html" -http_shtml ".shtml" -http_htm ".htm" -http_css ".css" -http_png ".png" -http_gif ".gif" -http_jpg ".jpg" -http_text ".txt" -http_txt ".txt" - diff --git a/nuttx/netutils/webserver/http-strings.c b/nuttx/netutils/webserver/http-strings.c deleted file mode 100644 index 0d822baf7..000000000 --- a/nuttx/netutils/webserver/http-strings.c +++ /dev/null @@ -1,102 +0,0 @@ -const char http_http[8] = -/* "http://" */ -{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, }; -const char http_200[5] = -/* "200 " */ -{0x32, 0x30, 0x30, 0x20, }; -const char http_301[5] = -/* "301 " */ -{0x33, 0x30, 0x31, 0x20, }; -const char http_302[5] = -/* "302 " */ -{0x33, 0x30, 0x32, 0x20, }; -const char http_get[5] = -/* "GET " */ -{0x47, 0x45, 0x54, 0x20, }; -const char http_10[9] = -/* "HTTP/1.0" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, }; -const char http_11[9] = -/* "HTTP/1.1" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, }; -const char http_content_type[15] = -/* "content-type: " */ -{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, }; -const char http_texthtml[10] = -/* "text/html" */ -{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_location[11] = -/* "location: " */ -{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, }; -const char http_host[7] = -/* "host: " */ -{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, }; -const char http_crnl[3] = -/* "\r\n" */ -{0xd, 0xa, }; -const char http_index_html[12] = -/* "/index.html" */ -{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_404_html[10] = -/* "/404.html" */ -{0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_referer[9] = -/* "Referer:" */ -{0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, 0x3a, }; -const char http_header_200[84] = -/* "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32, 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, }; -const char http_header_404[91] = -/* "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34, 0x30, 0x34, 0x20, 0x4e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0xd, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, }; -const char http_content_type_plain[29] = -/* "Content-type: text/plain\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_html[28] = -/* "Content-type: text/html\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_css [27] = -/* "Content-type: text/css\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_text[28] = -/* "Content-type: text/text\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x74, 0x65, 0x78, 0x74, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_png [28] = -/* "Content-type: image/png\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_gif [28] = -/* "Content-type: image/gif\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_jpg [29] = -/* "Content-type: image/jpeg\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x65, 0x67, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_binary[43] = -/* "Content-type: application/octet-stream\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x2d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0xd, 0xa, 0xd, 0xa, }; -const char http_html[6] = -/* ".html" */ -{0x2e, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_shtml[7] = -/* ".shtml" */ -{0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_htm[5] = -/* ".htm" */ -{0x2e, 0x68, 0x74, 0x6d, }; -const char http_css[5] = -/* ".css" */ -{0x2e, 0x63, 0x73, 0x73, }; -const char http_png[5] = -/* ".png" */ -{0x2e, 0x70, 0x6e, 0x67, }; -const char http_gif[5] = -/* ".gif" */ -{0x2e, 0x67, 0x69, 0x66, }; -const char http_jpg[5] = -/* ".jpg" */ -{0x2e, 0x6a, 0x70, 0x67, }; -const char http_text[5] = -/* ".txt" */ -{0x2e, 0x74, 0x78, 0x74, }; -const char http_txt[5] = -/* ".txt" */ -{0x2e, 0x74, 0x78, 0x74, }; diff --git a/nuttx/netutils/webserver/http-strings.h b/nuttx/netutils/webserver/http-strings.h deleted file mode 100644 index f121dd73a..000000000 --- a/nuttx/netutils/webserver/http-strings.h +++ /dev/null @@ -1,34 +0,0 @@ -extern const char http_http[8]; -extern const char http_200[5]; -extern const char http_301[5]; -extern const char http_302[5]; -extern const char http_get[5]; -extern const char http_10[9]; -extern const char http_11[9]; -extern const char http_content_type[15]; -extern const char http_texthtml[10]; -extern const char http_location[11]; -extern const char http_host[7]; -extern const char http_crnl[3]; -extern const char http_index_html[12]; -extern const char http_404_html[10]; -extern const char http_referer[9]; -extern const char http_header_200[84]; -extern const char http_header_404[91]; -extern const char http_content_type_plain[29]; -extern const char http_content_type_html[28]; -extern const char http_content_type_css [27]; -extern const char http_content_type_text[28]; -extern const char http_content_type_png [28]; -extern const char http_content_type_gif [28]; -extern const char http_content_type_jpg [29]; -extern const char http_content_type_binary[43]; -extern const char http_html[6]; -extern const char http_shtml[7]; -extern const char http_htm[5]; -extern const char http_css[5]; -extern const char http_png[5]; -extern const char http_gif[5]; -extern const char http_jpg[5]; -extern const char http_text[5]; -extern const char http_txt[5]; diff --git a/nuttx/netutils/webserver/makestrings b/nuttx/netutils/webserver/makestrings deleted file mode 100755 index 20f0e2429..000000000 --- a/nuttx/netutils/webserver/makestrings +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - - -sub stringify { - my $name = shift(@_); - open(OUTPUTC, "> $name.c"); - open(OUTPUTH, "> $name.h"); - - open(FILE, "$name"); - - while() { - if(/(.+) "(.+)"/) { - $var = $1; - $data = $2; - - $datan = $data; - $datan =~ s/\\r/\r/g; - $datan =~ s/\\n/\n/g; - $datan =~ s/\\01/\01/g; - $datan =~ s/\\0/\0/g; - - printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); - printf(OUTPUTC "/* \"$data\" */\n"); - printf(OUTPUTC "{"); - for($j = 0; $j < length($datan); $j++) { - printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); - } - printf(OUTPUTC "};\n"); - - printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); - - } - } - close(OUTPUTC); - close(OUTPUTH); -} -stringify("http-strings"); - -exit 0; - -- cgit v1.2.3