4 * lwIP Options Configuration
8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
33 * This file is part of the lwIP TCP/IP stack.
35 * Author: Adam Dunkels <adam@sics.se>
38 #ifndef LWIP_LWIPOPTS_H
39 #define LWIP_LWIPOPTS_H
44 #include <barrelfish/net_constants.h>
48 /// Don't want lwip POSIX socket wrappers
49 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
51 /// We do not want LWIP to provide POSIX errno
52 #undef LWIP_PROVIDE_ERRNO
54 /// Don't want socket functions overriden by lwIP. We provide our own.
55 #define LWIP_COMPAT_SOCKETS 0
57 /// We want to be informed about interface up/down
58 #define LWIP_NETIF_STATUS_CALLBACK 1
60 /// Don't do ARP lookup to test IP
61 #define DHCP_DOES_ARP_CHECK 1
63 /// Disable locks (we lock the whole stack)
64 #define SYS_LIGHTWEIGHT_PROT 0
67 /** ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table
68 * entries (using etharp_add_static_entry/etharp_remove_static_entry).
70 #define ETHARP_SUPPORT_STATIC_ENTRIES 1
72 /** Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type)
73 * to a filter function that returns the correct netif when using multiple
74 * netifs on one hardware interface where the netif's low-level receive
75 * routine cannot decide for the correct netif (e.g. when mapping multiple
76 * IP addresses to one hardware interface).
78 #define LWIP_ARP_FILTER_NETIF 1
79 #define LWIP_ARP_FILTER_NETIF_FN(p, netif, type) arp_filter_netif(p, netif, type)
83 struct netif *arp_filter_netif(struct pbuf *p, struct netif *netif, uint16_t type);
87 -----------------------------------------------
88 ---------- Platform specific locking ----------
89 -----------------------------------------------
93 * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
94 * use lwIP facilities.
99 * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
100 * critical regions during buffer allocation, deallocation and memory
101 * allocation and deallocation.
103 #define SYS_LIGHTWEIGHT_PROT 0
106 ------------------------------------
107 ---------- Memory options ----------
108 ------------------------------------
111 * MEM_ALIGNMENT: should be set to the alignment of the CPU
112 * 4 byte alignment -> #define MEM_ALIGNMENT 4
113 * 2 byte alignment -> #define MEM_ALIGNMENT 2
115 #define MEM_ALIGNMENT 1
119 ------------------------------------------------
120 ---------- Internal Memory Pool Sizes ----------
121 ------------------------------------------------
124 #define LWIP_SUPPORT_CUSTOM_PBUF 1
125 #define MEM_USE_POOLS 0
126 #define MEMP_USE_CUSTOM_POOLS 0
130 * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
131 * (requires the LWIP_RAW option)
133 #define MEMP_NUM_RAW_PCB 4
136 * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
137 * per active UDP "connection".
138 * (requires the LWIP_UDP option)
140 #define MEMP_NUM_UDP_PCB 4
143 * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
144 * (requires the LWIP_TCP option)
146 #define MEMP_NUM_TCP_PCB 2
149 * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
150 * (requires the LWIP_TCP option)
152 #define MEMP_NUM_TCP_PCB_LISTEN 8
155 * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
156 * (requires the LWIP_TCP option)
158 #define MEMP_NUM_TCP_SEG 4096
161 * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing
162 * packets (pbufs) that are waiting for an ARP request (to resolve
163 * their destination address) to finish.
164 * (requires the ARP_QUEUEING option)
166 #define MEMP_NUM_ARP_QUEUE 2
169 * MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active timeouts.
170 * The default number of timeouts is calculated here for all enabled modules.
171 * The formula expects settings to be either '0' or '1'.
173 * To this default value, 1 was added for the snmp_increment timer.
175 #define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD) : 0)) + 1
178 * MEMP_NUM_NETBUF: the number of struct netbufs.
179 * (only needed if you use the sequential API, like api_lib.c)
181 #define MEMP_NUM_NETBUF 0
184 * MEMP_NUM_NETCONN: the number of struct netconns.
185 * (only needed if you use the sequential API, like api_lib.c)
187 #define MEMP_NUM_NETCONN 0
190 * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
191 * for callback/timeout API communication.
192 * (only needed if you use tcpip.c)
194 #define MEMP_NUM_TCPIP_MSG_API 0
197 * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
198 * for incoming packets.
199 * (only needed if you use tcpip.c)
201 #define MEMP_NUM_TCPIP_MSG_INPKT 0
204 ---------------------------------
205 ---------- ARP options ----------
206 ---------------------------------
209 * LWIP_ARP==1: Enable ARP functionality.
214 --------------------------------
215 ---------- IP options ----------
216 --------------------------------
219 * IP_FORWARD==1: Enables the ability to forward IP packets across network
220 * interfaces. If you are going to run lwIP on a device with only one network
221 * interface, define this to 0.
226 * IP_OPTIONS: Defines the behavior for IP options.
227 * IP_OPTIONS==0_ALLOWED: All packets with IP options are dropped.
228 * IP_OPTIONS==1_ALLOWED: IP options are allowed (but not parsed).
230 #define IP_OPTIONS_ALLOWED 1
233 * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
234 * this option does not affect outgoing packet sizes, which can be controlled
237 #define IP_REASSEMBLY 1
240 * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
241 * that this option does not affect incoming packet sizes, which can be
242 * controlled via IP_REASSEMBLY.
247 * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
248 * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
249 * in this time, the whole packet is discarded.
251 #define IP_REASS_MAXAGE 3
254 * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
255 * Since the received pbufs are enqueued, be sure to configure
256 * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
257 * packets even if the maximum amount of fragments is enqueued for reassembly!
259 #define IP_REASS_MAX_PBUFS 10
262 * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
263 * fragmentation. Otherwise pbufs are allocated and reference the original
264 * packet data to be fragmented.
266 #define IP_FRAG_USES_STATIC_BUF 0
269 * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
271 #define IP_DEFAULT_TTL 255
274 ----------------------------------
275 ---------- ICMP options ----------
276 ----------------------------------
279 * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
280 * Be careful, disable that make your product non-compliant to RFC1122
285 * ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
287 #define ICMP_TTL (IP_DEFAULT_TTL)
290 ---------------------------------
291 ---------- RAW options ----------
292 ---------------------------------
295 * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
300 ----------------------------------
301 ---------- DHCP options ----------
302 ----------------------------------
305 * LWIP_DHCP==1: Enable DHCP module.
310 ------------------------------------
311 ---------- AUTOIP options ----------
312 ------------------------------------
315 * LWIP_AUTOIP==1: Enable AUTOIP module.
317 #define LWIP_AUTOIP 0
320 ----------------------------------
321 ---------- SNMP options ----------
322 ----------------------------------
325 * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
329 #define LWIP_MIB2_CALLBACKS 0
333 ----------------------------------
334 ---------- IGMP options ----------
335 ----------------------------------
338 * LWIP_IGMP==1: Turn on IGMP module.
343 ----------------------------------
344 ---------- DNS options -----------
345 ----------------------------------
348 * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
354 ---------------------------------
355 ---------- UDP options ----------
356 ---------------------------------
359 * LWIP_UDP==1: Turn on UDP.
364 * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP)
366 #define LWIP_UDPLITE 0
369 * UDP_TTL: Default Time-To-Live value.
371 #define UDP_TTL (IP_DEFAULT_TTL)
374 ---------------------------------
375 ---------- TCP options ----------
376 ---------------------------------
379 * LWIP_TCP==1: Turn on TCP.
384 ----------------------------------
385 ---------- Pbuf options ----------
386 ----------------------------------
389 * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
390 * link level header. The default is 14, the standard value for
393 #define PBUF_LINK_HLEN 14
396 ------------------------------------
397 ---------- LOOPIF options ----------
398 ------------------------------------
401 * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
403 #define LWIP_HAVE_LOOPIF 1
404 #define LWIP_NETIF_LOOPBACK 1
406 /** LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled
410 ----------------------------------------------
411 ---------- Sequential layer options ----------
412 ----------------------------------------------
416 * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
418 #define LWIP_NETCONN 0
421 ------------------------------------
422 ---------- Socket options ----------
423 ------------------------------------
426 * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
428 #define LWIP_SOCKET 0
431 ----------------------------------------
432 ---------- Statistics options ----------
433 ----------------------------------------
436 * LWIP_STATS==1: Enable statistics collection in lwip_stats.
441 ---------------------------------------
442 ---------- Debugging options ----------
443 ---------------------------------------
446 #define LWIP_NOASSERT 1
447 //#define LWIP_DEBUG 0
448 #define TAPIF_DEBUG LWIP_DBG_OFF
449 #define TUNIF_DEBUG LWIP_DBG_OFF
450 #define UNIXIF_DEBUG LWIP_DBG_OFF
451 #define DELIF_DEBUG LWIP_DBG_OFF
452 #define SIO_FIFO_DEBUG LWIP_DBG_OFF
453 #define ETHARP_DEBUG LWIP_DBG_OFF
454 #define TCPDUMP_DEBUG LWIP_DBG_OFF
455 #define API_LIB_DEBUG LWIP_DBG_OFF
456 #define API_MSG_DEBUG LWIP_DBG_OFF
457 #define TCPIP_DEBUG LWIP_DBG_OFF
458 #define NETIF_DEBUG LWIP_DBG_OFF
459 #define SOCKETS_DEBUG LWIP_DBG_OFF
460 #define DEMO_DEBUG LWIP_DBG_OFF
461 #define IP_DEBUG LWIP_DBG_OFF
462 #define IP_REASS_DEBUG LWIP_DBG_OFF
463 #define RAW_DEBUG LWIP_DBG_OFF
464 #define ICMP_DEBUG LWIP_DBG_OFF
465 #define UDP_DEBUG LWIP_DBG_OFF
466 #define TCP_DEBUG LWIP_DBG_OFF
467 #define TCP_INPUT_DEBUG LWIP_DBG_OFF
468 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
469 #define TCP_RTO_DEBUG LWIP_DBG_OFF
470 #define TCP_CWND_DEBUG LWIP_DBG_OFF
471 #define TCP_WND_DEBUG LWIP_DBG_OFF
472 #define TCP_FR_DEBUG LWIP_DBG_OFF
473 #define TCP_QLEN_DEBUG LWIP_DBG_OFF
474 #define TCP_RST_DEBUG LWIP_DBG_OFF
475 #define PBUF_DEBUG LWIP_DBG_OFF
476 #define DHCP_DEBUG LWIP_DBG_OFF
478 extern unsigned char debug_flags;
479 #define LWIP_DBG_TYPES_ON LWIP_DBG_ON
484 #ifndef CHECKSUM_GEN_IP
485 #define CHECKSUM_GEN_IP 1
488 #ifndef CHECKSUM_GEN_UDP
489 #define CHECKSUM_GEN_UDP 1
492 #ifndef CHECKSUM_GEN_TCP
493 #define CHECKSUM_GEN_TCP 1
496 #ifndef CHECKSUM_CHECK_IP
497 #define CHECKSUM_CHECK_IP 1
500 #ifndef CHECKSUM_CHECK_UDP
501 #define CHECKSUM_CHECK_UDP 1
504 #ifndef CHECKSUM_CHECK_TCP
505 #define CHECKSUM_CHECK_TCP 1
509 #define CHECKSUM_CHECK_IP 0
510 #define CHECKSUM_CHECK_UDP 0
511 #define CHECKSUM_CHECK_ICMP 0
512 #define LWIP_CHECKSUM_ON_COPY 0
513 #define CHECKSUM_CHECK_TCP 0
514 #define CHECKSUM_GEN_IP 0
515 #define CHECKSUM_GEN_UDP 0
516 #define CHECKSUM_GEN_TCP 0
520 #define TCP_WND (TCP_MSS * 20)
521 #define TCP_SND_BUF (TCP_MSS * 40)
522 #define TCP_SND_QUEUELEN (16 * (TCP_SND_BUF/TCP_MSS))
524 #define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
526 #endif /* LWIP_LWIPOPTS_H */