• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  *    derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
25  * OF SUCH DAMAGE.
26  *
27  * This file is part of the lwIP TCP/IP stack.
28  *
29  * Author: Adam Dunkels <adam@sics.se>
30  *
31  */
32 #ifndef LWIP_LWIPOPTS_H
33 #define LWIP_LWIPOPTS_H
34 
35 #ifdef LWIP_OPTTEST_FILE
36 #include "lwipopts_test.h"
37 #else /* LWIP_OPTTEST_FILE */
38 
39 #define LWIP_IPV4                  1
40 #define LWIP_IPV6                  1
41 
42 #define NO_SYS                     0
43 #define LWIP_SOCKET                (NO_SYS==0)
44 #define LWIP_NETCONN               (NO_SYS==0)
45 #define LWIP_NETIF_API             (NO_SYS==0)
46 
47 #define LWIP_IGMP                  LWIP_IPV4
48 #define LWIP_ICMP                  LWIP_IPV4
49 
50 #define LWIP_SNMP                  LWIP_UDP
51 #define MIB2_STATS                 LWIP_SNMP
52 #ifdef LWIP_HAVE_MBEDTLS
53 #define LWIP_SNMP_V3               (LWIP_SNMP)
54 #endif
55 
56 #define LWIP_DNS                   LWIP_UDP
57 #define LWIP_MDNS_RESPONDER        LWIP_UDP
58 
59 #define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER)
60 
61 #define LWIP_HAVE_LOOPIF           1
62 #define LWIP_NETIF_LOOPBACK        1
63 #define LWIP_LOOPBACK_MAX_PBUFS    10
64 
65 #define TCP_LISTEN_BACKLOG         1
66 
67 #define LWIP_COMPAT_SOCKETS        1
68 #define LWIP_SO_RCVTIMEO           1
69 #define LWIP_SO_RCVBUF             1
70 
71 #define LWIP_TCPIP_CORE_LOCKING    1
72 
73 #define LWIP_NETIF_LINK_CALLBACK        1
74 #define LWIP_NETIF_STATUS_CALLBACK      1
75 #define LWIP_NETIF_EXT_STATUS_CALLBACK  1
76 
77 #ifdef LWIP_DEBUG
78 
79 #define LWIP_DBG_MIN_LEVEL         0
80 #define PPP_DEBUG                  LWIP_DBG_OFF
81 #define MEM_DEBUG                  LWIP_DBG_OFF
82 #define MEMP_DEBUG                 LWIP_DBG_OFF
83 #define PBUF_DEBUG                 LWIP_DBG_OFF
84 #define API_LIB_DEBUG              LWIP_DBG_OFF
85 #define API_MSG_DEBUG              LWIP_DBG_OFF
86 #define TCPIP_DEBUG                LWIP_DBG_OFF
87 #define NETIF_DEBUG                LWIP_DBG_OFF
88 #define SOCKETS_DEBUG              LWIP_DBG_OFF
89 #define DNS_DEBUG                  LWIP_DBG_OFF
90 #define AUTOIP_DEBUG               LWIP_DBG_OFF
91 #define DHCP_DEBUG                 LWIP_DBG_OFF
92 #define IP_DEBUG                   LWIP_DBG_OFF
93 #define IP_REASS_DEBUG             LWIP_DBG_OFF
94 #define ICMP_DEBUG                 LWIP_DBG_OFF
95 #define IGMP_DEBUG                 LWIP_DBG_OFF
96 #define UDP_DEBUG                  LWIP_DBG_OFF
97 #define TCP_DEBUG                  LWIP_DBG_OFF
98 #define TCP_INPUT_DEBUG            LWIP_DBG_OFF
99 #define TCP_OUTPUT_DEBUG           LWIP_DBG_OFF
100 #define TCP_RTO_DEBUG              LWIP_DBG_OFF
101 #define TCP_CWND_DEBUG             LWIP_DBG_OFF
102 #define TCP_WND_DEBUG              LWIP_DBG_OFF
103 #define TCP_FR_DEBUG               LWIP_DBG_OFF
104 #define TCP_QLEN_DEBUG             LWIP_DBG_OFF
105 #define TCP_RST_DEBUG              LWIP_DBG_OFF
106 #endif
107 
108 #define LWIP_DBG_TYPES_ON         (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
109 
110 
111 /* ---------- Memory options ---------- */
112 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
113    lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
114    byte alignment -> define MEM_ALIGNMENT to 2. */
115 /* MSVC port: intel processors don't need 4-byte alignment,
116    but are faster that way! */
117 #define MEM_ALIGNMENT           4U
118 
119 /* MEM_SIZE: the size of the heap memory. If the application will send
120 a lot of data that needs to be copied, this should be set high. */
121 #define MEM_SIZE               10240
122 
123 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
124    sends a lot of data out of ROM (or other static memory), this
125    should be set high. */
126 #define MEMP_NUM_PBUF           16
127 /* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
128    per active RAW "connection". */
129 #define MEMP_NUM_RAW_PCB        3
130 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
131    per active UDP "connection". */
132 #define MEMP_NUM_UDP_PCB        8
133 /* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP
134    connections. */
135 #define MEMP_NUM_TCP_PCB        5
136 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
137    connections. */
138 #define MEMP_NUM_TCP_PCB_LISTEN 8
139 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
140    segments. */
141 #define MEMP_NUM_TCP_SEG        16
142 /* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
143    timeouts. */
144 #define MEMP_NUM_SYS_TIMEOUT    17
145 
146 /* The following four are used only with the sequential API and can be
147    set to 0 if the application only will use the raw API. */
148 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
149 #define MEMP_NUM_NETBUF         2
150 /* MEMP_NUM_NETCONN: the number of struct netconns. */
151 #define MEMP_NUM_NETCONN        12
152 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
153    for sequential API communication and incoming packets. Used in
154    src/api/tcpip.c. */
155 #define MEMP_NUM_TCPIP_MSG_API   16
156 #define MEMP_NUM_TCPIP_MSG_INPKT 16
157 
158 
159 /* ---------- Pbuf options ---------- */
160 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
161 #define PBUF_POOL_SIZE          120
162 
163 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
164 #define PBUF_POOL_BUFSIZE       256
165 
166 /** SYS_LIGHTWEIGHT_PROT
167  * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
168  * for certain critical regions during buffer allocation, deallocation and memory
169  * allocation and deallocation.
170  */
171 #define SYS_LIGHTWEIGHT_PROT    (NO_SYS==0)
172 
173 
174 /* ---------- TCP options ---------- */
175 #define LWIP_TCP                1
176 #define TCP_TTL                 255
177 
178 #define LWIP_ALTCP              (LWIP_TCP)
179 #ifdef LWIP_HAVE_MBEDTLS
180 #define LWIP_ALTCP_TLS          (LWIP_TCP)
181 #define LWIP_ALTCP_TLS_MBEDTLS  (LWIP_TCP)
182 #endif
183 
184 
185 /* Controls if TCP should queue segments that arrive out of
186    order. Define to 0 if your device is low on memory. */
187 #define TCP_QUEUE_OOSEQ         1
188 
189 /* TCP Maximum segment size. */
190 #define TCP_MSS                 1024
191 
192 /* TCP sender buffer space (bytes). */
193 #define TCP_SND_BUF             2048
194 
195 /* TCP sender buffer space (pbufs). This must be at least = 2 *
196    TCP_SND_BUF/TCP_MSS for things to work. */
197 #define TCP_SND_QUEUELEN       (4 * TCP_SND_BUF/TCP_MSS)
198 
199 /* TCP writable space (bytes). This must be less than or equal
200    to TCP_SND_BUF. It is the amount of space which must be
201    available in the tcp snd_buf for select to return writable */
202 #define TCP_SNDLOWAT           (TCP_SND_BUF/2)
203 
204 /* TCP receive window. */
205 #define TCP_WND                 (20 * 1024)
206 
207 /* Maximum number of retransmissions of data segments. */
208 #define TCP_MAXRTX              12
209 
210 /* Maximum number of retransmissions of SYN segments. */
211 #define TCP_SYNMAXRTX           4
212 
213 
214 /* ---------- ARP options ---------- */
215 #define LWIP_ARP                1
216 #define ARP_TABLE_SIZE          10
217 #define ARP_QUEUEING            1
218 
219 
220 /* ---------- IP options ---------- */
221 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
222    IP packets across network interfaces. If you are going to run lwIP
223    on a device with only one network interface, define this to 0. */
224 #define IP_FORWARD              1
225 
226 /* IP reassembly and segmentation.These are orthogonal even
227  * if they both deal with IP fragments */
228 #define IP_REASSEMBLY           1
229 #define IP_REASS_MAX_PBUFS      (10 * ((1500 + PBUF_POOL_BUFSIZE - 1) / PBUF_POOL_BUFSIZE))
230 #define MEMP_NUM_REASSDATA      IP_REASS_MAX_PBUFS
231 #define IP_FRAG                 1
232 #define IPV6_FRAG_COPYHEADER    1
233 
234 /* ---------- ICMP options ---------- */
235 #define ICMP_TTL                255
236 
237 
238 /* ---------- DHCP options ---------- */
239 /* Define LWIP_DHCP to 1 if you want DHCP configuration of
240    interfaces. */
241 #define LWIP_DHCP               LWIP_UDP
242 
243 /* 1 if you want to do an ARP check on the offered address
244    (recommended). */
245 #define DHCP_DOES_ARP_CHECK    (LWIP_DHCP)
246 
247 
248 /* ---------- AUTOIP options ------- */
249 #define LWIP_AUTOIP            (LWIP_DHCP)
250 #define LWIP_DHCP_AUTOIP_COOP  (LWIP_DHCP && LWIP_AUTOIP)
251 
252 
253 /* ---------- UDP options ---------- */
254 #define LWIP_UDP                1
255 #define LWIP_UDPLITE            LWIP_UDP
256 #define UDP_TTL                 255
257 
258 
259 /* ---------- RAW options ---------- */
260 #define LWIP_RAW                1
261 
262 
263 /* ---------- Statistics options ---------- */
264 
265 #define LWIP_STATS              1
266 #define LWIP_STATS_DISPLAY      1
267 
268 #if LWIP_STATS
269 #define LINK_STATS              1
270 #define IP_STATS                1
271 #define ICMP_STATS              1
272 #define IGMP_STATS              1
273 #define IPFRAG_STATS            1
274 #define UDP_STATS               1
275 #define TCP_STATS               1
276 #define MEM_STATS               1
277 #define MEMP_STATS              1
278 #define PBUF_STATS              1
279 #define SYS_STATS               1
280 #endif /* LWIP_STATS */
281 
282 /* ---------- NETBIOS options ---------- */
283 #define LWIP_NETBIOS_RESPOND_NAME_QUERY 1
284 
285 /* ---------- PPP options ---------- */
286 
287 #define PPP_SUPPORT             1      /* Set > 0 for PPP */
288 
289 #if PPP_SUPPORT
290 
291 #define NUM_PPP                 1      /* Max PPP sessions. */
292 
293 
294 /* Select modules to enable.  Ideally these would be set in the makefile but
295  * we're limited by the command line length so you need to modify the settings
296  * in this file.
297  */
298 #define PPPOE_SUPPORT           1
299 #define PPPOS_SUPPORT           1
300 
301 #define PAP_SUPPORT             1      /* Set > 0 for PAP. */
302 #define CHAP_SUPPORT            1      /* Set > 0 for CHAP. */
303 #define MSCHAP_SUPPORT          0      /* Set > 0 for MSCHAP */
304 #define CBCP_SUPPORT            0      /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
305 #define CCP_SUPPORT             0      /* Set > 0 for CCP */
306 #define VJ_SUPPORT              0      /* Set > 0 for VJ header compression. */
307 #define MD5_SUPPORT             1      /* Set > 0 for MD5 (see also CHAP) */
308 
309 #endif /* PPP_SUPPORT */
310 
311 #endif /* LWIP_OPTTEST_FILE */
312 
313 /* The following defines must be done even in OPTTEST mode: */
314 
315 #if !defined(NO_SYS) || !NO_SYS /* default is 0 */
316 void sys_check_core_locking(void);
317 #define LWIP_ASSERT_CORE_LOCKED()  sys_check_core_locking()
318 #endif
319 
320 #ifndef LWIP_PLATFORM_ASSERT
321 /* Define LWIP_PLATFORM_ASSERT to something to catch missing stdio.h includes */
322 void lwip_example_app_platform_assert(const char *msg, int line, const char *file);
323 #define LWIP_PLATFORM_ASSERT(x) lwip_example_app_platform_assert(x, __LINE__, __FILE__)
324 #endif
325 
326 #endif /* LWIP_LWIPOPTS_H */
327