ban4jp -
/
uIP-1-0_webserver
uIP 1.0 based webserver for LPC1114 + ENC28J60
Embed:
(wiki syntax)
Show/hide line numbers
uipopt.h
Go to the documentation of this file.
00001 /** 00002 * \defgroup uipopt Configuration options for uIP 00003 * @{ 00004 * 00005 * uIP is configured using the per-project configuration file 00006 * uipopt.h. This file contains all compile-time options for uIP and 00007 * should be tweaked to match each specific project. The uIP 00008 * distribution contains a documented example "uipopt.h" that can be 00009 * copied and modified for each project. 00010 * 00011 * \note Most of the configuration options in the uipopt.h should not 00012 * be changed, but rather the per-project uip-conf.h file. 00013 */ 00014 00015 /** 00016 * \file 00017 * Configuration options for uIP. 00018 * \author Adam Dunkels <adam@dunkels.com> 00019 * 00020 * This file is used for tweaking various configuration options for 00021 * uIP. You should make a copy of this file into one of your project's 00022 * directories instead of editing this example "uipopt.h" file that 00023 * comes with the uIP distribution. 00024 */ 00025 00026 /* 00027 * Copyright (c) 2001-2003, Adam Dunkels. 00028 * All rights reserved. 00029 * 00030 * Redistribution and use in source and binary forms, with or without 00031 * modification, are permitted provided that the following conditions 00032 * are met: 00033 * 1. Redistributions of source code must retain the above copyright 00034 * notice, this list of conditions and the following disclaimer. 00035 * 2. Redistributions in binary form must reproduce the above copyright 00036 * notice, this list of conditions and the following disclaimer in the 00037 * documentation and/or other materials provided with the distribution. 00038 * 3. The name of the author may not be used to endorse or promote 00039 * products derived from this software without specific prior 00040 * written permission. 00041 * 00042 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 00043 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00044 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00045 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00046 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00047 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00048 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00049 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00050 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00051 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00052 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00053 * 00054 * This file is part of the uIP TCP/IP stack. 00055 * 00056 * $Id: uipopt.h,v 1.4 2006/06/12 08:00:31 adam Exp $ 00057 * 00058 */ 00059 00060 #ifndef __UIPOPT_H__ 00061 #define __UIPOPT_H__ 00062 00063 #ifndef UIP_LITTLE_ENDIAN 00064 #define UIP_LITTLE_ENDIAN 3412 00065 #endif /* UIP_LITTLE_ENDIAN */ 00066 #ifndef UIP_BIG_ENDIAN 00067 #define UIP_BIG_ENDIAN 1234 00068 #endif /* UIP_BIG_ENDIAN */ 00069 00070 #include "uip-conf.h" 00071 00072 #define CCIF 00073 #define CLIF 00074 00075 /*------------------------------------------------------------------------------*/ 00076 00077 /** 00078 * \name Static configuration options 00079 * @{ 00080 * 00081 * These configuration options can be used for setting the IP address 00082 * settings statically, but only if UIP_FIXEDADDR is set to 1. The 00083 * configuration options for a specific node includes IP address, 00084 * netmask and default router as well as the Ethernet address. The 00085 * netmask, default router and Ethernet address are applicable only 00086 * if uIP should be run over Ethernet. 00087 * 00088 * All of these should be changed to suit your project. 00089 */ 00090 00091 /** 00092 * Determines if uIP should use a fixed IP address or not. 00093 * 00094 * If uIP should use a fixed IP address, the settings are set in the 00095 * uipopt.h file. If not, the macros uip_sethostaddr(), 00096 * uip_setdraddr() and uip_setnetmask() should be used instead. 00097 * 00098 * \hideinitializer 00099 */ 00100 #define UIP_FIXEDADDR 0 00101 00102 /** 00103 * Ping IP address assignment. 00104 * 00105 * uIP uses a "ping" packets for setting its own IP address if this 00106 * option is set. If so, uIP will start with an empty IP address and 00107 * the destination IP address of the first incoming "ping" (ICMP echo) 00108 * packet will be used for setting the hosts IP address. 00109 * 00110 * \note This works only if UIP_FIXEDADDR is 0. 00111 * 00112 * \hideinitializer 00113 */ 00114 #ifdef UIP_CONF_PINGADDRCONF 00115 #define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF 00116 #else /* UIP_CONF_PINGADDRCONF */ 00117 #define UIP_PINGADDRCONF 0 00118 #endif /* UIP_CONF_PINGADDRCONF */ 00119 00120 00121 /** 00122 * Specifies if the uIP ARP module should be compiled with a fixed 00123 * Ethernet MAC address or not. 00124 * 00125 * If this configuration option is 0, the macro uip_setethaddr() can 00126 * be used to specify the Ethernet address at run-time. 00127 * 00128 * \hideinitializer 00129 */ 00130 #define UIP_FIXEDETHADDR 0 00131 00132 /** @} */ 00133 /*------------------------------------------------------------------------------*/ 00134 /** 00135 * \name IP configuration options 00136 * @{ 00137 * 00138 */ 00139 /** 00140 * The IP TTL (time to live) of IP packets sent by uIP. 00141 * 00142 * This should normally not be changed. 00143 */ 00144 #define UIP_TTL 64 00145 00146 /** 00147 * Turn on support for IP packet reassembly. 00148 * 00149 * uIP supports reassembly of fragmented IP packets. This features 00150 * requires an additional amount of RAM to hold the reassembly buffer 00151 * and the reassembly code size is approximately 700 bytes. The 00152 * reassembly buffer is of the same size as the uip_buf buffer 00153 * (configured by UIP_BUFSIZE). 00154 * 00155 * \note IP packet reassembly is not heavily tested. 00156 * 00157 * \hideinitializer 00158 */ 00159 #define UIP_REASSEMBLY 0 00160 00161 /** 00162 * The maximum time an IP fragment should wait in the reassembly 00163 * buffer before it is dropped. 00164 * 00165 */ 00166 #define UIP_REASS_MAXAGE 40 00167 00168 /** @} */ 00169 00170 /*------------------------------------------------------------------------------*/ 00171 /** 00172 * \name UDP configuration options 00173 * @{ 00174 */ 00175 00176 /** 00177 * Toggles whether UDP support should be compiled in or not. 00178 * 00179 * \hideinitializer 00180 */ 00181 #ifdef UIP_CONF_UDP 00182 #define UIP_UDP UIP_CONF_UDP 00183 #else /* UIP_CONF_UDP */ 00184 #define UIP_UDP 0 00185 #endif /* UIP_CONF_UDP */ 00186 00187 /** 00188 * Toggles if UDP checksums should be used or not. 00189 * 00190 * \note Support for UDP checksums is currently not included in uIP, 00191 * so this option has no function. 00192 * 00193 * \hideinitializer 00194 */ 00195 #ifdef UIP_CONF_UDP_CHECKSUMS 00196 #define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS 00197 #else 00198 #define UIP_UDP_CHECKSUMS 0 00199 #endif 00200 00201 /** 00202 * The maximum amount of concurrent UDP connections. 00203 * 00204 * \hideinitializer 00205 */ 00206 #ifdef UIP_CONF_UDP_CONNS 00207 #define UIP_UDP_CONNS UIP_CONF_UDP_CONNS 00208 #else /* UIP_CONF_UDP_CONNS */ 00209 #define UIP_UDP_CONNS 10 00210 #endif /* UIP_CONF_UDP_CONNS */ 00211 00212 /** 00213 * The name of the function that should be called when UDP datagrams arrive. 00214 * 00215 * \hideinitializer 00216 */ 00217 00218 00219 /** @} */ 00220 /*------------------------------------------------------------------------------*/ 00221 /** 00222 * \name TCP configuration options 00223 * @{ 00224 */ 00225 00226 /** 00227 * Toggles whether TCP support should be compiled in or not. 00228 * 00229 * \hideinitializer 00230 */ 00231 #ifdef UIP_CONF_TCP 00232 #define UIP_TCP (UIP_CONF_TCP) 00233 #else /* UIP_CONF_TCP */ 00234 #define UIP_TCP 1 00235 #endif /* UIP_CONF_TCP */ 00236 00237 /** 00238 * Determines if support for opening connections from uIP should be 00239 * compiled in. 00240 * 00241 * If the applications that are running on top of uIP for this project 00242 * do not need to open outgoing TCP connections, this configuration 00243 * option can be turned off to reduce the code size of uIP. 00244 * 00245 * \hideinitializer 00246 */ 00247 #define UIP_ACTIVE_OPEN 1 00248 00249 /** 00250 * The maximum number of simultaneously open TCP connections. 00251 * 00252 * Since the TCP connections are statically allocated, turning this 00253 * configuration knob down results in less RAM used. Each TCP 00254 * connection requires approximately 30 bytes of memory. 00255 * 00256 * \hideinitializer 00257 */ 00258 #ifndef UIP_CONF_MAX_CONNECTIONS 00259 #define UIP_CONNS 10 00260 #else /* UIP_CONF_MAX_CONNECTIONS */ 00261 #define UIP_CONNS UIP_CONF_MAX_CONNECTIONS 00262 #endif /* UIP_CONF_MAX_CONNECTIONS */ 00263 00264 00265 /** 00266 * The maximum number of simultaneously listening TCP ports. 00267 * 00268 * Each listening TCP port requires 2 bytes of memory. 00269 * 00270 * \hideinitializer 00271 */ 00272 #ifndef UIP_CONF_MAX_LISTENPORTS 00273 #define UIP_LISTENPORTS 20 00274 #else /* UIP_CONF_MAX_LISTENPORTS */ 00275 #define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS 00276 #endif /* UIP_CONF_MAX_LISTENPORTS */ 00277 00278 /** 00279 * Determines if support for TCP urgent data notification should be 00280 * compiled in. 00281 * 00282 * Urgent data (out-of-band data) is a rarely used TCP feature that 00283 * very seldom would be required. 00284 * 00285 * \hideinitializer 00286 */ 00287 #define UIP_URGDATA 0 00288 00289 /** 00290 * The initial retransmission timeout counted in timer pulses. 00291 * 00292 * This should not be changed. 00293 */ 00294 #define UIP_RTO 3 00295 00296 /** 00297 * The maximum number of times a segment should be retransmitted 00298 * before the connection should be aborted. 00299 * 00300 * This should not be changed. 00301 */ 00302 #define UIP_MAXRTX 8 00303 00304 /** 00305 * The maximum number of times a SYN segment should be retransmitted 00306 * before a connection request should be deemed to have been 00307 * unsuccessful. 00308 * 00309 * This should not need to be changed. 00310 */ 00311 #define UIP_MAXSYNRTX 5 00312 00313 /** 00314 * The TCP maximum segment size. 00315 * 00316 * This is should not be to set to more than 00317 * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN. 00318 */ 00319 #define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) 00320 00321 /** 00322 * The size of the advertised receiver's window. 00323 * 00324 * Should be set low (i.e., to the size of the uip_buf buffer) if the 00325 * application is slow to process incoming data, or high (32768 bytes) 00326 * if the application processes data quickly. 00327 * 00328 * \hideinitializer 00329 */ 00330 #ifndef UIP_CONF_RECEIVE_WINDOW 00331 #define UIP_RECEIVE_WINDOW UIP_TCP_MSS 00332 #else 00333 #define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW 00334 #endif 00335 00336 /** 00337 * How long a connection should stay in the TIME_WAIT state. 00338 * 00339 * This configiration option has no real implication, and it should be 00340 * left untouched. 00341 */ 00342 #define UIP_TIME_WAIT_TIMEOUT 120 00343 00344 00345 /** @} */ 00346 /*------------------------------------------------------------------------------*/ 00347 /** 00348 * \name ARP configuration options 00349 * @{ 00350 */ 00351 00352 /** 00353 * The size of the ARP table. 00354 * 00355 * This option should be set to a larger value if this uIP node will 00356 * have many connections from the local network. 00357 * 00358 * \hideinitializer 00359 */ 00360 #ifdef UIP_CONF_ARPTAB_SIZE 00361 #define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE 00362 #else 00363 #define UIP_ARPTAB_SIZE 8 00364 #endif 00365 00366 /** 00367 * The maximum age of ARP table entries measured in 10ths of seconds. 00368 * 00369 * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD 00370 * default). 00371 */ 00372 #define UIP_ARP_MAXAGE 120 00373 00374 /** @} */ 00375 00376 /*------------------------------------------------------------------------------*/ 00377 00378 /** 00379 * \name General configuration options 00380 * @{ 00381 */ 00382 00383 /** 00384 * The size of the uIP packet buffer. 00385 * 00386 * The uIP packet buffer should not be smaller than 60 bytes, and does 00387 * not need to be larger than 1500 bytes. Lower size results in lower 00388 * TCP throughput, larger size results in higher TCP throughput. 00389 * 00390 * \hideinitializer 00391 */ 00392 #ifndef UIP_CONF_BUFFER_SIZE 00393 #define UIP_BUFSIZE 400 00394 #else /* UIP_CONF_BUFFER_SIZE */ 00395 #define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE 00396 #endif /* UIP_CONF_BUFFER_SIZE */ 00397 00398 00399 /** 00400 * Determines if statistics support should be compiled in. 00401 * 00402 * The statistics is useful for debugging and to show the user. 00403 * 00404 * \hideinitializer 00405 */ 00406 #ifndef UIP_CONF_STATISTICS 00407 #define UIP_STATISTICS 0 00408 #else /* UIP_CONF_STATISTICS */ 00409 #define UIP_STATISTICS UIP_CONF_STATISTICS 00410 #endif /* UIP_CONF_STATISTICS */ 00411 00412 /** 00413 * Determines if logging of certain events should be compiled in. 00414 * 00415 * This is useful mostly for debugging. The function uip_log() 00416 * must be implemented to suit the architecture of the project, if 00417 * logging is turned on. 00418 * 00419 * \hideinitializer 00420 */ 00421 #ifndef UIP_CONF_LOGGING 00422 #define UIP_LOGGING 0 00423 #else /* UIP_CONF_LOGGING */ 00424 #define UIP_LOGGING UIP_CONF_LOGGING 00425 #endif /* UIP_CONF_LOGGING */ 00426 00427 /** 00428 * Broadcast support. 00429 * 00430 * This flag configures IP broadcast support. This is useful only 00431 * together with UDP. 00432 * 00433 * \hideinitializer 00434 * 00435 */ 00436 #ifndef UIP_CONF_BROADCAST 00437 #define UIP_BROADCAST 0 00438 #else /* UIP_CONF_BROADCAST */ 00439 #define UIP_BROADCAST UIP_CONF_BROADCAST 00440 #endif /* UIP_CONF_BROADCAST */ 00441 00442 /** 00443 * Print out a uIP log message. 00444 * 00445 * This function must be implemented by the module that uses uIP, and 00446 * is called by uIP whenever a log message is generated. 00447 */ 00448 void uip_log(char *msg); 00449 00450 /** 00451 * The link level header length. 00452 * 00453 * This is the offset into the uip_buf where the IP header can be 00454 * found. For Ethernet, this should be set to 14. For SLIP, this 00455 * should be set to 0. 00456 * 00457 * \hideinitializer 00458 */ 00459 #ifdef UIP_CONF_LLH_LEN 00460 #define UIP_LLH_LEN UIP_CONF_LLH_LEN 00461 #else /* UIP_CONF_LLH_LEN */ 00462 #define UIP_LLH_LEN 14 00463 #endif /* UIP_CONF_LLH_LEN */ 00464 00465 /** @} */ 00466 /*------------------------------------------------------------------------------*/ 00467 /** 00468 * \name CPU architecture configuration 00469 * @{ 00470 * 00471 * The CPU architecture configuration is where the endianess of the 00472 * CPU on which uIP is to be run is specified. Most CPUs today are 00473 * little endian, and the most notable exception are the Motorolas 00474 * which are big endian. The BYTE_ORDER macro should be changed to 00475 * reflect the CPU architecture on which uIP is to be run. 00476 */ 00477 00478 /** 00479 * The byte order of the CPU architecture on which uIP is to be run. 00480 * 00481 * This option can be either BIG_ENDIAN (Motorola byte order) or 00482 * LITTLE_ENDIAN (Intel byte order). 00483 * 00484 * \hideinitializer 00485 */ 00486 #ifdef UIP_CONF_BYTE_ORDER 00487 #define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER 00488 #else /* UIP_CONF_BYTE_ORDER */ 00489 #define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN 00490 #endif /* UIP_CONF_BYTE_ORDER */ 00491 00492 /** @} */ 00493 /*------------------------------------------------------------------------------*/ 00494 00495 /** 00496 * \name Application specific configurations 00497 * @{ 00498 * 00499 * An uIP application is implemented using a single application 00500 * function that is called by uIP whenever a TCP/IP event occurs. The 00501 * name of this function must be registered with uIP at compile time 00502 * using the UIP_APPCALL definition. 00503 * 00504 * uIP applications can store the application state within the 00505 * uip_conn structure by specifying the type of the application 00506 * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t. 00507 * 00508 * The file containing the definitions must be included in the 00509 * uipopt.h file. 00510 * 00511 * The following example illustrates how this can look. 00512 \code 00513 00514 void httpd_appcall(void); 00515 #define UIP_APPCALL httpd_appcall 00516 00517 struct httpd_state { 00518 u8_t state; 00519 u16_t count; 00520 char *dataptr; 00521 char *script; 00522 }; 00523 typedef struct httpd_state uip_tcp_appstate_t 00524 \endcode 00525 */ 00526 00527 /** 00528 * \var #define UIP_APPCALL 00529 * 00530 * The name of the application function that uIP should call in 00531 * response to TCP/IP events. 00532 * 00533 */ 00534 00535 /** 00536 * \var typedef uip_tcp_appstate_t 00537 * 00538 * The type of the application state that is to be stored in the 00539 * uip_conn structure. This usually is typedef:ed to a struct holding 00540 * application state information. 00541 */ 00542 00543 /** 00544 * \var typedef uip_udp_appstate_t 00545 * 00546 * The type of the application state that is to be stored in the 00547 * uip_conn structure. This usually is typedef:ed to a struct holding 00548 * application state information. 00549 */ 00550 /** @} */ 00551 /** @} */ 00552 00553 #endif /* __UIPOPT_H__ */
Generated on Tue Jul 12 2022 12:52:12 by 1.7.2