7 * \defgroup uipopt Configuration options for uIP
\r
10 * uIP is configured using the per-project configuration file
\r
11 * "uipopt.h". This file contains all compile-time options for uIP and
\r
12 * should be tweaked to match each specific project. The uIP
\r
13 * distribution contains a documented example "uipopt.h" that can be
\r
14 * copied and modified for each project.
\r
16 * \note Contiki does not use the uipopt.h file to configure uIP, but
\r
17 * uses a per-port uip-conf.h file that should be edited instead.
\r
22 * Configuration options for uIP.
\r
23 * \author Adam Dunkels <adam@dunkels.com>
\r
25 * This file is used for tweaking various configuration options for
\r
26 * uIP. You should make a copy of this file into one of your project's
\r
27 * directories instead of editing this example "uipopt.h" file that
\r
28 * comes with the uIP distribution.
\r
32 * Copyright (c) 2001-2003, Adam Dunkels.
\r
33 * All rights reserved.
\r
35 * Redistribution and use in source and binary forms, with or without
\r
36 * modification, are permitted provided that the following conditions
\r
38 * 1. Redistributions of source code must retain the above copyright
\r
39 * notice, this list of conditions and the following disclaimer.
\r
40 * 2. Redistributions in binary form must reproduce the above copyright
\r
41 * notice, this list of conditions and the following disclaimer in the
\r
42 * documentation and/or other materials provided with the distribution.
\r
43 * 3. The name of the author may not be used to endorse or promote
\r
44 * products derived from this software without specific prior
\r
45 * written permission.
\r
47 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
\r
48 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
\r
49 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
\r
51 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
\r
53 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
54 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
\r
55 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
56 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
\r
57 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
59 * This file is part of the uIP TCP/IP stack.
\r
61 * $Id: uipopt.h,v 1.11 2009/04/10 00:37:48 adamdunkels Exp $
\r
64 #ifndef __UIPOPT_H__
\r
65 #define __UIPOPT_H__
\r
67 #ifndef UIP_LITTLE_ENDIAN
\r
68 #define UIP_LITTLE_ENDIAN 3412
\r
69 #endif /* UIP_LITTLE_ENDIAN */
\r
70 #ifndef UIP_BIG_ENDIAN
\r
71 #define UIP_BIG_ENDIAN 1234
\r
72 #endif /* UIP_BIG_ENDIAN */
\r
74 #include "uip-conf.h"
\r
75 //_RB_#include "contiki-conf.h"
\r
77 /*------------------------------------------------------------------------------*/
\r
80 * \defgroup uipoptstaticconf Static configuration options
\r
83 * These configuration options can be used for setting the IP address
\r
84 * settings statically, but only if UIP_FIXEDADDR is set to 1. The
\r
85 * configuration options for a specific node includes IP address,
\r
86 * netmask and default router as well as the Ethernet address. The
\r
87 * netmask, default router and Ethernet address are applicable only
\r
88 * if uIP should be run over Ethernet.
\r
90 * This options are meaningful only for the IPv4 code.
\r
92 * All of these should be changed to suit your project.
\r
96 * Determines if uIP should use a fixed IP address or not.
\r
98 * If uIP should use a fixed IP address, the settings are set in the
\r
99 * uipopt.h file. If not, the macros uip_sethostaddr(),
\r
100 * uip_setdraddr() and uip_setnetmask() should be used instead.
\r
104 #ifdef UIP_CONF_FIXEDADDR
\r
105 #define UIP_FIXED_ADDR UIP_CONF_FIXEDADDR
\r
106 #define UIP_FIXEDADDR 1
\r
110 * Ping IP address assignment.
\r
112 * uIP uses a "ping" packets for setting its own IP address if this
\r
113 * option is set. If so, uIP will start with an empty IP address and
\r
114 * the destination IP address of the first incoming "ping" (ICMP echo)
\r
115 * packet will be used for setting the hosts IP address.
\r
117 * \note This works only if UIP_FIXEDADDR is 0.
\r
121 #ifdef UIP_CONF_PINGADDRCONF
\r
122 #define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF
\r
123 #else /* UIP_CONF_PINGADDRCONF */
\r
124 #define UIP_PINGADDRCONF 0
\r
125 #endif /* UIP_CONF_PINGADDRCONF */
\r
128 * Specifies if the uIP ARP module should be compiled with a fixed
\r
129 * Ethernet MAC address or not.
\r
131 * If this configuration option is 0, the macro uip_setethaddr() can
\r
132 * be used to specify the Ethernet address at run-time.
\r
136 #define UIP_FIXEDETHADDR 0
\r
140 /*------------------------------------------------------------------------------*/
\r
143 * \defgroup uipoptip IP configuration options
\r
149 * The IP TTL (time to live) of IP packets sent by uIP.
\r
151 * This should normally not be changed.
\r
156 * The maximum time an IP fragment should wait in the reassembly
\r
157 * buffer before it is dropped.
\r
160 #define UIP_REASS_MAXAGE 60 /*60s*/
\r
163 * Turn on support for IP packet reassembly.
\r
165 * uIP supports reassembly of fragmented IP packets. This features
\r
166 * requires an additional amount of RAM to hold the reassembly buffer
\r
167 * and the reassembly code size is approximately 700 bytes. The
\r
168 * reassembly buffer is of the same size as the uip_buf buffer
\r
169 * (configured by UIP_BUFSIZE).
\r
171 * \note IP packet reassembly is not heavily tested.
\r
175 #ifdef UIP_CONF_REASSEMBLY
\r
176 #define UIP_REASSEMBLY UIP_CONF_REASSEMBLY
\r
177 #else /* UIP_CONF_REASSEMBLY */
\r
178 #define UIP_REASSEMBLY 0
\r
179 #endif /* UIP_CONF_REASSEMBLY */
\r
183 /*------------------------------------------------------------------------------*/
\r
186 * \defgroup uipoptipv6 IPv6 configuration options
\r
191 /** The maximum transmission unit at the IP Layer*/
\r
192 #define UIP_LINK_MTU 1280
\r
194 #ifndef UIP_CONF_IPV6
\r
196 /** Do we use IPv6 or not (default: no) */
\r
197 #define UIP_CONF_IPV6 0
\r
199 #ifndef UIP_CONF_IPV6_QUEUE_PKT
\r
201 /** Do we do per %neighbor queuing during address resolution (default: no) */
\r
202 #define UIP_CONF_IPV6_QUEUE_PKT 0
\r
204 #ifndef UIP_CONF_IPV6_CHECKS
\r
206 /** Do we do IPv6 consistency checks (highly recommended, default: yes) */
\r
207 #define UIP_CONF_IPV6_CHECKS 1
\r
209 #ifndef UIP_CONF_IPV6_REASSEMBLY
\r
211 /** Do we do IPv6 fragmentation (default: no) */
\r
212 #define UIP_CONF_IPV6_REASSEMBLY 0
\r
214 #ifndef UIP_CONF_NETIF_MAX_ADDRESSES
\r
216 /** Default number of IPv6 addresses associated to the node's interface */
\r
217 #define UIP_CONF_NETIF_MAX_ADDRESSES 3
\r
219 #ifndef UIP_CONF_ND6_MAX_PREFIXES
\r
221 /** Default number of IPv6 prefixes associated to the node's interface */
\r
222 #define UIP_CONF_ND6_MAX_PREFIXES 3
\r
224 #ifndef UIP_CONF_ND6_MAX_NEIGHBORS
\r
226 /** Default number of neighbors that can be stored in the %neighbor cache */
\r
227 #define UIP_CONF_ND6_MAX_NEIGHBORS 4
\r
229 #ifndef UIP_CONF_ND6_MAX_DEFROUTERS
\r
231 /** Minimum number of default routers */
\r
232 #define UIP_CONF_ND6_MAX_DEFROUTERS 2
\r
237 /*------------------------------------------------------------------------------*/
\r
240 * \defgroup uipoptudp UDP configuration options
\r
243 * \note The UDP support in uIP is still not entirely complete; there
\r
244 * is no support for sending or receiving broadcast or multicast
\r
245 * packets, but it works well enough to support a number of vital
\r
246 * applications such as DNS queries, though
\r
250 * Toggles whether UDP support should be compiled in or not.
\r
254 #ifdef UIP_CONF_UDP
\r
255 #define UIP_UDP UIP_CONF_UDP
\r
256 #else /* UIP_CONF_UDP */
\r
258 #endif /* UIP_CONF_UDP */
\r
261 * Toggles if UDP checksums should be used or not.
\r
263 * \note Support for UDP checksums is currently not included in uIP,
\r
264 * so this option has no function.
\r
268 #ifdef UIP_CONF_UDP_CHECKSUMS
\r
269 #define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS
\r
271 #define UIP_UDP_CHECKSUMS 0
\r
275 * The maximum amount of concurrent UDP connections.
\r
279 #ifdef UIP_CONF_UDP_CONNS
\r
280 #define UIP_UDP_CONNS UIP_CONF_UDP_CONNS
\r
281 #else /* UIP_CONF_UDP_CONNS */
\r
282 #define UIP_UDP_CONNS 10
\r
283 #endif /* UIP_CONF_UDP_CONNS */
\r
286 * The name of the function that should be called when UDP datagrams arrive.
\r
293 /*------------------------------------------------------------------------------*/
\r
296 * \defgroup uipopttcp TCP configuration options
\r
301 * Toggles whether UDP support should be compiled in or not.
\r
305 #ifdef UIP_CONF_TCP
\r
306 #define UIP_TCP UIP_CONF_TCP
\r
307 #else /* UIP_CONF_UDP */
\r
309 #endif /* UIP_CONF_UDP */
\r
312 * Determines if support for opening connections from uIP should be
\r
315 * If the applications that are running on top of uIP for this project
\r
316 * do not need to open outgoing TCP connections, this configuration
\r
317 * option can be turned off to reduce the code size of uIP.
\r
321 #ifndef UIP_CONF_ACTIVE_OPEN
\r
322 #define UIP_ACTIVE_OPEN 1
\r
323 #else /* UIP_CONF_ACTIVE_OPEN */
\r
324 #define UIP_ACTIVE_OPEN UIP_CONF_ACTIVE_OPEN
\r
325 #endif /* UIP_CONF_ACTIVE_OPEN */
\r
328 * The maximum number of simultaneously open TCP connections.
\r
330 * Since the TCP connections are statically allocated, turning this
\r
331 * configuration knob down results in less RAM used. Each TCP
\r
332 * connection requires approximately 30 bytes of memory.
\r
336 #ifndef UIP_CONF_MAX_CONNECTIONS
\r
337 #define UIP_CONNS 10
\r
338 #else /* UIP_CONF_MAX_CONNECTIONS */
\r
339 #define UIP_CONNS UIP_CONF_MAX_CONNECTIONS
\r
340 #endif /* UIP_CONF_MAX_CONNECTIONS */
\r
343 * The maximum number of simultaneously listening TCP ports.
\r
345 * Each listening TCP port requires 2 bytes of memory.
\r
349 #ifndef UIP_CONF_MAX_LISTENPORTS
\r
350 #define UIP_LISTENPORTS 20
\r
351 #else /* UIP_CONF_MAX_LISTENPORTS */
\r
352 #define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS
\r
353 #endif /* UIP_CONF_MAX_LISTENPORTS */
\r
356 * Determines if support for TCP urgent data notification should be
\r
359 * Urgent data (out-of-band data) is a rarely used TCP feature that
\r
360 * very seldom would be required.
\r
364 #define UIP_URGDATA 0
\r
367 * The initial retransmission timeout counted in timer pulses.
\r
369 * This should not be changed.
\r
374 * The maximum number of times a segment should be retransmitted
\r
375 * before the connection should be aborted.
\r
377 * This should not be changed.
\r
379 #define UIP_MAXRTX 8
\r
382 * The maximum number of times a SYN segment should be retransmitted
\r
383 * before a connection request should be deemed to have been
\r
386 * This should not need to be changed.
\r
388 #define UIP_MAXSYNRTX 5
\r
391 * The TCP maximum segment size.
\r
393 * This is should not be to set to more than
\r
394 * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
\r
396 #ifdef UIP_CONF_TCP_MSS
\r
397 #define UIP_TCP_MSS UIP_CONF_TCP_MSS
\r
399 #define UIP_TCP_MSS ( UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN )
\r
403 * The size of the advertised receiver's window.
\r
405 * Should be set low (i.e., to the size of the uip_buf buffer) if the
\r
406 * application is slow to process incoming data, or high (32768 bytes)
\r
407 * if the application processes data quickly.
\r
411 #ifndef UIP_CONF_RECEIVE_WINDOW
\r
412 #define UIP_RECEIVE_WINDOW UIP_TCP_MSS
\r
414 #define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW
\r
418 * How long a connection should stay in the TIME_WAIT state.
\r
420 * This configuration option has no real implication, and it should be
\r
423 #define UIP_TIME_WAIT_TIMEOUT 120
\r
427 /*------------------------------------------------------------------------------*/
\r
430 * \defgroup uipoptarp ARP configuration options
\r
435 * The size of the ARP table.
\r
437 * This option should be set to a larger value if this uIP node will
\r
438 * have many connections from the local network.
\r
442 #ifdef UIP_CONF_ARPTAB_SIZE
\r
443 #define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE
\r
445 #define UIP_ARPTAB_SIZE 8
\r
449 * The maximum age of ARP table entries measured in 10ths of seconds.
\r
451 * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
\r
454 #define UIP_ARP_MAXAGE 120
\r
458 /*------------------------------------------------------------------------------*/
\r
461 * \defgroup uipoptmac layer 2 options (for ipv6)
\r
464 #define UIP_DEFAULT_PREFIX_LEN 64
\r
468 /*------------------------------------------------------------------------------*/
\r
471 * \defgroup uipoptsics 6lowpan options (for ipv6)
\r
476 * Timeout for packet reassembly at the 6lowpan layer
\r
477 * (should be < 60s)
\r
479 #ifdef SICSLOWPAN_CONF_MAXAGE
\r
480 #define SICSLOWPAN_REASS_MAXAGE SICSLOWPAN_CONF_MAXAGE
\r
482 #define SICSLOWPAN_REASS_MAXAGE 20
\r
486 * Do we compress the IP header or not (default: no)
\r
488 #ifndef SICSLOWPAN_CONF_COMPRESSION
\r
489 #define SICSLOWPAN_CONF_COMPRESSION 0
\r
493 * If we use IPHC compression, how many address contexts do we support
\r
495 #ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS
\r
496 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
\r
500 * Do we support 6lowpan fragmentation
\r
502 #ifndef SICSLOWPAN_CONF_FRAG
\r
503 #define SICSLOWPAN_CONF_FRAG 0
\r
508 /*------------------------------------------------------------------------------*/
\r
511 * \defgroup uipoptgeneral General configuration options
\r
516 * The size of the uIP packet buffer.
\r
518 * The uIP packet buffer should not be smaller than 60 bytes, and does
\r
519 * not need to be larger than 1514 bytes. Lower size results in lower
\r
520 * TCP throughput, larger size results in higher TCP throughput.
\r
524 #ifndef UIP_CONF_BUFFER_SIZE
\r
525 #define UIP_BUFSIZE UIP_LINK_MTU + UIP_LLH_LEN
\r
526 #else /* UIP_CONF_BUFFER_SIZE */
\r
527 #define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE
\r
528 #endif /* UIP_CONF_BUFFER_SIZE */
\r
531 * Determines if statistics support should be compiled in.
\r
533 * The statistics is useful for debugging and to show the user.
\r
537 #ifndef UIP_CONF_STATISTICS
\r
538 #define UIP_STATISTICS 0
\r
539 #else /* UIP_CONF_STATISTICS */
\r
540 #define UIP_STATISTICS UIP_CONF_STATISTICS
\r
541 #endif /* UIP_CONF_STATISTICS */
\r
544 * Determines if logging of certain events should be compiled in.
\r
546 * This is useful mostly for debugging. The function uip_log()
\r
547 * must be implemented to suit the architecture of the project, if
\r
548 * logging is turned on.
\r
552 #ifndef UIP_CONF_LOGGING
\r
553 #define UIP_LOGGING 0
\r
554 #else /* UIP_CONF_LOGGING */
\r
555 #define UIP_LOGGING UIP_CONF_LOGGING
\r
556 #endif /* UIP_CONF_LOGGING */
\r
559 * Broadcast support.
\r
561 * This flag configures IP broadcast support. This is useful only
\r
562 * together with UDP.
\r
567 #ifndef UIP_CONF_BROADCAST
\r
568 #define UIP_BROADCAST 0
\r
569 #else /* UIP_CONF_BROADCAST */
\r
570 #define UIP_BROADCAST UIP_CONF_BROADCAST
\r
571 #endif /* UIP_CONF_BROADCAST */
\r
574 * Print out a uIP log message.
\r
576 * This function must be implemented by the module that uses uIP, and
\r
577 * is called by uIP whenever a log message is generated.
\r
579 void uip_log( char *msg );
\r
582 * The link level header length.
\r
584 * This is the offset into the uip_buf where the IP header can be
\r
585 * found. For Ethernet, this should be set to 14. For SLIP, this
\r
586 * should be set to 0.
\r
588 * \note we probably won't use this constant for other link layers than
\r
589 * ethernet as they have variable header length (this is due to variable
\r
590 * number and type of address fields and to optional security features)
\r
591 * E.g.: 802.15.4 -> 2 + (1/2*4/8) + 0/5/6/10/14
\r
592 * 802.11 -> 4 + (6*3/4) + 2
\r
595 #ifdef UIP_CONF_LLH_LEN
\r
596 #define UIP_LLH_LEN UIP_CONF_LLH_LEN
\r
597 #else /* UIP_LLH_LEN */
\r
598 #define UIP_LLH_LEN 14
\r
599 #endif /* UIP_CONF_LLH_LEN */
\r
603 /*------------------------------------------------------------------------------*/
\r
606 * \defgroup uipoptcpu CPU architecture configuration
\r
609 * The CPU architecture configuration is where the endianess of the
\r
610 * CPU on which uIP is to be run is specified. Most CPUs today are
\r
611 * little endian, and the most notable exception are the Motorolas
\r
612 * which are big endian. The BYTE_ORDER macro should be changed to
\r
613 * reflect the CPU architecture on which uIP is to be run.
\r
617 * The byte order of the CPU architecture on which uIP is to be run.
\r
619 * This option can be either UIP_BIG_ENDIAN (Motorola byte order) or
\r
620 * UIP_LITTLE_ENDIAN (Intel byte order).
\r
624 #ifdef UIP_CONF_BYTE_ORDER
\r
625 #define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER
\r
626 #else /* UIP_CONF_BYTE_ORDER */
\r
627 #define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN
\r
628 #endif /* UIP_CONF_BYTE_ORDER */
\r
632 /*------------------------------------------------------------------------------*/
\r
635 * \defgroup uipoptapp Application specific configurations
\r
638 * An uIP application is implemented using a single application
\r
639 * function that is called by uIP whenever a TCP/IP event occurs. The
\r
640 * name of this function must be registered with uIP at compile time
\r
641 * using the UIP_APPCALL definition.
\r
643 * uIP applications can store the application state within the
\r
644 * uip_conn structure by specifying the type of the application
\r
645 * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t.
\r
647 * The file containing the definitions must be included in the
\r
650 * The following example illustrates how this can look.
\r
653 void httpd_appcall(void);
\r
654 #define UIP_APPCALL httpd_appcall
\r
656 struct httpd_state {
\r
662 typedef struct httpd_state uip_tcp_appstate_t
\r
667 * \var #define UIP_APPCALL
\r
669 * The name of the application function that uIP should call in
\r
670 * response to TCP/IP events.
\r
675 * \var typedef uip_tcp_appstate_t
\r
677 * The type of the application state that is to be stored in the
\r
678 * uip_conn structure. This usually is typedef:ed to a struct holding
\r
679 * application state information.
\r
683 * \var typedef uip_udp_appstate_t
\r
685 * The type of the application state that is to be stored in the
\r
686 * uip_conn structure. This usually is typedef:ed to a struct holding
\r
687 * application state information.
\r
691 #endif /* __UIPOPT_H__ */
\r