diff options
Diffstat (limited to 'lib/lufa/Projects/Webserver/Lib/uip/uipopt.h')
| -rw-r--r-- | lib/lufa/Projects/Webserver/Lib/uip/uipopt.h | 740 |
1 files changed, 0 insertions, 740 deletions
diff --git a/lib/lufa/Projects/Webserver/Lib/uip/uipopt.h b/lib/lufa/Projects/Webserver/Lib/uip/uipopt.h deleted file mode 100644 index 520c03f25..000000000 --- a/lib/lufa/Projects/Webserver/Lib/uip/uipopt.h +++ /dev/null | |||
| @@ -1,740 +0,0 @@ | |||
| 1 | /** | ||
| 2 | * \addtogroup uip | ||
| 3 | * @{ | ||
| 4 | */ | ||
| 5 | |||
| 6 | /** | ||
| 7 | * \defgroup uipopt Configuration options for uIP | ||
| 8 | * @{ | ||
| 9 | * | ||
| 10 | * uIP is configured using the per-project configuration file | ||
| 11 | * "uipopt.h". This file contains all compile-time options for uIP and | ||
| 12 | * should be tweaked to match each specific project. The uIP | ||
| 13 | * distribution contains a documented example "uipopt.h" that can be | ||
| 14 | * copied and modified for each project. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /** | ||
| 18 | * \file | ||
| 19 | * Configuration options for uIP. | ||
| 20 | * \author Adam Dunkels <adam@dunkels.com> | ||
| 21 | * | ||
| 22 | * This file is used for tweaking various configuration options for | ||
| 23 | * uIP. You should make a copy of this file into one of your project's | ||
| 24 | * directories instead of editing this example "uipopt.h" file that | ||
| 25 | * comes with the uIP distribution. | ||
| 26 | */ | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Copyright (c) 2001-2003, Adam Dunkels. | ||
| 30 | * All rights reserved. | ||
| 31 | * | ||
| 32 | * Redistribution and use in source and binary forms, with or without | ||
| 33 | * modification, are permitted provided that the following conditions | ||
| 34 | * are met: | ||
| 35 | * 1. Redistributions of source code must retain the above copyright | ||
| 36 | * notice, this list of conditions and the following disclaimer. | ||
| 37 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 38 | * notice, this list of conditions and the following disclaimer in the | ||
| 39 | * documentation and/or other materials provided with the distribution. | ||
| 40 | * 3. The name of the author may not be used to endorse or promote | ||
| 41 | * products derived from this software without specific prior | ||
| 42 | * written permission. | ||
| 43 | * | ||
| 44 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS | ||
| 45 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
| 46 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 47 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
| 48 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 49 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
| 50 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 51 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
| 52 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| 53 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| 54 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 55 | * | ||
| 56 | * This file is part of the uIP TCP/IP stack. | ||
| 57 | * | ||
| 58 | * $Id: uipopt.h,v 1.11 2009/04/10 00:37:48 adamdunkels Exp $ | ||
| 59 | * | ||
| 60 | */ | ||
| 61 | |||
| 62 | #ifndef __UIPOPT_H__ | ||
| 63 | #define __UIPOPT_H__ | ||
| 64 | |||
| 65 | #include "Config/AppConfig.h" | ||
| 66 | |||
| 67 | #ifndef UIP_LITTLE_ENDIAN | ||
| 68 | #define UIP_LITTLE_ENDIAN 3412 | ||
| 69 | #endif /* UIP_LITTLE_ENDIAN */ | ||
| 70 | #ifndef UIP_BIG_ENDIAN | ||
| 71 | #define UIP_BIG_ENDIAN 1234 | ||
| 72 | #endif /* UIP_BIG_ENDIAN */ | ||
| 73 | |||
| 74 | /*------------------------------------------------------------------------------*/ | ||
| 75 | |||
| 76 | /** | ||
| 77 | * \defgroup uipoptstaticconf Static configuration options | ||
| 78 | * @{ | ||
| 79 | * | ||
| 80 | * These configuration options can be used for setting the IP address | ||
| 81 | * settings statically, but only if UIP_FIXEDADDR is set to 1. The | ||
| 82 | * configuration options for a specific node includes IP address, | ||
| 83 | * netmask and default router as well as the Ethernet address. The | ||
| 84 | * netmask, default router and Ethernet address are applicable only | ||
| 85 | * if uIP should be run over Ethernet. | ||
| 86 | * | ||
| 87 | * This options are meaningful only for the IPv4 code. | ||
| 88 | * | ||
| 89 | * All of these should be changed to suit your project. | ||
| 90 | */ | ||
| 91 | |||
| 92 | /** | ||
| 93 | * Determines if uIP should use a fixed IP address or not. | ||
| 94 | * | ||
| 95 | * If uIP should use a fixed IP address, the settings are set in the | ||
| 96 | * uipopt.h file. If not, the macros uip_sethostaddr(), | ||
| 97 | * uip_setdraddr() and uip_setnetmask() should be used instead. | ||
| 98 | * | ||
| 99 | * \hideinitializer | ||
| 100 | */ | ||
| 101 | #define UIP_FIXEDADDR 0 | ||
| 102 | |||
| 103 | /** | ||
| 104 | * Ping IP address assignment. | ||
| 105 | * | ||
| 106 | * uIP uses a "ping" packets for setting its own IP address if this | ||
| 107 | * option is set. If so, uIP will start with an empty IP address and | ||
| 108 | * the destination IP address of the first incoming "ping" (ICMP echo) | ||
| 109 | * packet will be used for setting the hosts IP address. | ||
| 110 | * | ||
| 111 | * \note This works only if UIP_FIXEDADDR is 0. | ||
| 112 | * | ||
| 113 | * \hideinitializer | ||
| 114 | */ | ||
| 115 | #ifdef UIP_CONF_PINGADDRCONF | ||
| 116 | #define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF | ||
| 117 | #else /* UIP_CONF_PINGADDRCONF */ | ||
| 118 | #define UIP_PINGADDRCONF 0 | ||
| 119 | #endif /* UIP_CONF_PINGADDRCONF */ | ||
| 120 | |||
| 121 | |||
| 122 | /** | ||
| 123 | * Specifies if the uIP ARP module should be compiled with a fixed | ||
| 124 | * Ethernet MAC address or not. | ||
| 125 | * | ||
| 126 | * If this configuration option is 0, the macro uip_setethaddr() can | ||
| 127 | * be used to specify the Ethernet address at run-time. | ||
| 128 | * | ||
| 129 | * \hideinitializer | ||
| 130 | */ | ||
| 131 | #define UIP_FIXEDETHADDR 0 | ||
| 132 | |||
| 133 | /** @} */ | ||
| 134 | /*------------------------------------------------------------------------------*/ | ||
| 135 | /** | ||
| 136 | * \defgroup uipoptip IP configuration options | ||
| 137 | * @{ | ||
| 138 | * | ||
| 139 | */ | ||
| 140 | /** | ||
| 141 | * The IP TTL (time to live) of IP packets sent by uIP. | ||
| 142 | * | ||
| 143 | * This should normally not be changed. | ||
| 144 | */ | ||
| 145 | #define UIP_TTL 64 | ||
| 146 | |||
| 147 | /** | ||
| 148 | * The maximum time an IP fragment should wait in the reassembly | ||
| 149 | * buffer before it is dropped. | ||
| 150 | * | ||
| 151 | */ | ||
| 152 | #define UIP_REASS_MAXAGE 60 /*60s*/ | ||
| 153 | |||
| 154 | /** | ||
| 155 | * Turn on support for IP packet reassembly. | ||
| 156 | * | ||
| 157 | * uIP supports reassembly of fragmented IP packets. This features | ||
| 158 | * requires an additional amount of RAM to hold the reassembly buffer | ||
| 159 | * and the reassembly code size is approximately 700 bytes. The | ||
| 160 | * reassembly buffer is of the same size as the uip_buf buffer | ||
| 161 | * (configured by UIP_BUFSIZE). | ||
| 162 | * | ||
| 163 | * \note IP packet reassembly is not heavily tested. | ||
| 164 | * | ||
| 165 | * \hideinitializer | ||
| 166 | */ | ||
| 167 | #ifdef UIP_CONF_REASSEMBLY | ||
| 168 | #define UIP_REASSEMBLY UIP_CONF_REASSEMBLY | ||
| 169 | #else /* UIP_CONF_REASSEMBLY */ | ||
| 170 | #define UIP_REASSEMBLY 0 | ||
| 171 | #endif /* UIP_CONF_REASSEMBLY */ | ||
| 172 | /** @} */ | ||
| 173 | |||
| 174 | /*------------------------------------------------------------------------------*/ | ||
| 175 | /** | ||
| 176 | * \defgroup uipoptipv6 IPv6 configuration options | ||
| 177 | * @{ | ||
| 178 | * | ||
| 179 | */ | ||
| 180 | |||
| 181 | /** The maximum transmission unit at the IP Layer*/ | ||
| 182 | #define UIP_LINK_MTU 1280 | ||
| 183 | |||
| 184 | #ifndef UIP_CONF_IPV6 | ||
| 185 | /** Do we use IPv6 or not (default: no) */ | ||
| 186 | #define UIP_CONF_IPV6 0 | ||
| 187 | #endif | ||
| 188 | |||
| 189 | #ifndef UIP_CONF_IPV6_QUEUE_PKT | ||
| 190 | /** Do we do per %neighbor queuing during address resolution (default: no) */ | ||
| 191 | #define UIP_CONF_IPV6_QUEUE_PKT 0 | ||
| 192 | #endif | ||
| 193 | |||
| 194 | #ifndef UIP_CONF_IPV6_CHECKS | ||
| 195 | /** Do we do IPv6 consistency checks (highly recommended, default: yes) */ | ||
| 196 | #define UIP_CONF_IPV6_CHECKS 1 | ||
| 197 | #endif | ||
| 198 | |||
| 199 | #ifndef UIP_CONF_IPV6_REASSEMBLY | ||
| 200 | /** Do we do IPv6 fragmentation (default: no) */ | ||
| 201 | #define UIP_CONF_IPV6_REASSEMBLY 0 | ||
| 202 | #endif | ||
| 203 | |||
| 204 | #ifndef UIP_CONF_NETIF_MAX_ADDRESSES | ||
| 205 | /** Default number of IPv6 addresses associated to the node's interface */ | ||
| 206 | #define UIP_CONF_NETIF_MAX_ADDRESSES 3 | ||
| 207 | #endif | ||
| 208 | |||
| 209 | #ifndef UIP_CONF_ND6_MAX_PREFIXES | ||
| 210 | /** Default number of IPv6 prefixes associated to the node's interface */ | ||
| 211 | #define UIP_CONF_ND6_MAX_PREFIXES 3 | ||
| 212 | #endif | ||
| 213 | |||
| 214 | #ifndef UIP_CONF_ND6_MAX_NEIGHBORS | ||
| 215 | /** Default number of neighbors that can be stored in the %neighbor cache */ | ||
| 216 | #define UIP_CONF_ND6_MAX_NEIGHBORS 4 | ||
| 217 | #endif | ||
| 218 | |||
| 219 | #ifndef UIP_CONF_ND6_MAX_DEFROUTERS | ||
| 220 | /** Minimum number of default routers */ | ||
| 221 | #define UIP_CONF_ND6_MAX_DEFROUTERS 2 | ||
| 222 | #endif | ||
| 223 | /** @} */ | ||
| 224 | |||
| 225 | /*------------------------------------------------------------------------------*/ | ||
| 226 | /** | ||
| 227 | * \defgroup uipoptudp UDP configuration options | ||
| 228 | * @{ | ||
| 229 | * | ||
| 230 | * \note The UDP support in uIP is still not entirely complete; there | ||
| 231 | * is no support for sending or receiving broadcast or multicast | ||
| 232 | * packets, but it works well enough to support a number of vital | ||
| 233 | * applications such as DNS queries, though | ||
| 234 | */ | ||
| 235 | |||
| 236 | /** | ||
| 237 | * Toggles whether UDP support should be compiled in or not. | ||
| 238 | * | ||
| 239 | * \hideinitializer | ||
| 240 | */ | ||
| 241 | #ifdef UIP_CONF_UDP | ||
| 242 | #define UIP_UDP UIP_CONF_UDP | ||
| 243 | #else /* UIP_CONF_UDP */ | ||
| 244 | #define UIP_UDP 1 | ||
| 245 | #endif /* UIP_CONF_UDP */ | ||
| 246 | |||
| 247 | /** | ||
| 248 | * Toggles if UDP checksums should be used or not. | ||
| 249 | * | ||
| 250 | * \note Support for UDP checksums is currently not included in uIP, | ||
| 251 | * so this option has no function. | ||
| 252 | * | ||
| 253 | * \hideinitializer | ||
| 254 | */ | ||
| 255 | #ifdef UIP_CONF_UDP_CHECKSUMS | ||
| 256 | #define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS | ||
| 257 | #else | ||
| 258 | #define UIP_UDP_CHECKSUMS 0 | ||
| 259 | #endif | ||
| 260 | |||
| 261 | /** | ||
| 262 | * The maximum amount of concurrent UDP connections. | ||
| 263 | * | ||
| 264 | * \hideinitializer | ||
| 265 | */ | ||
| 266 | #ifdef UIP_CONF_UDP_CONNS | ||
| 267 | #define UIP_UDP_CONNS UIP_CONF_UDP_CONNS | ||
| 268 | #else /* UIP_CONF_UDP_CONNS */ | ||
| 269 | #define UIP_UDP_CONNS 10 | ||
| 270 | #endif /* UIP_CONF_UDP_CONNS */ | ||
| 271 | |||
| 272 | /** | ||
| 273 | * The name of the function that should be called when UDP datagrams arrive. | ||
| 274 | * | ||
| 275 | * \hideinitializer | ||
| 276 | */ | ||
| 277 | |||
| 278 | |||
| 279 | /** @} */ | ||
| 280 | /*------------------------------------------------------------------------------*/ | ||
| 281 | /** | ||
| 282 | * \defgroup uipopttcp TCP configuration options | ||
| 283 | * @{ | ||
| 284 | */ | ||
| 285 | |||
| 286 | /** | ||
| 287 | * Toggles whether TCP support should be compiled in or not. | ||
| 288 | * | ||
| 289 | * \hideinitializer | ||
| 290 | */ | ||
| 291 | #ifdef UIP_CONF_TCP | ||
| 292 | #define UIP_TCP UIP_CONF_TCP | ||
| 293 | #else /* UIP_CONF_TCP */ | ||
| 294 | #define UIP_TCP 1 | ||
| 295 | #endif /* UIP_CONF_TCP */ | ||
| 296 | |||
| 297 | /** | ||
| 298 | * Determines if support for opening connections from uIP should be | ||
| 299 | * compiled in. | ||
| 300 | * | ||
| 301 | * If the applications that are running on top of uIP for this project | ||
| 302 | * do not need to open outgoing TCP connections, this configuration | ||
| 303 | * option can be turned off to reduce the code size of uIP. | ||
| 304 | * | ||
| 305 | * \hideinitializer | ||
| 306 | */ | ||
| 307 | #ifndef UIP_CONF_ACTIVE_OPEN | ||
| 308 | #define UIP_ACTIVE_OPEN 1 | ||
| 309 | #else /* UIP_CONF_ACTIVE_OPEN */ | ||
| 310 | #define UIP_ACTIVE_OPEN UIP_CONF_ACTIVE_OPEN | ||
| 311 | #endif /* UIP_CONF_ACTIVE_OPEN */ | ||
| 312 | |||
| 313 | /** | ||
| 314 | * The maximum number of simultaneously open TCP connections. | ||
| 315 | * | ||
| 316 | * Since the TCP connections are statically allocated, turning this | ||
| 317 | * configuration knob down results in less RAM used. Each TCP | ||
| 318 | * connection requires approximately 30 bytes of memory. | ||
| 319 | * | ||
| 320 | * \hideinitializer | ||
| 321 | */ | ||
| 322 | #ifndef UIP_CONF_MAX_CONNECTIONS | ||
| 323 | #define UIP_CONNS 10 | ||
| 324 | #else /* UIP_CONF_MAX_CONNECTIONS */ | ||
| 325 | #define UIP_CONNS UIP_CONF_MAX_CONNECTIONS | ||
| 326 | #endif /* UIP_CONF_MAX_CONNECTIONS */ | ||
| 327 | |||
| 328 | |||
| 329 | /** | ||
| 330 | * The maximum number of simultaneously listening TCP ports. | ||
| 331 | * | ||
| 332 | * Each listening TCP port requires 2 bytes of memory. | ||
| 333 | * | ||
| 334 | * \hideinitializer | ||
| 335 | */ | ||
| 336 | #ifndef UIP_CONF_MAX_LISTENPORTS | ||
| 337 | #define UIP_LISTENPORTS 20 | ||
| 338 | #else /* UIP_CONF_MAX_LISTENPORTS */ | ||
| 339 | #define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS | ||
| 340 | #endif /* UIP_CONF_MAX_LISTENPORTS */ | ||
| 341 | |||
| 342 | /** | ||
| 343 | * Determines if support for TCP urgent data notification should be | ||
| 344 | * compiled in. | ||
| 345 | * | ||
| 346 | * Urgent data (out-of-band data) is a rarely used TCP feature that | ||
| 347 | * very seldom would be required. | ||
| 348 | * | ||
| 349 | * \hideinitializer | ||
| 350 | */ | ||
| 351 | #if !defined(UIP_URGDATA) | ||
| 352 | #define UIP_URGDATA 0 | ||
| 353 | #endif | ||
| 354 | |||
| 355 | /** | ||
| 356 | * The initial retransmission timeout counted in timer pulses. | ||
| 357 | * | ||
| 358 | * This should not be changed. | ||
| 359 | */ | ||
| 360 | #if !defined(UIP_RTO) | ||
| 361 | #define UIP_RTO 3 | ||
| 362 | #endif | ||
| 363 | |||
| 364 | /** | ||
| 365 | * The maximum number of times a segment should be retransmitted | ||
| 366 | * before the connection should be aborted. | ||
| 367 | * | ||
| 368 | * This should not be changed. | ||
| 369 | */ | ||
| 370 | #if !defined(UIP_MAXRTX) | ||
| 371 | #define UIP_MAXRTX 8 | ||
| 372 | #endif | ||
| 373 | |||
| 374 | /** | ||
| 375 | * The maximum number of times a SYN segment should be retransmitted | ||
| 376 | * before a connection request should be deemed to have been | ||
| 377 | * unsuccessful. | ||
| 378 | * | ||
| 379 | * This should not need to be changed. | ||
| 380 | */ | ||
| 381 | #if !defined(UIP_MAXSYNRTX) | ||
| 382 | #define UIP_MAXSYNRTX 5 | ||
| 383 | #endif | ||
| 384 | |||
| 385 | /** | ||
| 386 | * The TCP maximum segment size. | ||
| 387 | * | ||
| 388 | * This is should not be to set to more than | ||
| 389 | * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN. | ||
| 390 | */ | ||
| 391 | #ifdef UIP_CONF_TCP_MSS | ||
| 392 | #define UIP_TCP_MSS UIP_CONF_TCP_MSS | ||
| 393 | #else | ||
| 394 | #define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) | ||
| 395 | #endif | ||
| 396 | |||
| 397 | /** | ||
| 398 | * The size of the advertised receiver's window. | ||
| 399 | * | ||
| 400 | * Should be set low (i.e., to the size of the uip_buf buffer) if the | ||
| 401 | * application is slow to process incoming data, or high (32768 bytes) | ||
| 402 | * if the application processes data quickly. | ||
| 403 | * | ||
| 404 | * \hideinitializer | ||
| 405 | */ | ||
| 406 | #ifndef UIP_CONF_RECEIVE_WINDOW | ||
| 407 | #define UIP_RECEIVE_WINDOW UIP_TCP_MSS | ||
| 408 | #else | ||
| 409 | #define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW | ||
| 410 | #endif | ||
| 411 | |||
| 412 | /** | ||
| 413 | * How long a connection should stay in the TIME_WAIT state. | ||
| 414 | * | ||
| 415 | * This configuration option has no real implication, and it should be | ||
| 416 | * left untouched. | ||
| 417 | */ | ||
| 418 | #define UIP_TIME_WAIT_TIMEOUT 120 | ||
| 419 | |||
| 420 | |||
| 421 | /** @} */ | ||
| 422 | /*------------------------------------------------------------------------------*/ | ||
| 423 | /** | ||
| 424 | * \defgroup uipoptarp ARP configuration options | ||
| 425 | * @{ | ||
| 426 | */ | ||
| 427 | |||
| 428 | /** | ||
| 429 | * The size of the ARP table. | ||
| 430 | * | ||
| 431 | * This option should be set to a larger value if this uIP node will | ||
| 432 | * have many connections from the local network. | ||
| 433 | * | ||
| 434 | * \hideinitializer | ||
| 435 | */ | ||
| 436 | #ifdef UIP_CONF_ARPTAB_SIZE | ||
| 437 | #define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE | ||
| 438 | #else | ||
| 439 | #define UIP_ARPTAB_SIZE 8 | ||
| 440 | #endif | ||
| 441 | |||
| 442 | /** | ||
| 443 | * The maximum age of ARP table entries measured in 10ths of seconds. | ||
| 444 | * | ||
| 445 | * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD | ||
| 446 | * default). | ||
| 447 | */ | ||
| 448 | #define UIP_ARP_MAXAGE 120 | ||
| 449 | |||
| 450 | |||
| 451 | /** @} */ | ||
| 452 | |||
| 453 | /*------------------------------------------------------------------------------*/ | ||
| 454 | |||
| 455 | /** | ||
| 456 | * \defgroup uipoptmac layer 2 options (for ipv6) | ||
| 457 | * @{ | ||
| 458 | */ | ||
| 459 | |||
| 460 | #define UIP_DEFAULT_PREFIX_LEN 64 | ||
| 461 | |||
| 462 | /** @} */ | ||
| 463 | |||
| 464 | /*------------------------------------------------------------------------------*/ | ||
| 465 | |||
| 466 | /** | ||
| 467 | * \defgroup uipoptsics 6lowpan options (for ipv6) | ||
| 468 | * @{ | ||
| 469 | */ | ||
| 470 | /** | ||
| 471 | * Timeout for packet reassembly at the 6lowpan layer | ||
| 472 | * (should be < 60s) | ||
| 473 | */ | ||
| 474 | #ifdef SICSLOWPAN_CONF_MAXAGE | ||
| 475 | #define SICSLOWPAN_REASS_MAXAGE SICSLOWPAN_CONF_MAXAGE | ||
| 476 | #else | ||
| 477 | #define SICSLOWPAN_REASS_MAXAGE 20 | ||
| 478 | #endif | ||
| 479 | |||
| 480 | /** | ||
| 481 | * Do we compress the IP header or not (default: no) | ||
| 482 | */ | ||
| 483 | #ifndef SICSLOWPAN_CONF_COMPRESSION | ||
| 484 | #define SICSLOWPAN_CONF_COMPRESSION 0 | ||
| 485 | #endif | ||
| 486 | |||
| 487 | /** | ||
| 488 | * If we use IPHC compression, how many address contexts do we support | ||
| 489 | */ | ||
| 490 | #ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS | ||
| 491 | #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1 | ||
| 492 | #endif | ||
| 493 | |||
| 494 | /** | ||
| 495 | * Do we support 6lowpan fragmentation | ||
| 496 | */ | ||
| 497 | #ifndef SICSLOWPAN_CONF_FRAG | ||
| 498 | #define SICSLOWPAN_CONF_FRAG 0 | ||
| 499 | #endif | ||
| 500 | |||
| 501 | /** @} */ | ||
| 502 | |||
| 503 | /*------------------------------------------------------------------------------*/ | ||
| 504 | |||
| 505 | /** | ||
| 506 | * \defgroup uipoptgeneral General configuration options | ||
| 507 | * @{ | ||
| 508 | */ | ||
| 509 | |||
| 510 | /** | ||
| 511 | * The size of the uIP packet buffer. | ||
| 512 | * | ||
| 513 | * The uIP packet buffer should not be smaller than 60 bytes, and does | ||
| 514 | * not need to be larger than 1514 bytes. Lower size results in lower | ||
| 515 | * TCP throughput, larger size results in higher TCP throughput. | ||
| 516 | * | ||
| 517 | * \hideinitializer | ||
| 518 | */ | ||
| 519 | #ifndef UIP_CONF_BUFFER_SIZE | ||
| 520 | #define UIP_BUFSIZE UIP_LINK_MTU + UIP_LLH_LEN | ||
| 521 | #else /* UIP_CONF_BUFFER_SIZE */ | ||
| 522 | #define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE | ||
| 523 | #endif /* UIP_CONF_BUFFER_SIZE */ | ||
| 524 | |||
| 525 | |||
| 526 | /** | ||
| 527 | * Determines if statistics support should be compiled in. | ||
| 528 | * | ||
| 529 | * The statistics is useful for debugging and to show the user. | ||
| 530 | * | ||
| 531 | * \hideinitializer | ||
| 532 | */ | ||
| 533 | #ifndef UIP_CONF_STATISTICS | ||
| 534 | #define UIP_STATISTICS 0 | ||
| 535 | #else /* UIP_CONF_STATISTICS */ | ||
| 536 | #define UIP_STATISTICS UIP_CONF_STATISTICS | ||
| 537 | #endif /* UIP_CONF_STATISTICS */ | ||
| 538 | |||
| 539 | /** | ||
| 540 | * Determines if logging of certain events should be compiled in. | ||
| 541 | * | ||
| 542 | * This is useful mostly for debugging. The function uip_log() | ||
| 543 | * must be implemented to suit the architecture of the project, if | ||
| 544 | * logging is turned on. | ||
| 545 | * | ||
| 546 | * \hideinitializer | ||
| 547 | */ | ||
| 548 | #ifndef UIP_CONF_LOGGING | ||
| 549 | #define UIP_LOGGING 0 | ||
| 550 | #else /* UIP_CONF_LOGGING */ | ||
| 551 | #define UIP_LOGGING UIP_CONF_LOGGING | ||
| 552 | #endif /* UIP_CONF_LOGGING */ | ||
| 553 | |||
| 554 | /** | ||
| 555 | * Broadcast support. | ||
| 556 | * | ||
| 557 | * This flag configures IP broadcast support. This is useful only | ||
| 558 | * together with UDP. | ||
| 559 | * | ||
| 560 | * \hideinitializer | ||
| 561 | * | ||
| 562 | */ | ||
| 563 | #ifndef UIP_CONF_BROADCAST | ||
| 564 | #define UIP_BROADCAST 0 | ||
| 565 | #else /* UIP_CONF_BROADCAST */ | ||
| 566 | #define UIP_BROADCAST UIP_CONF_BROADCAST | ||
| 567 | #endif /* UIP_CONF_BROADCAST */ | ||
| 568 | |||
| 569 | /** | ||
| 570 | * Print out a uIP log message. | ||
| 571 | * | ||
| 572 | * This function must be implemented by the module that uses uIP, and | ||
| 573 | * is called by uIP whenever a log message is generated. | ||
| 574 | */ | ||
| 575 | void uip_log(char *msg); | ||
| 576 | |||
| 577 | /** | ||
| 578 | * The link level header length. | ||
| 579 | * | ||
| 580 | * This is the offset into the uip_buf where the IP header can be | ||
| 581 | * found. For Ethernet, this should be set to 14. For SLIP, this | ||
| 582 | * should be set to 0. | ||
| 583 | * | ||
| 584 | * \note we probably won't use this constant for other link layers than | ||
| 585 | * ethernet as they have variable header length (this is due to variable | ||
| 586 | * number and type of address fields and to optional security features) | ||
| 587 | * E.g.: 802.15.4 -> 2 + (1/2*4/8) + 0/5/6/10/14 | ||
| 588 | * 802.11 -> 4 + (6*3/4) + 2 | ||
| 589 | * \hideinitializer | ||
| 590 | */ | ||
| 591 | #ifdef UIP_CONF_LLH_LEN | ||
| 592 | #define UIP_LLH_LEN UIP_CONF_LLH_LEN | ||
| 593 | #else /* UIP_LLH_LEN */ | ||
| 594 | #define UIP_LLH_LEN 14 | ||
| 595 | #endif /* UIP_CONF_LLH_LEN */ | ||
| 596 | |||
| 597 | /** @} */ | ||
| 598 | /*------------------------------------------------------------------------------*/ | ||
| 599 | /** | ||
| 600 | * \defgroup uipoptcpu CPU architecture configuration | ||
| 601 | * @{ | ||
| 602 | * | ||
| 603 | * The CPU architecture configuration is where the endianess of the | ||
| 604 | * CPU on which uIP is to be run is specified. Most CPUs today are | ||
| 605 | * little endian, and the most notable exception are the Motorolas | ||
| 606 | * which are big endian. The BYTE_ORDER macro should be changed to | ||
| 607 | * reflect the CPU architecture on which uIP is to be run. | ||
| 608 | */ | ||
| 609 | |||
| 610 | /** | ||
| 611 | * The byte order of the CPU architecture on which uIP is to be run. | ||
| 612 | * | ||
| 613 | * This option can be either UIP_BIG_ENDIAN (Motorola byte order) or | ||
| 614 | * UIP_LITTLE_ENDIAN (Intel byte order). | ||
| 615 | * | ||
| 616 | * \hideinitializer | ||
| 617 | */ | ||
| 618 | #ifdef UIP_CONF_BYTE_ORDER | ||
| 619 | #define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER | ||
| 620 | #else /* UIP_CONF_BYTE_ORDER */ | ||
| 621 | #define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN | ||
| 622 | #endif /* UIP_CONF_BYTE_ORDER */ | ||
| 623 | |||
| 624 | /** @} */ | ||
| 625 | /*------------------------------------------------------------------------------*/ | ||
| 626 | |||
| 627 | #include <ff.h> | ||
| 628 | #include <stdbool.h> | ||
| 629 | #include <stdint.h> | ||
| 630 | |||
| 631 | #include "timer.h" | ||
| 632 | |||
| 633 | typedef uint8_t u8_t; | ||
| 634 | typedef uint16_t u16_t; | ||
| 635 | typedef uint32_t u32_t; | ||
| 636 | typedef uint32_t uip_stats_t; | ||
| 637 | |||
| 638 | /** | ||
| 639 | * \defgroup uipoptapp Application specific configurations | ||
| 640 | * @{ | ||
| 641 | * | ||
| 642 | * An uIP application is implemented using a single application | ||
| 643 | * function that is called by uIP whenever a TCP/IP event occurs. The | ||
| 644 | * name of this function must be registered with uIP at compile time | ||
| 645 | * using the UIP_APPCALL definition. | ||
| 646 | * | ||
| 647 | * uIP applications can store the application state within the | ||
| 648 | * uip_conn structure by specifying the type of the application | ||
| 649 | * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t. | ||
| 650 | * | ||
| 651 | * The file containing the definitions must be included in the | ||
| 652 | * uipopt.h file. | ||
| 653 | * | ||
| 654 | * The following example illustrates how this can look. | ||
| 655 | \code | ||
| 656 | |||
| 657 | void httpd_appcall(void); | ||
| 658 | #define UIP_APPCALL httpd_appcall | ||
| 659 | |||
| 660 | struct httpd_state { | ||
| 661 | u8_t state; | ||
| 662 | u16_t count; | ||
| 663 | char *dataptr; | ||
| 664 | char *script; | ||
| 665 | }; | ||
| 666 | typedef struct httpd_state uip_tcp_appstate_t | ||
| 667 | \endcode | ||
| 668 | */ | ||
| 669 | #define UIP_UDP_APPCALL uIPManagement_UDPCallback | ||
| 670 | void UIP_UDP_APPCALL(void); | ||
| 671 | |||
| 672 | /** | ||
| 673 | * \var #define UIP_APPCALL | ||
| 674 | * | ||
| 675 | * The name of the application function that uIP should call in | ||
| 676 | * response to TCP/IP events. | ||
| 677 | * | ||
| 678 | */ | ||
| 679 | #define UIP_APPCALL uIPManagement_TCPCallback | ||
| 680 | void UIP_APPCALL(void); | ||
| 681 | |||
| 682 | /** | ||
| 683 | * \var typedef uip_tcp_appstate_t | ||
| 684 | * | ||
| 685 | * The type of the application state that is to be stored in the | ||
| 686 | * uip_conn structure. This usually is typedef:ed to a struct holding | ||
| 687 | * application state information. | ||
| 688 | */ | ||
| 689 | typedef union | ||
| 690 | { | ||
| 691 | struct | ||
| 692 | { | ||
| 693 | uint8_t CurrentState; | ||
| 694 | uint8_t NextState; | ||
| 695 | |||
| 696 | char FileName[MAX_URI_LENGTH]; | ||
| 697 | FIL FileHandle; | ||
| 698 | bool FileOpen; | ||
| 699 | uint32_t ACKedFilePos; | ||
| 700 | uint16_t SentChunkSize; | ||
| 701 | } HTTPServer; | ||
| 702 | |||
| 703 | struct | ||
| 704 | { | ||
| 705 | uint8_t CurrentState; | ||
| 706 | uint8_t NextState; | ||
| 707 | |||
| 708 | uint8_t IssuedCommand; | ||
| 709 | } TELNETServer; | ||
| 710 | } uip_tcp_appstate_t; | ||
| 711 | |||
| 712 | /** | ||
| 713 | * \var typedef uip_udp_appstate_t | ||
| 714 | * | ||
| 715 | * The type of the application state that is to be stored in the | ||
| 716 | * uip_conn structure. This usually is typedef:ed to a struct holding | ||
| 717 | * application state information. | ||
| 718 | */ | ||
| 719 | typedef union | ||
| 720 | { | ||
| 721 | struct | ||
| 722 | { | ||
| 723 | uint8_t CurrentState; | ||
| 724 | struct timer Timeout; | ||
| 725 | |||
| 726 | struct | ||
| 727 | { | ||
| 728 | uint8_t AllocatedIP[4]; | ||
| 729 | uint8_t Netmask[4]; | ||
| 730 | uint8_t GatewayIP[4]; | ||
| 731 | uint8_t ServerIP[4]; | ||
| 732 | } DHCPOffer_Data; | ||
| 733 | } DHCPClient; | ||
| 734 | } uip_udp_appstate_t; | ||
| 735 | /** @} */ | ||
| 736 | |||
| 737 | #endif /* __UIPOPT_H__ */ | ||
| 738 | /** @} */ | ||
| 739 | /** @} */ | ||
| 740 | |||
