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