Contiki-NG
Loading...
Searching...
No Matches
uipopt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2001-2003, Adam Dunkels.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote
14 * products derived from this software without specific prior
15 * written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * This file is part of the uIP TCP/IP stack.
30 *
31 *
32 */
33
34/**
35 * \file
36 * Configuration options for uIP.
37 * \author Adam Dunkels <adam@dunkels.com>
38 *
39 * This file contains various compile-time configuration options for
40 * uIP along with definitions of their default values.
41 *
42 * When an option starts with "UIP_CONF", it can be changed to fit the
43 * requirements of a specific system configuration, typically through
44 * a "project-conf.h" file.
45 */
46
47/**
48 * \addtogroup uip
49 * @{
50 */
51
52/**
53 * \defgroup uipopt Configuration options for uIP
54 * @{
55 */
56
57#ifndef UIPOPT_H_
58#define UIPOPT_H_
59
60#ifndef UIP_LITTLE_ENDIAN
61#define UIP_LITTLE_ENDIAN 3412
62#endif /* UIP_LITTLE_ENDIAN */
63#ifndef UIP_BIG_ENDIAN
64#define UIP_BIG_ENDIAN 1234
65#endif /* UIP_BIG_ENDIAN */
66
67#include "contiki.h"
68
69/*------------------------------------------------------------------------------*/
70
71/**
72 * \defgroup uipoptgeneral General configuration options
73 * @{
74 */
75
76/**
77 * The size of the uIP packet buffer.
78 *
79 * The uIP packet buffer should not be smaller than 60 bytes, and does
80 * not need to be larger than 1514 bytes, which is the Ethernet frame
81 * size limit. A lower size typically results in lower throughput for
82 * various protocols, whereas a larger size can result in higher
83 * throughput.
84
85 * \note 6LoWPAN fragmentation may be used if the link layer has a
86 * smaller maximum transmission unit (MTU) that cannot fit the uIP
87 * packet buffer contents. See the SICSLOWPAN_CONF_FRAG option.
88 *
89 * \hideinitializer
90 */
91#ifndef UIP_CONF_BUFFER_SIZE
92#define UIP_BUFSIZE (UIP_LINK_MTU)
93#else /* UIP_CONF_BUFFER_SIZE */
94#define UIP_BUFSIZE (UIP_CONF_BUFFER_SIZE)
95#endif /* UIP_CONF_BUFFER_SIZE */
96
97/**
98 * Determines if statistics support should be compiled in.
99 *
100 * The statistics is useful for debugging and to show the user.
101 *
102 * \hideinitializer
103 */
104#ifndef UIP_CONF_STATISTICS
105#define UIP_STATISTICS 0
106#else /* UIP_CONF_STATISTICS */
107#define UIP_STATISTICS (UIP_CONF_STATISTICS)
108#endif /* UIP_CONF_STATISTICS */
109
110/** @} */
111/*------------------------------------------------------------------------------*/
112/**
113 * \defgroup uipoptip IP configuration options
114 * @{
115 *
116 */
117/**
118 * The IP TTL (time to live) of IP packets sent by uIP.
119 *
120 * This should normally not be changed.
121 */
122#ifdef UIP_CONF_TTL
123#define UIP_TTL UIP_CONF_TTL
124#else /* UIP_CONF_TTL */
125#define UIP_TTL 64
126#endif /* UIP_CONF_TTL */
127
128/**
129 * The maximum time in seconds that an IP fragment should wait in the
130 * reassembly buffer before it is dropped.
131 *
132 */
133#define UIP_REASS_MAXAGE 60
134
135/** @} */
136
137/*------------------------------------------------------------------------------*/
138/**
139 * \defgroup uipoptipv6 IPv6 configuration options
140 * @{
141 *
142 */
143
144/** The maximum transmission unit at the IP layer. */
145#define UIP_LINK_MTU 1280
146
147#ifndef UIP_CONF_IPV6_QUEUE_PKT
148/** Do we do per-neighbor queuing during address resolution (default: no) */
149#define UIP_CONF_IPV6_QUEUE_PKT 0
150#endif
151
152#ifndef UIP_CONF_IPV6_CHECKS
153/** Do we do IPv6 consistency checks (highly recommended, default: yes) */
154#define UIP_CONF_IPV6_CHECKS 1
155#endif
156
157#ifndef UIP_CONF_IPV6_REASSEMBLY
158/** Do we do IPv6 fragmentation (default: no) */
159#define UIP_CONF_IPV6_REASSEMBLY 0
160#endif
161
162#ifndef UIP_CONF_NETIF_MAX_ADDRESSES
163/** Default number of IPv6 addresses associated to the node's interface */
164#define UIP_CONF_NETIF_MAX_ADDRESSES 3
165#endif
166
167#ifndef UIP_CONF_DS6_PREFIX_NBU
168/** Default number of IPv6 prefixes associated to the node's interface */
169#define UIP_CONF_DS6_PREFIX_NBU 2
170#endif
171
172#ifndef UIP_CONF_DS6_DEFRT_NBU
173/** Minimum number of default routers */
174#define UIP_CONF_DS6_DEFRT_NBU 2
175#endif
176/** @} */
177
178/*------------------------------------------------------------------------------*/
179/**
180 * \defgroup uipoptudp UDP configuration options
181 * @{
182 *
183 */
184
185/**
186 * Toggles whether UDP support should be compiled in or not.
187 *
188 * \hideinitializer
189 */
190#ifdef UIP_CONF_UDP
191#define UIP_UDP UIP_CONF_UDP
192#else /* UIP_CONF_UDP */
193#define UIP_UDP 1
194#endif /* UIP_CONF_UDP */
195
196/**
197 * Toggles if UDP checksums should be used or not.
198 *
199 * \hideinitializer
200 */
201#ifdef UIP_CONF_UDP_CHECKSUMS
202#define UIP_UDP_CHECKSUMS (UIP_CONF_UDP_CHECKSUMS)
203#else
204#define UIP_UDP_CHECKSUMS 1
205#endif
206
207/**
208 * The maximum amount of concurrent UDP connections.
209 *
210 * \hideinitializer
211 */
212#ifdef UIP_CONF_UDP_CONNS
213#define UIP_UDP_CONNS (UIP_CONF_UDP_CONNS)
214#else /* UIP_CONF_UDP_CONNS */
215#define UIP_UDP_CONNS 10
216#endif /* UIP_CONF_UDP_CONNS */
217
218/** @} */
219/*------------------------------------------------------------------------------*/
220/**
221 * \defgroup uipopttcp TCP configuration options
222 * @{
223 */
224
225/**
226 * Toggles whether TCP support should be compiled in or not.
227 *
228 * \hideinitializer
229 */
230#ifdef UIP_CONF_TCP
231#define UIP_TCP (UIP_CONF_TCP)
232#else /* UIP_CONF_TCP */
233#define UIP_TCP 1
234#endif /* UIP_CONF_TCP */
235
236/**
237 * Determines if support for opening connections from uIP should be
238 * compiled in.
239 *
240 * If the applications that are running on top of uIP do not need to
241 * open outgoing TCP connections, this configuration option can be
242 * turned off to reduce the code size of uIP.
243 *
244 * \hideinitializer
245 */
246#ifndef UIP_CONF_ACTIVE_OPEN
247#define UIP_ACTIVE_OPEN 1
248#else /* UIP_CONF_ACTIVE_OPEN */
249#define UIP_ACTIVE_OPEN (UIP_CONF_ACTIVE_OPEN)
250#endif /* UIP_CONF_ACTIVE_OPEN */
251
252/**
253 * The maximum number of simultaneously open TCP connections.
254 *
255 * Since the TCP connections are statically allocated, turning this
256 * configuration knob down results in less RAM used. Each TCP
257 * connection requires approximately 30 bytes of memory.
258 *
259 * \hideinitializer
260 */
261#ifndef UIP_CONF_TCP_CONNS
262#define UIP_TCP_CONNS 10
263#else /* UIP_CONF_TCP_CONNS */
264#define UIP_TCP_CONNS (UIP_CONF_TCP_CONNS)
265#endif /* UIP_CONF_TCP_CONNS */
266
267
268/**
269 * The maximum number of simultaneously listening TCP ports.
270 *
271 * Each listening TCP port requires 2 bytes of memory.
272 *
273 * \hideinitializer
274 */
275#ifndef UIP_CONF_MAX_LISTENPORTS
276#define UIP_LISTENPORTS 20
277#else /* UIP_CONF_MAX_LISTENPORTS */
278#define UIP_LISTENPORTS (UIP_CONF_MAX_LISTENPORTS)
279#endif /* UIP_CONF_MAX_LISTENPORTS */
280
281/**
282 * Determines if support for TCP urgent data notification should be
283 * compiled in.
284 *
285 * Urgent data (out-of-band data) is a rarely used TCP feature that
286 * seldomly would be required.
287 *
288 * \hideinitializer
289 */
290#define UIP_URGDATA 0
291
292/**
293 * The initial retransmission timeout counted in timer pulses.
294 *
295 * This should not be changed.
296 */
297#define UIP_RTO 3
298
299/**
300 * The maximum number of times a segment should be retransmitted
301 * before the connection should be aborted.
302 *
303 * This should not be changed.
304 */
305#define UIP_MAXRTX 8
306
307/**
308 * The maximum number of times a SYN segment should be retransmitted
309 * before a connection request should be deemed to have been
310 * unsuccessful.
311 *
312 * This should not need to be changed.
313 */
314#define UIP_MAXSYNRTX 5
315
316/**
317 * The TCP maximum segment size.
318 *
319 * This is should not be to set to more than
320 * UIP_BUFSIZE - UIP_IPTCPH_LEN.
321 */
322#ifdef UIP_CONF_TCP_MSS
323#if UIP_CONF_TCP_MSS > (UIP_BUFSIZE - UIP_IPTCPH_LEN)
324#error UIP_CONF_TCP_MSS is too large for the current UIP_BUFSIZE
325#endif /* UIP_CONF_TCP_MSS > (UIP_BUFSIZE - UIP_IPTCPH_LEN) */
326#define UIP_TCP_MSS (UIP_CONF_TCP_MSS)
327#else /* UIP_CONF_TCP_MSS */
328#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_IPTCPH_LEN)
329#endif /* UIP_CONF_TCP_MSS */
330
331/**
332 * The size of the advertised receiver's window.
333 *
334 * Should be set low (i.e., to the size of the uip_buf buffer) if the
335 * application is slow to process incoming data, or high (32768 bytes)
336 * if the application processes data quickly.
337 *
338 * \hideinitializer
339 */
340#ifndef UIP_CONF_RECEIVE_WINDOW
341#define UIP_RECEIVE_WINDOW (UIP_TCP_MSS)
342#else
343#define UIP_RECEIVE_WINDOW (UIP_CONF_RECEIVE_WINDOW)
344#endif
345
346/**
347 * How long a connection should stay in the TIME_WAIT state.
348 *
349 * This can be reduced for faster entry into power saving modes.
350 */
351#ifndef UIP_CONF_WAIT_TIMEOUT
352#define UIP_TIME_WAIT_TIMEOUT 120
353#else
354#define UIP_TIME_WAIT_TIMEOUT UIP_CONF_WAIT_TIMEOUT
355#endif
356
357/** @} */
358/*------------------------------------------------------------------------------*/
359/**
360 * \defgroup uipoptarp ARP configuration options
361 * @{
362 */
363
364/**
365 * The size of the ARP table.
366 *
367 * This option should be set to a larger value if this uIP node will
368 * have many connections from the local network.
369 *
370 * \hideinitializer
371 */
372#ifdef UIP_CONF_ARPTAB_SIZE
373#define UIP_ARPTAB_SIZE (UIP_CONF_ARPTAB_SIZE)
374#else
375#define UIP_ARPTAB_SIZE 8
376#endif
377
378/**
379 * The maximum age of ARP table entries measured in 10ths of seconds.
380 *
381 * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
382 * default).
383 */
384#define UIP_ARP_MAXAGE 120
385
386/** @} */
387/*------------------------------------------------------------------------------*/
388
389/**
390 * \defgroup uipoptmac layer 2 options (for ipv6)
391 * @{
392 */
393
394#define UIP_DEFAULT_PREFIX_LEN 64
395
396/**
397 * The MAC-layer transmissons limit is encapslated in "Traffic Class" field.
398 *
399 * In Contiki-NG, if the Traffic Class field in the IPv6 header has
400 * this bit set, the low-order bits are used as the MAC-layer
401 * transmissons limit.
402 */
403#define UIP_TC_MAC_TRANSMISSION_COUNTER_BIT 0x40
404
405/**
406 * The bits in the "Traffic Class" field that describe the MAC
407 * transmission limit.
408 */
409#define UIP_TC_MAC_TRANSMISSION_COUNTER_MASK 0x3F
410
411#ifdef UIP_CONF_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS
412#define UIP_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS UIP_CONF_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS
413#else
414#define UIP_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS 0
415#endif
416
417/**
418 * This is the default value of MAC-layer transmissons for uIPv6
419 *
420 * It means that the limit is selected by the MAC protocol instead of uIPv6.
421 */
422#define UIP_MAX_MAC_TRANSMISSIONS_UNDEFINED 0
423
424/** @} */
425
426/*------------------------------------------------------------------------------*/
427
428/**
429 * \defgroup uipoptsics 6lowpan options (for ipv6)
430 * @{
431 */
432/**
433 * Timeout for packet reassembly at the 6LoWPAN layer
434 * (should be < 60s)
435 */
436#ifdef SICSLOWPAN_CONF_MAXAGE
437#define SICSLOWPAN_REASS_MAXAGE (SICSLOWPAN_CONF_MAXAGE)
438#else
439#define SICSLOWPAN_REASS_MAXAGE 8
440#endif
441
442/**
443 * Determines whether the 6LoWPAN layer uses IP header compression.
444 */
445#ifndef SICSLOWPAN_CONF_COMPRESSION
446#define SICSLOWPAN_COMPRESSION SICSLOWPAN_COMPRESSION_IPHC
447#else
448#define SICSLOWPAN_COMPRESSION SICSLOWPAN_CONF_COMPRESSION
449#endif /* SICSLOWPAN_CONF_COMPRESSION */
450
451/**
452 * If we use IPHC compression, how many address contexts do we support.
453 */
454#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS
455#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
456#endif
457
458/**
459 * Determines whether 6LoWPAN fragmentation is enabled.
460 */
461#ifndef SICSLOWPAN_CONF_FRAG
462#define SICSLOWPAN_CONF_FRAG 1
463#endif
464
465/** @} */
466
467/*------------------------------------------------------------------------------*/
468/**
469 * \defgroup uipoptcpu CPU architecture configuration
470 * @{
471 *
472 * The CPU architecture configuration is where the endianness of the
473 * CPU on which uIP is to be run is specified. Most CPUs today are
474 * little endian, and the most notable exception are the Motorolas
475 * which are big endian. The BYTE_ORDER macro should be changed to
476 * reflect the CPU architecture on which uIP is to be run.
477 */
478
479/**
480 * The byte order of the CPU architecture on which uIP is to be run.
481 *
482 * This option can be either UIP_BIG_ENDIAN (Motorola byte order) or
483 * UIP_LITTLE_ENDIAN (Intel byte order).
484 *
485 * \hideinitializer
486 */
487#ifdef UIP_CONF_BYTE_ORDER
488#define UIP_BYTE_ORDER (UIP_CONF_BYTE_ORDER)
489#else /* UIP_CONF_BYTE_ORDER */
490#define UIP_BYTE_ORDER (UIP_LITTLE_ENDIAN)
491#endif /* UIP_CONF_BYTE_ORDER */
492
493/** @} */
494
495#endif /* UIPOPT_H_ */
496/** @} */
497/** @} */