1/**
2 * @file
3 *
4 * lwIP Options Configuration
5 */
6
7/*
8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 *
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.
21 *
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
31 * OF SUCH DAMAGE.
32 *
33 * This file is part of the lwIP TCP/IP stack.
34 *
35 * Author: Adam Dunkels <adam@sics.se>
36 *
37 */
38#ifndef LWIP_LWIPOPTS_H
39#define LWIP_LWIPOPTS_H
40
41#include <stdint.h>
42
43
44#include <barrelfish/net_constants.h>
45
46
47
48/// Don't want lwip POSIX socket wrappers
49#define LWIP_POSIX_SOCKETS_IO_NAMES     0
50
51/// We do not want LWIP to provide POSIX errno
52#undef LWIP_PROVIDE_ERRNO
53
54/// Don't want socket functions overriden by lwIP. We provide our own.
55#define LWIP_COMPAT_SOCKETS     0
56
57/// We want to be informed about interface up/down
58#define LWIP_NETIF_STATUS_CALLBACK      1
59
60/// Don't do ARP lookup to test IP
61#define DHCP_DOES_ARP_CHECK     1
62
63/// Disable locks (we lock the whole stack)
64#define SYS_LIGHTWEIGHT_PROT    0
65
66
67/** ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table
68 * entries (using etharp_add_static_entry/etharp_remove_static_entry).
69 */
70#define ETHARP_SUPPORT_STATIC_ENTRIES 1
71
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).
77 */
78#define LWIP_ARP_FILTER_NETIF 1
79#define LWIP_ARP_FILTER_NETIF_FN(p, netif, type) arp_filter_netif(p, netif, type)
80
81struct pbuf;
82struct netif;
83struct netif *arp_filter_netif(struct pbuf *p, struct netif *netif, uint16_t type);
84
85
86/*
87   -----------------------------------------------
88   ---------- Platform specific locking ----------
89   -----------------------------------------------
90*/
91
92/**
93 * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
94 * use lwIP facilities.
95 */
96#define NO_SYS                          1
97
98/**
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.
102 */
103#define SYS_LIGHTWEIGHT_PROT            0
104
105/*
106   ------------------------------------
107   ---------- Memory options ----------
108   ------------------------------------
109*/
110/**
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
114 */
115#define MEM_ALIGNMENT                   1
116
117
118/*
119   ------------------------------------------------
120   ---------- Internal Memory Pool Sizes ----------
121   ------------------------------------------------
122*/
123
124#define LWIP_SUPPORT_CUSTOM_PBUF 1
125#define MEM_USE_POOLS 0
126#define MEMP_USE_CUSTOM_POOLS 0
127
128
129/**
130 * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
131 * (requires the LWIP_RAW option)
132 */
133#define MEMP_NUM_RAW_PCB                4
134
135/**
136 * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
137 * per active UDP "connection".
138 * (requires the LWIP_UDP option)
139 */
140#define MEMP_NUM_UDP_PCB                4
141
142/**
143 * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
144 * (requires the LWIP_TCP option)
145 */
146#define MEMP_NUM_TCP_PCB                2
147
148/**
149 * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
150 * (requires the LWIP_TCP option)
151 */
152#define MEMP_NUM_TCP_PCB_LISTEN         8
153
154/**
155 * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
156 * (requires the LWIP_TCP option)
157 */
158#define MEMP_NUM_TCP_SEG                4096
159
160/**
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)
165 */
166#define MEMP_NUM_ARP_QUEUE              2
167
168/**
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'.
172 *
173 * To this default value, 1 was added for the snmp_increment timer.
174 */
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
176
177/**
178 * MEMP_NUM_NETBUF: the number of struct netbufs.
179 * (only needed if you use the sequential API, like api_lib.c)
180 */
181#define MEMP_NUM_NETBUF                 0
182
183/**
184 * MEMP_NUM_NETCONN: the number of struct netconns.
185 * (only needed if you use the sequential API, like api_lib.c)
186 */
187#define MEMP_NUM_NETCONN                0
188
189/**
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)
193 */
194#define MEMP_NUM_TCPIP_MSG_API          0
195
196/**
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)
200 */
201#define MEMP_NUM_TCPIP_MSG_INPKT        0
202
203/*
204   ---------------------------------
205   ---------- ARP options ----------
206   ---------------------------------
207*/
208/**
209 * LWIP_ARP==1: Enable ARP functionality.
210 */
211#define LWIP_ARP                        1
212
213/*
214   --------------------------------
215   ---------- IP options ----------
216   --------------------------------
217*/
218/**
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.
222 */
223#define IP_FORWARD                      0
224
225/**
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).
229 */
230#define IP_OPTIONS_ALLOWED              1
231
232/**
233 * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
234 * this option does not affect outgoing packet sizes, which can be controlled
235 * via IP_FRAG.
236 */
237#define IP_REASSEMBLY                   1
238
239/**
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.
243 */
244#define IP_FRAG                         0
245
246/**
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.
250 */
251#define IP_REASS_MAXAGE                 3
252
253/**
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!
258 */
259#define IP_REASS_MAX_PBUFS              10
260
261/**
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.
265 */
266#define IP_FRAG_USES_STATIC_BUF         0
267
268/**
269 * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
270 */
271#define IP_DEFAULT_TTL                  255
272
273/*
274   ----------------------------------
275   ---------- ICMP options ----------
276   ----------------------------------
277*/
278/**
279 * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
280 * Be careful, disable that make your product non-compliant to RFC1122
281 */
282#define LWIP_ICMP                       1
283
284/**
285 * ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
286 */
287#define ICMP_TTL                       (IP_DEFAULT_TTL)
288
289/*
290   ---------------------------------
291   ---------- RAW options ----------
292   ---------------------------------
293*/
294/**
295 * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
296 */
297#define LWIP_RAW                        1
298
299/*
300   ----------------------------------
301   ---------- DHCP options ----------
302   ----------------------------------
303*/
304/**
305 * LWIP_DHCP==1: Enable DHCP module.
306 */
307#define LWIP_DHCP                       1
308
309/*
310   ------------------------------------
311   ---------- AUTOIP options ----------
312   ------------------------------------
313*/
314/**
315 * LWIP_AUTOIP==1: Enable AUTOIP module.
316 */
317#define LWIP_AUTOIP                     0
318
319/*
320   ----------------------------------
321   ---------- SNMP options ----------
322   ----------------------------------
323*/
324/**
325 * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
326 * transport.
327 */
328#define LWIP_SNMP                       0
329#define LWIP_MIB2_CALLBACKS             0
330#define MIB2_STATS                      0
331
332/*
333   ----------------------------------
334   ---------- IGMP options ----------
335   ----------------------------------
336*/
337/**
338 * LWIP_IGMP==1: Turn on IGMP module.
339 */
340#define LWIP_IGMP                       0
341
342/*
343   ----------------------------------
344   ---------- DNS options -----------
345   ----------------------------------
346*/
347/**
348 * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
349 * transport.
350 */
351#define LWIP_DNS                        1
352
353/*
354   ---------------------------------
355   ---------- UDP options ----------
356   ---------------------------------
357*/
358/**
359 * LWIP_UDP==1: Turn on UDP.
360 */
361#define LWIP_UDP                        1
362
363/**
364 * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP)
365 */
366#define LWIP_UDPLITE                    0
367
368/**
369 * UDP_TTL: Default Time-To-Live value.
370 */
371#define UDP_TTL                         (IP_DEFAULT_TTL)
372
373/*
374   ---------------------------------
375   ---------- TCP options ----------
376   ---------------------------------
377*/
378/**
379 * LWIP_TCP==1: Turn on TCP.
380 */
381#define LWIP_TCP                        1
382
383/*
384   ----------------------------------
385   ---------- Pbuf options ----------
386   ----------------------------------
387*/
388/**
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
391 * Ethernet.
392 */
393#define PBUF_LINK_HLEN                  14
394
395/*
396   ------------------------------------
397   ---------- LOOPIF options ----------
398   ------------------------------------
399*/
400/**
401 * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
402 */
403#define LWIP_HAVE_LOOPIF                1
404#define LWIP_NETIF_LOOPBACK 1
405
406/** LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled
407 */
408
409/*
410   ----------------------------------------------
411   ---------- Sequential layer options ----------
412   ----------------------------------------------
413*/
414
415/**
416 * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
417 */
418#define LWIP_NETCONN                    0
419
420/*
421   ------------------------------------
422   ---------- Socket options ----------
423   ------------------------------------
424*/
425/**
426 * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
427 */
428#define LWIP_SOCKET                     0
429
430/*
431   ----------------------------------------
432   ---------- Statistics options ----------
433   ----------------------------------------
434*/
435/**
436 * LWIP_STATS==1: Enable statistics collection in lwip_stats.
437 */
438#define LWIP_STATS                      0
439
440/*
441   ---------------------------------------
442   ---------- Debugging options ----------
443   ---------------------------------------
444*/
445
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
477
478extern unsigned char debug_flags;
479#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
480
481
482
483#if 1
484#ifndef CHECKSUM_GEN_IP
485#define CHECKSUM_GEN_IP                 1
486#endif
487
488#ifndef CHECKSUM_GEN_UDP
489#define CHECKSUM_GEN_UDP                1
490#endif
491
492#ifndef CHECKSUM_GEN_TCP
493#define CHECKSUM_GEN_TCP                1
494#endif
495
496#ifndef CHECKSUM_CHECK_IP
497#define CHECKSUM_CHECK_IP               1
498#endif
499
500#ifndef CHECKSUM_CHECK_UDP
501#define CHECKSUM_CHECK_UDP              1
502#endif
503
504#ifndef CHECKSUM_CHECK_TCP
505#define CHECKSUM_CHECK_TCP              1
506#endif
507#else
508
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
517#endif
518
519#define TCP_MSS                 1460
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))
523
524#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
525
526#endif /* LWIP_LWIPOPTS_H */
527