VirtualBox

source: vbox/trunk/src/VBox/NetworkServices/NAT/lwipopts.h@ 50213

Last change on this file since 50213 was 50103, checked in by vboxsync, 11 years ago

LWIP_NOASSERT is tested with #ifdef, not #if. Drop it its incorrect
definition from lwipopts.h and instead disable it in the Makefile for
release, profile and kprofile builds.

  • Property svn:eol-style set to native
File size: 6.7 KB
Line 
1#ifndef _VBOX_NETNAT_LWIP_OPTS_H_
2#define _VBOX_NETNAT_LWIP_OPTS_H_
3
4#include <iprt/mem.h>
5#include <iprt/alloca.h> /* This may include malloc.h (msc), which is something that has
6 * to be done before redefining any of the functions therein. */
7#include <iprt/rand.h> /* see LWIP_RAND() definition */
8
9/* lwip/sockets.h assumes that if FD_SET is defined (in case of Innotek GCC
10 * its definition is dragged through iprt/types.h) then struct timeval is
11 * defined as well, but it's not the case. So include it manually. */
12#ifdef RT_OS_OS2
13# include <sys/time.h>
14#endif
15
16/** Make lwIP use the libc malloc, or more precisely (see below) the IPRT
17 * memory allocation functions. */
18#define MEM_LIBC_MALLOC 1
19
20/** Set proper memory alignment. */
21#if HC_ARCH_BITS == 64
22# define MEM_ALIGNMENT 8
23#else
24#define MEM_ALIGNMENT 4
25#endif
26
27/* Padding before Ethernet header to make IP header aligned */
28#define ETH_PAD_SIZE 2
29
30/* IP */
31#define IP_REASSEMBLY 1
32#define IP_REASS_MAX_PBUFS 128
33
34
35
36/** Increase maximum TCP window size. */
37#define TCP_WND 32768
38
39/** Increase TCP maximum segment size. */
40#define TCP_MSS 1460
41
42/** Enable queueing of out-of-order segments. */
43#define TCP_QUEUE_OOSEQ 1
44
45/** TCP sender buffer space (bytes). */
46#define TCP_SND_BUF (32 * TCP_MSS)
47
48/* TCP sender buffer space (pbufs). This must be at least = 2 *
49 TCP_SND_BUF/TCP_MSS for things to work. */
50#define TCP_SND_QUEUELEN 64
51
52/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
53 sends a lot of data out of ROM (or other static memory), this
54 should be set high.
55
56 NB: This is for PBUF_ROM and PBUF_REF pbufs only!
57
58 Number of PBUF_POOL pbufs is controlled by PBUF_POOL_SIZE that,
59 somewhat confusingly, breaks MEMP_NUM_* pattern.
60
61 PBUF_RAM pbufs are allocated with mem_malloc (with MEM_LIBC_MALLOC
62 set to 1 this is just system malloc), not memp_malloc. */
63#define MEMP_NUM_PBUF (1024 * 4)
64
65
66/* MEMP_NUM_MLD6_GROUP: Maximum number of IPv6 multicast groups that
67 can be joined.
68
69 We need to be able to join solicited node multicast for each
70 address (potentially different) and two groups for DHCP6. All
71 routers multicast is hardcoded in ip6.c and does not require
72 explicit joining. Provide also for a few extra groups just in
73 case. */
74#define MEMP_NUM_MLD6_GROUP (LWIP_IPV6_NUM_ADDRESSES + /* dhcp6 */ 2 + /* extra */ 8)
75
76
77/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
78 segments. */
79#define MEMP_NUM_TCP_SEG (MEMP_NUM_TCP_PCB * TCP_SND_QUEUELEN / 2)
80
81/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
82 connections. */
83#define MEMP_NUM_TCP_PCB 128
84
85/* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
86 for sequential API communication and incoming packets. Used in
87 src/api/tcpip.c. */
88#define MEMP_NUM_TCPIP_MSG_API 128
89#define MEMP_NUM_TCPIP_MSG_INPKT 1024
90
91/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
92 per active UDP "connection". */
93#define MEMP_NUM_UDP_PCB 32
94
95/* Pbuf options */
96/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
97 This is only for PBUF_POOL pbufs, primarily used by netif drivers.
98
99 This should have been named with the MEMP_NUM_ prefix (cf.
100 MEMP_NUM_PBUF for PBUF_ROM and PBUF_REF) as it controls the size of
101 yet another memp_malloc() pool. */
102#define PBUF_POOL_SIZE (1024 * 4)
103
104/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool.
105 Use default that is based on TCP_MSS and PBUF_LINK_HLEN. */
106#undef PBUF_POOL_BUFSIZE
107
108/** Turn on support for lightweight critical region protection. Leaving this
109 * off uses synchronization code in pbuf.c which is totally polluted with
110 * races. All the other lwip source files would fall back to semaphore-based
111 * synchronization, but pbuf.c is just broken, leading to incorrect allocation
112 * and as a result to assertions due to buffers being double freed. */
113#define SYS_LIGHTWEIGHT_PROT 1
114
115/** Attempt to get rid of htons etc. macro issues. */
116#undef LWIP_PREFIX_BYTEORDER_FUNCS
117
118#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
119#define LWIP_TCPIP_CORE_LOCKING 0
120#define LWIP_TCP 1
121#define LWIP_SOCKET 0
122#define LWIP_ARP 1
123#define ARP_PROXY 1
124#define LWIP_ETHERNET 1
125#define LWIP_COMPAT_SOCKETS 0
126#define LWIP_COMPAT_MUTEX 1
127
128#define LWIP_IPV6 1
129#define LWIP_IPV6_FORWARD 1
130#define LWIP_ND6_PROXY 1
131
132#define LWIP_ND6_ALLOW_RA_UPDATES (!LWIP_IPV6_FORWARD)
133#define LWIP_IPV6_SEND_ROUTER_SOLICIT (!LWIP_IPV6_FORWARD)
134/* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases
135 * iSCSI over intnet with IPv6
136 */
137#define LWIP_IPV6_AUTOCONFIG 1
138#if LWIP_IPV6_FORWARD /* otherwise use the default from lwip/opt.h */
139#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0
140#endif
141
142#define LWIP_IPV6_FRAG 1
143
144/**
145 * aka Slirp mode.
146 */
147#define LWIP_CONNECTION_PROXY 1
148#define IP_FORWARD 1
149
150/* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
151 timeouts. */
152#define MEMP_NUM_SYS_TIMEOUT 16
153
154
155/* this is required for IPv6 and IGMP needs */
156#define LWIP_RAND() RTRandU32()
157
158/* Debugging stuff. */
159#ifdef DEBUG
160/* filter in debugging severity */
161# define DBG_TYPES_ON (LWIP_DBG_ON | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_FRESH | LWIP_DBG_HALT)
162# define DBG_MIN_LEVEL 0
163
164# define LWIP_DEBUG LWIP_DBG_ON
165/* Ethernet & ARP debugging */
166# define ETHARP_DEBUG LWIP_DBG_ON
167/* IPv4 debugging */
168# define IP_DEBUG LWIP_DBG_ON
169# define IP_REASS_DEBUG LWIP_DBG_ON
170/* IPv6 debugging */
171# define IP6_DEBUG LWIP_DBG_ON
172/* ICMP debugging */
173# define ICMP_DEBUG LWIP_DBG_ON
174/* TCP debugging */
175# define TCP_DEBUG LWIP_DBG_ON
176# define TCP_INPUT_DEBUG LWIP_DBG_ON
177# define TCP_FR_DEBUG LWIP_DBG_ON
178# define TCP_RTO_DEBUG LWIP_DBG_ON
179# define TCP_CWND_DEBUG LWIP_DBG_ON
180# define TCP_WND_DEBUG LWIP_DBG_ON
181# define TCP_OUTPUT_DEBUG LWIP_DBG_ON
182# define TCP_RST_DEBUG LWIP_DBG_ON
183# define TCP_QLEN_DEBUG LWIP_DBG_ON
184/* RAW API debugging */
185/* API debugging */
186# define NETIF_DEBUG LWIP_DBG_ON
187# define PBUF_DEBUG LWIP_DBG_ON
188# define API_LIB_DEBUG LWIP_DBG_ON
189# define API_MSG_DEBUG LWIP_DBG_ON
190# define SOCKETS_DEBUG LWIP_DBG_ON
191
192# define INET_DEBUG LWIP_DBG_ON
193# define RAW_DEBUG LWIP_DBG_ON
194# define MEM_DEBUG LWIP_DBG_ON
195# define MEMP_DEBUG LWIP_DBG_ON
196# define SYS_DEBUG LWIP_DBG_ON
197
198# define UDP_DEBUG LWIP_DBG_ON
199# define TCPIP_DEBUG LWIP_DBG_ON
200# define DHCP_DEBUG LWIP_DBG_ON
201
202# define LWIP_PROXY_DEBUG LWIP_DBG_ON
203/* Debug checks */
204# define TCP_OVERSIZE_DBGCHECK 1
205#endif /* DEBUG */
206
207/* printf formatter definitions */
208#define U16_F "hu"
209#define S16_F "hd"
210#define X16_F "hx"
211#define U32_F "lu"
212#define S32_F "ld"
213#define X32_F "lx"
214
215/* Redirect libc memory alloc functions to IPRT. */
216#define malloc(x) RTMemAlloc(x)
217#define realloc(x,y) RTMemRealloc((x), (y))
218#define free(x) RTMemFree(x)
219
220#endif /* _VBOX_NETNAT_LWIP_OPTS_H_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette