1 /*
2  * Copyright (c) 2006-2022, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2022-02-23     Meco Man     integrate v1.4.1 v2.0.3 and v2.1.2 porting layer
9  * 2022-02-25     xiangxistu   modify the default config through v1.4.1
10  */
11 
12 #ifndef __LWIPOPTS_H__
13 #define __LWIPOPTS_H__
14 
15 #include <rtconfig.h>
16 
17 /* ---------- LIBC and standard header files ---------- */
18 #include <limits.h>
19 #include <fcntl.h>
20 #include <sys/ioctl.h>
21 #include <stdlib.h>
22 #include <sys/time.h>
23 #include <sys/errno.h>
24 #define LWIP_ERRNO_INCLUDE "sys/errno.h"
25 
26 #define LWIP_TIMEVAL_PRIVATE    0
27 #define LWIP_NO_UNISTD_H        0
28 #define LWIP_NO_STDDEF_H        0
29 #define LWIP_NO_STDINT_H        0
30 #define LWIP_NO_INTTYPES_H      0
31 #define LWIP_NO_LIMITS_H        0
32 #define LWIP_NO_CTYPE_H         0
33 #define LWIP_SOCKET_SELECT      1
34 #define LWIP_SOCKET_POLL        1
35 
36 #define LWIP_RAND rand
37 
38 #ifndef SSIZE_MAX
39 #define SSIZE_MAX INT_MAX
40 #endif
41 
42 /* some errno not defined in newlib */
43 #ifndef ENSRNOTFOUND
44 #define ENSRNOTFOUND 163  /* Domain name not found */
45 #endif
46 
47 /* ---------- Basic Configuration ---------- */
48 #define LWIP_IPV4                   1
49 
50 #ifdef RT_USING_LWIP_IPV6
51 #define LWIP_IPV6                   1
52 #else
53 #define LWIP_IPV6                   0
54 #endif /* RT_USING_LWIP_IPV6 */
55 
56 #define NO_SYS                      0
57 #define SYS_LIGHTWEIGHT_PROT        1
58 #define LWIP_SOCKET                 1
59 #define LWIP_NETCONN                1
60 
61 #ifdef RT_LWIP_IGMP
62 #define LWIP_IGMP                   1
63 #else
64 #define LWIP_IGMP                   0
65 #endif
66 
67 #ifdef RT_LWIP_ICMP
68 #define LWIP_ICMP                   1
69 #else
70 #define LWIP_ICMP                   0
71 #endif
72 
73 #ifdef RT_LWIP_SNMP
74 #define LWIP_SNMP                   1
75 #else
76 #define LWIP_SNMP                   0
77 #endif
78 
79 #ifdef RT_LWIP_DNS
80 #define LWIP_DNS                    1
81 #else
82 #define LWIP_DNS                    0
83 #endif
84 
85 #define LWIP_HAVE_LOOPIF            0
86 
87 #define LWIP_PLATFORM_BYTESWAP      0
88 
89 /* #define RT_LWIP_DEBUG */
90 
91 #ifdef RT_LWIP_DEBUG
92 #define LWIP_DEBUG
93 #endif
94 
95 /* ---------- Debug options ---------- */
96 #ifdef LWIP_DEBUG
97 #ifdef RT_LWIP_SYS_DEBUG
98 #define SYS_DEBUG                   LWIP_DBG_ON
99 #else
100 #define SYS_DEBUG                   LWIP_DBG_OFF
101 #endif
102 
103 #ifdef RT_LWIP_ETHARP_DEBUG
104 #define ETHARP_DEBUG                LWIP_DBG_ON
105 #else
106 #define ETHARP_DEBUG                LWIP_DBG_OFF
107 #endif
108 
109 #ifdef RT_LWIP_PPP_DEBUG
110 #define PPP_DEBUG                   LWIP_DBG_ON
111 #else
112 #define PPP_DEBUG                   LWIP_DBG_OFF
113 #endif
114 
115 #ifdef RT_LWIP_MEM_DEBUG
116 #define MEM_DEBUG                   LWIP_DBG_ON
117 #else
118 #define MEM_DEBUG                   LWIP_DBG_OFF
119 #endif
120 
121 #ifdef RT_LWIP_MEMP_DEBUG
122 #define MEMP_DEBUG                  LWIP_DBG_ON
123 #else
124 #define MEMP_DEBUG                  LWIP_DBG_OFF
125 #endif
126 
127 #ifdef RT_LWIP_PBUF_DEBUG
128 #define PBUF_DEBUG                  LWIP_DBG_ON
129 #else
130 #define PBUF_DEBUG                  LWIP_DBG_OFF
131 #endif
132 
133 #ifdef RT_LWIP_API_LIB_DEBUG
134 #define API_LIB_DEBUG               LWIP_DBG_ON
135 #else
136 #define API_LIB_DEBUG               LWIP_DBG_OFF
137 #endif
138 
139 #ifdef RT_LWIP_API_MSG_DEBUG
140 #define API_MSG_DEBUG               LWIP_DBG_ON
141 #else
142 #define API_MSG_DEBUG               LWIP_DBG_OFF
143 #endif
144 
145 #ifdef RT_LWIP_TCPIP_DEBUG
146 #define TCPIP_DEBUG                 LWIP_DBG_ON
147 #else
148 #define TCPIP_DEBUG                 LWIP_DBG_OFF
149 #endif
150 
151 #ifdef RT_LWIP_NETIF_DEBUG
152 #define NETIF_DEBUG                 LWIP_DBG_ON
153 #else
154 #define NETIF_DEBUG                 LWIP_DBG_OFF
155 #endif
156 
157 #ifdef RT_LWIP_SOCKETS_DEBUG
158 #define SOCKETS_DEBUG               LWIP_DBG_ON
159 #else
160 #define SOCKETS_DEBUG               LWIP_DBG_OFF
161 #endif
162 
163 #ifdef RT_LWIP_DNS_DEBUG
164 #define DNS_DEBUG                   LWIP_DBG_ON
165 #else
166 #define DNS_DEBUG                   LWIP_DBG_OFF
167 #endif
168 
169 #ifdef RT_LWIP_AUTOIP_DEBUG
170 #define AUTOIP_DEBUG                LWIP_DBG_ON
171 #else
172 #define AUTOIP_DEBUG                LWIP_DBG_OFF
173 #endif
174 
175 #ifdef RT_LWIP_DHCP_DEBUG
176 #define DHCP_DEBUG                  LWIP_DBG_ON
177 #else
178 #define DHCP_DEBUG                  LWIP_DBG_OFF
179 #endif
180 
181 #ifdef RT_LWIP_IP_DEBUG
182 #define IP_DEBUG                    LWIP_DBG_ON
183 #else
184 #define IP_DEBUG                    LWIP_DBG_OFF
185 #endif
186 
187 #ifdef RT_LWIP_IP_REASS_DEBUG
188 #define IP_REASS_DEBUG              LWIP_DBG_ON
189 #else
190 #define IP_REASS_DEBUG              LWIP_DBG_OFF
191 #endif
192 
193 #ifdef RT_LWIP_ICMP_DEBUG
194 #define ICMP_DEBUG                  LWIP_DBG_ON
195 #else
196 #define ICMP_DEBUG                  LWIP_DBG_OFF
197 #endif
198 
199 #ifdef RT_LWIP_IGMP_DEBUG
200 #define IGMP_DEBUG                  LWIP_DBG_ON
201 #else
202 #define IGMP_DEBUG                  LWIP_DBG_OFF
203 #endif
204 
205 #ifdef RT_LWIP_UDP_DEBUG
206 #define UDP_DEBUG                   LWIP_DBG_ON
207 #else
208 #define UDP_DEBUG                   LWIP_DBG_OFF
209 #endif
210 
211 #ifdef RT_LWIP_TCP_DEBUG
212 #define TCP_DEBUG                   LWIP_DBG_ON
213 #else
214 #define TCP_DEBUG                   LWIP_DBG_OFF
215 #endif
216 
217 #ifdef RT_LWIP_TCP_INPUT_DEBUG
218 #define TCP_INPUT_DEBUG             LWIP_DBG_ON
219 #else
220 #define TCP_INPUT_DEBUG             LWIP_DBG_OFF
221 #endif
222 
223 #ifdef RT_LWIP_TCP_OUTPUT_DEBUG
224 #define TCP_OUTPUT_DEBUG            LWIP_DBG_ON
225 #else
226 #define TCP_OUTPUT_DEBUG            LWIP_DBG_OFF
227 #endif
228 
229 #ifdef RT_LWIP_TCP_RTO_DEBUG
230 #define TCP_RTO_DEBUG               LWIP_DBG_ON
231 #else
232 #define TCP_RTO_DEBUG               LWIP_DBG_OFF
233 #endif
234 
235 #ifdef RT_LWIP_TCP_CWND_DEBUG
236 #define TCP_CWND_DEBUG              LWIP_DBG_ON
237 #else
238 #define TCP_CWND_DEBUG              LWIP_DBG_OFF
239 #endif
240 
241 #ifdef RT_LWIP_TCP_WND_DEBUG
242 #define TCP_WND_DEBUG               LWIP_DBG_ON
243 #else
244 #define TCP_WND_DEBUG               LWIP_DBG_OFF
245 #endif
246 
247 #ifdef RT_LWIP_TCP_FR_DEBUG
248 #define TCP_FR_DEBUG                LWIP_DBG_ON
249 #else
250 #define TCP_FR_DEBUG                LWIP_DBG_OFF
251 #endif
252 
253 #ifdef RT_LWIP_TCP_QLEN_DEBUG
254 #define TCP_QLEN_DEBUG              LWIP_DBG_ON
255 #else
256 #define TCP_QLEN_DEBUG              LWIP_DBG_OFF
257 #endif
258 
259 #ifdef RT_LWIP_TCP_RST_DEBUG
260 #define TCP_RST_DEBUG               LWIP_DBG_ON
261 #else
262 #define TCP_RST_DEBUG               LWIP_DBG_OFF
263 #endif
264 
265 #endif /* LWIP_DEBUG */
266 
267 #define LWIP_DBG_TYPES_ON           (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
268 
269 /* ---------- Memory options ---------- */
270 #define MEMCPY(dst,src,len)             rt_memcpy(dst,src,len)
271 #define SMEMCPY(dst,src,len)            MEMCPY(dst,src,len)
272 
273 #ifdef RT_LWIP_MEM_ALIGNMENT
274 #define MEM_ALIGNMENT RT_LWIP_MEM_ALIGNMENT
275 #else
276 #define MEM_ALIGNMENT               4
277 #endif
278 
279 #define MEMP_OVERFLOW_CHECK         1
280 #define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1
281 
282 //#define MEM_LIBC_MALLOC             1
283 //#define MEM_USE_POOLS               1
284 //#define MEMP_USE_CUSTOM_POOLS       1
285 //#define MEM_SIZE                    (1024*64)
286 
287 #define MEMP_MEM_MALLOC             0
288 
289 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
290    sends a lot of data out of ROM (or other static memory), this
291    should be set high. */
292 #define MEMP_NUM_PBUF               32 //16
293 
294 /* the number of struct netconns */
295 #ifdef RT_MEMP_NUM_NETCONN
296 #define MEMP_NUM_NETCONN            RT_MEMP_NUM_NETCONN
297 #endif
298 
299 /* the number of UDP protocol control blocks. One per active RAW "connection". */
300 #ifdef RT_LWIP_RAW_PCB_NUM
301 #define MEMP_NUM_RAW_PCB            RT_LWIP_RAW_PCB_NUM
302 #endif
303 
304 /* the number of UDP protocol control blocks. One per active UDP "connection". */
305 #ifdef RT_LWIP_UDP_PCB_NUM
306 #define MEMP_NUM_UDP_PCB            RT_LWIP_UDP_PCB_NUM
307 #endif
308 
309 /* the number of simulatenously active TCP connections. */
310 #ifdef RT_LWIP_TCP_PCB_NUM
311 #define MEMP_NUM_TCP_PCB            RT_LWIP_TCP_PCB_NUM
312 #endif
313 
314 /* the number of simultaneously queued TCP */
315 #ifdef RT_LWIP_TCP_SEG_NUM
316 #define MEMP_NUM_TCP_SEG            RT_LWIP_TCP_SEG_NUM
317 #else
318 #define MEMP_NUM_TCP_SEG            TCP_SND_QUEUELEN
319 #endif
320 
321 /*
322  * You can re-define following setting in rtcofnig.h to overwrite the default
323  * setting in the lwip opts.h
324  */
325 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
326 // #define MEMP_NUM_NETBUF             2
327 /* MEMP_NUM_NETCONN: the number of struct netconns. */
328 // #define MEMP_NUM_NETCONN            4
329 
330 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
331    for sequential API communication and incoming packets. Used in
332    src/api/tcpip.c. */
333 // #define MEMP_NUM_TCPIP_MSG_API      16
334 // #define MEMP_NUM_TCPIP_MSG_INPKT    16
335 
336 /* ---------- Pbuf options ---------- */
337 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
338 #ifdef RT_LWIP_PBUF_NUM
339 #define PBUF_POOL_SIZE               RT_LWIP_PBUF_NUM
340 #endif
341 
342 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
343 #ifdef RT_LWIP_PBUF_POOL_BUFSIZE
344 #define PBUF_POOL_BUFSIZE            RT_LWIP_PBUF_POOL_BUFSIZE
345 #endif
346 
347 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
348    link level header. */
349 #define PBUF_LINK_HLEN              16
350 
351 #ifdef RT_LWIP_ETH_PAD_SIZE
352 #define ETH_PAD_SIZE                RT_LWIP_ETH_PAD_SIZE
353 #endif
354 
355 #ifdef LWIP_USING_NAT
356 #define IP_NAT                      1
357 #else
358 #define IP_NAT                      0
359 #endif
360 
361 /* ---------- TCP options ---------- */
362 #ifdef RT_LWIP_TCP
363 #define LWIP_TCP                    1
364 #else
365 #define LWIP_TCP                    0
366 #endif
367 
368 #define TCP_TTL                     255
369 
370 /* Controls if TCP should queue segments that arrive out of
371    order. Define to 0 if your device is low on memory. */
372 #define TCP_QUEUE_OOSEQ             1
373 
374 /* TCP Maximum segment size. */
375 #define TCP_MSS                     1460
376 
377 /* TCP sender buffer space (bytes). */
378 #ifdef RT_LWIP_TCP_SND_BUF
379 #define TCP_SND_BUF                 RT_LWIP_TCP_SND_BUF
380 #else
381 #define TCP_SND_BUF                 (TCP_MSS * 2)
382 #endif
383 
384 /* TCP sender buffer space (pbufs). This must be at least = 2 *
385    TCP_SND_BUF/TCP_MSS for things to work. */
386 #define TCP_SND_QUEUELEN            (4 * TCP_SND_BUF/TCP_MSS)
387 
388 /* TCP writable space (bytes). This must be less than or equal
389    to TCP_SND_BUF. It is the amount of space which must be
390    available in the tcp snd_buf for select to return writable */
391 #define TCP_SNDLOWAT                (TCP_SND_BUF/2)
392 #define TCP_SNDQUEUELOWAT           TCP_SND_QUEUELEN/2
393 
394 /* TCP receive window. */
395 #ifdef RT_LWIP_TCP_WND
396 #define TCP_WND                     RT_LWIP_TCP_WND
397 #else
398 #define TCP_WND                     (TCP_MSS * 2)
399 #endif
400 
401 /* Maximum number of retransmissions of data segments. */
402 #define TCP_MAXRTX                  12
403 
404 /* Maximum number of retransmissions of SYN segments. */
405 #define TCP_SYNMAXRTX               4
406 
407 /* tcpip thread options */
408 #ifdef RT_LWIP_TCPTHREAD_PRIORITY
409 #define TCPIP_MBOX_SIZE             RT_LWIP_TCPTHREAD_MBOX_SIZE
410 #define TCPIP_THREAD_PRIO           RT_LWIP_TCPTHREAD_PRIORITY
411 #define TCPIP_THREAD_STACKSIZE      RT_LWIP_TCPTHREAD_STACKSIZE
412 #else
413 #define TCPIP_MBOX_SIZE             8
414 #define TCPIP_THREAD_PRIO           128
415 #define TCPIP_THREAD_STACKSIZE      4096
416 #endif
417 #define TCPIP_THREAD_NAME           "tcpip"
418 #define DEFAULT_TCP_RECVMBOX_SIZE   10
419 
420 /* ---------- ARP options ---------- */
421 #define LWIP_ARP                    1
422 #define ARP_TABLE_SIZE              10
423 #define ARP_QUEUEING                1
424 
425 /* ---------- Checksum options ---------- */
426 #ifdef RT_LWIP_USING_HW_CHECKSUM
427 #define CHECKSUM_GEN_IP                 0
428 #define CHECKSUM_GEN_UDP                0
429 #define CHECKSUM_GEN_TCP                0
430 #define CHECKSUM_GEN_ICMP               0
431 #define CHECKSUM_CHECK_IP               0
432 #define CHECKSUM_CHECK_UDP              0
433 #define CHECKSUM_CHECK_TCP              0
434 #define CHECKSUM_CHECK_ICMP             0
435 #endif
436 
437 /* ---------- IP options ---------- */
438 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
439    IP packets across network interfaces. If you are going to run lwIP
440    on a device with only one network interface, define this to 0. */
441 #define IP_FORWARD                  0
442 
443 /* IP reassembly and segmentation.These are orthogonal even
444  * if they both deal with IP fragments */
445 #ifdef RT_LWIP_REASSEMBLY_FRAG
446 #define IP_REASSEMBLY               1
447 #define IP_FRAG                     1
448 #define IP_REASS_MAX_PBUFS          10
449 #define MEMP_NUM_REASSDATA          10
450 #else
451 #define IP_REASSEMBLY               0
452 #define IP_FRAG                     0
453 #endif
454 
455 /* ---------- ICMP options ---------- */
456 #define ICMP_TTL                    255
457 
458 /* ---------- DHCP options ---------- */
459 /* Define LWIP_DHCP to 1 if you want DHCP configuration of
460    interfaces. */
461 #ifdef RT_LWIP_DHCP
462 #define LWIP_DHCP                   1
463 #else
464 #define LWIP_DHCP                   0
465 #endif
466 
467 /* 1 if you want to do an ARP check on the offered address
468    (recommended). */
469 #define DHCP_DOES_ARP_CHECK         (LWIP_DHCP)
470 
471 /* ---------- AUTOIP options ------- */
472 #define LWIP_AUTOIP                 0
473 #define LWIP_DHCP_AUTOIP_COOP       (LWIP_DHCP && LWIP_AUTOIP)
474 
475 /* ---------- UDP options ---------- */
476 #ifdef RT_LWIP_UDP
477 #define LWIP_UDP                    1
478 #else
479 #define LWIP_UDP                    0
480 #endif
481 
482 #define LWIP_UDPLITE                0
483 #define UDP_TTL                     255
484 #define DEFAULT_UDP_RECVMBOX_SIZE   1
485 
486 /* ---------- RAW options ---------- */
487 #ifdef RT_LWIP_RAW
488 #define LWIP_RAW                    1
489 #else
490 #define LWIP_RAW                    0
491 #endif
492 
493 #define DEFAULT_RAW_RECVMBOX_SIZE   1
494 #define DEFAULT_ACCEPTMBOX_SIZE     10
495 
496 /* ---------- Statistics options ---------- */
497 #ifdef RT_LWIP_STATS
498 #define LWIP_STATS                  1
499 #define LWIP_STATS_DISPLAY          1
500 #else
501 #define LWIP_STATS                  0
502 #endif
503 
504 #if LWIP_STATS
505 #define LINK_STATS                  1
506 #define IP_STATS                    1
507 #define ICMP_STATS                  1
508 #define IGMP_STATS                  1
509 #define IPFRAG_STATS                1
510 #define UDP_STATS                   1
511 #define TCP_STATS                   1
512 #define MEM_STATS                   1
513 #define MEMP_STATS                  1
514 #define PBUF_STATS                  1
515 #define SYS_STATS                   1
516 #define MIB2_STATS                  1
517 #endif /* LWIP_STATS */
518 
519 /* ---------- PPP options ---------- */
520 #ifdef RT_LWIP_PPP
521 #define PPP_SUPPORT                 1      /* Set > 0 for PPP */
522 #else
523 #define PPP_SUPPORT                 0      /* Set > 0 for PPP */
524 #endif
525 
526 #if PPP_SUPPORT
527 #define NUM_PPP                     1      /* Max PPP sessions. */
528 
529 /* Select modules to enable.  Ideally these would be set in the makefile but
530  * we're limited by the command line length so you need to modify the settings
531  * in this file.
532  */
533 #ifdef RT_LWIP_PPPOE
534 #define PPPOE_SUPPORT               1
535 #else
536 #define PPPOE_SUPPORT               0
537 #endif
538 
539 #ifdef RT_LWIP_PPPOS
540 #define PPPOS_SUPPORT               1
541 #else
542 #define PPPOS_SUPPORT               0
543 #endif
544 
545 #define PAP_SUPPORT                 1      /* Set > 0 for PAP. */
546 #define CHAP_SUPPORT                1      /* Set > 0 for CHAP. */
547 #define MSCHAP_SUPPORT              0      /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
548 #define CBCP_SUPPORT                0      /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
549 #define CCP_SUPPORT                 0      /* Set > 0 for CCP (NOT FUNCTIONAL!) */
550 #define VJ_SUPPORT                  1      /* Set > 0 for VJ header compression. */
551 #define MD5_SUPPORT                 1      /* Set > 0 for MD5 (see also CHAP) */
552 
553 #endif /* PPP_SUPPORT */
554 
555 /**
556  * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names.
557  * Disable this option if you use a POSIX operating system that uses the same
558  * names (read, write & close). (only used if you use sockets.c)
559  */
560 #ifndef LWIP_POSIX_SOCKETS_IO_NAMES
561 #define LWIP_POSIX_SOCKETS_IO_NAMES     0
562 #endif
563 
564 /**
565  * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT
566  * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set
567  * in seconds. (does not require sockets.c, and will affect tcp.c)
568  */
569 #ifndef LWIP_TCP_KEEPALIVE
570 #define LWIP_TCP_KEEPALIVE              1
571 #endif
572 
573 /**
574  * LWIP_NETIF_HOSTNAME==1: Support netif hostname
575  */
576 #ifndef LWIP_NETIF_HOSTNAME
577 #define LWIP_NETIF_HOSTNAME             1
578 #endif
579 
580 /**
581  * RT_LWIP_NETIF_NAMESIZE support netif name length(in netif.c)
582  */
583 #ifdef RT_LWIP_NETIF_NAMESIZE
584 #if (RT_LWIP_NETIF_NAMESIZE < 2)
585 #warning NETIF_NAMESIZE too small, the value must be greater than or equal to 6.
586 #endif
587 #define NETIF_NAMESIZE                  RT_LWIP_NETIF_NAMESIZE
588 #endif /* RT_LWIP_NETIF_NAMESIZE */
589 
590 /**
591  * LWIP_NETIF_API==1: Support netif api (in netifapi.c)
592  */
593 #ifndef LWIP_NETIF_API
594 #define LWIP_NETIF_API                  1
595 #endif
596 
597 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */
598 #define MEMP_NUM_SYS_TIMEOUT       (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT + (LWIP_IPV6 ? (1 + (2*LWIP_IPV6)) : 0))
599 
600 /*
601  * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
602  * (only used if you use sockets.c)
603  */
604 #ifdef SAL_USING_POSIX
605 #define LWIP_COMPAT_SOCKETS             0
606 #else
607 #ifndef LWIP_COMPAT_SOCKETS
608 #define LWIP_COMPAT_SOCKETS             1
609 #endif
610 #endif
611 
612 /**
613  * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and
614  * SO_SNDTIMEO processing.
615  */
616 #ifndef LWIP_SO_SNDTIMEO
617 #define LWIP_SO_SNDTIMEO                1
618 #endif
619 
620 /**
621  * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and
622  * SO_RCVTIMEO processing.
623  */
624 #ifndef LWIP_SO_RCVTIMEO
625 #define LWIP_SO_RCVTIMEO                1
626 #endif
627 
628 /**
629  * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
630  */
631 #ifndef LWIP_SO_RCVBUF
632 #define LWIP_SO_RCVBUF                  1
633 #endif
634 
635 /**
636  * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize.
637  */
638 #ifndef RECV_BUFSIZE_DEFAULT
639 #define RECV_BUFSIZE_DEFAULT            8192
640 #endif
641 
642 /**
643  * SO_REUSE==1: Enable SO_REUSEADDR option.
644  */
645 #ifndef SO_REUSE
646 #define SO_REUSE                        0
647 #endif
648 
649 #if RT_USING_LWIP_VER_NUM >= 0x20000 /* >= v2.0.0 */
650 #if RT_USING_LWIP_VER_NUM < 0x20102  /* >= v2.0.0 && < v2.1.2 */
651 #define LWIP_HOOK_IP4_ROUTE_SRC(dest, src)  lwip_ip4_route_src(dest, src)
652 #else                                /* >= v2.1.2 */
653 #define LWIP_HOOK_IP4_ROUTE_SRC(src, dest)  lwip_ip4_route_src(dest, src)
654 #endif
655 #endif /* RT_USING_LWIP_VER_NUM >= 0x20000 */
656 
657 #ifdef RT_LWIP_ENABLE_USER_HOOKS
658 /**
659  * This hook provides flexibility for handling unknown Ethernet protocols.
660  *
661  * For example, you can define how to handle packets of unknown types,
662  * such as forwarding them to another interface, discarding them,
663  * or passing them to an application for further processing.
664  */
665 #define LWIP_HOOK_UNKNOWN_ETH_PROTOCOL lwip_hook_unknown_eth_protocol
666 #endif /* RT_LWIP_ENABLE_USER_HOOKS */
667 
668 #endif /* __LWIPOPTS_H__ */
669