ban4jp -
/
uIP-1-0_webserver
uIP 1.0 based webserver for LPC1114 + ENC28J60
uip/uipopt.h@0:685224d2f66d, 2014-06-14 (annotated)
- Committer:
- ban4jp
- Date:
- Sat Jun 14 16:02:21 2014 +0000
- Revision:
- 0:685224d2f66d
- Child:
- 3:a2715e9c7737
initial commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ban4jp | 0:685224d2f66d | 1 | /** |
ban4jp | 0:685224d2f66d | 2 | * \defgroup uipopt Configuration options for uIP |
ban4jp | 0:685224d2f66d | 3 | * @{ |
ban4jp | 0:685224d2f66d | 4 | * |
ban4jp | 0:685224d2f66d | 5 | * uIP is configured using the per-project configuration file |
ban4jp | 0:685224d2f66d | 6 | * uipopt.h. This file contains all compile-time options for uIP and |
ban4jp | 0:685224d2f66d | 7 | * should be tweaked to match each specific project. The uIP |
ban4jp | 0:685224d2f66d | 8 | * distribution contains a documented example "uipopt.h" that can be |
ban4jp | 0:685224d2f66d | 9 | * copied and modified for each project. |
ban4jp | 0:685224d2f66d | 10 | * |
ban4jp | 0:685224d2f66d | 11 | * \note Most of the configuration options in the uipopt.h should not |
ban4jp | 0:685224d2f66d | 12 | * be changed, but rather the per-project uip-conf.h file. |
ban4jp | 0:685224d2f66d | 13 | */ |
ban4jp | 0:685224d2f66d | 14 | |
ban4jp | 0:685224d2f66d | 15 | /** |
ban4jp | 0:685224d2f66d | 16 | * \file |
ban4jp | 0:685224d2f66d | 17 | * Configuration options for uIP. |
ban4jp | 0:685224d2f66d | 18 | * \author Adam Dunkels <adam@dunkels.com> |
ban4jp | 0:685224d2f66d | 19 | * |
ban4jp | 0:685224d2f66d | 20 | * This file is used for tweaking various configuration options for |
ban4jp | 0:685224d2f66d | 21 | * uIP. You should make a copy of this file into one of your project's |
ban4jp | 0:685224d2f66d | 22 | * directories instead of editing this example "uipopt.h" file that |
ban4jp | 0:685224d2f66d | 23 | * comes with the uIP distribution. |
ban4jp | 0:685224d2f66d | 24 | */ |
ban4jp | 0:685224d2f66d | 25 | |
ban4jp | 0:685224d2f66d | 26 | /* |
ban4jp | 0:685224d2f66d | 27 | * Copyright (c) 2001-2003, Adam Dunkels. |
ban4jp | 0:685224d2f66d | 28 | * All rights reserved. |
ban4jp | 0:685224d2f66d | 29 | * |
ban4jp | 0:685224d2f66d | 30 | * Redistribution and use in source and binary forms, with or without |
ban4jp | 0:685224d2f66d | 31 | * modification, are permitted provided that the following conditions |
ban4jp | 0:685224d2f66d | 32 | * are met: |
ban4jp | 0:685224d2f66d | 33 | * 1. Redistributions of source code must retain the above copyright |
ban4jp | 0:685224d2f66d | 34 | * notice, this list of conditions and the following disclaimer. |
ban4jp | 0:685224d2f66d | 35 | * 2. Redistributions in binary form must reproduce the above copyright |
ban4jp | 0:685224d2f66d | 36 | * notice, this list of conditions and the following disclaimer in the |
ban4jp | 0:685224d2f66d | 37 | * documentation and/or other materials provided with the distribution. |
ban4jp | 0:685224d2f66d | 38 | * 3. The name of the author may not be used to endorse or promote |
ban4jp | 0:685224d2f66d | 39 | * products derived from this software without specific prior |
ban4jp | 0:685224d2f66d | 40 | * written permission. |
ban4jp | 0:685224d2f66d | 41 | * |
ban4jp | 0:685224d2f66d | 42 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
ban4jp | 0:685224d2f66d | 43 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
ban4jp | 0:685224d2f66d | 44 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
ban4jp | 0:685224d2f66d | 45 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
ban4jp | 0:685224d2f66d | 46 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
ban4jp | 0:685224d2f66d | 47 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
ban4jp | 0:685224d2f66d | 48 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
ban4jp | 0:685224d2f66d | 49 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
ban4jp | 0:685224d2f66d | 50 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
ban4jp | 0:685224d2f66d | 51 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
ban4jp | 0:685224d2f66d | 52 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
ban4jp | 0:685224d2f66d | 53 | * |
ban4jp | 0:685224d2f66d | 54 | * This file is part of the uIP TCP/IP stack. |
ban4jp | 0:685224d2f66d | 55 | * |
ban4jp | 0:685224d2f66d | 56 | * $Id: uipopt.h,v 1.4 2006/06/12 08:00:31 adam Exp $ |
ban4jp | 0:685224d2f66d | 57 | * |
ban4jp | 0:685224d2f66d | 58 | */ |
ban4jp | 0:685224d2f66d | 59 | |
ban4jp | 0:685224d2f66d | 60 | #ifndef __UIPOPT_H__ |
ban4jp | 0:685224d2f66d | 61 | #define __UIPOPT_H__ |
ban4jp | 0:685224d2f66d | 62 | |
ban4jp | 0:685224d2f66d | 63 | #ifndef UIP_LITTLE_ENDIAN |
ban4jp | 0:685224d2f66d | 64 | #define UIP_LITTLE_ENDIAN 3412 |
ban4jp | 0:685224d2f66d | 65 | #endif /* UIP_LITTLE_ENDIAN */ |
ban4jp | 0:685224d2f66d | 66 | #ifndef UIP_BIG_ENDIAN |
ban4jp | 0:685224d2f66d | 67 | #define UIP_BIG_ENDIAN 1234 |
ban4jp | 0:685224d2f66d | 68 | #endif /* UIP_BIG_ENDIAN */ |
ban4jp | 0:685224d2f66d | 69 | |
ban4jp | 0:685224d2f66d | 70 | #include "uip-conf.h" |
ban4jp | 0:685224d2f66d | 71 | |
ban4jp | 0:685224d2f66d | 72 | /*------------------------------------------------------------------------------*/ |
ban4jp | 0:685224d2f66d | 73 | |
ban4jp | 0:685224d2f66d | 74 | /** |
ban4jp | 0:685224d2f66d | 75 | * \name Static configuration options |
ban4jp | 0:685224d2f66d | 76 | * @{ |
ban4jp | 0:685224d2f66d | 77 | * |
ban4jp | 0:685224d2f66d | 78 | * These configuration options can be used for setting the IP address |
ban4jp | 0:685224d2f66d | 79 | * settings statically, but only if UIP_FIXEDADDR is set to 1. The |
ban4jp | 0:685224d2f66d | 80 | * configuration options for a specific node includes IP address, |
ban4jp | 0:685224d2f66d | 81 | * netmask and default router as well as the Ethernet address. The |
ban4jp | 0:685224d2f66d | 82 | * netmask, default router and Ethernet address are appliciable only |
ban4jp | 0:685224d2f66d | 83 | * if uIP should be run over Ethernet. |
ban4jp | 0:685224d2f66d | 84 | * |
ban4jp | 0:685224d2f66d | 85 | * All of these should be changed to suit your project. |
ban4jp | 0:685224d2f66d | 86 | */ |
ban4jp | 0:685224d2f66d | 87 | |
ban4jp | 0:685224d2f66d | 88 | /** |
ban4jp | 0:685224d2f66d | 89 | * Determines if uIP should use a fixed IP address or not. |
ban4jp | 0:685224d2f66d | 90 | * |
ban4jp | 0:685224d2f66d | 91 | * If uIP should use a fixed IP address, the settings are set in the |
ban4jp | 0:685224d2f66d | 92 | * uipopt.h file. If not, the macros uip_sethostaddr(), |
ban4jp | 0:685224d2f66d | 93 | * uip_setdraddr() and uip_setnetmask() should be used instead. |
ban4jp | 0:685224d2f66d | 94 | * |
ban4jp | 0:685224d2f66d | 95 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 96 | */ |
ban4jp | 0:685224d2f66d | 97 | #define UIP_FIXEDADDR 0 |
ban4jp | 0:685224d2f66d | 98 | |
ban4jp | 0:685224d2f66d | 99 | /** |
ban4jp | 0:685224d2f66d | 100 | * Ping IP address asignment. |
ban4jp | 0:685224d2f66d | 101 | * |
ban4jp | 0:685224d2f66d | 102 | * uIP uses a "ping" packets for setting its own IP address if this |
ban4jp | 0:685224d2f66d | 103 | * option is set. If so, uIP will start with an empty IP address and |
ban4jp | 0:685224d2f66d | 104 | * the destination IP address of the first incoming "ping" (ICMP echo) |
ban4jp | 0:685224d2f66d | 105 | * packet will be used for setting the hosts IP address. |
ban4jp | 0:685224d2f66d | 106 | * |
ban4jp | 0:685224d2f66d | 107 | * \note This works only if UIP_FIXEDADDR is 0. |
ban4jp | 0:685224d2f66d | 108 | * |
ban4jp | 0:685224d2f66d | 109 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 110 | */ |
ban4jp | 0:685224d2f66d | 111 | #ifdef UIP_CONF_PINGADDRCONF |
ban4jp | 0:685224d2f66d | 112 | #define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF |
ban4jp | 0:685224d2f66d | 113 | #else /* UIP_CONF_PINGADDRCONF */ |
ban4jp | 0:685224d2f66d | 114 | #define UIP_PINGADDRCONF 0 |
ban4jp | 0:685224d2f66d | 115 | #endif /* UIP_CONF_PINGADDRCONF */ |
ban4jp | 0:685224d2f66d | 116 | |
ban4jp | 0:685224d2f66d | 117 | |
ban4jp | 0:685224d2f66d | 118 | /** |
ban4jp | 0:685224d2f66d | 119 | * Specifies if the uIP ARP module should be compiled with a fixed |
ban4jp | 0:685224d2f66d | 120 | * Ethernet MAC address or not. |
ban4jp | 0:685224d2f66d | 121 | * |
ban4jp | 0:685224d2f66d | 122 | * If this configuration option is 0, the macro uip_setethaddr() can |
ban4jp | 0:685224d2f66d | 123 | * be used to specify the Ethernet address at run-time. |
ban4jp | 0:685224d2f66d | 124 | * |
ban4jp | 0:685224d2f66d | 125 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 126 | */ |
ban4jp | 0:685224d2f66d | 127 | #define UIP_FIXEDETHADDR 0 |
ban4jp | 0:685224d2f66d | 128 | |
ban4jp | 0:685224d2f66d | 129 | /** @} */ |
ban4jp | 0:685224d2f66d | 130 | /*------------------------------------------------------------------------------*/ |
ban4jp | 0:685224d2f66d | 131 | /** |
ban4jp | 0:685224d2f66d | 132 | * \name IP configuration options |
ban4jp | 0:685224d2f66d | 133 | * @{ |
ban4jp | 0:685224d2f66d | 134 | * |
ban4jp | 0:685224d2f66d | 135 | */ |
ban4jp | 0:685224d2f66d | 136 | /** |
ban4jp | 0:685224d2f66d | 137 | * The IP TTL (time to live) of IP packets sent by uIP. |
ban4jp | 0:685224d2f66d | 138 | * |
ban4jp | 0:685224d2f66d | 139 | * This should normally not be changed. |
ban4jp | 0:685224d2f66d | 140 | */ |
ban4jp | 0:685224d2f66d | 141 | #define UIP_TTL 64 |
ban4jp | 0:685224d2f66d | 142 | |
ban4jp | 0:685224d2f66d | 143 | /** |
ban4jp | 0:685224d2f66d | 144 | * Turn on support for IP packet reassembly. |
ban4jp | 0:685224d2f66d | 145 | * |
ban4jp | 0:685224d2f66d | 146 | * uIP supports reassembly of fragmented IP packets. This features |
ban4jp | 0:685224d2f66d | 147 | * requires an additonal amount of RAM to hold the reassembly buffer |
ban4jp | 0:685224d2f66d | 148 | * and the reassembly code size is approximately 700 bytes. The |
ban4jp | 0:685224d2f66d | 149 | * reassembly buffer is of the same size as the uip_buf buffer |
ban4jp | 0:685224d2f66d | 150 | * (configured by UIP_BUFSIZE). |
ban4jp | 0:685224d2f66d | 151 | * |
ban4jp | 0:685224d2f66d | 152 | * \note IP packet reassembly is not heavily tested. |
ban4jp | 0:685224d2f66d | 153 | * |
ban4jp | 0:685224d2f66d | 154 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 155 | */ |
ban4jp | 0:685224d2f66d | 156 | #define UIP_REASSEMBLY 0 |
ban4jp | 0:685224d2f66d | 157 | |
ban4jp | 0:685224d2f66d | 158 | /** |
ban4jp | 0:685224d2f66d | 159 | * The maximum time an IP fragment should wait in the reassembly |
ban4jp | 0:685224d2f66d | 160 | * buffer before it is dropped. |
ban4jp | 0:685224d2f66d | 161 | * |
ban4jp | 0:685224d2f66d | 162 | */ |
ban4jp | 0:685224d2f66d | 163 | #define UIP_REASS_MAXAGE 40 |
ban4jp | 0:685224d2f66d | 164 | |
ban4jp | 0:685224d2f66d | 165 | /** @} */ |
ban4jp | 0:685224d2f66d | 166 | |
ban4jp | 0:685224d2f66d | 167 | /*------------------------------------------------------------------------------*/ |
ban4jp | 0:685224d2f66d | 168 | /** |
ban4jp | 0:685224d2f66d | 169 | * \name UDP configuration options |
ban4jp | 0:685224d2f66d | 170 | * @{ |
ban4jp | 0:685224d2f66d | 171 | */ |
ban4jp | 0:685224d2f66d | 172 | |
ban4jp | 0:685224d2f66d | 173 | /** |
ban4jp | 0:685224d2f66d | 174 | * Toggles wether UDP support should be compiled in or not. |
ban4jp | 0:685224d2f66d | 175 | * |
ban4jp | 0:685224d2f66d | 176 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 177 | */ |
ban4jp | 0:685224d2f66d | 178 | #ifdef UIP_CONF_UDP |
ban4jp | 0:685224d2f66d | 179 | #define UIP_UDP UIP_CONF_UDP |
ban4jp | 0:685224d2f66d | 180 | #else /* UIP_CONF_UDP */ |
ban4jp | 0:685224d2f66d | 181 | #define UIP_UDP 0 |
ban4jp | 0:685224d2f66d | 182 | #endif /* UIP_CONF_UDP */ |
ban4jp | 0:685224d2f66d | 183 | |
ban4jp | 0:685224d2f66d | 184 | /** |
ban4jp | 0:685224d2f66d | 185 | * Toggles if UDP checksums should be used or not. |
ban4jp | 0:685224d2f66d | 186 | * |
ban4jp | 0:685224d2f66d | 187 | * \note Support for UDP checksums is currently not included in uIP, |
ban4jp | 0:685224d2f66d | 188 | * so this option has no function. |
ban4jp | 0:685224d2f66d | 189 | * |
ban4jp | 0:685224d2f66d | 190 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 191 | */ |
ban4jp | 0:685224d2f66d | 192 | #ifdef UIP_CONF_UDP_CHECKSUMS |
ban4jp | 0:685224d2f66d | 193 | #define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS |
ban4jp | 0:685224d2f66d | 194 | #else |
ban4jp | 0:685224d2f66d | 195 | #define UIP_UDP_CHECKSUMS 0 |
ban4jp | 0:685224d2f66d | 196 | #endif |
ban4jp | 0:685224d2f66d | 197 | |
ban4jp | 0:685224d2f66d | 198 | /** |
ban4jp | 0:685224d2f66d | 199 | * The maximum amount of concurrent UDP connections. |
ban4jp | 0:685224d2f66d | 200 | * |
ban4jp | 0:685224d2f66d | 201 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 202 | */ |
ban4jp | 0:685224d2f66d | 203 | #ifdef UIP_CONF_UDP_CONNS |
ban4jp | 0:685224d2f66d | 204 | #define UIP_UDP_CONNS UIP_CONF_UDP_CONNS |
ban4jp | 0:685224d2f66d | 205 | #else /* UIP_CONF_UDP_CONNS */ |
ban4jp | 0:685224d2f66d | 206 | #define UIP_UDP_CONNS 10 |
ban4jp | 0:685224d2f66d | 207 | #endif /* UIP_CONF_UDP_CONNS */ |
ban4jp | 0:685224d2f66d | 208 | |
ban4jp | 0:685224d2f66d | 209 | /** |
ban4jp | 0:685224d2f66d | 210 | * The name of the function that should be called when UDP datagrams arrive. |
ban4jp | 0:685224d2f66d | 211 | * |
ban4jp | 0:685224d2f66d | 212 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 213 | */ |
ban4jp | 0:685224d2f66d | 214 | |
ban4jp | 0:685224d2f66d | 215 | |
ban4jp | 0:685224d2f66d | 216 | /** @} */ |
ban4jp | 0:685224d2f66d | 217 | /*------------------------------------------------------------------------------*/ |
ban4jp | 0:685224d2f66d | 218 | /** |
ban4jp | 0:685224d2f66d | 219 | * \name TCP configuration options |
ban4jp | 0:685224d2f66d | 220 | * @{ |
ban4jp | 0:685224d2f66d | 221 | */ |
ban4jp | 0:685224d2f66d | 222 | |
ban4jp | 0:685224d2f66d | 223 | /** |
ban4jp | 0:685224d2f66d | 224 | * Determines if support for opening connections from uIP should be |
ban4jp | 0:685224d2f66d | 225 | * compiled in. |
ban4jp | 0:685224d2f66d | 226 | * |
ban4jp | 0:685224d2f66d | 227 | * If the applications that are running on top of uIP for this project |
ban4jp | 0:685224d2f66d | 228 | * do not need to open outgoing TCP connections, this configration |
ban4jp | 0:685224d2f66d | 229 | * option can be turned off to reduce the code size of uIP. |
ban4jp | 0:685224d2f66d | 230 | * |
ban4jp | 0:685224d2f66d | 231 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 232 | */ |
ban4jp | 0:685224d2f66d | 233 | #define UIP_ACTIVE_OPEN 1 |
ban4jp | 0:685224d2f66d | 234 | |
ban4jp | 0:685224d2f66d | 235 | /** |
ban4jp | 0:685224d2f66d | 236 | * The maximum number of simultaneously open TCP connections. |
ban4jp | 0:685224d2f66d | 237 | * |
ban4jp | 0:685224d2f66d | 238 | * Since the TCP connections are statically allocated, turning this |
ban4jp | 0:685224d2f66d | 239 | * configuration knob down results in less RAM used. Each TCP |
ban4jp | 0:685224d2f66d | 240 | * connection requires approximatly 30 bytes of memory. |
ban4jp | 0:685224d2f66d | 241 | * |
ban4jp | 0:685224d2f66d | 242 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 243 | */ |
ban4jp | 0:685224d2f66d | 244 | #ifndef UIP_CONF_MAX_CONNECTIONS |
ban4jp | 0:685224d2f66d | 245 | #define UIP_CONNS 10 |
ban4jp | 0:685224d2f66d | 246 | #else /* UIP_CONF_MAX_CONNECTIONS */ |
ban4jp | 0:685224d2f66d | 247 | #define UIP_CONNS UIP_CONF_MAX_CONNECTIONS |
ban4jp | 0:685224d2f66d | 248 | #endif /* UIP_CONF_MAX_CONNECTIONS */ |
ban4jp | 0:685224d2f66d | 249 | |
ban4jp | 0:685224d2f66d | 250 | |
ban4jp | 0:685224d2f66d | 251 | /** |
ban4jp | 0:685224d2f66d | 252 | * The maximum number of simultaneously listening TCP ports. |
ban4jp | 0:685224d2f66d | 253 | * |
ban4jp | 0:685224d2f66d | 254 | * Each listening TCP port requires 2 bytes of memory. |
ban4jp | 0:685224d2f66d | 255 | * |
ban4jp | 0:685224d2f66d | 256 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 257 | */ |
ban4jp | 0:685224d2f66d | 258 | #ifndef UIP_CONF_MAX_LISTENPORTS |
ban4jp | 0:685224d2f66d | 259 | #define UIP_LISTENPORTS 20 |
ban4jp | 0:685224d2f66d | 260 | #else /* UIP_CONF_MAX_LISTENPORTS */ |
ban4jp | 0:685224d2f66d | 261 | #define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS |
ban4jp | 0:685224d2f66d | 262 | #endif /* UIP_CONF_MAX_LISTENPORTS */ |
ban4jp | 0:685224d2f66d | 263 | |
ban4jp | 0:685224d2f66d | 264 | /** |
ban4jp | 0:685224d2f66d | 265 | * Determines if support for TCP urgent data notification should be |
ban4jp | 0:685224d2f66d | 266 | * compiled in. |
ban4jp | 0:685224d2f66d | 267 | * |
ban4jp | 0:685224d2f66d | 268 | * Urgent data (out-of-band data) is a rarely used TCP feature that |
ban4jp | 0:685224d2f66d | 269 | * very seldom would be required. |
ban4jp | 0:685224d2f66d | 270 | * |
ban4jp | 0:685224d2f66d | 271 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 272 | */ |
ban4jp | 0:685224d2f66d | 273 | #define UIP_URGDATA 0 |
ban4jp | 0:685224d2f66d | 274 | |
ban4jp | 0:685224d2f66d | 275 | /** |
ban4jp | 0:685224d2f66d | 276 | * The initial retransmission timeout counted in timer pulses. |
ban4jp | 0:685224d2f66d | 277 | * |
ban4jp | 0:685224d2f66d | 278 | * This should not be changed. |
ban4jp | 0:685224d2f66d | 279 | */ |
ban4jp | 0:685224d2f66d | 280 | #define UIP_RTO 3 |
ban4jp | 0:685224d2f66d | 281 | |
ban4jp | 0:685224d2f66d | 282 | /** |
ban4jp | 0:685224d2f66d | 283 | * The maximum number of times a segment should be retransmitted |
ban4jp | 0:685224d2f66d | 284 | * before the connection should be aborted. |
ban4jp | 0:685224d2f66d | 285 | * |
ban4jp | 0:685224d2f66d | 286 | * This should not be changed. |
ban4jp | 0:685224d2f66d | 287 | */ |
ban4jp | 0:685224d2f66d | 288 | #define UIP_MAXRTX 8 |
ban4jp | 0:685224d2f66d | 289 | |
ban4jp | 0:685224d2f66d | 290 | /** |
ban4jp | 0:685224d2f66d | 291 | * The maximum number of times a SYN segment should be retransmitted |
ban4jp | 0:685224d2f66d | 292 | * before a connection request should be deemed to have been |
ban4jp | 0:685224d2f66d | 293 | * unsuccessful. |
ban4jp | 0:685224d2f66d | 294 | * |
ban4jp | 0:685224d2f66d | 295 | * This should not need to be changed. |
ban4jp | 0:685224d2f66d | 296 | */ |
ban4jp | 0:685224d2f66d | 297 | #define UIP_MAXSYNRTX 5 |
ban4jp | 0:685224d2f66d | 298 | |
ban4jp | 0:685224d2f66d | 299 | /** |
ban4jp | 0:685224d2f66d | 300 | * The TCP maximum segment size. |
ban4jp | 0:685224d2f66d | 301 | * |
ban4jp | 0:685224d2f66d | 302 | * This is should not be to set to more than |
ban4jp | 0:685224d2f66d | 303 | * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN. |
ban4jp | 0:685224d2f66d | 304 | */ |
ban4jp | 0:685224d2f66d | 305 | #define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) |
ban4jp | 0:685224d2f66d | 306 | |
ban4jp | 0:685224d2f66d | 307 | /** |
ban4jp | 0:685224d2f66d | 308 | * The size of the advertised receiver's window. |
ban4jp | 0:685224d2f66d | 309 | * |
ban4jp | 0:685224d2f66d | 310 | * Should be set low (i.e., to the size of the uip_buf buffer) is the |
ban4jp | 0:685224d2f66d | 311 | * application is slow to process incoming data, or high (32768 bytes) |
ban4jp | 0:685224d2f66d | 312 | * if the application processes data quickly. |
ban4jp | 0:685224d2f66d | 313 | * |
ban4jp | 0:685224d2f66d | 314 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 315 | */ |
ban4jp | 0:685224d2f66d | 316 | #ifndef UIP_CONF_RECEIVE_WINDOW |
ban4jp | 0:685224d2f66d | 317 | #define UIP_RECEIVE_WINDOW UIP_TCP_MSS |
ban4jp | 0:685224d2f66d | 318 | #else |
ban4jp | 0:685224d2f66d | 319 | #define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW |
ban4jp | 0:685224d2f66d | 320 | #endif |
ban4jp | 0:685224d2f66d | 321 | |
ban4jp | 0:685224d2f66d | 322 | /** |
ban4jp | 0:685224d2f66d | 323 | * How long a connection should stay in the TIME_WAIT state. |
ban4jp | 0:685224d2f66d | 324 | * |
ban4jp | 0:685224d2f66d | 325 | * This configiration option has no real implication, and it should be |
ban4jp | 0:685224d2f66d | 326 | * left untouched. |
ban4jp | 0:685224d2f66d | 327 | */ |
ban4jp | 0:685224d2f66d | 328 | #define UIP_TIME_WAIT_TIMEOUT 120 |
ban4jp | 0:685224d2f66d | 329 | |
ban4jp | 0:685224d2f66d | 330 | |
ban4jp | 0:685224d2f66d | 331 | /** @} */ |
ban4jp | 0:685224d2f66d | 332 | /*------------------------------------------------------------------------------*/ |
ban4jp | 0:685224d2f66d | 333 | /** |
ban4jp | 0:685224d2f66d | 334 | * \name ARP configuration options |
ban4jp | 0:685224d2f66d | 335 | * @{ |
ban4jp | 0:685224d2f66d | 336 | */ |
ban4jp | 0:685224d2f66d | 337 | |
ban4jp | 0:685224d2f66d | 338 | /** |
ban4jp | 0:685224d2f66d | 339 | * The size of the ARP table. |
ban4jp | 0:685224d2f66d | 340 | * |
ban4jp | 0:685224d2f66d | 341 | * This option should be set to a larger value if this uIP node will |
ban4jp | 0:685224d2f66d | 342 | * have many connections from the local network. |
ban4jp | 0:685224d2f66d | 343 | * |
ban4jp | 0:685224d2f66d | 344 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 345 | */ |
ban4jp | 0:685224d2f66d | 346 | #ifdef UIP_CONF_ARPTAB_SIZE |
ban4jp | 0:685224d2f66d | 347 | #define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE |
ban4jp | 0:685224d2f66d | 348 | #else |
ban4jp | 0:685224d2f66d | 349 | #define UIP_ARPTAB_SIZE 8 |
ban4jp | 0:685224d2f66d | 350 | #endif |
ban4jp | 0:685224d2f66d | 351 | |
ban4jp | 0:685224d2f66d | 352 | /** |
ban4jp | 0:685224d2f66d | 353 | * The maxium age of ARP table entries measured in 10ths of seconds. |
ban4jp | 0:685224d2f66d | 354 | * |
ban4jp | 0:685224d2f66d | 355 | * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD |
ban4jp | 0:685224d2f66d | 356 | * default). |
ban4jp | 0:685224d2f66d | 357 | */ |
ban4jp | 0:685224d2f66d | 358 | #define UIP_ARP_MAXAGE 120 |
ban4jp | 0:685224d2f66d | 359 | |
ban4jp | 0:685224d2f66d | 360 | /** @} */ |
ban4jp | 0:685224d2f66d | 361 | |
ban4jp | 0:685224d2f66d | 362 | /*------------------------------------------------------------------------------*/ |
ban4jp | 0:685224d2f66d | 363 | |
ban4jp | 0:685224d2f66d | 364 | /** |
ban4jp | 0:685224d2f66d | 365 | * \name General configuration options |
ban4jp | 0:685224d2f66d | 366 | * @{ |
ban4jp | 0:685224d2f66d | 367 | */ |
ban4jp | 0:685224d2f66d | 368 | |
ban4jp | 0:685224d2f66d | 369 | /** |
ban4jp | 0:685224d2f66d | 370 | * The size of the uIP packet buffer. |
ban4jp | 0:685224d2f66d | 371 | * |
ban4jp | 0:685224d2f66d | 372 | * The uIP packet buffer should not be smaller than 60 bytes, and does |
ban4jp | 0:685224d2f66d | 373 | * not need to be larger than 1500 bytes. Lower size results in lower |
ban4jp | 0:685224d2f66d | 374 | * TCP throughput, larger size results in higher TCP throughput. |
ban4jp | 0:685224d2f66d | 375 | * |
ban4jp | 0:685224d2f66d | 376 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 377 | */ |
ban4jp | 0:685224d2f66d | 378 | #ifndef UIP_CONF_BUFFER_SIZE |
ban4jp | 0:685224d2f66d | 379 | #define UIP_BUFSIZE 400 |
ban4jp | 0:685224d2f66d | 380 | #else /* UIP_CONF_BUFFER_SIZE */ |
ban4jp | 0:685224d2f66d | 381 | #define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE |
ban4jp | 0:685224d2f66d | 382 | #endif /* UIP_CONF_BUFFER_SIZE */ |
ban4jp | 0:685224d2f66d | 383 | |
ban4jp | 0:685224d2f66d | 384 | |
ban4jp | 0:685224d2f66d | 385 | /** |
ban4jp | 0:685224d2f66d | 386 | * Determines if statistics support should be compiled in. |
ban4jp | 0:685224d2f66d | 387 | * |
ban4jp | 0:685224d2f66d | 388 | * The statistics is useful for debugging and to show the user. |
ban4jp | 0:685224d2f66d | 389 | * |
ban4jp | 0:685224d2f66d | 390 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 391 | */ |
ban4jp | 0:685224d2f66d | 392 | #ifndef UIP_CONF_STATISTICS |
ban4jp | 0:685224d2f66d | 393 | #define UIP_STATISTICS 0 |
ban4jp | 0:685224d2f66d | 394 | #else /* UIP_CONF_STATISTICS */ |
ban4jp | 0:685224d2f66d | 395 | #define UIP_STATISTICS UIP_CONF_STATISTICS |
ban4jp | 0:685224d2f66d | 396 | #endif /* UIP_CONF_STATISTICS */ |
ban4jp | 0:685224d2f66d | 397 | |
ban4jp | 0:685224d2f66d | 398 | /** |
ban4jp | 0:685224d2f66d | 399 | * Determines if logging of certain events should be compiled in. |
ban4jp | 0:685224d2f66d | 400 | * |
ban4jp | 0:685224d2f66d | 401 | * This is useful mostly for debugging. The function uip_log() |
ban4jp | 0:685224d2f66d | 402 | * must be implemented to suit the architecture of the project, if |
ban4jp | 0:685224d2f66d | 403 | * logging is turned on. |
ban4jp | 0:685224d2f66d | 404 | * |
ban4jp | 0:685224d2f66d | 405 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 406 | */ |
ban4jp | 0:685224d2f66d | 407 | #ifndef UIP_CONF_LOGGING |
ban4jp | 0:685224d2f66d | 408 | #define UIP_LOGGING 0 |
ban4jp | 0:685224d2f66d | 409 | #else /* UIP_CONF_LOGGING */ |
ban4jp | 0:685224d2f66d | 410 | #define UIP_LOGGING UIP_CONF_LOGGING |
ban4jp | 0:685224d2f66d | 411 | #endif /* UIP_CONF_LOGGING */ |
ban4jp | 0:685224d2f66d | 412 | |
ban4jp | 0:685224d2f66d | 413 | /** |
ban4jp | 0:685224d2f66d | 414 | * Broadcast support. |
ban4jp | 0:685224d2f66d | 415 | * |
ban4jp | 0:685224d2f66d | 416 | * This flag configures IP broadcast support. This is useful only |
ban4jp | 0:685224d2f66d | 417 | * together with UDP. |
ban4jp | 0:685224d2f66d | 418 | * |
ban4jp | 0:685224d2f66d | 419 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 420 | * |
ban4jp | 0:685224d2f66d | 421 | */ |
ban4jp | 0:685224d2f66d | 422 | #ifndef UIP_CONF_BROADCAST |
ban4jp | 0:685224d2f66d | 423 | #define UIP_BROADCAST 0 |
ban4jp | 0:685224d2f66d | 424 | #else /* UIP_CONF_BROADCAST */ |
ban4jp | 0:685224d2f66d | 425 | #define UIP_BROADCAST UIP_CONF_BROADCAST |
ban4jp | 0:685224d2f66d | 426 | #endif /* UIP_CONF_BROADCAST */ |
ban4jp | 0:685224d2f66d | 427 | |
ban4jp | 0:685224d2f66d | 428 | /** |
ban4jp | 0:685224d2f66d | 429 | * Print out a uIP log message. |
ban4jp | 0:685224d2f66d | 430 | * |
ban4jp | 0:685224d2f66d | 431 | * This function must be implemented by the module that uses uIP, and |
ban4jp | 0:685224d2f66d | 432 | * is called by uIP whenever a log message is generated. |
ban4jp | 0:685224d2f66d | 433 | */ |
ban4jp | 0:685224d2f66d | 434 | void uip_log(char *msg); |
ban4jp | 0:685224d2f66d | 435 | |
ban4jp | 0:685224d2f66d | 436 | /** |
ban4jp | 0:685224d2f66d | 437 | * The link level header length. |
ban4jp | 0:685224d2f66d | 438 | * |
ban4jp | 0:685224d2f66d | 439 | * This is the offset into the uip_buf where the IP header can be |
ban4jp | 0:685224d2f66d | 440 | * found. For Ethernet, this should be set to 14. For SLIP, this |
ban4jp | 0:685224d2f66d | 441 | * should be set to 0. |
ban4jp | 0:685224d2f66d | 442 | * |
ban4jp | 0:685224d2f66d | 443 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 444 | */ |
ban4jp | 0:685224d2f66d | 445 | #ifdef UIP_CONF_LLH_LEN |
ban4jp | 0:685224d2f66d | 446 | #define UIP_LLH_LEN UIP_CONF_LLH_LEN |
ban4jp | 0:685224d2f66d | 447 | #else /* UIP_CONF_LLH_LEN */ |
ban4jp | 0:685224d2f66d | 448 | #define UIP_LLH_LEN 14 |
ban4jp | 0:685224d2f66d | 449 | #endif /* UIP_CONF_LLH_LEN */ |
ban4jp | 0:685224d2f66d | 450 | |
ban4jp | 0:685224d2f66d | 451 | /** @} */ |
ban4jp | 0:685224d2f66d | 452 | /*------------------------------------------------------------------------------*/ |
ban4jp | 0:685224d2f66d | 453 | /** |
ban4jp | 0:685224d2f66d | 454 | * \name CPU architecture configuration |
ban4jp | 0:685224d2f66d | 455 | * @{ |
ban4jp | 0:685224d2f66d | 456 | * |
ban4jp | 0:685224d2f66d | 457 | * The CPU architecture configuration is where the endianess of the |
ban4jp | 0:685224d2f66d | 458 | * CPU on which uIP is to be run is specified. Most CPUs today are |
ban4jp | 0:685224d2f66d | 459 | * little endian, and the most notable exception are the Motorolas |
ban4jp | 0:685224d2f66d | 460 | * which are big endian. The BYTE_ORDER macro should be changed to |
ban4jp | 0:685224d2f66d | 461 | * reflect the CPU architecture on which uIP is to be run. |
ban4jp | 0:685224d2f66d | 462 | */ |
ban4jp | 0:685224d2f66d | 463 | |
ban4jp | 0:685224d2f66d | 464 | /** |
ban4jp | 0:685224d2f66d | 465 | * The byte order of the CPU architecture on which uIP is to be run. |
ban4jp | 0:685224d2f66d | 466 | * |
ban4jp | 0:685224d2f66d | 467 | * This option can be either BIG_ENDIAN (Motorola byte order) or |
ban4jp | 0:685224d2f66d | 468 | * LITTLE_ENDIAN (Intel byte order). |
ban4jp | 0:685224d2f66d | 469 | * |
ban4jp | 0:685224d2f66d | 470 | * \hideinitializer |
ban4jp | 0:685224d2f66d | 471 | */ |
ban4jp | 0:685224d2f66d | 472 | #ifdef UIP_CONF_BYTE_ORDER |
ban4jp | 0:685224d2f66d | 473 | #define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER |
ban4jp | 0:685224d2f66d | 474 | #else /* UIP_CONF_BYTE_ORDER */ |
ban4jp | 0:685224d2f66d | 475 | #define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN |
ban4jp | 0:685224d2f66d | 476 | #endif /* UIP_CONF_BYTE_ORDER */ |
ban4jp | 0:685224d2f66d | 477 | |
ban4jp | 0:685224d2f66d | 478 | /** @} */ |
ban4jp | 0:685224d2f66d | 479 | /*------------------------------------------------------------------------------*/ |
ban4jp | 0:685224d2f66d | 480 | |
ban4jp | 0:685224d2f66d | 481 | /** |
ban4jp | 0:685224d2f66d | 482 | * \name Appication specific configurations |
ban4jp | 0:685224d2f66d | 483 | * @{ |
ban4jp | 0:685224d2f66d | 484 | * |
ban4jp | 0:685224d2f66d | 485 | * An uIP application is implemented using a single application |
ban4jp | 0:685224d2f66d | 486 | * function that is called by uIP whenever a TCP/IP event occurs. The |
ban4jp | 0:685224d2f66d | 487 | * name of this function must be registered with uIP at compile time |
ban4jp | 0:685224d2f66d | 488 | * using the UIP_APPCALL definition. |
ban4jp | 0:685224d2f66d | 489 | * |
ban4jp | 0:685224d2f66d | 490 | * uIP applications can store the application state within the |
ban4jp | 0:685224d2f66d | 491 | * uip_conn structure by specifying the type of the application |
ban4jp | 0:685224d2f66d | 492 | * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t. |
ban4jp | 0:685224d2f66d | 493 | * |
ban4jp | 0:685224d2f66d | 494 | * The file containing the definitions must be included in the |
ban4jp | 0:685224d2f66d | 495 | * uipopt.h file. |
ban4jp | 0:685224d2f66d | 496 | * |
ban4jp | 0:685224d2f66d | 497 | * The following example illustrates how this can look. |
ban4jp | 0:685224d2f66d | 498 | \code |
ban4jp | 0:685224d2f66d | 499 | |
ban4jp | 0:685224d2f66d | 500 | void httpd_appcall(void); |
ban4jp | 0:685224d2f66d | 501 | #define UIP_APPCALL httpd_appcall |
ban4jp | 0:685224d2f66d | 502 | |
ban4jp | 0:685224d2f66d | 503 | struct httpd_state { |
ban4jp | 0:685224d2f66d | 504 | u8_t state; |
ban4jp | 0:685224d2f66d | 505 | u16_t count; |
ban4jp | 0:685224d2f66d | 506 | char *dataptr; |
ban4jp | 0:685224d2f66d | 507 | char *script; |
ban4jp | 0:685224d2f66d | 508 | }; |
ban4jp | 0:685224d2f66d | 509 | typedef struct httpd_state uip_tcp_appstate_t |
ban4jp | 0:685224d2f66d | 510 | \endcode |
ban4jp | 0:685224d2f66d | 511 | */ |
ban4jp | 0:685224d2f66d | 512 | |
ban4jp | 0:685224d2f66d | 513 | /** |
ban4jp | 0:685224d2f66d | 514 | * \var #define UIP_APPCALL |
ban4jp | 0:685224d2f66d | 515 | * |
ban4jp | 0:685224d2f66d | 516 | * The name of the application function that uIP should call in |
ban4jp | 0:685224d2f66d | 517 | * response to TCP/IP events. |
ban4jp | 0:685224d2f66d | 518 | * |
ban4jp | 0:685224d2f66d | 519 | */ |
ban4jp | 0:685224d2f66d | 520 | |
ban4jp | 0:685224d2f66d | 521 | /** |
ban4jp | 0:685224d2f66d | 522 | * \var typedef uip_tcp_appstate_t |
ban4jp | 0:685224d2f66d | 523 | * |
ban4jp | 0:685224d2f66d | 524 | * The type of the application state that is to be stored in the |
ban4jp | 0:685224d2f66d | 525 | * uip_conn structure. This usually is typedef:ed to a struct holding |
ban4jp | 0:685224d2f66d | 526 | * application state information. |
ban4jp | 0:685224d2f66d | 527 | */ |
ban4jp | 0:685224d2f66d | 528 | |
ban4jp | 0:685224d2f66d | 529 | /** |
ban4jp | 0:685224d2f66d | 530 | * \var typedef uip_udp_appstate_t |
ban4jp | 0:685224d2f66d | 531 | * |
ban4jp | 0:685224d2f66d | 532 | * The type of the application state that is to be stored in the |
ban4jp | 0:685224d2f66d | 533 | * uip_conn structure. This usually is typedef:ed to a struct holding |
ban4jp | 0:685224d2f66d | 534 | * application state information. |
ban4jp | 0:685224d2f66d | 535 | */ |
ban4jp | 0:685224d2f66d | 536 | /** @} */ |
ban4jp | 0:685224d2f66d | 537 | /** @} */ |
ban4jp | 0:685224d2f66d | 538 | |
ban4jp | 0:685224d2f66d | 539 | #endif /* __UIPOPT_H__ */ |