uIP 1.0 based webserver for LPC1114 + ENC28J60

Dependencies:   mbed TMP102

Committer:
ban4jp
Date:
Mon Jun 30 16:00:08 2014 +0000
Revision:
3:a2715e9c7737
Parent:
0:685224d2f66d
backported from Contiki 2.7

Who changed what in which revision?

UserRevisionLine numberNew 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 3:a2715e9c7737 72 #define CCIF
ban4jp 3:a2715e9c7737 73 #define CLIF
ban4jp 3:a2715e9c7737 74
ban4jp 0:685224d2f66d 75 /*------------------------------------------------------------------------------*/
ban4jp 0:685224d2f66d 76
ban4jp 0:685224d2f66d 77 /**
ban4jp 0:685224d2f66d 78 * \name Static configuration options
ban4jp 0:685224d2f66d 79 * @{
ban4jp 0:685224d2f66d 80 *
ban4jp 0:685224d2f66d 81 * These configuration options can be used for setting the IP address
ban4jp 0:685224d2f66d 82 * settings statically, but only if UIP_FIXEDADDR is set to 1. The
ban4jp 0:685224d2f66d 83 * configuration options for a specific node includes IP address,
ban4jp 0:685224d2f66d 84 * netmask and default router as well as the Ethernet address. The
ban4jp 3:a2715e9c7737 85 * netmask, default router and Ethernet address are applicable only
ban4jp 0:685224d2f66d 86 * if uIP should be run over Ethernet.
ban4jp 0:685224d2f66d 87 *
ban4jp 0:685224d2f66d 88 * All of these should be changed to suit your project.
ban4jp 3:a2715e9c7737 89 */
ban4jp 0:685224d2f66d 90
ban4jp 0:685224d2f66d 91 /**
ban4jp 0:685224d2f66d 92 * Determines if uIP should use a fixed IP address or not.
ban4jp 0:685224d2f66d 93 *
ban4jp 0:685224d2f66d 94 * If uIP should use a fixed IP address, the settings are set in the
ban4jp 0:685224d2f66d 95 * uipopt.h file. If not, the macros uip_sethostaddr(),
ban4jp 0:685224d2f66d 96 * uip_setdraddr() and uip_setnetmask() should be used instead.
ban4jp 0:685224d2f66d 97 *
ban4jp 0:685224d2f66d 98 * \hideinitializer
ban4jp 0:685224d2f66d 99 */
ban4jp 0:685224d2f66d 100 #define UIP_FIXEDADDR 0
ban4jp 0:685224d2f66d 101
ban4jp 0:685224d2f66d 102 /**
ban4jp 3:a2715e9c7737 103 * Ping IP address assignment.
ban4jp 0:685224d2f66d 104 *
ban4jp 0:685224d2f66d 105 * uIP uses a "ping" packets for setting its own IP address if this
ban4jp 0:685224d2f66d 106 * option is set. If so, uIP will start with an empty IP address and
ban4jp 0:685224d2f66d 107 * the destination IP address of the first incoming "ping" (ICMP echo)
ban4jp 0:685224d2f66d 108 * packet will be used for setting the hosts IP address.
ban4jp 0:685224d2f66d 109 *
ban4jp 0:685224d2f66d 110 * \note This works only if UIP_FIXEDADDR is 0.
ban4jp 0:685224d2f66d 111 *
ban4jp 0:685224d2f66d 112 * \hideinitializer
ban4jp 0:685224d2f66d 113 */
ban4jp 0:685224d2f66d 114 #ifdef UIP_CONF_PINGADDRCONF
ban4jp 0:685224d2f66d 115 #define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF
ban4jp 0:685224d2f66d 116 #else /* UIP_CONF_PINGADDRCONF */
ban4jp 0:685224d2f66d 117 #define UIP_PINGADDRCONF 0
ban4jp 0:685224d2f66d 118 #endif /* UIP_CONF_PINGADDRCONF */
ban4jp 0:685224d2f66d 119
ban4jp 0:685224d2f66d 120
ban4jp 0:685224d2f66d 121 /**
ban4jp 0:685224d2f66d 122 * Specifies if the uIP ARP module should be compiled with a fixed
ban4jp 0:685224d2f66d 123 * Ethernet MAC address or not.
ban4jp 0:685224d2f66d 124 *
ban4jp 0:685224d2f66d 125 * If this configuration option is 0, the macro uip_setethaddr() can
ban4jp 0:685224d2f66d 126 * be used to specify the Ethernet address at run-time.
ban4jp 0:685224d2f66d 127 *
ban4jp 0:685224d2f66d 128 * \hideinitializer
ban4jp 0:685224d2f66d 129 */
ban4jp 0:685224d2f66d 130 #define UIP_FIXEDETHADDR 0
ban4jp 0:685224d2f66d 131
ban4jp 0:685224d2f66d 132 /** @} */
ban4jp 0:685224d2f66d 133 /*------------------------------------------------------------------------------*/
ban4jp 0:685224d2f66d 134 /**
ban4jp 0:685224d2f66d 135 * \name IP configuration options
ban4jp 0:685224d2f66d 136 * @{
ban4jp 0:685224d2f66d 137 *
ban4jp 0:685224d2f66d 138 */
ban4jp 0:685224d2f66d 139 /**
ban4jp 0:685224d2f66d 140 * The IP TTL (time to live) of IP packets sent by uIP.
ban4jp 0:685224d2f66d 141 *
ban4jp 0:685224d2f66d 142 * This should normally not be changed.
ban4jp 0:685224d2f66d 143 */
ban4jp 0:685224d2f66d 144 #define UIP_TTL 64
ban4jp 0:685224d2f66d 145
ban4jp 0:685224d2f66d 146 /**
ban4jp 0:685224d2f66d 147 * Turn on support for IP packet reassembly.
ban4jp 0:685224d2f66d 148 *
ban4jp 0:685224d2f66d 149 * uIP supports reassembly of fragmented IP packets. This features
ban4jp 3:a2715e9c7737 150 * requires an additional amount of RAM to hold the reassembly buffer
ban4jp 0:685224d2f66d 151 * and the reassembly code size is approximately 700 bytes. The
ban4jp 0:685224d2f66d 152 * reassembly buffer is of the same size as the uip_buf buffer
ban4jp 0:685224d2f66d 153 * (configured by UIP_BUFSIZE).
ban4jp 0:685224d2f66d 154 *
ban4jp 0:685224d2f66d 155 * \note IP packet reassembly is not heavily tested.
ban4jp 0:685224d2f66d 156 *
ban4jp 0:685224d2f66d 157 * \hideinitializer
ban4jp 0:685224d2f66d 158 */
ban4jp 0:685224d2f66d 159 #define UIP_REASSEMBLY 0
ban4jp 0:685224d2f66d 160
ban4jp 0:685224d2f66d 161 /**
ban4jp 0:685224d2f66d 162 * The maximum time an IP fragment should wait in the reassembly
ban4jp 0:685224d2f66d 163 * buffer before it is dropped.
ban4jp 0:685224d2f66d 164 *
ban4jp 0:685224d2f66d 165 */
ban4jp 0:685224d2f66d 166 #define UIP_REASS_MAXAGE 40
ban4jp 0:685224d2f66d 167
ban4jp 0:685224d2f66d 168 /** @} */
ban4jp 0:685224d2f66d 169
ban4jp 0:685224d2f66d 170 /*------------------------------------------------------------------------------*/
ban4jp 0:685224d2f66d 171 /**
ban4jp 0:685224d2f66d 172 * \name UDP configuration options
ban4jp 0:685224d2f66d 173 * @{
ban4jp 0:685224d2f66d 174 */
ban4jp 0:685224d2f66d 175
ban4jp 0:685224d2f66d 176 /**
ban4jp 3:a2715e9c7737 177 * Toggles whether UDP support should be compiled in or not.
ban4jp 0:685224d2f66d 178 *
ban4jp 0:685224d2f66d 179 * \hideinitializer
ban4jp 0:685224d2f66d 180 */
ban4jp 0:685224d2f66d 181 #ifdef UIP_CONF_UDP
ban4jp 0:685224d2f66d 182 #define UIP_UDP UIP_CONF_UDP
ban4jp 0:685224d2f66d 183 #else /* UIP_CONF_UDP */
ban4jp 0:685224d2f66d 184 #define UIP_UDP 0
ban4jp 0:685224d2f66d 185 #endif /* UIP_CONF_UDP */
ban4jp 0:685224d2f66d 186
ban4jp 0:685224d2f66d 187 /**
ban4jp 0:685224d2f66d 188 * Toggles if UDP checksums should be used or not.
ban4jp 0:685224d2f66d 189 *
ban4jp 0:685224d2f66d 190 * \note Support for UDP checksums is currently not included in uIP,
ban4jp 0:685224d2f66d 191 * so this option has no function.
ban4jp 0:685224d2f66d 192 *
ban4jp 0:685224d2f66d 193 * \hideinitializer
ban4jp 0:685224d2f66d 194 */
ban4jp 0:685224d2f66d 195 #ifdef UIP_CONF_UDP_CHECKSUMS
ban4jp 0:685224d2f66d 196 #define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS
ban4jp 0:685224d2f66d 197 #else
ban4jp 0:685224d2f66d 198 #define UIP_UDP_CHECKSUMS 0
ban4jp 0:685224d2f66d 199 #endif
ban4jp 0:685224d2f66d 200
ban4jp 0:685224d2f66d 201 /**
ban4jp 0:685224d2f66d 202 * The maximum amount of concurrent UDP connections.
ban4jp 0:685224d2f66d 203 *
ban4jp 0:685224d2f66d 204 * \hideinitializer
ban4jp 0:685224d2f66d 205 */
ban4jp 0:685224d2f66d 206 #ifdef UIP_CONF_UDP_CONNS
ban4jp 0:685224d2f66d 207 #define UIP_UDP_CONNS UIP_CONF_UDP_CONNS
ban4jp 0:685224d2f66d 208 #else /* UIP_CONF_UDP_CONNS */
ban4jp 0:685224d2f66d 209 #define UIP_UDP_CONNS 10
ban4jp 0:685224d2f66d 210 #endif /* UIP_CONF_UDP_CONNS */
ban4jp 0:685224d2f66d 211
ban4jp 0:685224d2f66d 212 /**
ban4jp 0:685224d2f66d 213 * The name of the function that should be called when UDP datagrams arrive.
ban4jp 0:685224d2f66d 214 *
ban4jp 0:685224d2f66d 215 * \hideinitializer
ban4jp 0:685224d2f66d 216 */
ban4jp 0:685224d2f66d 217
ban4jp 0:685224d2f66d 218
ban4jp 0:685224d2f66d 219 /** @} */
ban4jp 0:685224d2f66d 220 /*------------------------------------------------------------------------------*/
ban4jp 0:685224d2f66d 221 /**
ban4jp 0:685224d2f66d 222 * \name TCP configuration options
ban4jp 0:685224d2f66d 223 * @{
ban4jp 0:685224d2f66d 224 */
ban4jp 0:685224d2f66d 225
ban4jp 0:685224d2f66d 226 /**
ban4jp 3:a2715e9c7737 227 * Toggles whether TCP support should be compiled in or not.
ban4jp 3:a2715e9c7737 228 *
ban4jp 3:a2715e9c7737 229 * \hideinitializer
ban4jp 3:a2715e9c7737 230 */
ban4jp 3:a2715e9c7737 231 #ifdef UIP_CONF_TCP
ban4jp 3:a2715e9c7737 232 #define UIP_TCP (UIP_CONF_TCP)
ban4jp 3:a2715e9c7737 233 #else /* UIP_CONF_TCP */
ban4jp 3:a2715e9c7737 234 #define UIP_TCP 1
ban4jp 3:a2715e9c7737 235 #endif /* UIP_CONF_TCP */
ban4jp 3:a2715e9c7737 236
ban4jp 3:a2715e9c7737 237 /**
ban4jp 0:685224d2f66d 238 * Determines if support for opening connections from uIP should be
ban4jp 0:685224d2f66d 239 * compiled in.
ban4jp 0:685224d2f66d 240 *
ban4jp 0:685224d2f66d 241 * If the applications that are running on top of uIP for this project
ban4jp 3:a2715e9c7737 242 * do not need to open outgoing TCP connections, this configuration
ban4jp 0:685224d2f66d 243 * option can be turned off to reduce the code size of uIP.
ban4jp 0:685224d2f66d 244 *
ban4jp 0:685224d2f66d 245 * \hideinitializer
ban4jp 0:685224d2f66d 246 */
ban4jp 0:685224d2f66d 247 #define UIP_ACTIVE_OPEN 1
ban4jp 0:685224d2f66d 248
ban4jp 0:685224d2f66d 249 /**
ban4jp 0:685224d2f66d 250 * The maximum number of simultaneously open TCP connections.
ban4jp 0:685224d2f66d 251 *
ban4jp 0:685224d2f66d 252 * Since the TCP connections are statically allocated, turning this
ban4jp 0:685224d2f66d 253 * configuration knob down results in less RAM used. Each TCP
ban4jp 3:a2715e9c7737 254 * connection requires approximately 30 bytes of memory.
ban4jp 0:685224d2f66d 255 *
ban4jp 0:685224d2f66d 256 * \hideinitializer
ban4jp 0:685224d2f66d 257 */
ban4jp 0:685224d2f66d 258 #ifndef UIP_CONF_MAX_CONNECTIONS
ban4jp 0:685224d2f66d 259 #define UIP_CONNS 10
ban4jp 0:685224d2f66d 260 #else /* UIP_CONF_MAX_CONNECTIONS */
ban4jp 0:685224d2f66d 261 #define UIP_CONNS UIP_CONF_MAX_CONNECTIONS
ban4jp 0:685224d2f66d 262 #endif /* UIP_CONF_MAX_CONNECTIONS */
ban4jp 0:685224d2f66d 263
ban4jp 0:685224d2f66d 264
ban4jp 0:685224d2f66d 265 /**
ban4jp 0:685224d2f66d 266 * The maximum number of simultaneously listening TCP ports.
ban4jp 0:685224d2f66d 267 *
ban4jp 0:685224d2f66d 268 * Each listening TCP port requires 2 bytes of memory.
ban4jp 0:685224d2f66d 269 *
ban4jp 0:685224d2f66d 270 * \hideinitializer
ban4jp 0:685224d2f66d 271 */
ban4jp 0:685224d2f66d 272 #ifndef UIP_CONF_MAX_LISTENPORTS
ban4jp 0:685224d2f66d 273 #define UIP_LISTENPORTS 20
ban4jp 0:685224d2f66d 274 #else /* UIP_CONF_MAX_LISTENPORTS */
ban4jp 0:685224d2f66d 275 #define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS
ban4jp 0:685224d2f66d 276 #endif /* UIP_CONF_MAX_LISTENPORTS */
ban4jp 0:685224d2f66d 277
ban4jp 0:685224d2f66d 278 /**
ban4jp 0:685224d2f66d 279 * Determines if support for TCP urgent data notification should be
ban4jp 0:685224d2f66d 280 * compiled in.
ban4jp 0:685224d2f66d 281 *
ban4jp 0:685224d2f66d 282 * Urgent data (out-of-band data) is a rarely used TCP feature that
ban4jp 0:685224d2f66d 283 * very seldom would be required.
ban4jp 0:685224d2f66d 284 *
ban4jp 0:685224d2f66d 285 * \hideinitializer
ban4jp 0:685224d2f66d 286 */
ban4jp 0:685224d2f66d 287 #define UIP_URGDATA 0
ban4jp 0:685224d2f66d 288
ban4jp 0:685224d2f66d 289 /**
ban4jp 0:685224d2f66d 290 * The initial retransmission timeout counted in timer pulses.
ban4jp 0:685224d2f66d 291 *
ban4jp 0:685224d2f66d 292 * This should not be changed.
ban4jp 0:685224d2f66d 293 */
ban4jp 0:685224d2f66d 294 #define UIP_RTO 3
ban4jp 0:685224d2f66d 295
ban4jp 0:685224d2f66d 296 /**
ban4jp 0:685224d2f66d 297 * The maximum number of times a segment should be retransmitted
ban4jp 0:685224d2f66d 298 * before the connection should be aborted.
ban4jp 0:685224d2f66d 299 *
ban4jp 0:685224d2f66d 300 * This should not be changed.
ban4jp 0:685224d2f66d 301 */
ban4jp 0:685224d2f66d 302 #define UIP_MAXRTX 8
ban4jp 0:685224d2f66d 303
ban4jp 0:685224d2f66d 304 /**
ban4jp 0:685224d2f66d 305 * The maximum number of times a SYN segment should be retransmitted
ban4jp 0:685224d2f66d 306 * before a connection request should be deemed to have been
ban4jp 0:685224d2f66d 307 * unsuccessful.
ban4jp 0:685224d2f66d 308 *
ban4jp 0:685224d2f66d 309 * This should not need to be changed.
ban4jp 0:685224d2f66d 310 */
ban4jp 0:685224d2f66d 311 #define UIP_MAXSYNRTX 5
ban4jp 0:685224d2f66d 312
ban4jp 0:685224d2f66d 313 /**
ban4jp 0:685224d2f66d 314 * The TCP maximum segment size.
ban4jp 0:685224d2f66d 315 *
ban4jp 0:685224d2f66d 316 * This is should not be to set to more than
ban4jp 0:685224d2f66d 317 * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
ban4jp 0:685224d2f66d 318 */
ban4jp 0:685224d2f66d 319 #define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
ban4jp 0:685224d2f66d 320
ban4jp 0:685224d2f66d 321 /**
ban4jp 0:685224d2f66d 322 * The size of the advertised receiver's window.
ban4jp 0:685224d2f66d 323 *
ban4jp 3:a2715e9c7737 324 * Should be set low (i.e., to the size of the uip_buf buffer) if the
ban4jp 0:685224d2f66d 325 * application is slow to process incoming data, or high (32768 bytes)
ban4jp 0:685224d2f66d 326 * if the application processes data quickly.
ban4jp 0:685224d2f66d 327 *
ban4jp 0:685224d2f66d 328 * \hideinitializer
ban4jp 0:685224d2f66d 329 */
ban4jp 0:685224d2f66d 330 #ifndef UIP_CONF_RECEIVE_WINDOW
ban4jp 0:685224d2f66d 331 #define UIP_RECEIVE_WINDOW UIP_TCP_MSS
ban4jp 0:685224d2f66d 332 #else
ban4jp 0:685224d2f66d 333 #define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW
ban4jp 0:685224d2f66d 334 #endif
ban4jp 0:685224d2f66d 335
ban4jp 0:685224d2f66d 336 /**
ban4jp 0:685224d2f66d 337 * How long a connection should stay in the TIME_WAIT state.
ban4jp 0:685224d2f66d 338 *
ban4jp 0:685224d2f66d 339 * This configiration option has no real implication, and it should be
ban4jp 0:685224d2f66d 340 * left untouched.
ban4jp 0:685224d2f66d 341 */
ban4jp 0:685224d2f66d 342 #define UIP_TIME_WAIT_TIMEOUT 120
ban4jp 0:685224d2f66d 343
ban4jp 0:685224d2f66d 344
ban4jp 0:685224d2f66d 345 /** @} */
ban4jp 0:685224d2f66d 346 /*------------------------------------------------------------------------------*/
ban4jp 0:685224d2f66d 347 /**
ban4jp 0:685224d2f66d 348 * \name ARP configuration options
ban4jp 0:685224d2f66d 349 * @{
ban4jp 0:685224d2f66d 350 */
ban4jp 0:685224d2f66d 351
ban4jp 0:685224d2f66d 352 /**
ban4jp 0:685224d2f66d 353 * The size of the ARP table.
ban4jp 0:685224d2f66d 354 *
ban4jp 0:685224d2f66d 355 * This option should be set to a larger value if this uIP node will
ban4jp 0:685224d2f66d 356 * have many connections from the local network.
ban4jp 0:685224d2f66d 357 *
ban4jp 0:685224d2f66d 358 * \hideinitializer
ban4jp 0:685224d2f66d 359 */
ban4jp 0:685224d2f66d 360 #ifdef UIP_CONF_ARPTAB_SIZE
ban4jp 0:685224d2f66d 361 #define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE
ban4jp 0:685224d2f66d 362 #else
ban4jp 0:685224d2f66d 363 #define UIP_ARPTAB_SIZE 8
ban4jp 0:685224d2f66d 364 #endif
ban4jp 0:685224d2f66d 365
ban4jp 0:685224d2f66d 366 /**
ban4jp 3:a2715e9c7737 367 * The maximum age of ARP table entries measured in 10ths of seconds.
ban4jp 0:685224d2f66d 368 *
ban4jp 0:685224d2f66d 369 * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
ban4jp 0:685224d2f66d 370 * default).
ban4jp 0:685224d2f66d 371 */
ban4jp 0:685224d2f66d 372 #define UIP_ARP_MAXAGE 120
ban4jp 0:685224d2f66d 373
ban4jp 0:685224d2f66d 374 /** @} */
ban4jp 0:685224d2f66d 375
ban4jp 0:685224d2f66d 376 /*------------------------------------------------------------------------------*/
ban4jp 0:685224d2f66d 377
ban4jp 0:685224d2f66d 378 /**
ban4jp 0:685224d2f66d 379 * \name General configuration options
ban4jp 0:685224d2f66d 380 * @{
ban4jp 0:685224d2f66d 381 */
ban4jp 0:685224d2f66d 382
ban4jp 0:685224d2f66d 383 /**
ban4jp 0:685224d2f66d 384 * The size of the uIP packet buffer.
ban4jp 0:685224d2f66d 385 *
ban4jp 0:685224d2f66d 386 * The uIP packet buffer should not be smaller than 60 bytes, and does
ban4jp 0:685224d2f66d 387 * not need to be larger than 1500 bytes. Lower size results in lower
ban4jp 0:685224d2f66d 388 * TCP throughput, larger size results in higher TCP throughput.
ban4jp 0:685224d2f66d 389 *
ban4jp 0:685224d2f66d 390 * \hideinitializer
ban4jp 0:685224d2f66d 391 */
ban4jp 0:685224d2f66d 392 #ifndef UIP_CONF_BUFFER_SIZE
ban4jp 0:685224d2f66d 393 #define UIP_BUFSIZE 400
ban4jp 0:685224d2f66d 394 #else /* UIP_CONF_BUFFER_SIZE */
ban4jp 0:685224d2f66d 395 #define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE
ban4jp 0:685224d2f66d 396 #endif /* UIP_CONF_BUFFER_SIZE */
ban4jp 0:685224d2f66d 397
ban4jp 0:685224d2f66d 398
ban4jp 0:685224d2f66d 399 /**
ban4jp 0:685224d2f66d 400 * Determines if statistics support should be compiled in.
ban4jp 0:685224d2f66d 401 *
ban4jp 0:685224d2f66d 402 * The statistics is useful for debugging and to show the user.
ban4jp 0:685224d2f66d 403 *
ban4jp 0:685224d2f66d 404 * \hideinitializer
ban4jp 0:685224d2f66d 405 */
ban4jp 0:685224d2f66d 406 #ifndef UIP_CONF_STATISTICS
ban4jp 0:685224d2f66d 407 #define UIP_STATISTICS 0
ban4jp 0:685224d2f66d 408 #else /* UIP_CONF_STATISTICS */
ban4jp 0:685224d2f66d 409 #define UIP_STATISTICS UIP_CONF_STATISTICS
ban4jp 0:685224d2f66d 410 #endif /* UIP_CONF_STATISTICS */
ban4jp 0:685224d2f66d 411
ban4jp 0:685224d2f66d 412 /**
ban4jp 0:685224d2f66d 413 * Determines if logging of certain events should be compiled in.
ban4jp 0:685224d2f66d 414 *
ban4jp 0:685224d2f66d 415 * This is useful mostly for debugging. The function uip_log()
ban4jp 0:685224d2f66d 416 * must be implemented to suit the architecture of the project, if
ban4jp 0:685224d2f66d 417 * logging is turned on.
ban4jp 0:685224d2f66d 418 *
ban4jp 0:685224d2f66d 419 * \hideinitializer
ban4jp 0:685224d2f66d 420 */
ban4jp 0:685224d2f66d 421 #ifndef UIP_CONF_LOGGING
ban4jp 0:685224d2f66d 422 #define UIP_LOGGING 0
ban4jp 0:685224d2f66d 423 #else /* UIP_CONF_LOGGING */
ban4jp 0:685224d2f66d 424 #define UIP_LOGGING UIP_CONF_LOGGING
ban4jp 0:685224d2f66d 425 #endif /* UIP_CONF_LOGGING */
ban4jp 0:685224d2f66d 426
ban4jp 0:685224d2f66d 427 /**
ban4jp 0:685224d2f66d 428 * Broadcast support.
ban4jp 0:685224d2f66d 429 *
ban4jp 0:685224d2f66d 430 * This flag configures IP broadcast support. This is useful only
ban4jp 0:685224d2f66d 431 * together with UDP.
ban4jp 0:685224d2f66d 432 *
ban4jp 0:685224d2f66d 433 * \hideinitializer
ban4jp 0:685224d2f66d 434 *
ban4jp 0:685224d2f66d 435 */
ban4jp 0:685224d2f66d 436 #ifndef UIP_CONF_BROADCAST
ban4jp 0:685224d2f66d 437 #define UIP_BROADCAST 0
ban4jp 0:685224d2f66d 438 #else /* UIP_CONF_BROADCAST */
ban4jp 0:685224d2f66d 439 #define UIP_BROADCAST UIP_CONF_BROADCAST
ban4jp 0:685224d2f66d 440 #endif /* UIP_CONF_BROADCAST */
ban4jp 0:685224d2f66d 441
ban4jp 0:685224d2f66d 442 /**
ban4jp 0:685224d2f66d 443 * Print out a uIP log message.
ban4jp 0:685224d2f66d 444 *
ban4jp 0:685224d2f66d 445 * This function must be implemented by the module that uses uIP, and
ban4jp 0:685224d2f66d 446 * is called by uIP whenever a log message is generated.
ban4jp 0:685224d2f66d 447 */
ban4jp 0:685224d2f66d 448 void uip_log(char *msg);
ban4jp 0:685224d2f66d 449
ban4jp 0:685224d2f66d 450 /**
ban4jp 0:685224d2f66d 451 * The link level header length.
ban4jp 0:685224d2f66d 452 *
ban4jp 0:685224d2f66d 453 * This is the offset into the uip_buf where the IP header can be
ban4jp 0:685224d2f66d 454 * found. For Ethernet, this should be set to 14. For SLIP, this
ban4jp 0:685224d2f66d 455 * should be set to 0.
ban4jp 0:685224d2f66d 456 *
ban4jp 0:685224d2f66d 457 * \hideinitializer
ban4jp 0:685224d2f66d 458 */
ban4jp 0:685224d2f66d 459 #ifdef UIP_CONF_LLH_LEN
ban4jp 0:685224d2f66d 460 #define UIP_LLH_LEN UIP_CONF_LLH_LEN
ban4jp 0:685224d2f66d 461 #else /* UIP_CONF_LLH_LEN */
ban4jp 0:685224d2f66d 462 #define UIP_LLH_LEN 14
ban4jp 0:685224d2f66d 463 #endif /* UIP_CONF_LLH_LEN */
ban4jp 0:685224d2f66d 464
ban4jp 0:685224d2f66d 465 /** @} */
ban4jp 0:685224d2f66d 466 /*------------------------------------------------------------------------------*/
ban4jp 0:685224d2f66d 467 /**
ban4jp 0:685224d2f66d 468 * \name CPU architecture configuration
ban4jp 0:685224d2f66d 469 * @{
ban4jp 0:685224d2f66d 470 *
ban4jp 0:685224d2f66d 471 * The CPU architecture configuration is where the endianess of the
ban4jp 0:685224d2f66d 472 * CPU on which uIP is to be run is specified. Most CPUs today are
ban4jp 0:685224d2f66d 473 * little endian, and the most notable exception are the Motorolas
ban4jp 0:685224d2f66d 474 * which are big endian. The BYTE_ORDER macro should be changed to
ban4jp 0:685224d2f66d 475 * reflect the CPU architecture on which uIP is to be run.
ban4jp 0:685224d2f66d 476 */
ban4jp 0:685224d2f66d 477
ban4jp 0:685224d2f66d 478 /**
ban4jp 0:685224d2f66d 479 * The byte order of the CPU architecture on which uIP is to be run.
ban4jp 0:685224d2f66d 480 *
ban4jp 0:685224d2f66d 481 * This option can be either BIG_ENDIAN (Motorola byte order) or
ban4jp 0:685224d2f66d 482 * LITTLE_ENDIAN (Intel byte order).
ban4jp 0:685224d2f66d 483 *
ban4jp 0:685224d2f66d 484 * \hideinitializer
ban4jp 0:685224d2f66d 485 */
ban4jp 0:685224d2f66d 486 #ifdef UIP_CONF_BYTE_ORDER
ban4jp 0:685224d2f66d 487 #define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER
ban4jp 0:685224d2f66d 488 #else /* UIP_CONF_BYTE_ORDER */
ban4jp 0:685224d2f66d 489 #define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN
ban4jp 0:685224d2f66d 490 #endif /* UIP_CONF_BYTE_ORDER */
ban4jp 0:685224d2f66d 491
ban4jp 0:685224d2f66d 492 /** @} */
ban4jp 0:685224d2f66d 493 /*------------------------------------------------------------------------------*/
ban4jp 0:685224d2f66d 494
ban4jp 0:685224d2f66d 495 /**
ban4jp 3:a2715e9c7737 496 * \name Application specific configurations
ban4jp 0:685224d2f66d 497 * @{
ban4jp 0:685224d2f66d 498 *
ban4jp 0:685224d2f66d 499 * An uIP application is implemented using a single application
ban4jp 0:685224d2f66d 500 * function that is called by uIP whenever a TCP/IP event occurs. The
ban4jp 0:685224d2f66d 501 * name of this function must be registered with uIP at compile time
ban4jp 0:685224d2f66d 502 * using the UIP_APPCALL definition.
ban4jp 0:685224d2f66d 503 *
ban4jp 0:685224d2f66d 504 * uIP applications can store the application state within the
ban4jp 0:685224d2f66d 505 * uip_conn structure by specifying the type of the application
ban4jp 0:685224d2f66d 506 * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t.
ban4jp 0:685224d2f66d 507 *
ban4jp 0:685224d2f66d 508 * The file containing the definitions must be included in the
ban4jp 0:685224d2f66d 509 * uipopt.h file.
ban4jp 0:685224d2f66d 510 *
ban4jp 0:685224d2f66d 511 * The following example illustrates how this can look.
ban4jp 0:685224d2f66d 512 \code
ban4jp 0:685224d2f66d 513
ban4jp 0:685224d2f66d 514 void httpd_appcall(void);
ban4jp 0:685224d2f66d 515 #define UIP_APPCALL httpd_appcall
ban4jp 0:685224d2f66d 516
ban4jp 0:685224d2f66d 517 struct httpd_state {
ban4jp 0:685224d2f66d 518 u8_t state;
ban4jp 0:685224d2f66d 519 u16_t count;
ban4jp 0:685224d2f66d 520 char *dataptr;
ban4jp 0:685224d2f66d 521 char *script;
ban4jp 0:685224d2f66d 522 };
ban4jp 0:685224d2f66d 523 typedef struct httpd_state uip_tcp_appstate_t
ban4jp 0:685224d2f66d 524 \endcode
ban4jp 0:685224d2f66d 525 */
ban4jp 0:685224d2f66d 526
ban4jp 0:685224d2f66d 527 /**
ban4jp 0:685224d2f66d 528 * \var #define UIP_APPCALL
ban4jp 0:685224d2f66d 529 *
ban4jp 0:685224d2f66d 530 * The name of the application function that uIP should call in
ban4jp 0:685224d2f66d 531 * response to TCP/IP events.
ban4jp 0:685224d2f66d 532 *
ban4jp 0:685224d2f66d 533 */
ban4jp 0:685224d2f66d 534
ban4jp 0:685224d2f66d 535 /**
ban4jp 0:685224d2f66d 536 * \var typedef uip_tcp_appstate_t
ban4jp 0:685224d2f66d 537 *
ban4jp 0:685224d2f66d 538 * The type of the application state that is to be stored in the
ban4jp 0:685224d2f66d 539 * uip_conn structure. This usually is typedef:ed to a struct holding
ban4jp 0:685224d2f66d 540 * application state information.
ban4jp 0:685224d2f66d 541 */
ban4jp 0:685224d2f66d 542
ban4jp 0:685224d2f66d 543 /**
ban4jp 0:685224d2f66d 544 * \var typedef uip_udp_appstate_t
ban4jp 0:685224d2f66d 545 *
ban4jp 0:685224d2f66d 546 * The type of the application state that is to be stored in the
ban4jp 0:685224d2f66d 547 * uip_conn structure. This usually is typedef:ed to a struct holding
ban4jp 0:685224d2f66d 548 * application state information.
ban4jp 0:685224d2f66d 549 */
ban4jp 0:685224d2f66d 550 /** @} */
ban4jp 0:685224d2f66d 551 /** @} */
ban4jp 0:685224d2f66d 552
ban4jp 0:685224d2f66d 553 #endif /* __UIPOPT_H__ */