Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
httpd_opts.h
Go to the documentation of this file.
00001 /** 00002 * @file 00003 * HTTP server options list 00004 */ 00005 00006 /* 00007 * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without modification, 00011 * are permitted provided that the following conditions are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. The name of the author may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00024 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00026 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00029 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00030 * OF SUCH DAMAGE. 00031 * 00032 * This file is part of the lwIP TCP/IP stack. 00033 * 00034 * Author: Adam Dunkels <adam@sics.se> 00035 * 00036 * This version of the file has been modified by Texas Instruments to offer 00037 * simple server-side-include (SSI) and Common Gateway Interface (CGI) 00038 * capability. 00039 */ 00040 00041 #ifndef LWIP_HDR_APPS_HTTPD_OPTS_H 00042 #define LWIP_HDR_APPS_HTTPD_OPTS_H 00043 00044 #include "lwip/opt.h" 00045 00046 /** 00047 * @defgroup httpd_opts Options 00048 * @ingroup httpd 00049 * @{ 00050 */ 00051 00052 /** Set this to 1 to support CGI (old style) */ 00053 #if !defined LWIP_HTTPD_CGI || defined __DOXYGEN__ 00054 #define LWIP_HTTPD_CGI 0 00055 #endif 00056 00057 /** Set this to 1 to support CGI (new style) */ 00058 #if !defined LWIP_HTTPD_CGI_SSI || defined __DOXYGEN__ 00059 #define LWIP_HTTPD_CGI_SSI 0 00060 #endif 00061 00062 /** Set this to 1 to support SSI (Server-Side-Includes) */ 00063 #if !defined LWIP_HTTPD_SSI || defined __DOXYGEN__ 00064 #define LWIP_HTTPD_SSI 0 00065 #endif 00066 00067 /** Set this to 1 to implement an SSI tag handler callback that gets a const char* 00068 * to the tag (instead of an index into a pre-registered array of known tags) */ 00069 #if !defined LWIP_HTTPD_SSI_RAW || defined __DOXYGEN__ 00070 #define LWIP_HTTPD_SSI_RAW 0 00071 #endif 00072 00073 /** Set this to 1 to support HTTP POST */ 00074 #if !defined LWIP_HTTPD_SUPPORT_POST || defined __DOXYGEN__ 00075 #define LWIP_HTTPD_SUPPORT_POST 0 00076 #endif 00077 00078 /* The maximum number of parameters that the CGI handler can be sent. */ 00079 #if !defined LWIP_HTTPD_MAX_CGI_PARAMETERS || defined __DOXYGEN__ 00080 #define LWIP_HTTPD_MAX_CGI_PARAMETERS 16 00081 #endif 00082 00083 /** LWIP_HTTPD_SSI_MULTIPART==1: SSI handler function is called with 2 more 00084 * arguments indicating a counter for insert string that are too long to be 00085 * inserted at once: the SSI handler function must then set 'next_tag_part' 00086 * which will be passed back to it in the next call. */ 00087 #if !defined LWIP_HTTPD_SSI_MULTIPART || defined __DOXYGEN__ 00088 #define LWIP_HTTPD_SSI_MULTIPART 0 00089 #endif 00090 00091 /* The maximum length of the string comprising the tag name */ 00092 #if !defined LWIP_HTTPD_MAX_TAG_NAME_LEN || defined __DOXYGEN__ 00093 #define LWIP_HTTPD_MAX_TAG_NAME_LEN 8 00094 #endif 00095 00096 /* The maximum length of string that can be returned to replace any given tag */ 00097 #if !defined LWIP_HTTPD_MAX_TAG_INSERT_LEN || defined __DOXYGEN__ 00098 #define LWIP_HTTPD_MAX_TAG_INSERT_LEN 192 00099 #endif 00100 00101 #if !defined LWIP_HTTPD_POST_MANUAL_WND || defined __DOXYGEN__ 00102 #define LWIP_HTTPD_POST_MANUAL_WND 0 00103 #endif 00104 00105 /** This string is passed in the HTTP header as "Server: " */ 00106 #if !defined HTTPD_SERVER_AGENT || defined __DOXYGEN__ 00107 #define HTTPD_SERVER_AGENT "lwIP/" LWIP_VERSION_STRING " (http://savannah.nongnu.org/projects/lwip)" 00108 #endif 00109 00110 /** Set this to 1 if you want to include code that creates HTTP headers 00111 * at runtime. Default is off: HTTP headers are then created statically 00112 * by the makefsdata tool. Static headers mean smaller code size, but 00113 * the (readonly) fsdata will grow a bit as every file includes the HTTP 00114 * header. */ 00115 #if !defined LWIP_HTTPD_DYNAMIC_HEADERS || defined __DOXYGEN__ 00116 #define LWIP_HTTPD_DYNAMIC_HEADERS 0 00117 #endif 00118 00119 #if !defined HTTPD_DEBUG || defined __DOXYGEN__ 00120 #define HTTPD_DEBUG LWIP_DBG_OFF 00121 #endif 00122 00123 /** Set this to 1 to use a memp pool for allocating 00124 * struct http_state instead of the heap. 00125 */ 00126 #if !defined HTTPD_USE_MEM_POOL || defined __DOXYGEN__ 00127 #define HTTPD_USE_MEM_POOL 0 00128 #endif 00129 00130 /** The server port for HTTPD to use */ 00131 #if !defined HTTPD_SERVER_PORT || defined __DOXYGEN__ 00132 #define HTTPD_SERVER_PORT 80 00133 #endif 00134 00135 /** Maximum retries before the connection is aborted/closed. 00136 * - number of times pcb->poll is called -> default is 4*500ms = 2s; 00137 * - reset when pcb->sent is called 00138 */ 00139 #if !defined HTTPD_MAX_RETRIES || defined __DOXYGEN__ 00140 #define HTTPD_MAX_RETRIES 4 00141 #endif 00142 00143 /** The poll delay is X*500ms */ 00144 #if !defined HTTPD_POLL_INTERVAL || defined __DOXYGEN__ 00145 #define HTTPD_POLL_INTERVAL 4 00146 #endif 00147 00148 /** Priority for tcp pcbs created by HTTPD (very low by default). 00149 * Lower priorities get killed first when running out of memory. 00150 */ 00151 #if !defined HTTPD_TCP_PRIO || defined __DOXYGEN__ 00152 #define HTTPD_TCP_PRIO TCP_PRIO_MIN 00153 #endif 00154 00155 /** Set this to 1 to enable timing each file sent */ 00156 #if !defined LWIP_HTTPD_TIMING || defined __DOXYGEN__ 00157 #define LWIP_HTTPD_TIMING 0 00158 #endif 00159 /** Set this to 1 to enable timing each file sent */ 00160 #if !defined HTTPD_DEBUG_TIMING || defined __DOXYGEN__ 00161 #define HTTPD_DEBUG_TIMING LWIP_DBG_OFF 00162 #endif 00163 00164 /** Set this to one to show error pages when parsing a request fails instead 00165 of simply closing the connection. */ 00166 #if !defined LWIP_HTTPD_SUPPORT_EXTSTATUS || defined __DOXYGEN__ 00167 #define LWIP_HTTPD_SUPPORT_EXTSTATUS 0 00168 #endif 00169 00170 /** Set this to 0 to drop support for HTTP/0.9 clients (to save some bytes) */ 00171 #if !defined LWIP_HTTPD_SUPPORT_V09 || defined __DOXYGEN__ 00172 #define LWIP_HTTPD_SUPPORT_V09 1 00173 #endif 00174 00175 /** Set this to 1 to enable HTTP/1.1 persistent connections. 00176 * ATTENTION: If the generated file system includes HTTP headers, these must 00177 * include the "Connection: keep-alive" header (pass argument "-11" to makefsdata). 00178 */ 00179 #if !defined LWIP_HTTPD_SUPPORT_11_KEEPALIVE || defined __DOXYGEN__ 00180 #define LWIP_HTTPD_SUPPORT_11_KEEPALIVE 0 00181 #endif 00182 00183 /** Set this to 1 to support HTTP request coming in in multiple packets/pbufs */ 00184 #if !defined LWIP_HTTPD_SUPPORT_REQUESTLIST || defined __DOXYGEN__ 00185 #define LWIP_HTTPD_SUPPORT_REQUESTLIST 1 00186 #endif 00187 00188 #if LWIP_HTTPD_SUPPORT_REQUESTLIST 00189 /** Number of rx pbufs to enqueue to parse an incoming request (up to the first 00190 newline) */ 00191 #if !defined LWIP_HTTPD_REQ_QUEUELEN || defined __DOXYGEN__ 00192 #define LWIP_HTTPD_REQ_QUEUELEN 5 00193 #endif 00194 00195 /** Number of (TCP payload-) bytes (in pbufs) to enqueue to parse and incoming 00196 request (up to the first double-newline) */ 00197 #if !defined LWIP_HTTPD_REQ_BUFSIZE || defined __DOXYGEN__ 00198 #define LWIP_HTTPD_REQ_BUFSIZE LWIP_HTTPD_MAX_REQ_LENGTH 00199 #endif 00200 00201 /** Defines the maximum length of a HTTP request line (up to the first CRLF, 00202 copied from pbuf into this a global buffer when pbuf- or packet-queues 00203 are received - otherwise the input pbuf is used directly) */ 00204 #if !defined LWIP_HTTPD_MAX_REQ_LENGTH || defined __DOXYGEN__ 00205 #define LWIP_HTTPD_MAX_REQ_LENGTH LWIP_MIN(1023, (LWIP_HTTPD_REQ_QUEUELEN * PBUF_POOL_BUFSIZE)) 00206 #endif 00207 #endif /* LWIP_HTTPD_SUPPORT_REQUESTLIST */ 00208 00209 /** This is the size of a static buffer used when URIs end with '/'. 00210 * In this buffer, the directory requested is concatenated with all the 00211 * configured default file names. 00212 * Set to 0 to disable checking default filenames on non-root directories. 00213 */ 00214 #if !defined LWIP_HTTPD_MAX_REQUEST_URI_LEN || defined __DOXYGEN__ 00215 #define LWIP_HTTPD_MAX_REQUEST_URI_LEN 63 00216 #endif 00217 00218 /** Maximum length of the filename to send as response to a POST request, 00219 * filled in by the application when a POST is finished. 00220 */ 00221 #if !defined LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN || defined __DOXYGEN__ 00222 #define LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN 63 00223 #endif 00224 00225 /** Set this to 0 to not send the SSI tag (default is on, so the tag will 00226 * be sent in the HTML page */ 00227 #if !defined LWIP_HTTPD_SSI_INCLUDE_TAG || defined __DOXYGEN__ 00228 #define LWIP_HTTPD_SSI_INCLUDE_TAG 1 00229 #endif 00230 00231 /** Set this to 1 to call tcp_abort when tcp_close fails with memory error. 00232 * This can be used to prevent consuming all memory in situations where the 00233 * HTTP server has low priority compared to other communication. */ 00234 #if !defined LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR || defined __DOXYGEN__ 00235 #define LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR 0 00236 #endif 00237 00238 /** Set this to 1 to kill the oldest connection when running out of 00239 * memory for 'struct http_state' or 'struct http_ssi_state'. 00240 * ATTENTION: This puts all connections on a linked list, so may be kind of slow. 00241 */ 00242 #if !defined LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED || defined __DOXYGEN__ 00243 #define LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED 0 00244 #endif 00245 00246 /** Set this to 1 to send URIs without extension without headers 00247 * (who uses this at all??) */ 00248 #if !defined LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI || defined __DOXYGEN__ 00249 #define LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI 0 00250 #endif 00251 00252 /** Default: Tags are sent from struct http_state and are therefore volatile */ 00253 #if !defined HTTP_IS_TAG_VOLATILE || defined __DOXYGEN__ 00254 #define HTTP_IS_TAG_VOLATILE(ptr) TCP_WRITE_FLAG_COPY 00255 #endif 00256 00257 /* By default, the httpd is limited to send 2*pcb->mss to keep resource usage low 00258 when http is not an important protocol in the device. */ 00259 #if !defined HTTPD_LIMIT_SENDING_TO_2MSS || defined __DOXYGEN__ 00260 #define HTTPD_LIMIT_SENDING_TO_2MSS 1 00261 #endif 00262 00263 /* Define this to a function that returns the maximum amount of data to enqueue. 00264 The function have this signature: u16_t fn(struct tcp_pcb* pcb); */ 00265 #if !defined HTTPD_MAX_WRITE_LEN || defined __DOXYGEN__ 00266 #if HTTPD_LIMIT_SENDING_TO_2MSS 00267 #define HTTPD_MAX_WRITE_LEN(pcb) (2 * tcp_mss(pcb)) 00268 #endif 00269 #endif 00270 00271 /*------------------- FS OPTIONS -------------------*/ 00272 00273 /** Set this to 1 and provide the functions: 00274 * - "int fs_open_custom(struct fs_file *file, const char *name)" 00275 * Called first for every opened file to allow opening files 00276 * that are not included in fsdata(_custom).c 00277 * - "void fs_close_custom(struct fs_file *file)" 00278 * Called to free resources allocated by fs_open_custom(). 00279 */ 00280 #if !defined LWIP_HTTPD_CUSTOM_FILES || defined __DOXYGEN__ 00281 #define LWIP_HTTPD_CUSTOM_FILES 0 00282 #endif 00283 00284 /** Set this to 1 to support fs_read() to dynamically read file data. 00285 * Without this (default=off), only one-block files are supported, 00286 * and the contents must be ready after fs_open(). 00287 */ 00288 #if !defined LWIP_HTTPD_DYNAMIC_FILE_READ || defined __DOXYGEN__ 00289 #define LWIP_HTTPD_DYNAMIC_FILE_READ 0 00290 #endif 00291 00292 /** Set this to 1 to include an application state argument per file 00293 * that is opened. This allows to keep a state per connection/file. 00294 */ 00295 #if !defined LWIP_HTTPD_FILE_STATE || defined __DOXYGEN__ 00296 #define LWIP_HTTPD_FILE_STATE 0 00297 #endif 00298 00299 /** HTTPD_PRECALCULATED_CHECKSUM==1: include precompiled checksums for 00300 * predefined (MSS-sized) chunks of the files to prevent having to calculate 00301 * the checksums at runtime. */ 00302 #if !defined HTTPD_PRECALCULATED_CHECKSUM || defined __DOXYGEN__ 00303 #define HTTPD_PRECALCULATED_CHECKSUM 0 00304 #endif 00305 00306 /** LWIP_HTTPD_FS_ASYNC_READ==1: support asynchronous read operations 00307 * (fs_read_async returns FS_READ_DELAYED and calls a callback when finished). 00308 */ 00309 #if !defined LWIP_HTTPD_FS_ASYNC_READ || defined __DOXYGEN__ 00310 #define LWIP_HTTPD_FS_ASYNC_READ 0 00311 #endif 00312 00313 /** Set this to 1 to include "fsdata_custom.c" instead of "fsdata.c" for the 00314 * file system (to prevent changing the file included in CVS) */ 00315 #if !defined HTTPD_USE_CUSTOM_FSDATA || defined __DOXYGEN__ 00316 #define HTTPD_USE_CUSTOM_FSDATA 0 00317 #endif 00318 00319 /** 00320 * @} 00321 */ 00322 00323 #endif /* LWIP_HDR_APPS_HTTPD_OPTS_H */
Generated on Sun Jul 17 2022 08:25:23 by 1.7.2