VirtualBox

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

最後變更 在這個檔案從57809是 55992,由 vboxsync 提交於 10 年 前

lwip: Drop "l" (ell) length modifier from U32_F and friends. This
will do for now, though the right thing to do would be to use PRI*
macros, but it's a bit of a portability mess.

  • 屬性 svn:eol-style 設為 native
檔案大小: 5.3 KB
 
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#undef LWIP_PREFIX_BYTEORDER_FUNCS
114
115#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
116#define LWIP_TCPIP_CORE_LOCKING 0
117#define LWIP_TCP 1
118#define LWIP_SOCKET 1
119#define LWIP_ARP 1
120#define ARP_PROXY 0
121#define LWIP_ETHERNET 1
122#define LWIP_COMPAT_SOCKETS 0
123#define LWIP_COMPAT_MUTEX 1
124
125#define LWIP_IPV6 1
126#define LWIP_IPV6_FORWARD 0
127#define LWIP_ND6_PROXY 0
128
129#define LWIP_ND6_ALLOW_RA_UPDATES (!LWIP_IPV6_FORWARD)
130#define LWIP_IPV6_SEND_ROUTER_SOLICIT (!LWIP_IPV6_FORWARD)
131/* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases
132 * iSCSI over intnet with IPv6
133 */
134#define LWIP_IPV6_AUTOCONFIG 1
135#if LWIP_IPV6_FORWARD /* otherwise use the default from lwip/opt.h */
136#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0
137#endif
138
139#define LWIP_IPV6_FRAG 1
140
141/**
142 * aka Slirp mode.
143 */
144#define LWIP_CONNECTION_PROXY 0
145#define IP_FORWARD 0
146
147/* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
148 timeouts. */
149#define MEMP_NUM_SYS_TIMEOUT 16
150
151
152/* this is required for IPv6 and IGMP needs */
153#define LWIP_RAND() RTRandU32()
154
155/* Debugging stuff. */
156#ifdef DEBUG
157# define LWIP_DEBUG
158# include "lwip-log.h"
159#endif /* DEBUG */
160
161/* printf formatter definitions */
162#define U16_F "hu"
163#define S16_F "hd"
164#define X16_F "hx"
165#define U32_F "u"
166#define S32_F "d"
167#define X32_F "x"
168
169/* Redirect libc memory alloc functions to IPRT. */
170#define malloc(x) RTMemAlloc(x)
171#define realloc(x,y) RTMemRealloc((x), (y))
172#define free(x) RTMemFree(x)
173
174
175#include "lwip-namespace.h"
176
177#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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