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