2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without modification,
\r
6 * are permitted provided that the following conditions are met:
\r
8 * 1. Redistributions of source code must retain the above copyright notice,
\r
9 * this list of conditions and the following disclaimer.
\r
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
11 * this list of conditions and the following disclaimer in the documentation
\r
12 * and/or other materials provided with the distribution.
\r
13 * 3. The name of the author may not be used to endorse or promote products
\r
14 * derived from this software without specific prior written permission.
\r
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
\r
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
\r
19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
\r
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
\r
21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
\r
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
\r
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
\r
27 * This file is part of the lwIP TCP/IP stack.
\r
29 * Author: Adam Dunkels <adam@sics.se>
\r
32 #ifndef __LWIP_OPT_H__
\r
33 #define __LWIP_OPT_H__
\r
35 /* Include user defined options first */
\r
36 #include "lwipopts.h"
\r
37 #include "lwip/debug.h"
\r
39 /* Define default values for unconfigured parameters. */
\r
41 /* Platform specific locking */
\r
44 * enable SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
\r
45 * for certain critical regions during buffer allocation, deallocation and memory
\r
46 * allocation and deallocation.
\r
48 #ifndef SYS_LIGHTWEIGHT_PROT
\r
49 #define SYS_LIGHTWEIGHT_PROT 0
\r
55 /* ---------- Memory options ---------- */
\r
56 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
\r
57 lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
\r
58 byte alignment -> define MEM_ALIGNMENT to 2. */
\r
60 #ifndef MEM_ALIGNMENT
\r
61 #define MEM_ALIGNMENT 1
\r
64 /* MEM_SIZE: the size of the heap memory. If the application will send
\r
65 a lot of data that needs to be copied, this should be set high. */
\r
67 #define MEM_SIZE 1600
\r
70 #ifndef MEMP_SANITY_CHECK
\r
71 #define MEMP_SANITY_CHECK 0
\r
74 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
\r
75 sends a lot of data out of ROM (or other static memory), this
\r
76 should be set high. */
\r
77 #ifndef MEMP_NUM_PBUF
\r
78 #define MEMP_NUM_PBUF 16
\r
81 /* Number of raw connection PCBs */
\r
82 #ifndef MEMP_NUM_RAW_PCB
\r
83 #define MEMP_NUM_RAW_PCB 4
\r
86 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
\r
87 per active UDP "connection". */
\r
88 #ifndef MEMP_NUM_UDP_PCB
\r
89 #define MEMP_NUM_UDP_PCB 4
\r
91 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
\r
93 #ifndef MEMP_NUM_TCP_PCB
\r
94 #define MEMP_NUM_TCP_PCB 5
\r
96 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
\r
98 #ifndef MEMP_NUM_TCP_PCB_LISTEN
\r
99 #define MEMP_NUM_TCP_PCB_LISTEN 8
\r
101 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
\r
103 #ifndef MEMP_NUM_TCP_SEG
\r
104 #define MEMP_NUM_TCP_SEG 16
\r
106 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
\r
108 #ifndef MEMP_NUM_SYS_TIMEOUT
\r
109 #define MEMP_NUM_SYS_TIMEOUT 3
\r
112 /* The following four are used only with the sequential API and can be
\r
113 set to 0 if the application only will use the raw API. */
\r
114 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
\r
115 #ifndef MEMP_NUM_NETBUF
\r
116 #define MEMP_NUM_NETBUF 2
\r
118 /* MEMP_NUM_NETCONN: the number of struct netconns. */
\r
119 #ifndef MEMP_NUM_NETCONN
\r
120 #define MEMP_NUM_NETCONN 4
\r
122 /* MEMP_NUM_APIMSG: the number of struct api_msg, used for
\r
123 communication between the TCP/IP stack and the sequential
\r
125 #ifndef MEMP_NUM_API_MSG
\r
126 #define MEMP_NUM_API_MSG 8
\r
128 /* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
\r
129 for sequential API communication and incoming packets. Used in
\r
130 src/api/tcpip.c. */
\r
131 #ifndef MEMP_NUM_TCPIP_MSG
\r
132 #define MEMP_NUM_TCPIP_MSG 8
\r
135 /* ---------- Pbuf options ---------- */
\r
136 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
\r
138 #ifndef PBUF_POOL_SIZE
\r
139 #define PBUF_POOL_SIZE 16
\r
142 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
\r
144 #ifndef PBUF_POOL_BUFSIZE
\r
145 #define PBUF_POOL_BUFSIZE 128
\r
148 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
\r
149 link level header. Defaults to 14 for Ethernet. */
\r
151 #ifndef PBUF_LINK_HLEN
\r
152 #define PBUF_LINK_HLEN 14
\r
157 /* ---------- ARP options ---------- */
\r
159 /** Number of active hardware address, IP address pairs cached */
\r
160 #ifndef ARP_TABLE_SIZE
\r
161 #define ARP_TABLE_SIZE 10
\r
165 * If enabled, outgoing packets are queued during hardware address
\r
168 * This feature has not stabilized yet. Single-packet queueing is
\r
169 * believed to be stable, multi-packet queueing is believed to
\r
170 * clash with the TCP segment queueing.
\r
172 * As multi-packet-queueing is currently disabled, enabling this
\r
173 * _should_ work, but we need your testing feedback on lwip-users.
\r
176 #ifndef ARP_QUEUEING
\r
177 #define ARP_QUEUEING 1
\r
180 /* This option is deprecated */
\r
181 #ifdef ETHARP_QUEUE_FIRST
\r
182 #error ETHARP_QUEUE_FIRST option is deprecated. Remove it from your lwipopts.h.
\r
185 /* This option is removed to comply with the ARP standard */
\r
186 #ifdef ETHARP_ALWAYS_INSERT
\r
187 #error ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h.
\r
190 /* ---------- IP options ---------- */
\r
191 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
\r
192 IP packets across network interfaces. If you are going to run lwIP
\r
193 on a device with only one network interface, define this to 0. */
\r
195 #define IP_FORWARD 0
\r
198 /* If defined to 1, IP options are allowed (but not parsed). If
\r
199 defined to 0, all packets with IP options are dropped. */
\r
201 #define IP_OPTIONS 1
\r
204 /** IP reassembly and segmentation. Even if they both deal with IP
\r
205 * fragments, note that these are orthogonal, one dealing with incoming
\r
206 * packets, the other with outgoing packets
\r
209 /** Reassemble incoming fragmented IP packets */
\r
210 #ifndef IP_REASSEMBLY
\r
211 #define IP_REASSEMBLY 1
\r
214 /** Fragment outgoing IP packets if their size exceeds MTU */
\r
219 /* ---------- ICMP options ---------- */
\r
222 #define ICMP_TTL 255
\r
225 /* ---------- RAW options ---------- */
\r
232 #define RAW_TTL 255
\r
235 /* ---------- DHCP options ---------- */
\r
238 #define LWIP_DHCP 0
\r
241 /* 1 if you want to do an ARP check on the offered address
\r
243 #ifndef DHCP_DOES_ARP_CHECK
\r
244 #define DHCP_DOES_ARP_CHECK 1
\r
247 /* ---------- UDP options ---------- */
\r
253 #define UDP_TTL 255
\r
256 /* ---------- TCP options ---------- */
\r
262 #define TCP_TTL 255
\r
266 #define TCP_WND 2048
\r
270 #define TCP_MAXRTX 12
\r
273 #ifndef TCP_SYNMAXRTX
\r
274 #define TCP_SYNMAXRTX 6
\r
278 /* Controls if TCP should queue segments that arrive out of
\r
279 order. Define to 0 if your device is low on memory. */
\r
280 #ifndef TCP_QUEUE_OOSEQ
\r
281 #define TCP_QUEUE_OOSEQ 1
\r
284 /* TCP Maximum segment size. */
\r
286 #define TCP_MSS 128 /* A *very* conservative default. */
\r
289 /* TCP sender buffer space (bytes). */
\r
290 #ifndef TCP_SND_BUF
\r
291 #define TCP_SND_BUF 256
\r
294 /* TCP sender buffer space (pbufs). This must be at least = 2 *
\r
295 TCP_SND_BUF/TCP_MSS for things to work. */
\r
296 #ifndef TCP_SND_QUEUELEN
\r
297 #define TCP_SND_QUEUELEN 4 * TCP_SND_BUF/TCP_MSS
\r
301 /* Maximum number of retransmissions of data segments. */
\r
303 /* Maximum number of retransmissions of SYN segments. */
\r
305 /* TCP writable space (bytes). This must be less than or equal
\r
306 to TCP_SND_BUF. It is the amount of space which must be
\r
307 available in the tcp snd_buf for select to return writable */
\r
308 #ifndef TCP_SNDLOWAT
\r
309 #define TCP_SNDLOWAT TCP_SND_BUF/2
\r
312 /* Support loop interface (127.0.0.1) */
\r
313 #ifndef LWIP_HAVE_LOOPIF
\r
314 #define LWIP_HAVE_LOOPIF 0
\r
317 #ifndef LWIP_EVENT_API
\r
318 #define LWIP_EVENT_API 0
\r
319 #define LWIP_CALLBACK_API 1
\r
321 #define LWIP_EVENT_API 1
\r
322 #define LWIP_CALLBACK_API 0
\r
325 #ifndef LWIP_COMPAT_SOCKETS
\r
326 #define LWIP_COMPAT_SOCKETS 1
\r
330 #ifndef TCPIP_THREAD_PRIO
\r
331 #define TCPIP_THREAD_PRIO 1
\r
334 #ifndef SLIPIF_THREAD_PRIO
\r
335 #define SLIPIF_THREAD_PRIO 1
\r
338 #ifndef PPP_THREAD_PRIO
\r
339 #define PPP_THREAD_PRIO 1
\r
342 #ifndef DEFAULT_THREAD_PRIO
\r
343 #define DEFAULT_THREAD_PRIO 1
\r
347 /* ---------- Socket Options ---------- */
\r
348 /* Enable SO_REUSEADDR and SO_REUSEPORT options */
\r
350 /* I removed the lot since this was an ugly hack. It broke the raw-API.
\r
351 It also came with many ugly goto's, Christiaan Simons. */
\r
352 #error "SO_REUSE currently unavailable, this was a hack"
\r
356 /* ---------- Statistics options ---------- */
\r
358 #define LWIP_STATS 1
\r
363 #ifndef LWIP_STATS_DISPLAY
\r
364 #define LWIP_STATS_DISPLAY 0
\r
368 #define LINK_STATS 1
\r
375 #ifndef IPFRAG_STATS
\r
376 #define IPFRAG_STATS 1
\r
380 #define ICMP_STATS 1
\r
384 #define UDP_STATS 1
\r
388 #define TCP_STATS 1
\r
392 #define MEM_STATS 1
\r
396 #define MEMP_STATS 1
\r
400 #define PBUF_STATS 1
\r
404 #define SYS_STATS 1
\r
408 #define RAW_STATS 0
\r
413 #define LINK_STATS 0
\r
415 #define IPFRAG_STATS 0
\r
416 #define ICMP_STATS 0
\r
417 #define UDP_STATS 0
\r
418 #define TCP_STATS 0
\r
419 #define MEM_STATS 0
\r
420 #define MEMP_STATS 0
\r
421 #define PBUF_STATS 0
\r
422 #define SYS_STATS 0
\r
423 #define RAW_STATS 0
\r
424 #define LWIP_STATS_DISPLAY 0
\r
426 #endif /* LWIP_STATS */
\r
428 /* ---------- PPP options ---------- */
\r
430 #ifndef PPP_SUPPORT
\r
431 #define PPP_SUPPORT 0 /* Set for PPP */
\r
436 #define NUM_PPP 1 /* Max PPP sessions. */
\r
440 #ifndef PAP_SUPPORT
\r
441 #define PAP_SUPPORT 0 /* Set for PAP. */
\r
444 #ifndef CHAP_SUPPORT
\r
445 #define CHAP_SUPPORT 0 /* Set for CHAP. */
\r
448 #define MSCHAP_SUPPORT 0 /* Set for MSCHAP (NOT FUNCTIONAL!) */
\r
449 #define CBCP_SUPPORT 0 /* Set for CBCP (NOT FUNCTIONAL!) */
\r
450 #define CCP_SUPPORT 0 /* Set for CCP (NOT FUNCTIONAL!) */
\r
453 #define VJ_SUPPORT 0 /* Set for VJ header compression. */
\r
456 #ifndef MD5_SUPPORT
\r
457 #define MD5_SUPPORT 0 /* Set for MD5 (see also CHAP) */
\r
464 #define FSM_DEFTIMEOUT 6 /* Timeout time in seconds */
\r
465 #define FSM_DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */
\r
466 #define FSM_DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */
\r
467 #define FSM_DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */
\r
469 #define UPAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */
\r
470 #define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
\r
472 #define CHAP_DEFTIMEOUT 6 /* Timeout time in seconds */
\r
473 #define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */
\r
476 /* Interval in seconds between keepalive echo requests, 0 to disable. */
\r
478 #define LCP_ECHOINTERVAL 0
\r
480 #define LCP_ECHOINTERVAL 10
\r
483 /* Number of unanswered echo requests before failure. */
\r
484 #define LCP_MAXECHOFAILS 3
\r
486 /* Max Xmit idle time (in jiffies) before resend flag char. */
\r
487 #define PPP_MAXIDLEFLAG 100
\r
492 * Note - lcp shouldn't be allowed to negotiate stuff outside these
\r
493 * limits. See lcp.h in the pppd directory.
\r
494 * (XXX - these constants should simply be shared by lcp.c instead
\r
495 * of living in lcp.h)
\r
497 #define PPP_MTU 1500 /* Default MTU (size of Info field) */
\r
499 #define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN)
\r
501 #define PPP_MAXMTU 1500 /* Largest MTU we allow */
\r
503 #define PPP_MINMTU 64
\r
504 #define PPP_MRU 1500 /* default MRU = max length of info field */
\r
505 #define PPP_MAXMRU 1500 /* Largest MRU we allow */
\r
506 #define PPP_DEFMRU 296 /* Try for this */
\r
507 #define PPP_MINMRU 128 /* No MRUs below this */
\r
510 #define MAXNAMELEN 256 /* max length of hostname or name for auth */
\r
511 #define MAXSECRETLEN 256 /* max length of password or secret */
\r
513 #endif /* PPP_SUPPORT */
\r
515 /* checksum options - set to zero for hardware checksum support */
\r
517 #ifndef CHECKSUM_GEN_IP
\r
518 #define CHECKSUM_GEN_IP 1
\r
521 #ifndef CHECKSUM_GEN_UDP
\r
522 #define CHECKSUM_GEN_UDP 1
\r
525 #ifndef CHECKSUM_GEN_TCP
\r
526 #define CHECKSUM_GEN_TCP 1
\r
529 #ifndef CHECKSUM_CHECK_IP
\r
530 #define CHECKSUM_CHECK_IP 1
\r
533 #ifndef CHECKSUM_CHECK_UDP
\r
534 #define CHECKSUM_CHECK_UDP 1
\r
537 #ifndef CHECKSUM_CHECK_TCP
\r
538 #define CHECKSUM_CHECK_TCP 1
\r
541 /* Debugging options all default to off */
\r
543 #ifndef DBG_TYPES_ON
\r
544 #define DBG_TYPES_ON 0
\r
547 #ifndef ETHARP_DEBUG
\r
548 #define ETHARP_DEBUG DBG_OFF
\r
551 #ifndef NETIF_DEBUG
\r
552 #define NETIF_DEBUG DBG_OFF
\r
556 #define PBUF_DEBUG DBG_OFF
\r
559 #ifndef API_LIB_DEBUG
\r
560 #define API_LIB_DEBUG DBG_OFF
\r
563 #ifndef API_MSG_DEBUG
\r
564 #define API_MSG_DEBUG DBG_OFF
\r
567 #ifndef SOCKETS_DEBUG
\r
568 #define SOCKETS_DEBUG DBG_OFF
\r
572 #define ICMP_DEBUG DBG_OFF
\r
576 #define INET_DEBUG DBG_OFF
\r
580 #define IP_DEBUG DBG_OFF
\r
583 #ifndef IP_REASS_DEBUG
\r
584 #define IP_REASS_DEBUG DBG_OFF
\r
588 #define RAW_DEBUG DBG_OFF
\r
592 #define MEM_DEBUG DBG_OFF
\r
596 #define MEMP_DEBUG DBG_OFF
\r
600 #define SYS_DEBUG DBG_OFF
\r
604 #define TCP_DEBUG DBG_OFF
\r
607 #ifndef TCP_INPUT_DEBUG
\r
608 #define TCP_INPUT_DEBUG DBG_OFF
\r
611 #ifndef TCP_FR_DEBUG
\r
612 #define TCP_FR_DEBUG DBG_OFF
\r
615 #ifndef TCP_RTO_DEBUG
\r
616 #define TCP_RTO_DEBUG DBG_OFF
\r
619 #ifndef TCP_REXMIT_DEBUG
\r
620 #define TCP_REXMIT_DEBUG DBG_OFF
\r
623 #ifndef TCP_CWND_DEBUG
\r
624 #define TCP_CWND_DEBUG DBG_OFF
\r
627 #ifndef TCP_WND_DEBUG
\r
628 #define TCP_WND_DEBUG DBG_OFF
\r
631 #ifndef TCP_OUTPUT_DEBUG
\r
632 #define TCP_OUTPUT_DEBUG DBG_OFF
\r
635 #ifndef TCP_RST_DEBUG
\r
636 #define TCP_RST_DEBUG DBG_OFF
\r
639 #ifndef TCP_QLEN_DEBUG
\r
640 #define TCP_QLEN_DEBUG DBG_OFF
\r
644 #define UDP_DEBUG DBG_OFF
\r
647 #ifndef TCPIP_DEBUG
\r
648 #define TCPIP_DEBUG DBG_OFF
\r
652 #define PPP_DEBUG DBG_OFF
\r
655 #ifndef SLIP_DEBUG
\r
656 #define SLIP_DEBUG DBG_OFF
\r
659 #ifndef DHCP_DEBUG
\r
660 #define DHCP_DEBUG DBG_OFF
\r
664 #ifndef DBG_MIN_LEVEL
\r
665 #define DBG_MIN_LEVEL DBG_LEVEL_OFF
\r
668 #endif /* __LWIP_OPT_H__ */
\r