xref: /nrf52832-nimble/rt-thread/components/net/lwip-1.4.1/src/lwipopts.h (revision 104654410c56c573564690304ae786df310c91fc)
1 #ifndef __LWIPOPTS_H__
2 #define __LWIPOPTS_H__
3 
4 #include <rtconfig.h>
5 
6 #define ERRNO                       1
7 
8 #define NO_SYS                      0
9 #define LWIP_SOCKET                 1
10 #define LWIP_NETCONN                1
11 
12 #ifdef RT_LWIP_IGMP
13 #define LWIP_IGMP                   1
14 #else
15 #define LWIP_IGMP                   0
16 #endif
17 
18 #ifdef RT_LWIP_ICMP
19 #define LWIP_ICMP                   1
20 #else
21 #define LWIP_ICMP                   0
22 #endif
23 
24 #ifdef RT_LWIP_SNMP
25 #define LWIP_SNMP                   1
26 #else
27 #define LWIP_SNMP                   0
28 #endif
29 
30 #ifdef RT_LWIP_DNS
31 #define LWIP_DNS                    1
32 #else
33 #define LWIP_DNS                    0
34 #endif
35 
36 #define LWIP_HAVE_LOOPIF            0
37 
38 #define LWIP_PLATFORM_BYTESWAP      0
39 
40 #ifndef BYTE_ORDER
41 #define BYTE_ORDER                  LITTLE_ENDIAN
42 #endif
43 
44 /* #define RT_LWIP_DEBUG */
45 
46 #ifdef RT_LWIP_DEBUG
47 #define LWIP_DEBUG
48 #endif
49 
50 /* ---------- Debug options ---------- */
51 #ifdef LWIP_DEBUG
52 #ifdef RT_LWIP_SYS_DEBUG
53 #define SYS_DEBUG                   LWIP_DBG_ON
54 #else
55 #define SYS_DEBUG                   LWIP_DBG_OFF
56 #endif
57 
58 #ifdef RT_LWIP_ETHARP_DEBUG
59 #define ETHARP_DEBUG                LWIP_DBG_ON
60 #else
61 #define ETHARP_DEBUG                LWIP_DBG_OFF
62 #endif
63 
64 #ifdef RT_LWIP_PPP_DEBUG
65 #define PPP_DEBUG                   LWIP_DBG_ON
66 #else
67 #define PPP_DEBUG                   LWIP_DBG_OFF
68 #endif
69 
70 #ifdef RT_LWIP_MEM_DEBUG
71 #define MEM_DEBUG                   LWIP_DBG_ON
72 #else
73 #define MEM_DEBUG                   LWIP_DBG_OFF
74 #endif
75 
76 #ifdef RT_LWIP_MEMP_DEBUG
77 #define MEMP_DEBUG                  LWIP_DBG_ON
78 #else
79 #define MEMP_DEBUG                  LWIP_DBG_OFF
80 #endif
81 
82 #ifdef RT_LWIP_PBUF_DEBUG
83 #define PBUF_DEBUG                  LWIP_DBG_ON
84 #else
85 #define PBUF_DEBUG                  LWIP_DBG_OFF
86 #endif
87 
88 #ifdef RT_LWIP_API_LIB_DEBUG
89 #define API_LIB_DEBUG               LWIP_DBG_ON
90 #else
91 #define API_LIB_DEBUG               LWIP_DBG_OFF
92 #endif
93 
94 #ifdef RT_LWIP_API_MSG_DEBUG
95 #define API_MSG_DEBUG               LWIP_DBG_ON
96 #else
97 #define API_MSG_DEBUG               LWIP_DBG_OFF
98 #endif
99 
100 #ifdef RT_LWIP_TCPIP_DEBUG
101 #define TCPIP_DEBUG                 LWIP_DBG_ON
102 #else
103 #define TCPIP_DEBUG                 LWIP_DBG_OFF
104 #endif
105 
106 #ifdef RT_LWIP_NETIF_DEBUG
107 #define NETIF_DEBUG                 LWIP_DBG_ON
108 #else
109 #define NETIF_DEBUG                 LWIP_DBG_OFF
110 #endif
111 
112 #ifdef RT_LWIP_SOCKETS_DEBUG
113 #define SOCKETS_DEBUG               LWIP_DBG_ON
114 #else
115 #define SOCKETS_DEBUG               LWIP_DBG_OFF
116 #endif
117 
118 #ifdef RT_LWIP_DNS_DEBUG
119 #define DNS_DEBUG                   LWIP_DBG_ON
120 #else
121 #define DNS_DEBUG                   LWIP_DBG_OFF
122 #endif
123 
124 #ifdef RT_LWIP_AUTOIP_DEBUG
125 #define AUTOIP_DEBUG                LWIP_DBG_ON
126 #else
127 #define AUTOIP_DEBUG                LWIP_DBG_OFF
128 #endif
129 
130 #ifdef RT_LWIP_DHCP_DEBUG
131 #define DHCP_DEBUG                  LWIP_DBG_ON
132 #else
133 #define DHCP_DEBUG                  LWIP_DBG_OFF
134 #endif
135 
136 #ifdef RT_LWIP_IP_DEBUG
137 #define IP_DEBUG                    LWIP_DBG_ON
138 #else
139 #define IP_DEBUG                    LWIP_DBG_OFF
140 #endif
141 
142 #ifdef RT_LWIP_IP_REASS_DEBUG
143 #define IP_REASS_DEBUG              LWIP_DBG_ON
144 #else
145 #define IP_REASS_DEBUG              LWIP_DBG_OFF
146 #endif
147 
148 #ifdef RT_LWIP_ICMP_DEBUG
149 #define ICMP_DEBUG                  LWIP_DBG_ON
150 #else
151 #define ICMP_DEBUG                  LWIP_DBG_OFF
152 #endif
153 
154 #ifdef RT_LWIP_IGMP_DEBUG
155 #define IGMP_DEBUG                  LWIP_DBG_ON
156 #else
157 #define IGMP_DEBUG                  LWIP_DBG_OFF
158 #endif
159 
160 #ifdef RT_LWIP_UDP_DEBUG
161 #define UDP_DEBUG                   LWIP_DBG_ON
162 #else
163 #define UDP_DEBUG                   LWIP_DBG_OFF
164 #endif
165 
166 #ifdef RT_LWIP_TCP_DEBUG
167 #define TCP_DEBUG                   LWIP_DBG_ON
168 #else
169 #define TCP_DEBUG                   LWIP_DBG_OFF
170 #endif
171 
172 #ifdef RT_LWIP_TCP_INPUT_DEBUG
173 #define TCP_INPUT_DEBUG             LWIP_DBG_ON
174 #else
175 #define TCP_INPUT_DEBUG             LWIP_DBG_OFF
176 #endif
177 
178 #ifdef RT_LWIP_TCP_OUTPUT_DEBUG
179 #define TCP_OUTPUT_DEBUG            LWIP_DBG_ON
180 #else
181 #define TCP_OUTPUT_DEBUG            LWIP_DBG_OFF
182 #endif
183 
184 #ifdef RT_LWIP_TCP_RTO_DEBUG
185 #define TCP_RTO_DEBUG               LWIP_DBG_ON
186 #else
187 #define TCP_RTO_DEBUG               LWIP_DBG_OFF
188 #endif
189 
190 #ifdef RT_LWIP_TCP_CWND_DEBUG
191 #define TCP_CWND_DEBUG              LWIP_DBG_ON
192 #else
193 #define TCP_CWND_DEBUG              LWIP_DBG_OFF
194 #endif
195 
196 #ifdef RT_LWIP_TCP_WND_DEBUG
197 #define TCP_WND_DEBUG               LWIP_DBG_ON
198 #else
199 #define TCP_WND_DEBUG               LWIP_DBG_OFF
200 #endif
201 
202 #ifdef RT_LWIP_TCP_FR_DEBUG
203 #define TCP_FR_DEBUG                LWIP_DBG_ON
204 #else
205 #define TCP_FR_DEBUG                LWIP_DBG_OFF
206 #endif
207 
208 #ifdef RT_LWIP_TCP_QLEN_DEBUG
209 #define TCP_QLEN_DEBUG              LWIP_DBG_ON
210 #else
211 #define TCP_QLEN_DEBUG              LWIP_DBG_OFF
212 #endif
213 
214 #ifdef RT_LWIP_TCP_RST_DEBUG
215 #define TCP_RST_DEBUG               LWIP_DBG_ON
216 #else
217 #define TCP_RST_DEBUG               LWIP_DBG_OFF
218 #endif
219 
220 #endif /* LWIP_DEBUG */
221 
222 #define LWIP_DBG_TYPES_ON           (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
223 
224 /* ---------- Memory options ---------- */
225 #define MEM_ALIGNMENT               4
226 
227 #define MEM_LIBC_MALLOC             1
228 #define mem_malloc                  rt_malloc
229 #define mem_free                    rt_free
230 #define mem_calloc                  rt_calloc
231 
232 #define MEMP_MEM_MALLOC             0
233 
234 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
235    sends a lot of data out of ROM (or other static memory), this
236    should be set high. */
237 #define MEMP_NUM_PBUF               16
238 
239 /* the number of struct netconns */
240 #ifdef RT_MEMP_NUM_NETCONN
241 #define MEMP_NUM_NETCONN            RT_MEMP_NUM_NETCONN
242 #endif
243 
244 /* the number of UDP protocol control blocks. One per active RAW "connection". */
245 #ifdef RT_LWIP_RAW_PCB_NUM
246 #define MEMP_NUM_RAW_PCB            RT_LWIP_RAW_PCB_NUM
247 #endif
248 
249 /* the number of UDP protocol control blocks. One per active UDP "connection". */
250 #ifdef RT_LWIP_UDP_PCB_NUM
251 #define MEMP_NUM_UDP_PCB            RT_LWIP_UDP_PCB_NUM
252 #endif
253 
254 /* the number of simulatenously active TCP connections. */
255 #ifdef RT_LWIP_TCP_PCB_NUM
256 #define MEMP_NUM_TCP_PCB            RT_LWIP_TCP_PCB_NUM
257 #endif
258 
259 /* the number of simultaneously queued TCP */
260 #ifdef RT_LWIP_TCP_SEG_NUM
261 #define MEMP_NUM_TCP_SEG            RT_LWIP_TCP_SEG_NUM
262 #else
263 #define MEMP_NUM_TCP_SEG            TCP_SND_QUEUELEN
264 #endif
265 
266 /*
267  * You can re-define following setting in rtcofnig.h to overwrite the default
268  * setting in the lwip opts.h
269  */
270 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
271 // #define MEMP_NUM_NETBUF             2
272 /* MEMP_NUM_NETCONN: the number of struct netconns. */
273 // #define MEMP_NUM_NETCONN            4
274 
275 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
276    for sequential API communication and incoming packets. Used in
277    src/api/tcpip.c. */
278 // #define MEMP_NUM_TCPIP_MSG_API      16
279 // #define MEMP_NUM_TCPIP_MSG_INPKT    16
280 
281 /* ---------- Pbuf options ---------- */
282 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
283 #ifdef RT_LWIP_PBUF_NUM
284 #define PBUF_POOL_SIZE               RT_LWIP_PBUF_NUM
285 #endif
286 
287 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
288 #ifdef RT_LWIP_PBUF_POOL_BUFSIZE
289 #define PBUF_POOL_BUFSIZE            RT_LWIP_PBUF_POOL_BUFSIZE
290 #endif
291 
292 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
293    link level header. */
294 #define PBUF_LINK_HLEN              16
295 
296 #ifdef RT_LWIP_ETH_PAD_SIZE
297 #define ETH_PAD_SIZE                RT_LWIP_ETH_PAD_SIZE
298 #endif
299 
300 /** SYS_LIGHTWEIGHT_PROT
301  * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
302  * for certain critical regions during buffer allocation, deallocation and memory
303  * allocation and deallocation.
304  */
305 #define SYS_LIGHTWEIGHT_PROT        (NO_SYS==0)
306 
307 #ifdef LWIP_USING_NAT
308 #define IP_NAT                      1
309 #else
310 #define IP_NAT                      0
311 #endif
312 
313 /* ---------- TCP options ---------- */
314 #ifdef RT_LWIP_TCP
315 #define LWIP_TCP                    1
316 #else
317 #define LWIP_TCP                    0
318 #endif
319 
320 #define TCP_TTL                     255
321 
322 /* Controls if TCP should queue segments that arrive out of
323    order. Define to 0 if your device is low on memory. */
324 #define TCP_QUEUE_OOSEQ             1
325 
326 /* TCP Maximum segment size. */
327 #define TCP_MSS                     1460
328 
329 /* TCP sender buffer space (bytes). */
330 #ifdef RT_LWIP_TCP_SND_BUF
331 #define TCP_SND_BUF                 RT_LWIP_TCP_SND_BUF
332 #else
333 #define TCP_SND_BUF                 (TCP_MSS * 2)
334 #endif
335 
336 /* TCP sender buffer space (pbufs). This must be at least = 2 *
337    TCP_SND_BUF/TCP_MSS for things to work. */
338 #define TCP_SND_QUEUELEN            (4 * TCP_SND_BUF/TCP_MSS)
339 
340 /* TCP writable space (bytes). This must be less than or equal
341    to TCP_SND_BUF. It is the amount of space which must be
342    available in the tcp snd_buf for select to return writable */
343 #define TCP_SNDLOWAT                (TCP_SND_BUF/2)
344 #define TCP_SNDQUEUELOWAT           TCP_SND_QUEUELEN/2
345 
346 /* TCP receive window. */
347 #ifdef RT_LWIP_TCP_WND
348 #define TCP_WND                     RT_LWIP_TCP_WND
349 #else
350 #define TCP_WND                     (TCP_MSS * 2)
351 #endif
352 
353 /* Maximum number of retransmissions of data segments. */
354 #define TCP_MAXRTX                  12
355 
356 /* Maximum number of retransmissions of SYN segments. */
357 #define TCP_SYNMAXRTX               4
358 
359 /* tcpip thread options */
360 #ifdef RT_LWIP_TCPTHREAD_PRIORITY
361 #define TCPIP_MBOX_SIZE             RT_LWIP_TCPTHREAD_MBOX_SIZE
362 #define TCPIP_THREAD_PRIO           RT_LWIP_TCPTHREAD_PRIORITY
363 #define TCPIP_THREAD_STACKSIZE      RT_LWIP_TCPTHREAD_STACKSIZE
364 #else
365 #define TCPIP_MBOX_SIZE             8
366 #define TCPIP_THREAD_PRIO           128
367 #define TCPIP_THREAD_STACKSIZE      4096
368 #endif
369 #define TCPIP_THREAD_NAME           "tcpip"
370 #define DEFAULT_TCP_RECVMBOX_SIZE   10
371 
372 /* ---------- ARP options ---------- */
373 #define LWIP_ARP                    1
374 #define ARP_TABLE_SIZE              10
375 #define ARP_QUEUEING                1
376 
377 /* ---------- IP options ---------- */
378 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
379    IP packets across network interfaces. If you are going to run lwIP
380    on a device with only one network interface, define this to 0. */
381 #define IP_FORWARD                  0
382 
383 /* IP reassembly and segmentation.These are orthogonal even
384  * if they both deal with IP fragments */
385 #ifdef RT_LWIP_REASSEMBLY_FRAG
386 #define IP_REASSEMBLY               1
387 #define IP_FRAG                     1
388 #define IP_REASS_MAX_PBUFS          10
389 #define MEMP_NUM_REASSDATA          10
390 #else
391 #define IP_REASSEMBLY               0
392 #define IP_FRAG                     0
393 #endif
394 
395 /* ---------- ICMP options ---------- */
396 #define ICMP_TTL                    255
397 
398 /* ---------- DHCP options ---------- */
399 /* Define LWIP_DHCP to 1 if you want DHCP configuration of
400    interfaces. */
401 #ifdef RT_LWIP_DHCP
402 #define LWIP_DHCP                   1
403 #else
404 #define LWIP_DHCP                   0
405 #endif
406 
407 /* 1 if you want to do an ARP check on the offered address
408    (recommended). */
409 #define DHCP_DOES_ARP_CHECK         (LWIP_DHCP)
410 
411 /* ---------- AUTOIP options ------- */
412 #define LWIP_AUTOIP                 0
413 #define LWIP_DHCP_AUTOIP_COOP       (LWIP_DHCP && LWIP_AUTOIP)
414 
415 /* ---------- UDP options ---------- */
416 #ifdef RT_LWIP_UDP
417 #define LWIP_UDP                    1
418 #else
419 #define LWIP_UDP                    0
420 #endif
421 
422 #define LWIP_UDPLITE                0
423 #define UDP_TTL                     255
424 #define DEFAULT_UDP_RECVMBOX_SIZE   1
425 
426 /* ---------- RAW options ---------- */
427 #define DEFAULT_RAW_RECVMBOX_SIZE   1
428 #define DEFAULT_ACCEPTMBOX_SIZE     10
429 
430 /* ---------- Statistics options ---------- */
431 #ifdef RT_LWIP_STATS
432 #define LWIP_STATS                  1
433 #define LWIP_STATS_DISPLAY          1
434 #else
435 #define LWIP_STATS                  0
436 #endif
437 
438 #if LWIP_STATS
439 #define LINK_STATS                  1
440 #define IP_STATS                    1
441 #define ICMP_STATS                  1
442 #define IGMP_STATS                  1
443 #define IPFRAG_STATS                1
444 #define UDP_STATS                   1
445 #define TCP_STATS                   1
446 #define MEM_STATS                   1
447 #define MEMP_STATS                  1
448 #define PBUF_STATS                  1
449 #define SYS_STATS                   1
450 #endif /* LWIP_STATS */
451 
452 /* ---------- PPP options ---------- */
453 #ifdef RT_LWIP_PPP
454 #define PPP_SUPPORT                 1      /* Set > 0 for PPP */
455 #else
456 #define PPP_SUPPORT                 0      /* Set > 0 for PPP */
457 #endif
458 
459 #if PPP_SUPPORT
460 #define NUM_PPP                     1      /* Max PPP sessions. */
461 
462 /* Select modules to enable.  Ideally these would be set in the makefile but
463  * we're limited by the command line length so you need to modify the settings
464  * in this file.
465  */
466 #ifdef RT_LWIP_PPPOE
467 #define PPPOE_SUPPORT               1
468 #else
469 #define PPPOE_SUPPORT               0
470 #endif
471 
472 #ifdef RT_LWIP_PPPOS
473 #define PPPOS_SUPPORT               1
474 #else
475 #define PPPOS_SUPPORT               0
476 #endif
477 
478 #define PAP_SUPPORT                 1      /* Set > 0 for PAP. */
479 #define CHAP_SUPPORT                1      /* Set > 0 for CHAP. */
480 #define MSCHAP_SUPPORT              0      /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
481 #define CBCP_SUPPORT                0      /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
482 #define CCP_SUPPORT                 0      /* Set > 0 for CCP (NOT FUNCTIONAL!) */
483 #define VJ_SUPPORT                  1      /* Set > 0 for VJ header compression. */
484 #define MD5_SUPPORT                 1      /* Set > 0 for MD5 (see also CHAP) */
485 
486 #endif /* PPP_SUPPORT */
487 
488 /* no read/write/close for socket */
489 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
490 #define LWIP_NETIF_API  1
491 
492 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */
493 #define MEMP_NUM_SYS_TIMEOUT       (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT)
494 #ifdef LWIP_IGMP
495 #include <stdlib.h>
496 #define LWIP_RAND                  rand
497 #endif
498 /*
499    ------------------------------------
500    ---------- Socket options ----------
501    ------------------------------------
502 */
503 /*
504  * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
505  */
506 #ifndef LWIP_SOCKET
507 #define LWIP_SOCKET                     1
508 #endif
509 
510 /*
511  * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
512  * (only used if you use sockets.c)
513  */
514 #ifdef SAL_USING_POSIX
515 #define LWIP_COMPAT_SOCKETS             0
516 #else
517 #ifndef LWIP_COMPAT_SOCKETS
518 #define LWIP_COMPAT_SOCKETS             1
519 #endif
520 #endif
521 
522 
523 /**
524  * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and
525  * SO_SNDTIMEO processing.
526  */
527 #ifndef LWIP_SO_SNDTIMEO
528 #define LWIP_SO_SNDTIMEO                1
529 #endif
530 
531 /**
532  * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and
533  * SO_RCVTIMEO processing.
534  */
535 #ifndef LWIP_SO_RCVTIMEO
536 #define LWIP_SO_RCVTIMEO                1
537 #endif
538 
539 /**
540  * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
541  */
542 #ifndef LWIP_SO_RCVBUF
543 #define LWIP_SO_RCVBUF                  1
544 #endif
545 
546 /**
547  * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize.
548  */
549 #ifndef RECV_BUFSIZE_DEFAULT
550 #define RECV_BUFSIZE_DEFAULT            8192
551 #endif
552 
553 /**
554  * SO_REUSE==1: Enable SO_REUSEADDR option.
555  */
556 #ifndef SO_REUSE
557 #define SO_REUSE                        0
558 #endif
559 
560 #endif /* __LWIPOPTS_H__ */
561