VirtualBox

source: vbox/trunk/src/VBox/NetworkServices/Dhcpd/lwipopts.h@ 76690

Last change on this file since 76690 was 76576, checked in by vboxsync, 6 years ago

NetworkServices: scm header guard alignment.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/* $Id: lwipopts.h 76576 2019-01-01 06:05:25Z vboxsync $ */
2/** @file
3 * DHCP server - lwIP configuration options.
4 */
5
6/*
7 * Copyright (C) 2013-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef VBOX_INCLUDED_SRC_Dhcpd_lwipopts_h
19#define VBOX_INCLUDED_SRC_Dhcpd_lwipopts_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <VBox/cdefs.h> /* For VBOX_STRICT. */
25#include <iprt/mem.h>
26#include <iprt/alloca.h> /* This may include malloc.h (msc), which is something that has
27 * to be done before redefining any of the functions therein. */
28#include <iprt/rand.h> /* see LWIP_RAND() definition */
29
30/** Make lwIP use the libc malloc, or more precisely (see below) the IPRT
31 * memory allocation functions. */
32#define MEM_LIBC_MALLOC 1
33
34/** Set proper memory alignment. */
35#if HC_ARCH_BITS == 64
36# define MEM_ALIGNMENT 8
37#else
38#define MEM_ALIGNMENT 4
39#endif
40
41/* Padding before Ethernet header to make IP header aligned */
42#define ETH_PAD_SIZE 2
43
44/* IP */
45#define IP_REASSEMBLY 1
46#define IP_REASS_MAX_PBUFS 128
47
48
49
50/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
51 sends a lot of data out of ROM (or other static memory), this
52 should be set high.
53
54 NB: This is for PBUF_ROM and PBUF_REF pbufs only!
55
56 Number of PBUF_POOL pbufs is controlled by PBUF_POOL_SIZE that,
57 somewhat confusingly, breaks MEMP_NUM_* pattern.
58
59 PBUF_RAM pbufs are allocated with mem_malloc (with MEM_LIBC_MALLOC
60 set to 1 this is just system malloc), not memp_malloc. */
61#define MEMP_NUM_PBUF (1024 * 4)
62
63
64/* MEMP_NUM_MLD6_GROUP: Maximum number of IPv6 multicast groups that
65 can be joined.
66
67 We need to be able to join solicited node multicast for each
68 address (potentially different) and two groups for DHCP6. All
69 routers multicast is hardcoded in ip6.c and does not require
70 explicit joining. Provide also for a few extra groups just in
71 case. */
72#define MEMP_NUM_MLD6_GROUP (LWIP_IPV6_NUM_ADDRESSES + /* dhcp6 */ 2 + /* extra */ 8)
73
74
75/* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
76 for sequential API communication and incoming packets. Used in
77 src/api/tcpip.c. */
78#define MEMP_NUM_TCPIP_MSG_API 128
79#define MEMP_NUM_TCPIP_MSG_INPKT 1024
80
81/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
82 per active UDP "connection". */
83#define MEMP_NUM_UDP_PCB 32
84
85/* Pbuf options */
86/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
87 This is only for PBUF_POOL pbufs, primarily used by netif drivers.
88
89 This should have been named with the MEMP_NUM_ prefix (cf.
90 MEMP_NUM_PBUF for PBUF_ROM and PBUF_REF) as it controls the size of
91 yet another memp_malloc() pool. */
92#define PBUF_POOL_SIZE (1024 * 4)
93
94/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool.
95 Use default that is based on TCP_MSS and PBUF_LINK_HLEN. */
96#undef PBUF_POOL_BUFSIZE
97
98/** Turn on support for lightweight critical region protection. Leaving this
99 * off uses synchronization code in pbuf.c which is totally polluted with
100 * races. All the other lwip source files would fall back to semaphore-based
101 * synchronization, but pbuf.c is just broken, leading to incorrect allocation
102 * and as a result to assertions due to buffers being double freed. */
103#define SYS_LIGHTWEIGHT_PROT 1
104
105/** Attempt to get rid of htons etc. macro issues. */
106#undef LWIP_PREFIX_BYTEORDER_FUNCS
107
108#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
109#define LWIP_TCPIP_CORE_LOCKING 0
110
111#define LWIP_NETCONN 0
112#define LWIP_SOCKET 0
113#define LWIP_COMPAT_SOCKETS 0
114#define LWIP_COMPAT_MUTEX 1
115
116#define LWIP_TCP 0
117#define LWI_UDP 1
118#define LWIP_ARP 1
119#define ARP_PROXY 0
120#define LWIP_ETHERNET 1
121
122/* accept any->broadcast */
123#define LWIP_IP_ACCEPT_UDP_PORT(port) ((port) == PP_NTOHS(/*DHCP_SERVER_PORT*/ 67))
124
125#define LWIP_IPV6 0
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
160# define LWIP_PROXY_DEBUG LWIP_DBG_OFF
161#endif /* DEBUG */
162
163/* printf formatter definitions */
164#define U16_F "hu"
165#define S16_F "hd"
166#define X16_F "hx"
167#define U32_F "u"
168#define S32_F "d"
169#define X32_F "x"
170
171/* Redirect libc memory alloc functions to IPRT. */
172#define malloc(x) RTMemAlloc(x)
173#define realloc(x,y) RTMemRealloc((x), (y))
174#define free(x) RTMemFree(x)
175
176/* Align VBOX_STRICT and LWIP_NOASSERT. */
177#ifndef VBOX_STRICT
178# define LWIP_NOASSERT 1
179#endif
180
181#endif /* !VBOX_INCLUDED_SRC_Dhcpd_lwipopts_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