VirtualBox

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

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

#define ETH_PAD_SIZE 2 - to make IP header &c aligned.

  • Property svn:eol-style set to native
File size: 6.8 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_NOASSERT 0
119
120#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
121#define LWIP_TCPIP_CORE_LOCKING 0
122#define LWIP_TCP 1
123#define LWIP_SOCKET 0
124#define LWIP_ARP 1
125#define ARP_PROXY 1
126#define LWIP_ETHERNET 1
127#define LWIP_COMPAT_SOCKETS 0
128#define LWIP_COMPAT_MUTEX 1
129
130#define LWIP_IPV6 1
131#define LWIP_IPV6_FORWARD 1
132#define LWIP_ND6_PROXY 1
133
134#define LWIP_ND6_ALLOW_RA_UPDATES (!LWIP_IPV6_FORWARD)
135#define LWIP_IPV6_SEND_ROUTER_SOLICIT (!LWIP_IPV6_FORWARD)
136/* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases
137 * iSCSI over intnet with IPv6
138 */
139#define LWIP_IPV6_AUTOCONFIG 1
140#if LWIP_IPV6_FORWARD /* otherwise use the default from lwip/opt.h */
141#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0
142#endif
143
144#define LWIP_IPV6_FRAG 1
145
146/**
147 * aka Slirp mode.
148 */
149#define LWIP_CONNECTION_PROXY 1
150#define IP_FORWARD 1
151
152/* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
153 timeouts. */
154#define MEMP_NUM_SYS_TIMEOUT 16
155
156
157/* this is required for IPv6 and IGMP needs */
158#define LWIP_RAND() RTRandU32()
159
160/* Debugging stuff. */
161#ifdef DEBUG
162/* filter in debugging severity */
163# define DBG_TYPES_ON (LWIP_DBG_ON | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_FRESH | LWIP_DBG_HALT)
164# define DBG_MIN_LEVEL 0
165
166# define LWIP_DEBUG LWIP_DBG_ON
167/* Ethernet & ARP debugging */
168# define ETHARP_DEBUG LWIP_DBG_ON
169/* IPv4 debugging */
170# define IP_DEBUG LWIP_DBG_ON
171# define IP_REASS_DEBUG LWIP_DBG_ON
172/* IPv6 debugging */
173# define IP6_DEBUG LWIP_DBG_ON
174/* ICMP debugging */
175# define ICMP_DEBUG LWIP_DBG_ON
176/* TCP debugging */
177# define TCP_DEBUG LWIP_DBG_ON
178# define TCP_INPUT_DEBUG LWIP_DBG_ON
179# define TCP_FR_DEBUG LWIP_DBG_ON
180# define TCP_RTO_DEBUG LWIP_DBG_ON
181# define TCP_CWND_DEBUG LWIP_DBG_ON
182# define TCP_WND_DEBUG LWIP_DBG_ON
183# define TCP_OUTPUT_DEBUG LWIP_DBG_ON
184# define TCP_RST_DEBUG LWIP_DBG_ON
185# define TCP_QLEN_DEBUG LWIP_DBG_ON
186/* RAW API debugging */
187/* API debugging */
188# define NETIF_DEBUG LWIP_DBG_ON
189# define PBUF_DEBUG LWIP_DBG_ON
190# define API_LIB_DEBUG LWIP_DBG_ON
191# define API_MSG_DEBUG LWIP_DBG_ON
192# define SOCKETS_DEBUG LWIP_DBG_ON
193
194# define INET_DEBUG LWIP_DBG_ON
195# define RAW_DEBUG LWIP_DBG_ON
196# define MEM_DEBUG LWIP_DBG_ON
197# define MEMP_DEBUG LWIP_DBG_ON
198# define SYS_DEBUG LWIP_DBG_ON
199
200# define UDP_DEBUG LWIP_DBG_ON
201# define TCPIP_DEBUG LWIP_DBG_ON
202# define DHCP_DEBUG LWIP_DBG_ON
203
204# define LWIP_PROXY_DEBUG LWIP_DBG_ON
205/* Debug checks */
206# define TCP_OVERSIZE_DBGCHECK 1
207#endif /* DEBUG */
208
209/* printf formatter definitions */
210#define U16_F "hu"
211#define S16_F "hd"
212#define X16_F "hx"
213#define U32_F "lu"
214#define S32_F "ld"
215#define X32_F "lx"
216
217/* Redirect libc memory alloc functions to IPRT. */
218#define malloc(x) RTMemAlloc(x)
219#define realloc(x,y) RTMemRealloc((x), (y))
220#define free(x) RTMemFree(x)
221
222#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