VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/lwipopts.h@ 50066

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

Use component-specific lwipopts.h instead of sharing single one. This
commit just replicates existing lwipopts.h and the resulting object
code is identical.

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