1/**
2 * @file
3 *
4 * lwIP Options Configuration
5 */
6
7/*
8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright notice,
15 *    this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright notice,
17 *    this list of conditions and the following disclaimer in the documentation
18 *    and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote products
20 *    derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31 * OF SUCH DAMAGE.
32 *
33 * This file is part of the lwIP TCP/IP stack.
34 *
35 * Author: Adam Dunkels <adam@sics.se>
36 *
37 */
38
39/*
40 * NOTE: || defined __DOXYGEN__ is a workaround for doxygen bug -
41 * without this, doxygen does not see the actual #define
42 */
43
44#if !defined LWIP_HDR_OPT_H
45#define LWIP_HDR_OPT_H
46
47/*
48 * Include user defined options first. Anything not defined in these files
49 * will be set to standard values. Override anything you don't like!
50 */
51#include "lwipopts.h"
52#include "lwip/debug.h"
53
54/**
55 * @defgroup lwip_opts Options (lwipopts.h)
56 * @ingroup lwip
57 *
58 * @defgroup lwip_opts_debug Debugging
59 * @ingroup lwip_opts
60 *
61 * @defgroup lwip_opts_infrastructure Infrastructure
62 * @ingroup lwip_opts
63 *
64 * @defgroup lwip_opts_callback Callback-style APIs
65 * @ingroup lwip_opts
66 *
67 * @defgroup lwip_opts_threadsafe_apis Thread-safe APIs
68 * @ingroup lwip_opts
69 */
70
71 /*
72   ------------------------------------
73   -------------- NO SYS --------------
74   ------------------------------------
75*/
76/**
77 * @defgroup lwip_opts_nosys NO_SYS
78 * @ingroup lwip_opts_infrastructure
79 * @{
80 */
81/**
82 * NO_SYS==1: Use lwIP without OS-awareness (no thread, semaphores, mutexes or
83 * mboxes). This means threaded APIs cannot be used (socket, netconn,
84 * i.e. everything in the 'api' folder), only the callback-style raw API is
85 * available (and you have to watch out for yourself that you don't access
86 * lwIP functions/structures from more than one context at a time!)
87 */
88#if !defined NO_SYS || defined __DOXYGEN__
89#define NO_SYS                          0
90#endif
91/**
92 * @}
93 */
94
95/**
96 * @defgroup lwip_opts_timers Timers
97 * @ingroup lwip_opts_infrastructure
98 * @{
99 */
100/**
101 * LWIP_TIMERS==0: Drop support for sys_timeout and lwip-internal cyclic timers.
102 * (the array of lwip-internal cyclic timers is still provided)
103 * (check NO_SYS_NO_TIMERS for compatibility to old versions)
104 */
105#if !defined LWIP_TIMERS || defined __DOXYGEN__
106#ifdef NO_SYS_NO_TIMERS
107#define LWIP_TIMERS                     (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS))
108#else
109#define LWIP_TIMERS                     1
110#endif
111#endif
112
113/**
114 * LWIP_TIMERS_CUSTOM==1: Provide your own timer implementation.
115 * Function prototypes in timeouts.h and the array of lwip-internal cyclic timers
116 * are still included, but the implementation is not. The following functions
117 * will be required: sys_timeouts_init(), sys_timeout(), sys_untimeout(),
118 *                   sys_timeouts_mbox_fetch()
119 */
120#if !defined LWIP_TIMERS_CUSTOM || defined __DOXYGEN__
121#define LWIP_TIMERS_CUSTOM              0
122#endif
123/**
124 * @}
125 */
126
127/**
128 * @defgroup lwip_opts_memcpy memcpy
129 * @ingroup lwip_opts_infrastructure
130 * @{
131 */
132/**
133 * MEMCPY: override this if you have a faster implementation at hand than the
134 * one included in your C library
135 */
136#if !defined MEMCPY || defined __DOXYGEN__
137#define MEMCPY(dst,src,len)             memcpy(dst,src,len)
138#endif
139
140/**
141 * SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a
142 * call to memcpy() if the length is known at compile time and is small.
143 */
144#if !defined SMEMCPY || defined __DOXYGEN__
145#define SMEMCPY(dst,src,len)            memcpy(dst,src,len)
146#endif
147/**
148 * @}
149 */
150
151/*
152   ------------------------------------
153   ----------- Core locking -----------
154   ------------------------------------
155*/
156/**
157 * @defgroup lwip_opts_lock Core locking and MPU
158 * @ingroup lwip_opts_infrastructure
159 * @{
160 */
161/**
162 * LWIP_MPU_COMPATIBLE: enables special memory management mechanism
163 * which makes lwip able to work on MPU (Memory Protection Unit) system
164 * by not passing stack-pointers to other threads
165 * (this decreases performance as memory is allocated from pools instead
166 * of keeping it on the stack)
167 */
168#if !defined LWIP_MPU_COMPATIBLE || defined __DOXYGEN__
169#define LWIP_MPU_COMPATIBLE             0
170#endif
171
172/**
173 * LWIP_TCPIP_CORE_LOCKING
174 * Creates a global mutex that is held during TCPIP thread operations.
175 * Can be locked by client code to perform lwIP operations without changing
176 * into TCPIP thread using callbacks. See LOCK_TCPIP_CORE() and
177 * UNLOCK_TCPIP_CORE().
178 * Your system should provide mutexes supporting priority inversion to use this.
179 */
180#if !defined LWIP_TCPIP_CORE_LOCKING || defined __DOXYGEN__
181#define LWIP_TCPIP_CORE_LOCKING         1
182#endif
183
184/**
185 * LWIP_TCPIP_CORE_LOCKING_INPUT: when LWIP_TCPIP_CORE_LOCKING is enabled,
186 * this lets tcpip_input() grab the mutex for input packets as well,
187 * instead of allocating a message and passing it to tcpip_thread.
188 *
189 * ATTENTION: this does not work when tcpip_input() is called from
190 * interrupt context!
191 */
192#if !defined LWIP_TCPIP_CORE_LOCKING_INPUT || defined __DOXYGEN__
193#define LWIP_TCPIP_CORE_LOCKING_INPUT   0
194#endif
195
196/**
197 * SYS_LIGHTWEIGHT_PROT==1: enable inter-task protection (and task-vs-interrupt
198 * protection) for certain critical regions during buffer allocation, deallocation
199 * and memory allocation and deallocation.
200 * ATTENTION: This is required when using lwIP from more than one context! If
201 * you disable this, you must be sure what you are doing!
202 */
203#if !defined SYS_LIGHTWEIGHT_PROT || defined __DOXYGEN__
204#define SYS_LIGHTWEIGHT_PROT            1
205#endif
206/**
207 * @}
208 */
209
210/*
211   ------------------------------------
212   ---------- Memory options ----------
213   ------------------------------------
214*/
215/**
216 * @defgroup lwip_opts_mem Heap and memory pools
217 * @ingroup lwip_opts_infrastructure
218 * @{
219 */
220/**
221 * MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library
222 * instead of the lwip internal allocator. Can save code size if you
223 * already use it.
224 */
225#if !defined MEM_LIBC_MALLOC || defined __DOXYGEN__
226#define MEM_LIBC_MALLOC                 0
227#endif
228
229/**
230 * MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator.
231 * Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution
232 * speed (heap alloc can be much slower than pool alloc) and usage from interrupts
233 * (especially if your netif driver allocates PBUF_POOL pbufs for received frames
234 * from interrupt)!
235 * ATTENTION: Currently, this uses the heap for ALL pools (also for private pools,
236 * not only for internal pools defined in memp_std.h)!
237 */
238#if !defined MEMP_MEM_MALLOC || defined __DOXYGEN__
239#define MEMP_MEM_MALLOC                 0
240#endif
241
242/**
243 * MEM_ALIGNMENT: should be set to the alignment of the CPU
244 *    4 byte alignment -> \#define MEM_ALIGNMENT 4
245 *    2 byte alignment -> \#define MEM_ALIGNMENT 2
246 */
247#if !defined MEM_ALIGNMENT || defined __DOXYGEN__
248#define MEM_ALIGNMENT                   1
249#endif
250
251/**
252 * MEM_SIZE: the size of the heap memory. If the application will send
253 * a lot of data that needs to be copied, this should be set high.
254 */
255#if !defined MEM_SIZE || defined __DOXYGEN__
256#define MEM_SIZE                        1600
257#endif
258
259/**
260 * MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable
261 * amount of bytes before and after each memp element in every pool and fills
262 * it with a prominent default value.
263 *    MEMP_OVERFLOW_CHECK == 0 no checking
264 *    MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed
265 *    MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time
266 *      memp_malloc() or memp_free() is called (useful but slow!)
267 */
268#if !defined MEMP_OVERFLOW_CHECK || defined __DOXYGEN__
269#define MEMP_OVERFLOW_CHECK             0
270#endif
271
272/**
273 * MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make
274 * sure that there are no cycles in the linked lists.
275 */
276#if !defined MEMP_SANITY_CHECK || defined __DOXYGEN__
277#define MEMP_SANITY_CHECK               0
278#endif
279
280/**
281 * MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set
282 * of memory pools of various sizes. When mem_malloc is called, an element of
283 * the smallest pool that can provide the length needed is returned.
284 * To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled.
285 */
286#if !defined MEM_USE_POOLS || defined __DOXYGEN__
287#define MEM_USE_POOLS                   0
288#endif
289
290/**
291 * MEM_USE_POOLS_TRY_BIGGER_POOL==1: if one malloc-pool is empty, try the next
292 * bigger pool - WARNING: THIS MIGHT WASTE MEMORY but it can make a system more
293 * reliable. */
294#if !defined MEM_USE_POOLS_TRY_BIGGER_POOL || defined __DOXYGEN__
295#define MEM_USE_POOLS_TRY_BIGGER_POOL   0
296#endif
297
298/**
299 * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h
300 * that defines additional pools beyond the "standard" ones required
301 * by lwIP. If you set this to 1, you must have lwippools.h in your
302 * include path somewhere.
303 */
304#if !defined MEMP_USE_CUSTOM_POOLS || defined __DOXYGEN__
305#define MEMP_USE_CUSTOM_POOLS           0
306#endif
307
308/**
309 * Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from
310 * interrupt context (or another context that doesn't allow waiting for a
311 * semaphore).
312 * If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT,
313 * while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs
314 * with each loop so that mem_free can run.
315 *
316 * ATTENTION: As you can see from the above description, this leads to dis-/
317 * enabling interrupts often, which can be slow! Also, on low memory, mem_malloc
318 * can need longer.
319 *
320 * If you don't want that, at least for NO_SYS=0, you can still use the following
321 * functions to enqueue a deallocation call which then runs in the tcpip_thread
322 * context:
323 * - pbuf_free_callback(p);
324 * - mem_free_callback(m);
325 */
326#if !defined LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT || defined __DOXYGEN__
327#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
328#endif
329/**
330 * @}
331 */
332
333/*
334   ------------------------------------------------
335   ---------- Internal Memory Pool Sizes ----------
336   ------------------------------------------------
337*/
338/**
339 * @defgroup lwip_opts_memp Internal memory pools
340 * @ingroup lwip_opts_infrastructure
341 * @{
342 */
343/**
344 * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
345 * If the application sends a lot of data out of ROM (or other static memory),
346 * this should be set high.
347 */
348#if !defined MEMP_NUM_PBUF || defined __DOXYGEN__
349#define MEMP_NUM_PBUF                   16
350#endif
351
352/**
353 * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
354 * (requires the LWIP_RAW option)
355 */
356#if !defined MEMP_NUM_RAW_PCB || defined __DOXYGEN__
357#define MEMP_NUM_RAW_PCB                4
358#endif
359
360/**
361 * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
362 * per active UDP "connection".
363 * (requires the LWIP_UDP option)
364 */
365#if !defined MEMP_NUM_UDP_PCB || defined __DOXYGEN__
366#define MEMP_NUM_UDP_PCB                4
367#endif
368
369/**
370 * MEMP_NUM_TCP_PCB: the number of simultaneously active TCP connections.
371 * (requires the LWIP_TCP option)
372 */
373#if !defined MEMP_NUM_TCP_PCB || defined __DOXYGEN__
374#define MEMP_NUM_TCP_PCB                5
375#endif
376
377/**
378 * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
379 * (requires the LWIP_TCP option)
380 */
381#if !defined MEMP_NUM_TCP_PCB_LISTEN || defined __DOXYGEN__
382#define MEMP_NUM_TCP_PCB_LISTEN         8
383#endif
384
385/**
386 * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
387 * (requires the LWIP_TCP option)
388 */
389#if !defined MEMP_NUM_TCP_SEG || defined __DOXYGEN__
390#define MEMP_NUM_TCP_SEG                16
391#endif
392
393/**
394 * MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for
395 * reassembly (whole packets, not fragments!)
396 */
397#if !defined MEMP_NUM_REASSDATA || defined __DOXYGEN__
398#define MEMP_NUM_REASSDATA              5
399#endif
400
401/**
402 * MEMP_NUM_FRAG_PBUF: the number of IP fragments simultaneously sent
403 * (fragments, not whole packets!).
404 * This is only used with LWIP_NETIF_TX_SINGLE_PBUF==0 and only has to be > 1
405 * with DMA-enabled MACs where the packet is not yet sent when netif->output
406 * returns.
407 */
408#if !defined MEMP_NUM_FRAG_PBUF || defined __DOXYGEN__
409#define MEMP_NUM_FRAG_PBUF              15
410#endif
411
412/**
413 * MEMP_NUM_ARP_QUEUE: the number of simultaneously queued outgoing
414 * packets (pbufs) that are waiting for an ARP request (to resolve
415 * their destination address) to finish.
416 * (requires the ARP_QUEUEING option)
417 */
418#if !defined MEMP_NUM_ARP_QUEUE || defined __DOXYGEN__
419#define MEMP_NUM_ARP_QUEUE              30
420#endif
421
422/**
423 * MEMP_NUM_IGMP_GROUP: The number of multicast groups whose network interfaces
424 * can be members at the same time (one per netif - allsystems group -, plus one
425 * per netif membership).
426 * (requires the LWIP_IGMP option)
427 */
428#if !defined MEMP_NUM_IGMP_GROUP || defined __DOXYGEN__
429#define MEMP_NUM_IGMP_GROUP             8
430#endif
431
432/**
433 * MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active timeouts.
434 * The default number of timeouts is calculated here for all enabled modules.
435 * The formula expects settings to be either '0' or '1'.
436 */
437#if !defined MEMP_NUM_SYS_TIMEOUT || defined __DOXYGEN__
438#define MEMP_NUM_SYS_TIMEOUT            (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + (PPP_SUPPORT*6*MEMP_NUM_PPP_PCB) + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD) : 0))
439#endif
440
441/**
442 * MEMP_NUM_NETBUF: the number of struct netbufs.
443 * (only needed if you use the sequential API, like api_lib.c)
444 */
445#if !defined MEMP_NUM_NETBUF || defined __DOXYGEN__
446#define MEMP_NUM_NETBUF                 2
447#endif
448
449/**
450 * MEMP_NUM_NETCONN: the number of struct netconns.
451 * (only needed if you use the sequential API, like api_lib.c)
452 */
453#if !defined MEMP_NUM_NETCONN || defined __DOXYGEN__
454#define MEMP_NUM_NETCONN                4
455#endif
456
457/**
458 * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
459 * for callback/timeout API communication.
460 * (only needed if you use tcpip.c)
461 */
462#if !defined MEMP_NUM_TCPIP_MSG_API || defined __DOXYGEN__
463#define MEMP_NUM_TCPIP_MSG_API          8
464#endif
465
466/**
467 * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
468 * for incoming packets.
469 * (only needed if you use tcpip.c)
470 */
471#if !defined MEMP_NUM_TCPIP_MSG_INPKT || defined __DOXYGEN__
472#define MEMP_NUM_TCPIP_MSG_INPKT        8
473#endif
474
475/**
476 * MEMP_NUM_NETDB: the number of concurrently running lwip_addrinfo() calls
477 * (before freeing the corresponding memory using lwip_freeaddrinfo()).
478 */
479#if !defined MEMP_NUM_NETDB || defined __DOXYGEN__
480#define MEMP_NUM_NETDB                  1
481#endif
482
483/**
484 * MEMP_NUM_LOCALHOSTLIST: the number of host entries in the local host list
485 * if DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1.
486 */
487#if !defined MEMP_NUM_LOCALHOSTLIST || defined __DOXYGEN__
488#define MEMP_NUM_LOCALHOSTLIST          1
489#endif
490
491/**
492 * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
493 */
494#if !defined PBUF_POOL_SIZE || defined __DOXYGEN__
495#define PBUF_POOL_SIZE                  16
496#endif
497
498/** MEMP_NUM_API_MSG: the number of concurrently active calls to various
499 * socket, netconn, and tcpip functions
500 */
501#if !defined MEMP_NUM_API_MSG || defined __DOXYGEN__
502#define MEMP_NUM_API_MSG                MEMP_NUM_TCPIP_MSG_API
503#endif
504
505/** MEMP_NUM_DNS_API_MSG: the number of concurrently active calls to netconn_gethostbyname
506 */
507#if !defined MEMP_NUM_DNS_API_MSG || defined __DOXYGEN__
508#define MEMP_NUM_DNS_API_MSG            MEMP_NUM_TCPIP_MSG_API
509#endif
510
511/** MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA: the number of concurrently active calls
512 * to getsockopt/setsockopt
513 */
514#if !defined MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA || defined __DOXYGEN__
515#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API
516#endif
517
518/** MEMP_NUM_NETIFAPI_MSG: the number of concurrently active calls to the
519 * netifapi functions
520 */
521#if !defined MEMP_NUM_NETIFAPI_MSG || defined __DOXYGEN__
522#define MEMP_NUM_NETIFAPI_MSG           MEMP_NUM_TCPIP_MSG_API
523#endif
524/**
525 * @}
526 */
527
528/*
529   ---------------------------------
530   ---------- ARP options ----------
531   ---------------------------------
532*/
533/**
534 * @defgroup lwip_opts_arp ARP
535 * @ingroup lwip_opts_ipv4
536 * @{
537 */
538/**
539 * LWIP_ARP==1: Enable ARP functionality.
540 */
541#if !defined LWIP_ARP || defined __DOXYGEN__
542#define LWIP_ARP                        1
543#endif
544
545/**
546 * ARP_TABLE_SIZE: Number of active MAC-IP address pairs cached.
547 */
548#if !defined ARP_TABLE_SIZE || defined __DOXYGEN__
549#define ARP_TABLE_SIZE                  10
550#endif
551
552/** the time an ARP entry stays valid after its last update,
553 *  for ARP_TMR_INTERVAL = 1000, this is
554 *  (60 * 5) seconds = 5 minutes.
555 */
556#if !defined ARP_MAXAGE || defined __DOXYGEN__
557#define ARP_MAXAGE                      300
558#endif
559
560/**
561 * ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address
562 * resolution. By default, only the most recent packet is queued per IP address.
563 * This is sufficient for most protocols and mainly reduces TCP connection
564 * startup time. Set this to 1 if you know your application sends more than one
565 * packet in a row to an IP address that is not in the ARP cache.
566 */
567#if !defined ARP_QUEUEING || defined __DOXYGEN__
568#define ARP_QUEUEING                    0
569#endif
570
571/** The maximum number of packets which may be queued for each
572 *  unresolved address by other network layers. Defaults to 3, 0 means disabled.
573 *  Old packets are dropped, new packets are queued.
574 */
575#if !defined ARP_QUEUE_LEN || defined __DOXYGEN__
576#define ARP_QUEUE_LEN                   3
577#endif
578
579/**
580 * ETHARP_SUPPORT_VLAN==1: support receiving and sending ethernet packets with
581 * VLAN header. See the description of LWIP_HOOK_VLAN_CHECK and
582 * LWIP_HOOK_VLAN_SET hooks to check/set VLAN headers.
583 * Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check.
584 * If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted.
585 * If ETHARP_VLAN_CHECK is not defined, all traffic is accepted.
586 * Alternatively, define a function/define ETHARP_VLAN_CHECK_FN(eth_hdr, vlan)
587 * that returns 1 to accept a packet or 0 to drop a packet.
588 */
589#if !defined ETHARP_SUPPORT_VLAN || defined __DOXYGEN__
590#define ETHARP_SUPPORT_VLAN             0
591#endif
592
593/** LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled
594 */
595#if !defined LWIP_ETHERNET || defined __DOXYGEN__
596#define LWIP_ETHERNET                   LWIP_ARP
597#endif
598
599/** ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure
600 * alignment of payload after that header. Since the header is 14 bytes long,
601 * without this padding e.g. addresses in the IP header will not be aligned
602 * on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms.
603 */
604#if !defined ETH_PAD_SIZE || defined __DOXYGEN__
605#define ETH_PAD_SIZE                    0
606#endif
607
608/** ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table
609 * entries (using etharp_add_static_entry/etharp_remove_static_entry).
610 */
611#if !defined ETHARP_SUPPORT_STATIC_ENTRIES || defined __DOXYGEN__
612#define ETHARP_SUPPORT_STATIC_ENTRIES   0
613#endif
614
615/** ETHARP_TABLE_MATCH_NETIF==1: Match netif for ARP table entries.
616 * If disabled, duplicate IP address on multiple netifs are not supported
617 * (but this should only occur for AutoIP).
618 */
619#if !defined ETHARP_TABLE_MATCH_NETIF || defined __DOXYGEN__
620#define ETHARP_TABLE_MATCH_NETIF        0
621#endif
622/**
623 * @}
624 */
625
626/*
627   --------------------------------
628   ---------- IP options ----------
629   --------------------------------
630*/
631/**
632 * @defgroup lwip_opts_ipv4 IPv4
633 * @ingroup lwip_opts
634 * @{
635 */
636/**
637 * LWIP_IPV4==1: Enable IPv4
638 */
639#if !defined LWIP_IPV4 || defined __DOXYGEN__
640#define LWIP_IPV4                       1
641#endif
642
643/**
644 * IP_FORWARD==1: Enables the ability to forward IP packets across network
645 * interfaces. If you are going to run lwIP on a device with only one network
646 * interface, define this to 0.
647 */
648#if !defined IP_FORWARD || defined __DOXYGEN__
649#define IP_FORWARD                      0
650#endif
651
652/**
653 * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
654 * this option does not affect outgoing packet sizes, which can be controlled
655 * via IP_FRAG.
656 */
657#if !defined IP_REASSEMBLY || defined __DOXYGEN__
658#define IP_REASSEMBLY                   1
659#endif
660
661/**
662 * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
663 * that this option does not affect incoming packet sizes, which can be
664 * controlled via IP_REASSEMBLY.
665 */
666#if !defined IP_FRAG || defined __DOXYGEN__
667#define IP_FRAG                         1
668#endif
669
670#if !LWIP_IPV4
671/* disable IPv4 extensions when IPv4 is disabled */
672#undef IP_FORWARD
673#define IP_FORWARD                      0
674#undef IP_REASSEMBLY
675#define IP_REASSEMBLY                   0
676#undef IP_FRAG
677#define IP_FRAG                         0
678#endif /* !LWIP_IPV4 */
679
680/**
681 * IP_OPTIONS_ALLOWED: Defines the behavior for IP options.
682 *      IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
683 *      IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
684 */
685#if !defined IP_OPTIONS_ALLOWED || defined __DOXYGEN__
686#define IP_OPTIONS_ALLOWED              1
687#endif
688
689/**
690 * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
691 * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
692 * in this time, the whole packet is discarded.
693 */
694#if !defined IP_REASS_MAXAGE || defined __DOXYGEN__
695#define IP_REASS_MAXAGE                 3
696#endif
697
698/**
699 * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
700 * Since the received pbufs are enqueued, be sure to configure
701 * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
702 * packets even if the maximum amount of fragments is enqueued for reassembly!
703 */
704#if !defined IP_REASS_MAX_PBUFS || defined __DOXYGEN__
705#define IP_REASS_MAX_PBUFS              10
706#endif
707
708/**
709 * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
710 */
711#if !defined IP_DEFAULT_TTL || defined __DOXYGEN__
712#define IP_DEFAULT_TTL                  255
713#endif
714
715/**
716 * IP_SOF_BROADCAST=1: Use the SOF_BROADCAST field to enable broadcast
717 * filter per pcb on udp and raw send operations. To enable broadcast filter
718 * on recv operations, you also have to set IP_SOF_BROADCAST_RECV=1.
719 */
720#if !defined IP_SOF_BROADCAST || defined __DOXYGEN__
721#define IP_SOF_BROADCAST                0
722#endif
723
724/**
725 * IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast
726 * filter on recv operations.
727 */
728#if !defined IP_SOF_BROADCAST_RECV || defined __DOXYGEN__
729#define IP_SOF_BROADCAST_RECV           0
730#endif
731
732/**
733 * IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1: allow ip_forward() to send packets back
734 * out on the netif where it was received. This should only be used for
735 * wireless networks.
736 * ATTENTION: When this is 1, make sure your netif driver correctly marks incoming
737 * link-layer-broadcast/multicast packets as such using the corresponding pbuf flags!
738 */
739#if !defined IP_FORWARD_ALLOW_TX_ON_RX_NETIF || defined __DOXYGEN__
740#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
741#endif
742
743/**
744 * LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS==1: randomize the local port for the first
745 * local TCP/UDP pcb (default==0). This can prevent creating predictable port
746 * numbers after booting a device.
747 */
748#if !defined LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS || defined __DOXYGEN__
749#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 0
750#endif
751/**
752 * @}
753 */
754
755/*
756   ----------------------------------
757   ---------- ICMP options ----------
758   ----------------------------------
759*/
760/**
761 * @defgroup lwip_opts_icmp ICMP
762 * @ingroup lwip_opts_ipv4
763 * @{
764 */
765/**
766 * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
767 * Be careful, disable that make your product non-compliant to RFC1122
768 */
769#if !defined LWIP_ICMP || defined __DOXYGEN__
770#define LWIP_ICMP                       1
771#endif
772
773/**
774 * ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
775 */
776#if !defined ICMP_TTL || defined __DOXYGEN__
777#define ICMP_TTL                       (IP_DEFAULT_TTL)
778#endif
779
780/**
781 * LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only)
782 */
783#if !defined LWIP_BROADCAST_PING || defined __DOXYGEN__
784#define LWIP_BROADCAST_PING             0
785#endif
786
787/**
788 * LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only)
789 */
790#if !defined LWIP_MULTICAST_PING || defined __DOXYGEN__
791#define LWIP_MULTICAST_PING             0
792#endif
793/**
794 * @}
795 */
796
797/*
798   ---------------------------------
799   ---------- RAW options ----------
800   ---------------------------------
801*/
802/**
803 * @defgroup lwip_opts_raw RAW
804 * @ingroup lwip_opts_callback
805 * @{
806 */
807/**
808 * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
809 */
810#if !defined LWIP_RAW || defined __DOXYGEN__
811#define LWIP_RAW                        0
812#endif
813
814/**
815 * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
816 */
817#if !defined RAW_TTL || defined __DOXYGEN__
818#define RAW_TTL                        (IP_DEFAULT_TTL)
819#endif
820/**
821 * @}
822 */
823
824/*
825   ----------------------------------
826   ---------- DHCP options ----------
827   ----------------------------------
828*/
829/**
830 * @defgroup lwip_opts_dhcp DHCP
831 * @ingroup lwip_opts_ipv4
832 * @{
833 */
834/**
835 * LWIP_DHCP==1: Enable DHCP module.
836 */
837#if !defined LWIP_DHCP || defined __DOXYGEN__
838#define LWIP_DHCP                       0
839#endif
840#if !LWIP_IPV4
841/* disable DHCP when IPv4 is disabled */
842#undef LWIP_DHCP
843#define LWIP_DHCP                       0
844#endif /* !LWIP_IPV4 */
845
846/**
847 * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address.
848 */
849#if !defined DHCP_DOES_ARP_CHECK || defined __DOXYGEN__
850#define DHCP_DOES_ARP_CHECK             ((LWIP_DHCP) && (LWIP_ARP))
851#endif
852
853/**
854 * LWIP_DHCP_CHECK_LINK_UP==1: dhcp_start() only really starts if the netif has
855 * NETIF_FLAG_LINK_UP set in its flags. As this is only an optimization and
856 * netif drivers might not set this flag, the default is off. If enabled,
857 * netif_set_link_up() must be called to continue dhcp starting.
858 */
859#if !defined LWIP_DHCP_CHECK_LINK_UP
860#define LWIP_DHCP_CHECK_LINK_UP         0
861#endif
862
863/**
864 * LWIP_DHCP_BOOTP_FILE==1: Store offered_si_addr and boot_file_name.
865 */
866#if !defined LWIP_DHCP_BOOTP_FILE || defined __DOXYGEN__
867#define LWIP_DHCP_BOOTP_FILE            0
868#endif
869
870/**
871 * LWIP_DHCP_GETS_NTP==1: Request NTP servers with discover/select. For each
872 * response packet, an callback is called, which has to be provided by the port:
873 * void dhcp_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs);
874*/
875#if !defined LWIP_DHCP_GET_NTP_SRV || defined __DOXYGEN__
876#define LWIP_DHCP_GET_NTP_SRV           0
877#endif
878
879/**
880 * The maximum of NTP servers requested
881 */
882#if !defined LWIP_DHCP_MAX_NTP_SERVERS || defined __DOXYGEN__
883#define LWIP_DHCP_MAX_NTP_SERVERS       1
884#endif
885
886/**
887 * LWIP_DHCP_MAX_DNS_SERVERS > 0: Request DNS servers with discover/select.
888 * DHCP servers received in the response are passed to DNS via @ref dns_setserver()
889 * (up to the maximum limit defined here).
890 */
891#if !defined LWIP_DHCP_MAX_DNS_SERVERS || defined __DOXYGEN__
892#define LWIP_DHCP_MAX_DNS_SERVERS       DNS_MAX_SERVERS
893#endif
894/**
895 * @}
896 */
897
898/*
899   ------------------------------------
900   ---------- AUTOIP options ----------
901   ------------------------------------
902*/
903/**
904 * @defgroup lwip_opts_autoip AUTOIP
905 * @ingroup lwip_opts_ipv4
906 * @{
907 */
908/**
909 * LWIP_AUTOIP==1: Enable AUTOIP module.
910 */
911#if !defined LWIP_AUTOIP || defined __DOXYGEN__
912#define LWIP_AUTOIP                     0
913#endif
914#if !LWIP_IPV4
915/* disable AUTOIP when IPv4 is disabled */
916#undef LWIP_AUTOIP
917#define LWIP_AUTOIP                     0
918#endif /* !LWIP_IPV4 */
919
920/**
921 * LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on
922 * the same interface at the same time.
923 */
924#if !defined LWIP_DHCP_AUTOIP_COOP || defined __DOXYGEN__
925#define LWIP_DHCP_AUTOIP_COOP           0
926#endif
927
928/**
929 * LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes
930 * that should be sent before falling back on AUTOIP (the DHCP client keeps
931 * running in this case). This can be set as low as 1 to get an AutoIP address
932 * very  quickly, but you should be prepared to handle a changing IP address
933 * when DHCP overrides AutoIP.
934 */
935#if !defined LWIP_DHCP_AUTOIP_COOP_TRIES || defined __DOXYGEN__
936#define LWIP_DHCP_AUTOIP_COOP_TRIES     9
937#endif
938/**
939 * @}
940 */
941
942/*
943   ----------------------------------
944   ----- SNMP MIB2 support      -----
945   ----------------------------------
946*/
947/**
948 * @defgroup lwip_opts_mib2 SNMP MIB2 callbacks
949 * @ingroup lwip_opts_infrastructure
950 * @{
951 */
952/**
953 * LWIP_MIB2_CALLBACKS==1: Turn on SNMP MIB2 callbacks.
954 * Turn this on to get callbacks needed to implement MIB2.
955 * Usually MIB2_STATS should be enabled, too.
956 */
957#if !defined LWIP_MIB2_CALLBACKS || defined __DOXYGEN__
958#define LWIP_MIB2_CALLBACKS             0
959#endif
960/**
961 * @}
962 */
963
964/*
965   ----------------------------------
966   ----- Multicast/IGMP options -----
967   ----------------------------------
968*/
969/**
970 * @defgroup lwip_opts_igmp IGMP
971 * @ingroup lwip_opts_ipv4
972 * @{
973 */
974/**
975 * LWIP_IGMP==1: Turn on IGMP module.
976 */
977#if !defined LWIP_IGMP || defined __DOXYGEN__
978#define LWIP_IGMP                       0
979#endif
980#if !LWIP_IPV4
981#undef LWIP_IGMP
982#define LWIP_IGMP                       0
983#endif
984
985/**
986 * LWIP_MULTICAST_TX_OPTIONS==1: Enable multicast TX support like the socket options
987 * IP_MULTICAST_TTL/IP_MULTICAST_IF/IP_MULTICAST_LOOP
988 */
989#if !defined LWIP_MULTICAST_TX_OPTIONS || defined __DOXYGEN__
990#define LWIP_MULTICAST_TX_OPTIONS       (LWIP_IGMP && LWIP_UDP)
991#endif
992/**
993 * @}
994 */
995
996/*
997   ----------------------------------
998   ---------- DNS options -----------
999   ----------------------------------
1000*/
1001/**
1002 * @defgroup lwip_opts_dns DNS
1003 * @ingroup lwip_opts_callback
1004 * @{
1005 */
1006/**
1007 * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
1008 * transport.
1009 */
1010#if !defined LWIP_DNS || defined __DOXYGEN__
1011#define LWIP_DNS                        0
1012#endif
1013
1014/** DNS maximum number of entries to maintain locally. */
1015#if !defined DNS_TABLE_SIZE || defined __DOXYGEN__
1016#define DNS_TABLE_SIZE                  4
1017#endif
1018
1019/** DNS maximum host name length supported in the name table. */
1020#if !defined DNS_MAX_NAME_LENGTH || defined __DOXYGEN__
1021#define DNS_MAX_NAME_LENGTH             256
1022#endif
1023
1024/** The maximum of DNS servers
1025 * The first server can be initialized automatically by defining
1026 * DNS_SERVER_ADDRESS(ipaddr), where 'ipaddr' is an 'ip_addr_t*'
1027 */
1028#if !defined DNS_MAX_SERVERS || defined __DOXYGEN__
1029#define DNS_MAX_SERVERS                 2
1030#endif
1031
1032/** DNS do a name checking between the query and the response. */
1033#if !defined DNS_DOES_NAME_CHECK || defined __DOXYGEN__
1034#define DNS_DOES_NAME_CHECK             1
1035#endif
1036
1037/** LWIP_DNS_SECURE: controls the security level of the DNS implementation
1038 * Use all DNS security features by default.
1039 * This is overridable but should only be needed by very small targets
1040 * or when using against non standard DNS servers. */
1041#if !defined LWIP_DNS_SECURE || defined __DOXYGEN__
1042#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
1043#endif
1044
1045/* A list of DNS security features follows */
1046#define LWIP_DNS_SECURE_RAND_XID                1
1047#define LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING 2
1048#define LWIP_DNS_SECURE_RAND_SRC_PORT           4
1049
1050/** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled, you have to define an initializer:
1051 *  \#define DNS_LOCAL_HOSTLIST_INIT {DNS_LOCAL_HOSTLIST_ELEM("host_ip4", IPADDR4_INIT_BYTES(1,2,3,4)), \
1052 *                                    DNS_LOCAL_HOSTLIST_ELEM("host_ip6", IPADDR6_INIT_HOST(123, 234, 345, 456)}
1053 *
1054 *  Instead, you can also use an external function:
1055 *  \#define DNS_LOOKUP_LOCAL_EXTERN(x) extern err_t my_lookup_function(const char *name, ip_addr_t *addr, u8_t dns_addrtype)
1056 *  that looks up the IP address and returns ERR_OK if found (LWIP_DNS_ADDRTYPE_xxx is passed in dns_addrtype).
1057 */
1058#if !defined DNS_LOCAL_HOSTLIST || defined __DOXYGEN__
1059#define DNS_LOCAL_HOSTLIST              0
1060#endif /* DNS_LOCAL_HOSTLIST */
1061
1062/** If this is turned on, the local host-list can be dynamically changed
1063 *  at runtime. */
1064#if !defined DNS_LOCAL_HOSTLIST_IS_DYNAMIC || defined __DOXYGEN__
1065#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC   0
1066#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
1067
1068/** Set this to 1 to enable querying ".local" names via mDNS
1069 *  using a One-Shot Multicast DNS Query */
1070#if !defined LWIP_DNS_SUPPORT_MDNS_QUERIES || defined __DOXYGEN__
1071#define LWIP_DNS_SUPPORT_MDNS_QUERIES  0
1072#endif
1073/**
1074 * @}
1075 */
1076
1077/*
1078   ---------------------------------
1079   ---------- UDP options ----------
1080   ---------------------------------
1081*/
1082/**
1083 * @defgroup lwip_opts_udp UDP
1084 * @ingroup lwip_opts_callback
1085 * @{
1086 */
1087/**
1088 * LWIP_UDP==1: Turn on UDP.
1089 */
1090#if !defined LWIP_UDP || defined __DOXYGEN__
1091#define LWIP_UDP                        1
1092#endif
1093
1094/**
1095 * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP)
1096 */
1097#if !defined LWIP_UDPLITE || defined __DOXYGEN__
1098#define LWIP_UDPLITE                    0
1099#endif
1100
1101/**
1102 * UDP_TTL: Default Time-To-Live value.
1103 */
1104#if !defined UDP_TTL || defined __DOXYGEN__
1105#define UDP_TTL                         (IP_DEFAULT_TTL)
1106#endif
1107
1108/**
1109 * LWIP_NETBUF_RECVINFO==1: append destination addr and port to every netbuf.
1110 */
1111#if !defined LWIP_NETBUF_RECVINFO || defined __DOXYGEN__
1112#define LWIP_NETBUF_RECVINFO            0
1113#endif
1114/**
1115 * @}
1116 */
1117
1118/*
1119   ---------------------------------
1120   ---------- TCP options ----------
1121   ---------------------------------
1122*/
1123/**
1124 * @defgroup lwip_opts_tcp TCP
1125 * @ingroup lwip_opts_callback
1126 * @{
1127 */
1128/**
1129 * LWIP_TCP==1: Turn on TCP.
1130 */
1131#if !defined LWIP_TCP || defined __DOXYGEN__
1132#define LWIP_TCP                        1
1133#endif
1134
1135/**
1136 * TCP_TTL: Default Time-To-Live value.
1137 */
1138#if !defined TCP_TTL || defined __DOXYGEN__
1139#define TCP_TTL                         (IP_DEFAULT_TTL)
1140#endif
1141
1142/**
1143 * TCP_WND: The size of a TCP window.  This must be at least
1144 * (2 * TCP_MSS) for things to work well.
1145 * ATTENTION: when using TCP_RCV_SCALE, TCP_WND is the total size
1146 * with scaling applied. Maximum window value in the TCP header
1147 * will be TCP_WND >> TCP_RCV_SCALE
1148 */
1149#if !defined TCP_WND || defined __DOXYGEN__
1150#define TCP_WND                         (4 * TCP_MSS)
1151#endif
1152
1153/**
1154 * TCP_MAXRTX: Maximum number of retransmissions of data segments.
1155 */
1156#if !defined TCP_MAXRTX || defined __DOXYGEN__
1157#define TCP_MAXRTX                      12
1158#endif
1159
1160/**
1161 * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments.
1162 */
1163#if !defined TCP_SYNMAXRTX || defined __DOXYGEN__
1164#define TCP_SYNMAXRTX                   6
1165#endif
1166
1167/**
1168 * TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order.
1169 * Define to 0 if your device is low on memory.
1170 */
1171#if !defined TCP_QUEUE_OOSEQ || defined __DOXYGEN__
1172#define TCP_QUEUE_OOSEQ                 (LWIP_TCP)
1173#endif
1174
1175/**
1176 * TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default,
1177 * you might want to increase this.)
1178 * For the receive side, this MSS is advertised to the remote side
1179 * when opening a connection. For the transmit size, this MSS sets
1180 * an upper limit on the MSS advertised by the remote host.
1181 */
1182#if !defined TCP_MSS || defined __DOXYGEN__
1183#define TCP_MSS                         536
1184#endif
1185
1186/**
1187 * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really
1188 * sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which
1189 * reflects the available reassembly buffer size at the remote host) and the
1190 * largest size permitted by the IP layer" (RFC 1122)
1191 * Setting this to 1 enables code that checks TCP_MSS against the MTU of the
1192 * netif used for a connection and limits the MSS if it would be too big otherwise.
1193 */
1194#if !defined TCP_CALCULATE_EFF_SEND_MSS || defined __DOXYGEN__
1195#define TCP_CALCULATE_EFF_SEND_MSS      1
1196#endif
1197
1198
1199/**
1200 * TCP_SND_BUF: TCP sender buffer space (bytes).
1201 * To achieve good performance, this should be at least 2 * TCP_MSS.
1202 */
1203#if !defined TCP_SND_BUF || defined __DOXYGEN__
1204#define TCP_SND_BUF                     (2 * TCP_MSS)
1205#endif
1206
1207/**
1208 * TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
1209 * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work.
1210 */
1211#if !defined TCP_SND_QUEUELEN || defined __DOXYGEN__
1212#define TCP_SND_QUEUELEN                ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
1213#endif
1214
1215/**
1216 * TCP_SNDLOWAT: TCP writable space (bytes). This must be less than
1217 * TCP_SND_BUF. It is the amount of space which must be available in the
1218 * TCP snd_buf for select to return writable (combined with TCP_SNDQUEUELOWAT).
1219 */
1220#if !defined TCP_SNDLOWAT || defined __DOXYGEN__
1221#define TCP_SNDLOWAT                    LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1)
1222#endif
1223
1224/**
1225 * TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be less
1226 * than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below
1227 * this number, select returns writable (combined with TCP_SNDLOWAT).
1228 */
1229#if !defined TCP_SNDQUEUELOWAT || defined __DOXYGEN__
1230#define TCP_SNDQUEUELOWAT               LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
1231#endif
1232
1233/**
1234 * TCP_OOSEQ_MAX_BYTES: The maximum number of bytes queued on ooseq per pcb.
1235 * Default is 0 (no limit). Only valid for TCP_QUEUE_OOSEQ==1.
1236 */
1237#if !defined TCP_OOSEQ_MAX_BYTES || defined __DOXYGEN__
1238#define TCP_OOSEQ_MAX_BYTES             0
1239#endif
1240
1241/**
1242 * TCP_OOSEQ_MAX_PBUFS: The maximum number of pbufs queued on ooseq per pcb.
1243 * Default is 0 (no limit). Only valid for TCP_QUEUE_OOSEQ==1.
1244 */
1245#if !defined TCP_OOSEQ_MAX_PBUFS || defined __DOXYGEN__
1246#define TCP_OOSEQ_MAX_PBUFS             0
1247#endif
1248
1249/**
1250 * TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
1251 */
1252#if !defined TCP_LISTEN_BACKLOG || defined __DOXYGEN__
1253#define TCP_LISTEN_BACKLOG              0
1254#endif
1255
1256/**
1257 * The maximum allowed backlog for TCP listen netconns.
1258 * This backlog is used unless another is explicitly specified.
1259 * 0xff is the maximum (u8_t).
1260 */
1261#if !defined TCP_DEFAULT_LISTEN_BACKLOG || defined __DOXYGEN__
1262#define TCP_DEFAULT_LISTEN_BACKLOG      0xff
1263#endif
1264
1265/**
1266 * TCP_OVERSIZE: The maximum number of bytes that tcp_write may
1267 * allocate ahead of time in an attempt to create shorter pbuf chains
1268 * for transmission. The meaningful range is 0 to TCP_MSS. Some
1269 * suggested values are:
1270 *
1271 * 0:         Disable oversized allocation. Each tcp_write() allocates a new
1272              pbuf (old behaviour).
1273 * 1:         Allocate size-aligned pbufs with minimal excess. Use this if your
1274 *            scatter-gather DMA requires aligned fragments.
1275 * 128:       Limit the pbuf/memory overhead to 20%.
1276 * TCP_MSS:   Try to create unfragmented TCP packets.
1277 * TCP_MSS/4: Try to create 4 fragments or less per TCP packet.
1278 */
1279#if !defined TCP_OVERSIZE || defined __DOXYGEN__
1280#define TCP_OVERSIZE                    TCP_MSS
1281#endif
1282
1283/**
1284 * LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option.
1285 * The timestamp option is currently only used to help remote hosts, it is not
1286 * really used locally. Therefore, it is only enabled when a TS option is
1287 * received in the initial SYN packet from a remote host.
1288 */
1289#if !defined LWIP_TCP_TIMESTAMPS || defined __DOXYGEN__
1290#define LWIP_TCP_TIMESTAMPS             0
1291#endif
1292
1293/**
1294 * TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an
1295 * explicit window update
1296 */
1297#if !defined TCP_WND_UPDATE_THRESHOLD || defined __DOXYGEN__
1298#define TCP_WND_UPDATE_THRESHOLD   LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4))
1299#endif
1300
1301/**
1302 * LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1.
1303 *     LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all
1304 *         events (accept, sent, etc) that happen in the system.
1305 *     LWIP_CALLBACK_API==1: The PCB callback function is called directly
1306 *         for the event. This is the default.
1307 */
1308#if !defined(LWIP_EVENT_API) && !defined(LWIP_CALLBACK_API) || defined __DOXYGEN__
1309#define LWIP_EVENT_API                  0
1310#define LWIP_CALLBACK_API               1
1311#else
1312#ifndef LWIP_EVENT_API
1313#define LWIP_EVENT_API                  0
1314#endif
1315#ifndef LWIP_CALLBACK_API
1316#define LWIP_CALLBACK_API               0
1317#endif
1318#endif
1319
1320/**
1321 * LWIP_WND_SCALE and TCP_RCV_SCALE:
1322 * Set LWIP_WND_SCALE to 1 to enable window scaling.
1323 * Set TCP_RCV_SCALE to the desired scaling factor (shift count in the
1324 * range of [0..14]).
1325 * When LWIP_WND_SCALE is enabled but TCP_RCV_SCALE is 0, we can use a large
1326 * send window while having a small receive window only.
1327 */
1328#if !defined LWIP_WND_SCALE || defined __DOXYGEN__
1329#define LWIP_WND_SCALE                  0
1330#define TCP_RCV_SCALE                   0
1331#endif
1332/**
1333 * @}
1334 */
1335
1336/*
1337   ----------------------------------
1338   ---------- Pbuf options ----------
1339   ----------------------------------
1340*/
1341/**
1342 * @defgroup lwip_opts_pbuf PBUF
1343 * @ingroup lwip_opts
1344 * @{
1345 */
1346/**
1347 * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
1348 * link level header. The default is 14, the standard value for
1349 * Ethernet.
1350 */
1351#if !defined PBUF_LINK_HLEN || defined __DOXYGEN__
1352#if defined LWIP_HOOK_VLAN_SET && !defined __DOXYGEN__
1353#define PBUF_LINK_HLEN                  (18 + ETH_PAD_SIZE)
1354#else /* LWIP_HOOK_VLAN_SET */
1355#define PBUF_LINK_HLEN                  (14 + ETH_PAD_SIZE)
1356#endif /* LWIP_HOOK_VLAN_SET */
1357#endif
1358
1359/**
1360 * PBUF_LINK_ENCAPSULATION_HLEN: the number of bytes that should be allocated
1361 * for an additional encapsulation header before ethernet headers (e.g. 802.11)
1362 */
1363#if !defined PBUF_LINK_ENCAPSULATION_HLEN || defined __DOXYGEN__
1364#define PBUF_LINK_ENCAPSULATION_HLEN    0u
1365#endif
1366
1367/**
1368 * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
1369 * designed to accommodate single full size TCP frame in one pbuf, including
1370 * TCP_MSS, IP header, and link header.
1371 */
1372#if !defined PBUF_POOL_BUFSIZE || defined __DOXYGEN__
1373#define PBUF_POOL_BUFSIZE               LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
1374#endif
1375/**
1376 * @}
1377 */
1378
1379/*
1380   ------------------------------------------------
1381   ---------- Network Interfaces options ----------
1382   ------------------------------------------------
1383*/
1384/**
1385 * @defgroup lwip_opts_netif NETIF
1386 * @ingroup lwip_opts
1387 * @{
1388 */
1389/**
1390 * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname
1391 * field.
1392 */
1393#if !defined LWIP_NETIF_HOSTNAME || defined __DOXYGEN__
1394#define LWIP_NETIF_HOSTNAME             0
1395#endif
1396
1397/**
1398 * LWIP_NETIF_API==1: Support netif api (in netifapi.c)
1399 */
1400#if !defined LWIP_NETIF_API || defined __DOXYGEN__
1401#define LWIP_NETIF_API                  0
1402#endif
1403
1404/**
1405 * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
1406 * changes its up/down status (i.e., due to DHCP IP acquisition)
1407 */
1408#if !defined LWIP_NETIF_STATUS_CALLBACK || defined __DOXYGEN__
1409#define LWIP_NETIF_STATUS_CALLBACK      0
1410#endif
1411
1412/**
1413 * LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
1414 * whenever the link changes (i.e., link down)
1415 */
1416#if !defined LWIP_NETIF_LINK_CALLBACK || defined __DOXYGEN__
1417#define LWIP_NETIF_LINK_CALLBACK        0
1418#endif
1419
1420/**
1421 * LWIP_NETIF_REMOVE_CALLBACK==1: Support a callback function that is called
1422 * when a netif has been removed
1423 */
1424#if !defined LWIP_NETIF_REMOVE_CALLBACK || defined __DOXYGEN__
1425#define LWIP_NETIF_REMOVE_CALLBACK      0
1426#endif
1427
1428/**
1429 * LWIP_NETIF_HWADDRHINT==1: Cache link-layer-address hints (e.g. table
1430 * indices) in struct netif. TCP and UDP can make use of this to prevent
1431 * scanning the ARP table for every sent packet. While this is faster for big
1432 * ARP tables or many concurrent connections, it might be counterproductive
1433 * if you have a tiny ARP table or if there never are concurrent connections.
1434 */
1435#if !defined LWIP_NETIF_HWADDRHINT || defined __DOXYGEN__
1436#define LWIP_NETIF_HWADDRHINT           0
1437#endif
1438
1439/**
1440 * LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP tries to put all data
1441 * to be sent into one single pbuf. This is for compatibility with DMA-enabled
1442 * MACs that do not support scatter-gather.
1443 * Beware that this might involve CPU-memcpy before transmitting that would not
1444 * be needed without this flag! Use this only if you need to!
1445 *
1446 * @todo: TCP and IP-frag do not work with this, yet:
1447 */
1448#if !defined LWIP_NETIF_TX_SINGLE_PBUF || defined __DOXYGEN__
1449#define LWIP_NETIF_TX_SINGLE_PBUF             0
1450#endif /* LWIP_NETIF_TX_SINGLE_PBUF */
1451
1452/**
1453 * LWIP_NUM_NETIF_CLIENT_DATA: Number of clients that may store
1454 * data in client_data member array of struct netif.
1455 */
1456#if !defined LWIP_NUM_NETIF_CLIENT_DATA || defined __DOXYGEN__
1457#define LWIP_NUM_NETIF_CLIENT_DATA            0
1458#endif
1459/**
1460 * @}
1461 */
1462
1463/*
1464   ------------------------------------
1465   ---------- LOOPIF options ----------
1466   ------------------------------------
1467*/
1468/**
1469 * @defgroup lwip_opts_loop Loopback interface
1470 * @ingroup lwip_opts_netif
1471 * @{
1472 */
1473/**
1474 * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1).
1475 * This is only needed when no real netifs are available. If at least one other
1476 * netif is available, loopback traffic uses this netif.
1477 */
1478#if !defined LWIP_HAVE_LOOPIF || defined __DOXYGEN__
1479#define LWIP_HAVE_LOOPIF                LWIP_NETIF_LOOPBACK
1480#endif
1481
1482/**
1483 * LWIP_LOOPIF_MULTICAST==1: Support multicast/IGMP on loop interface (127.0.0.1).
1484 */
1485#if !defined LWIP_LOOPIF_MULTICAST || defined __DOXYGEN__
1486#define LWIP_LOOPIF_MULTICAST               0
1487#endif
1488
1489/**
1490 * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP
1491 * address equal to the netif IP address, looping them back up the stack.
1492 */
1493#if !defined LWIP_NETIF_LOOPBACK || defined __DOXYGEN__
1494#define LWIP_NETIF_LOOPBACK             0
1495#endif
1496
1497/**
1498 * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback
1499 * sending for each netif (0 = disabled)
1500 */
1501#if !defined LWIP_LOOPBACK_MAX_PBUFS || defined __DOXYGEN__
1502#define LWIP_LOOPBACK_MAX_PBUFS         0
1503#endif
1504
1505/**
1506 * LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in
1507 * the system, as netifs must change how they behave depending on this setting
1508 * for the LWIP_NETIF_LOOPBACK option to work.
1509 * Setting this is needed to avoid reentering non-reentrant functions like
1510 * tcp_input().
1511 *    LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a
1512 *       multithreaded environment like tcpip.c. In this case, netif->input()
1513 *       is called directly.
1514 *    LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup.
1515 *       The packets are put on a list and netif_poll() must be called in
1516 *       the main application loop.
1517 */
1518#if !defined LWIP_NETIF_LOOPBACK_MULTITHREADING || defined __DOXYGEN__
1519#define LWIP_NETIF_LOOPBACK_MULTITHREADING    (!NO_SYS)
1520#endif
1521/**
1522 * @}
1523 */
1524
1525/*
1526   ------------------------------------
1527   ---------- Thread options ----------
1528   ------------------------------------
1529*/
1530/**
1531 * @defgroup lwip_opts_thread Threading
1532 * @ingroup lwip_opts_infrastructure
1533 * @{
1534 */
1535/**
1536 * TCPIP_THREAD_NAME: The name assigned to the main tcpip thread.
1537 */
1538#if !defined TCPIP_THREAD_NAME || defined __DOXYGEN__
1539#define TCPIP_THREAD_NAME              "tcpip_thread"
1540#endif
1541
1542/**
1543 * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
1544 * The stack size value itself is platform-dependent, but is passed to
1545 * sys_thread_new() when the thread is created.
1546 */
1547#if !defined TCPIP_THREAD_STACKSIZE || defined __DOXYGEN__
1548#define TCPIP_THREAD_STACKSIZE          0
1549#endif
1550
1551/**
1552 * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
1553 * The priority value itself is platform-dependent, but is passed to
1554 * sys_thread_new() when the thread is created.
1555 */
1556#if !defined TCPIP_THREAD_PRIO || defined __DOXYGEN__
1557#define TCPIP_THREAD_PRIO               1
1558#endif
1559
1560/**
1561 * TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
1562 * The queue size value itself is platform-dependent, but is passed to
1563 * sys_mbox_new() when tcpip_init is called.
1564 */
1565#if !defined TCPIP_MBOX_SIZE || defined __DOXYGEN__
1566#define TCPIP_MBOX_SIZE                 0
1567#endif
1568
1569/**
1570 * Define this to something that triggers a watchdog. This is called from
1571 * tcpip_thread after processing a message.
1572 */
1573#if !defined LWIP_TCPIP_THREAD_ALIVE || defined __DOXYGEN__
1574#define LWIP_TCPIP_THREAD_ALIVE()
1575#endif
1576
1577/**
1578 * SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread.
1579 */
1580#if !defined SLIPIF_THREAD_NAME || defined __DOXYGEN__
1581#define SLIPIF_THREAD_NAME             "slipif_loop"
1582#endif
1583
1584/**
1585 * SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread.
1586 * The stack size value itself is platform-dependent, but is passed to
1587 * sys_thread_new() when the thread is created.
1588 */
1589#if !defined SLIPIF_THREAD_STACKSIZE || defined __DOXYGEN__
1590#define SLIPIF_THREAD_STACKSIZE         0
1591#endif
1592
1593/**
1594 * SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread.
1595 * The priority value itself is platform-dependent, but is passed to
1596 * sys_thread_new() when the thread is created.
1597 */
1598#if !defined SLIPIF_THREAD_PRIO || defined __DOXYGEN__
1599#define SLIPIF_THREAD_PRIO              1
1600#endif
1601
1602/**
1603 * DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread.
1604 */
1605#if !defined DEFAULT_THREAD_NAME || defined __DOXYGEN__
1606#define DEFAULT_THREAD_NAME            "lwIP"
1607#endif
1608
1609/**
1610 * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
1611 * The stack size value itself is platform-dependent, but is passed to
1612 * sys_thread_new() when the thread is created.
1613 */
1614#if !defined DEFAULT_THREAD_STACKSIZE || defined __DOXYGEN__
1615#define DEFAULT_THREAD_STACKSIZE        0
1616#endif
1617
1618/**
1619 * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread.
1620 * The priority value itself is platform-dependent, but is passed to
1621 * sys_thread_new() when the thread is created.
1622 */
1623#if !defined DEFAULT_THREAD_PRIO || defined __DOXYGEN__
1624#define DEFAULT_THREAD_PRIO             1
1625#endif
1626
1627/**
1628 * DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
1629 * NETCONN_RAW. The queue size value itself is platform-dependent, but is passed
1630 * to sys_mbox_new() when the recvmbox is created.
1631 */
1632#if !defined DEFAULT_RAW_RECVMBOX_SIZE || defined __DOXYGEN__
1633#define DEFAULT_RAW_RECVMBOX_SIZE       0
1634#endif
1635
1636/**
1637 * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
1638 * NETCONN_UDP. The queue size value itself is platform-dependent, but is passed
1639 * to sys_mbox_new() when the recvmbox is created.
1640 */
1641#if !defined DEFAULT_UDP_RECVMBOX_SIZE || defined __DOXYGEN__
1642#define DEFAULT_UDP_RECVMBOX_SIZE       0
1643#endif
1644
1645/**
1646 * DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
1647 * NETCONN_TCP. The queue size value itself is platform-dependent, but is passed
1648 * to sys_mbox_new() when the recvmbox is created.
1649 */
1650#if !defined DEFAULT_TCP_RECVMBOX_SIZE || defined __DOXYGEN__
1651#define DEFAULT_TCP_RECVMBOX_SIZE       0
1652#endif
1653
1654/**
1655 * DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections.
1656 * The queue size value itself is platform-dependent, but is passed to
1657 * sys_mbox_new() when the acceptmbox is created.
1658 */
1659#if !defined DEFAULT_ACCEPTMBOX_SIZE || defined __DOXYGEN__
1660#define DEFAULT_ACCEPTMBOX_SIZE         0
1661#endif
1662/**
1663 * @}
1664 */
1665
1666/*
1667   ----------------------------------------------
1668   ---------- Sequential layer options ----------
1669   ----------------------------------------------
1670*/
1671/**
1672 * @defgroup lwip_opts_netconn Netconn
1673 * @ingroup lwip_opts_threadsafe_apis
1674 * @{
1675 */
1676/**
1677 * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
1678 */
1679#if !defined LWIP_NETCONN || defined __DOXYGEN__
1680#define LWIP_NETCONN                    1
1681#endif
1682
1683/** LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout to create
1684 * timers running in tcpip_thread from another thread.
1685 */
1686#if !defined LWIP_TCPIP_TIMEOUT || defined __DOXYGEN__
1687#define LWIP_TCPIP_TIMEOUT              0
1688#endif
1689
1690/** LWIP_NETCONN_SEM_PER_THREAD==1: Use one (thread-local) semaphore per
1691 * thread calling socket/netconn functions instead of allocating one
1692 * semaphore per netconn (and per select etc.)
1693 * ATTENTION: a thread-local semaphore for API calls is needed:
1694 * - LWIP_NETCONN_THREAD_SEM_GET() returning a sys_sem_t*
1695 * - LWIP_NETCONN_THREAD_SEM_ALLOC() creating the semaphore
1696 * - LWIP_NETCONN_THREAD_SEM_FREE() freeing the semaphore
1697 * The latter 2 can be invoked up by calling netconn_thread_init()/netconn_thread_cleanup().
1698 * Ports may call these for threads created with sys_thread_new().
1699 */
1700#if !defined LWIP_NETCONN_SEM_PER_THREAD || defined __DOXYGEN__
1701#define LWIP_NETCONN_SEM_PER_THREAD     0
1702#endif
1703
1704/** LWIP_NETCONN_FULLDUPLEX==1: Enable code that allows reading from one thread,
1705 * writing from a 2nd thread and closing from a 3rd thread at the same time.
1706 * ATTENTION: This is currently really alpha! Some requirements:
1707 * - LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from
1708 *   multiple threads at once
1709 * - sys_mbox_free() has to unblock receive tasks waiting on recvmbox/acceptmbox
1710 *   and prevent a task pending on this during/after deletion
1711 */
1712#if !defined LWIP_NETCONN_FULLDUPLEX || defined __DOXYGEN__
1713#define LWIP_NETCONN_FULLDUPLEX         0
1714#endif
1715/**
1716 * @}
1717 */
1718
1719/*
1720   ------------------------------------
1721   ---------- Socket options ----------
1722   ------------------------------------
1723*/
1724/**
1725 * @defgroup lwip_opts_socket Sockets
1726 * @ingroup lwip_opts_threadsafe_apis
1727 * @{
1728 */
1729/**
1730 * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
1731 */
1732#if !defined LWIP_SOCKET || defined __DOXYGEN__
1733#define LWIP_SOCKET                     1
1734#endif
1735
1736/* LWIP_SOCKET_SET_ERRNO==1: Set errno when socket functions cannot complete
1737 * successfully, as required by POSIX. Default is POSIX-compliant.
1738 */
1739#if !defined LWIP_SOCKET_SET_ERRNO || defined __DOXYGEN__
1740#define LWIP_SOCKET_SET_ERRNO           1
1741#endif
1742
1743/**
1744 * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names through defines.
1745 * LWIP_COMPAT_SOCKETS==2: Same as ==1 but correctly named functions are created.
1746 * While this helps code completion, it might conflict with existing libraries.
1747 * (only used if you use sockets.c)
1748 */
1749#if !defined LWIP_COMPAT_SOCKETS || defined __DOXYGEN__
1750#define LWIP_COMPAT_SOCKETS             1
1751#endif
1752
1753/**
1754 * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names.
1755 * Disable this option if you use a POSIX operating system that uses the same
1756 * names (read, write & close). (only used if you use sockets.c)
1757 */
1758#if !defined LWIP_POSIX_SOCKETS_IO_NAMES || defined __DOXYGEN__
1759#define LWIP_POSIX_SOCKETS_IO_NAMES     1
1760#endif
1761
1762/**
1763 * LWIP_SOCKET_OFFSET==n: Increases the file descriptor number created by LwIP with n.
1764 * This can be useful when there are multiple APIs which create file descriptors.
1765 * When they all start with a different offset and you won't make them overlap you can
1766 * re implement read/write/close/ioctl/fnctl to send the requested action to the right
1767 * library (sharing select will need more work though).
1768 */
1769#if !defined LWIP_SOCKET_OFFSET || defined __DOXYGEN__
1770#define LWIP_SOCKET_OFFSET              0
1771#endif
1772
1773/**
1774 * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT
1775 * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set
1776 * in seconds. (does not require sockets.c, and will affect tcp.c)
1777 */
1778#if !defined LWIP_TCP_KEEPALIVE || defined __DOXYGEN__
1779#define LWIP_TCP_KEEPALIVE              0
1780#endif
1781
1782/**
1783 * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and
1784 * SO_SNDTIMEO processing.
1785 */
1786#if !defined LWIP_SO_SNDTIMEO || defined __DOXYGEN__
1787#define LWIP_SO_SNDTIMEO                0
1788#endif
1789
1790/**
1791 * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and
1792 * SO_RCVTIMEO processing.
1793 */
1794#if !defined LWIP_SO_RCVTIMEO || defined __DOXYGEN__
1795#define LWIP_SO_RCVTIMEO                0
1796#endif
1797
1798/**
1799 * LWIP_SO_SNDRCVTIMEO_NONSTANDARD==1: SO_RCVTIMEO/SO_SNDTIMEO take an int
1800 * (milliseconds, much like winsock does) instead of a struct timeval (default).
1801 */
1802#if !defined LWIP_SO_SNDRCVTIMEO_NONSTANDARD || defined __DOXYGEN__
1803#define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0
1804#endif
1805
1806/**
1807 * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
1808 */
1809#if !defined LWIP_SO_RCVBUF || defined __DOXYGEN__
1810#define LWIP_SO_RCVBUF                  0
1811#endif
1812
1813/**
1814 * LWIP_SO_LINGER==1: Enable SO_LINGER processing.
1815 */
1816#if !defined LWIP_SO_LINGER || defined __DOXYGEN__
1817#define LWIP_SO_LINGER                  0
1818#endif
1819
1820/**
1821 * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize.
1822 */
1823#if !defined RECV_BUFSIZE_DEFAULT || defined __DOXYGEN__
1824#define RECV_BUFSIZE_DEFAULT            INT_MAX
1825#endif
1826
1827/**
1828 * By default, TCP socket/netconn close waits 20 seconds max to send the FIN
1829 */
1830#if !defined LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT || defined __DOXYGEN__
1831#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000
1832#endif
1833
1834/**
1835 * SO_REUSE==1: Enable SO_REUSEADDR option.
1836 */
1837#if !defined SO_REUSE || defined __DOXYGEN__
1838#define SO_REUSE                        0
1839#endif
1840
1841/**
1842 * SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets
1843 * to all local matches if SO_REUSEADDR is turned on.
1844 * WARNING: Adds a memcpy for every packet if passing to more than one pcb!
1845 */
1846#if !defined SO_REUSE_RXTOALL || defined __DOXYGEN__
1847#define SO_REUSE_RXTOALL                0
1848#endif
1849
1850/**
1851 * LWIP_FIONREAD_LINUXMODE==0 (default): ioctl/FIONREAD returns the amount of
1852 * pending data in the network buffer. This is the way windows does it. It's
1853 * the default for lwIP since it is smaller.
1854 * LWIP_FIONREAD_LINUXMODE==1: ioctl/FIONREAD returns the size of the next
1855 * pending datagram in bytes. This is the way linux does it. This code is only
1856 * here for compatibility.
1857 */
1858#if !defined LWIP_FIONREAD_LINUXMODE || defined __DOXYGEN__
1859#define LWIP_FIONREAD_LINUXMODE         0
1860#endif
1861/**
1862 * @}
1863 */
1864
1865/*
1866   ----------------------------------------
1867   ---------- Statistics options ----------
1868   ----------------------------------------
1869*/
1870/**
1871 * @defgroup lwip_opts_stats Statistics
1872 * @ingroup lwip_opts_debug
1873 * @{
1874 */
1875/**
1876 * LWIP_STATS==1: Enable statistics collection in lwip_stats.
1877 */
1878#if !defined LWIP_STATS || defined __DOXYGEN__
1879#define LWIP_STATS                      1
1880#endif
1881
1882#if LWIP_STATS
1883
1884/**
1885 * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions.
1886 */
1887#if !defined LWIP_STATS_DISPLAY || defined __DOXYGEN__
1888#define LWIP_STATS_DISPLAY              0
1889#endif
1890
1891/**
1892 * LINK_STATS==1: Enable link stats.
1893 */
1894#if !defined LINK_STATS || defined __DOXYGEN__
1895#define LINK_STATS                      1
1896#endif
1897
1898/**
1899 * ETHARP_STATS==1: Enable etharp stats.
1900 */
1901#if !defined ETHARP_STATS || defined __DOXYGEN__
1902#define ETHARP_STATS                    (LWIP_ARP)
1903#endif
1904
1905/**
1906 * IP_STATS==1: Enable IP stats.
1907 */
1908#if !defined IP_STATS || defined __DOXYGEN__
1909#define IP_STATS                        1
1910#endif
1911
1912/**
1913 * IPFRAG_STATS==1: Enable IP fragmentation stats. Default is
1914 * on if using either frag or reass.
1915 */
1916#if !defined IPFRAG_STATS || defined __DOXYGEN__
1917#define IPFRAG_STATS                    (IP_REASSEMBLY || IP_FRAG)
1918#endif
1919
1920/**
1921 * ICMP_STATS==1: Enable ICMP stats.
1922 */
1923#if !defined ICMP_STATS || defined __DOXYGEN__
1924#define ICMP_STATS                      1
1925#endif
1926
1927/**
1928 * IGMP_STATS==1: Enable IGMP stats.
1929 */
1930#if !defined IGMP_STATS || defined __DOXYGEN__
1931#define IGMP_STATS                      (LWIP_IGMP)
1932#endif
1933
1934/**
1935 * UDP_STATS==1: Enable UDP stats. Default is on if
1936 * UDP enabled, otherwise off.
1937 */
1938#if !defined UDP_STATS || defined __DOXYGEN__
1939#define UDP_STATS                       (LWIP_UDP)
1940#endif
1941
1942/**
1943 * TCP_STATS==1: Enable TCP stats. Default is on if TCP
1944 * enabled, otherwise off.
1945 */
1946#if !defined TCP_STATS || defined __DOXYGEN__
1947#define TCP_STATS                       (LWIP_TCP)
1948#endif
1949
1950/**
1951 * MEM_STATS==1: Enable mem.c stats.
1952 */
1953#if !defined MEM_STATS || defined __DOXYGEN__
1954#define MEM_STATS                       ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
1955#endif
1956
1957/**
1958 * MEMP_STATS==1: Enable memp.c pool stats.
1959 */
1960#if !defined MEMP_STATS || defined __DOXYGEN__
1961#define MEMP_STATS                      (MEMP_MEM_MALLOC == 0)
1962#endif
1963
1964/**
1965 * SYS_STATS==1: Enable system stats (sem and mbox counts, etc).
1966 */
1967#if !defined SYS_STATS || defined __DOXYGEN__
1968#define SYS_STATS                       (NO_SYS == 0)
1969#endif
1970
1971/**
1972 * IP6_STATS==1: Enable IPv6 stats.
1973 */
1974#if !defined IP6_STATS || defined __DOXYGEN__
1975#define IP6_STATS                       (LWIP_IPV6)
1976#endif
1977
1978/**
1979 * ICMP6_STATS==1: Enable ICMP for IPv6 stats.
1980 */
1981#if !defined ICMP6_STATS || defined __DOXYGEN__
1982#define ICMP6_STATS                     (LWIP_IPV6 && LWIP_ICMP6)
1983#endif
1984
1985/**
1986 * IP6_FRAG_STATS==1: Enable IPv6 fragmentation stats.
1987 */
1988#if !defined IP6_FRAG_STATS || defined __DOXYGEN__
1989#define IP6_FRAG_STATS                  (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS))
1990#endif
1991
1992/**
1993 * MLD6_STATS==1: Enable MLD for IPv6 stats.
1994 */
1995#if !defined MLD6_STATS || defined __DOXYGEN__
1996#define MLD6_STATS                      (LWIP_IPV6 && LWIP_IPV6_MLD)
1997#endif
1998
1999/**
2000 * ND6_STATS==1: Enable Neighbor discovery for IPv6 stats.
2001 */
2002#if !defined ND6_STATS || defined __DOXYGEN__
2003#define ND6_STATS                       (LWIP_IPV6)
2004#endif
2005
2006/**
2007 * MIB2_STATS==1: Stats for SNMP MIB2.
2008 */
2009#if !defined MIB2_STATS || defined __DOXYGEN__
2010#define MIB2_STATS                      0
2011#endif
2012
2013#else
2014
2015#define LINK_STATS                      0
2016#define ETHARP_STATS                    0
2017#define IP_STATS                        0
2018#define IPFRAG_STATS                    0
2019#define ICMP_STATS                      0
2020#define IGMP_STATS                      0
2021#define UDP_STATS                       0
2022#define TCP_STATS                       0
2023#define MEM_STATS                       0
2024#define MEMP_STATS                      0
2025#define SYS_STATS                       0
2026#define LWIP_STATS_DISPLAY              0
2027#define IP6_STATS                       0
2028#define ICMP6_STATS                     0
2029#define IP6_FRAG_STATS                  0
2030#define MLD6_STATS                      0
2031#define ND6_STATS                       0
2032#define MIB2_STATS                      0
2033
2034#endif /* LWIP_STATS */
2035/**
2036 * @}
2037 */
2038
2039/*
2040   --------------------------------------
2041   ---------- Checksum options ----------
2042   --------------------------------------
2043*/
2044/**
2045 * @defgroup lwip_opts_checksum Checksum
2046 * @ingroup lwip_opts_infrastructure
2047 * @{
2048 */
2049/**
2050 * LWIP_CHECKSUM_CTRL_PER_NETIF==1: Checksum generation/check can be enabled/disabled
2051 * per netif.
2052 * ATTENTION: if enabled, the CHECKSUM_GEN_* and CHECKSUM_CHECK_* defines must be enabled!
2053 */
2054#if !defined LWIP_CHECKSUM_CTRL_PER_NETIF || defined __DOXYGEN__
2055#define LWIP_CHECKSUM_CTRL_PER_NETIF    0
2056#endif
2057
2058/**
2059 * CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.
2060 */
2061#if !defined CHECKSUM_GEN_IP || defined __DOXYGEN__
2062#define CHECKSUM_GEN_IP                 1
2063#endif
2064
2065/**
2066 * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.
2067 */
2068#if !defined CHECKSUM_GEN_UDP || defined __DOXYGEN__
2069#define CHECKSUM_GEN_UDP                1
2070#endif
2071
2072/**
2073 * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.
2074 */
2075#if !defined CHECKSUM_GEN_TCP || defined __DOXYGEN__
2076#define CHECKSUM_GEN_TCP                1
2077#endif
2078
2079/**
2080 * CHECKSUM_GEN_ICMP==1: Generate checksums in software for outgoing ICMP packets.
2081 */
2082#if !defined CHECKSUM_GEN_ICMP || defined __DOXYGEN__
2083#define CHECKSUM_GEN_ICMP               1
2084#endif
2085
2086/**
2087 * CHECKSUM_GEN_ICMP6==1: Generate checksums in software for outgoing ICMP6 packets.
2088 */
2089#if !defined CHECKSUM_GEN_ICMP6 || defined __DOXYGEN__
2090#define CHECKSUM_GEN_ICMP6              1
2091#endif
2092
2093/**
2094 * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
2095 */
2096#if !defined CHECKSUM_CHECK_IP || defined __DOXYGEN__
2097#define CHECKSUM_CHECK_IP               1
2098#endif
2099
2100/**
2101 * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
2102 */
2103#if !defined CHECKSUM_CHECK_UDP || defined __DOXYGEN__
2104#define CHECKSUM_CHECK_UDP              1
2105#endif
2106
2107/**
2108 * CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.
2109 */
2110#if !defined CHECKSUM_CHECK_TCP || defined __DOXYGEN__
2111#define CHECKSUM_CHECK_TCP              1
2112#endif
2113
2114/**
2115 * CHECKSUM_CHECK_ICMP==1: Check checksums in software for incoming ICMP packets.
2116 */
2117#if !defined CHECKSUM_CHECK_ICMP || defined __DOXYGEN__
2118#define CHECKSUM_CHECK_ICMP             1
2119#endif
2120
2121/**
2122 * CHECKSUM_CHECK_ICMP6==1: Check checksums in software for incoming ICMPv6 packets
2123 */
2124#if !defined CHECKSUM_CHECK_ICMP6 || defined __DOXYGEN__
2125#define CHECKSUM_CHECK_ICMP6            1
2126#endif
2127
2128/**
2129 * LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from
2130 * application buffers to pbufs.
2131 */
2132#if !defined LWIP_CHECKSUM_ON_COPY || defined __DOXYGEN__
2133#define LWIP_CHECKSUM_ON_COPY           0
2134#endif
2135/**
2136 * @}
2137 */
2138
2139/*
2140   ---------------------------------------
2141   ---------- IPv6 options ---------------
2142   ---------------------------------------
2143*/
2144/**
2145 * @defgroup lwip_opts_ipv6 IPv6
2146 * @ingroup lwip_opts
2147 * @{
2148 */
2149/**
2150 * LWIP_IPV6==1: Enable IPv6
2151 */
2152#if !defined LWIP_IPV6 || defined __DOXYGEN__
2153#define LWIP_IPV6                       0
2154#endif
2155
2156/**
2157 * LWIP_IPV6_NUM_ADDRESSES: Number of IPv6 addresses per netif.
2158 */
2159#if !defined LWIP_IPV6_NUM_ADDRESSES || defined __DOXYGEN__
2160#define LWIP_IPV6_NUM_ADDRESSES         3
2161#endif
2162
2163/**
2164 * LWIP_IPV6_FORWARD==1: Forward IPv6 packets across netifs
2165 */
2166#if !defined LWIP_IPV6_FORWARD || defined __DOXYGEN__
2167#define LWIP_IPV6_FORWARD               0
2168#endif
2169
2170/**
2171 * LWIP_IPV6_FRAG==1: Fragment outgoing IPv6 packets that are too big.
2172 */
2173#if !defined LWIP_IPV6_FRAG || defined __DOXYGEN__
2174#define LWIP_IPV6_FRAG                  0
2175#endif
2176
2177/**
2178 * LWIP_IPV6_REASS==1: reassemble incoming IPv6 packets that fragmented
2179 */
2180#if !defined LWIP_IPV6_REASS || defined __DOXYGEN__
2181#define LWIP_IPV6_REASS                 (LWIP_IPV6)
2182#endif
2183
2184/**
2185 * LWIP_IPV6_SEND_ROUTER_SOLICIT==1: Send router solicitation messages during
2186 * network startup.
2187 */
2188#if !defined LWIP_IPV6_SEND_ROUTER_SOLICIT || defined __DOXYGEN__
2189#define LWIP_IPV6_SEND_ROUTER_SOLICIT   1
2190#endif
2191
2192/**
2193 * LWIP_IPV6_AUTOCONFIG==1: Enable stateless address autoconfiguration as per RFC 4862.
2194 */
2195#if !defined LWIP_IPV6_AUTOCONFIG || defined __DOXYGEN__
2196#define LWIP_IPV6_AUTOCONFIG            (LWIP_IPV6)
2197#endif
2198
2199/**
2200 * LWIP_IPV6_DUP_DETECT_ATTEMPTS=[0..7]: Number of duplicate address detection attempts.
2201 */
2202#if !defined LWIP_IPV6_DUP_DETECT_ATTEMPTS || defined __DOXYGEN__
2203#define LWIP_IPV6_DUP_DETECT_ATTEMPTS   1
2204#endif
2205/**
2206 * @}
2207 */
2208
2209/**
2210 * @defgroup lwip_opts_icmp6 ICMP6
2211 * @ingroup lwip_opts_ipv6
2212 * @{
2213 */
2214/**
2215 * LWIP_ICMP6==1: Enable ICMPv6 (mandatory per RFC)
2216 */
2217#if !defined LWIP_ICMP6 || defined __DOXYGEN__
2218#define LWIP_ICMP6                      (LWIP_IPV6)
2219#endif
2220
2221/**
2222 * LWIP_ICMP6_DATASIZE: bytes from original packet to send back in
2223 * ICMPv6 error messages.
2224 */
2225#if !defined LWIP_ICMP6_DATASIZE || defined __DOXYGEN__
2226#define LWIP_ICMP6_DATASIZE             8
2227#endif
2228
2229/**
2230 * LWIP_ICMP6_HL: default hop limit for ICMPv6 messages
2231 */
2232#if !defined LWIP_ICMP6_HL || defined __DOXYGEN__
2233#define LWIP_ICMP6_HL                   255
2234#endif
2235/**
2236 * @}
2237 */
2238
2239/**
2240 * @defgroup lwip_opts_mld6 Multicast listener discovery
2241 * @ingroup lwip_opts_ipv6
2242 * @{
2243 */
2244/**
2245 * LWIP_IPV6_MLD==1: Enable multicast listener discovery protocol.
2246 * If LWIP_IPV6 is enabled but this setting is disabled, the MAC layer must
2247 * indiscriminately pass all inbound IPv6 multicast traffic to lwIP.
2248 */
2249#if !defined LWIP_IPV6_MLD || defined __DOXYGEN__
2250#define LWIP_IPV6_MLD                   (LWIP_IPV6)
2251#endif
2252
2253/**
2254 * MEMP_NUM_MLD6_GROUP: Max number of IPv6 multicast groups that can be joined.
2255 * There must be enough groups so that each netif can join the solicited-node
2256 * multicast group for each of its local addresses, plus one for MDNS if
2257 * applicable, plus any number of groups to be joined on UDP sockets.
2258 */
2259#if !defined MEMP_NUM_MLD6_GROUP || defined __DOXYGEN__
2260#define MEMP_NUM_MLD6_GROUP             4
2261#endif
2262/**
2263 * @}
2264 */
2265
2266/**
2267 * @defgroup lwip_opts_nd6 Neighbor discovery
2268 * @ingroup lwip_opts_ipv6
2269 * @{
2270 */
2271/**
2272 * LWIP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address
2273 * is being resolved.
2274 */
2275#if !defined LWIP_ND6_QUEUEING || defined __DOXYGEN__
2276#define LWIP_ND6_QUEUEING               (LWIP_IPV6)
2277#endif
2278
2279/**
2280 * MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution.
2281 */
2282#if !defined MEMP_NUM_ND6_QUEUE || defined __DOXYGEN__
2283#define MEMP_NUM_ND6_QUEUE              20
2284#endif
2285
2286/**
2287 * LWIP_ND6_NUM_NEIGHBORS: Number of entries in IPv6 neighbor cache
2288 */
2289#if !defined LWIP_ND6_NUM_NEIGHBORS || defined __DOXYGEN__
2290#define LWIP_ND6_NUM_NEIGHBORS          10
2291#endif
2292
2293/**
2294 * LWIP_ND6_NUM_DESTINATIONS: number of entries in IPv6 destination cache
2295 */
2296#if !defined LWIP_ND6_NUM_DESTINATIONS || defined __DOXYGEN__
2297#define LWIP_ND6_NUM_DESTINATIONS       10
2298#endif
2299
2300/**
2301 * LWIP_ND6_NUM_PREFIXES: number of entries in IPv6 on-link prefixes cache
2302 */
2303#if !defined LWIP_ND6_NUM_PREFIXES || defined __DOXYGEN__
2304#define LWIP_ND6_NUM_PREFIXES           5
2305#endif
2306
2307/**
2308 * LWIP_ND6_NUM_ROUTERS: number of entries in IPv6 default router cache
2309 */
2310#if !defined LWIP_ND6_NUM_ROUTERS || defined __DOXYGEN__
2311#define LWIP_ND6_NUM_ROUTERS            3
2312#endif
2313
2314/**
2315 * LWIP_ND6_MAX_MULTICAST_SOLICIT: max number of multicast solicit messages to send
2316 * (neighbor solicit and router solicit)
2317 */
2318#if !defined LWIP_ND6_MAX_MULTICAST_SOLICIT || defined __DOXYGEN__
2319#define LWIP_ND6_MAX_MULTICAST_SOLICIT  3
2320#endif
2321
2322/**
2323 * LWIP_ND6_MAX_UNICAST_SOLICIT: max number of unicast neighbor solicitation messages
2324 * to send during neighbor reachability detection.
2325 */
2326#if !defined LWIP_ND6_MAX_UNICAST_SOLICIT || defined __DOXYGEN__
2327#define LWIP_ND6_MAX_UNICAST_SOLICIT    3
2328#endif
2329
2330/**
2331 * Unused: See ND RFC (time in milliseconds).
2332 */
2333#if !defined LWIP_ND6_MAX_ANYCAST_DELAY_TIME || defined __DOXYGEN__
2334#define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000
2335#endif
2336
2337/**
2338 * Unused: See ND RFC
2339 */
2340#if !defined LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT || defined __DOXYGEN__
2341#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT  3
2342#endif
2343
2344/**
2345 * LWIP_ND6_REACHABLE_TIME: default neighbor reachable time (in milliseconds).
2346 * May be updated by router advertisement messages.
2347 */
2348#if !defined LWIP_ND6_REACHABLE_TIME || defined __DOXYGEN__
2349#define LWIP_ND6_REACHABLE_TIME         30000
2350#endif
2351
2352/**
2353 * LWIP_ND6_RETRANS_TIMER: default retransmission timer for solicitation messages
2354 */
2355#if !defined LWIP_ND6_RETRANS_TIMER || defined __DOXYGEN__
2356#define LWIP_ND6_RETRANS_TIMER          1000
2357#endif
2358
2359/**
2360 * LWIP_ND6_DELAY_FIRST_PROBE_TIME: Delay before first unicast neighbor solicitation
2361 * message is sent, during neighbor reachability detection.
2362 */
2363#if !defined LWIP_ND6_DELAY_FIRST_PROBE_TIME || defined __DOXYGEN__
2364#define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000
2365#endif
2366
2367/**
2368 * LWIP_ND6_ALLOW_RA_UPDATES==1: Allow Router Advertisement messages to update
2369 * Reachable time and retransmission timers, and netif MTU.
2370 */
2371#if !defined LWIP_ND6_ALLOW_RA_UPDATES || defined __DOXYGEN__
2372#define LWIP_ND6_ALLOW_RA_UPDATES       1
2373#endif
2374
2375/**
2376 * LWIP_ND6_TCP_REACHABILITY_HINTS==1: Allow TCP to provide Neighbor Discovery
2377 * with reachability hints for connected destinations. This helps avoid sending
2378 * unicast neighbor solicitation messages.
2379 */
2380#if !defined LWIP_ND6_TCP_REACHABILITY_HINTS || defined __DOXYGEN__
2381#define LWIP_ND6_TCP_REACHABILITY_HINTS 1
2382#endif
2383
2384/**
2385 * LWIP_ND6_RDNSS_MAX_DNS_SERVERS > 0: Use IPv6 Router Advertisement Recursive
2386 * DNS Server Option (as per RFC 6106) to copy a defined maximum number of DNS
2387 * servers to the DNS module.
2388 */
2389#if !defined LWIP_ND6_RDNSS_MAX_DNS_SERVERS || defined __DOXYGEN__
2390#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS  0
2391#endif
2392/**
2393 * @}
2394 */
2395
2396/**
2397 * LWIP_IPV6_DHCP6==1: enable DHCPv6 stateful address autoconfiguration.
2398 */
2399#if !defined LWIP_IPV6_DHCP6 || defined __DOXYGEN__
2400#define LWIP_IPV6_DHCP6                 0
2401#endif
2402
2403/*
2404   ---------------------------------------
2405   ---------- Hook options ---------------
2406   ---------------------------------------
2407*/
2408
2409/**
2410 * @defgroup lwip_opts_hooks Hooks
2411 * @ingroup lwip_opts_infrastructure
2412 * Hooks are undefined by default, define them to a function if you need them.
2413 * @{
2414 */
2415
2416/**
2417 * LWIP_HOOK_FILENAME: Custom filename to #include in files that provide hooks.
2418 * Declare your hook function prototypes in there, you may also #include all headers
2419 * providing data types that are need in this file.
2420 */
2421#ifdef __DOXYGEN__
2422#define LWIP_HOOK_FILENAME "path/to/my/lwip_hooks.h"
2423#endif
2424
2425/**
2426 * LWIP_HOOK_TCP_ISN:
2427 * Hook for generation of the Initial Sequence Number (ISN) for a new TCP
2428 * connection. The default lwIP ISN generation algorithm is very basic and may
2429 * allow for TCP spoofing attacks. This hook provides the means to implement
2430 * the standardized ISN generation algorithm from RFC 6528 (see contrib/adons/tcp_isn),
2431 * or any other desired algorithm as a replacement.
2432 * Called from tcp_connect() and tcp_listen_input() when an ISN is needed for
2433 * a new TCP connection, if TCP support (@ref LWIP_TCP) is enabled.\n
2434 * Signature: u32_t my_hook_tcp_isn(const ip_addr_t* local_ip, u16_t local_port, const ip_addr_t* remote_ip, u16_t remote_port);
2435 * - it may be necessary to use "struct ip_addr" (ip4_addr, ip6_addr) instead of "ip_addr_t" in function declarations\n
2436 * Arguments:
2437 * - local_ip: pointer to the local IP address of the connection
2438 * - local_port: local port number of the connection (host-byte order)
2439 * - remote_ip: pointer to the remote IP address of the connection
2440 * - remote_port: remote port number of the connection (host-byte order)\n
2441 * Return value:
2442 * - the 32-bit Initial Sequence Number to use for the new TCP connection.
2443 */
2444#ifdef __DOXYGEN__
2445#define LWIP_HOOK_TCP_ISN(local_ip, local_port, remote_ip, remote_port)
2446#endif
2447
2448/**
2449 * LWIP_HOOK_IP4_INPUT(pbuf, input_netif):
2450 * - called from ip_input() (IPv4)
2451 * - pbuf: received struct pbuf passed to ip_input()
2452 * - input_netif: struct netif on which the packet has been received
2453 * Return values:
2454 * - 0: Hook has not consumed the packet, packet is processed as normal
2455 * - != 0: Hook has consumed the packet.
2456 * If the hook consumed the packet, 'pbuf' is in the responsibility of the hook
2457 * (i.e. free it when done).
2458 */
2459#ifdef __DOXYGEN__
2460#define LWIP_HOOK_IP4_INPUT(pbuf, input_netif)
2461#endif
2462
2463/**
2464 * LWIP_HOOK_IP4_ROUTE(dest):
2465 * - called from ip_route() (IPv4)
2466 * - dest: destination IPv4 address
2467 * Returns the destination netif or NULL if no destination netif is found. In
2468 * that case, ip_route() continues as normal.
2469 */
2470#ifdef __DOXYGEN__
2471#define LWIP_HOOK_IP4_ROUTE()
2472#endif
2473
2474/**
2475 * LWIP_HOOK_IP4_ROUTE_SRC(dest, src):
2476 * - source-based routing for IPv4 (see LWIP_HOOK_IP4_ROUTE(), src may be NULL)
2477 */
2478#ifdef __DOXYGEN__
2479#define LWIP_HOOK_IP4_ROUTE_SRC(dest, src)
2480#endif
2481
2482/**
2483 * LWIP_HOOK_ETHARP_GET_GW(netif, dest):
2484 * - called from etharp_output() (IPv4)
2485 * - netif: the netif used for sending
2486 * - dest: the destination IPv4 address
2487 * Returns the IPv4 address of the gateway to handle the specified destination
2488 * IPv4 address. If NULL is returned, the netif's default gateway is used.
2489 * The returned address MUST be directly reachable on the specified netif!
2490 * This function is meant to implement advanced IPv4 routing together with
2491 * LWIP_HOOK_IP4_ROUTE(). The actual routing/gateway table implementation is
2492 * not part of lwIP but can e.g. be hidden in the netif's state argument.
2493*/
2494#ifdef __DOXYGEN__
2495#define LWIP_HOOK_ETHARP_GET_GW(netif, dest)
2496#endif
2497
2498/**
2499 * LWIP_HOOK_IP6_INPUT(pbuf, input_netif):
2500 * - called from ip6_input() (IPv6)
2501 * - pbuf: received struct pbuf passed to ip6_input()
2502 * - input_netif: struct netif on which the packet has been received
2503 * Return values:
2504 * - 0: Hook has not consumed the packet, packet is processed as normal
2505 * - != 0: Hook has consumed the packet.
2506 * If the hook consumed the packet, 'pbuf' is in the responsibility of the hook
2507 * (i.e. free it when done).
2508 */
2509#ifdef __DOXYGEN__
2510#define LWIP_HOOK_IP6_INPUT(pbuf, input_netif)
2511#endif
2512
2513/**
2514 * LWIP_HOOK_IP6_ROUTE(src, dest):
2515 * - called from ip6_route() (IPv6)
2516 * - src: sourc IPv6 address
2517 * - dest: destination IPv6 address
2518 * Returns the destination netif or NULL if no destination netif is found. In
2519 * that case, ip6_route() continues as normal.
2520 */
2521#ifdef __DOXYGEN__
2522#define LWIP_HOOK_IP6_ROUTE(src, dest)
2523#endif
2524
2525/**
2526 * LWIP_HOOK_ND6_GET_GW(netif, dest):
2527 * - called from nd6_get_next_hop_entry() (IPv6)
2528 * - netif: the netif used for sending
2529 * - dest: the destination IPv6 address
2530 * Returns the IPv6 address of the next hop to handle the specified destination
2531 * IPv6 address. If NULL is returned, a NDP-discovered router is used instead.
2532 * The returned address MUST be directly reachable on the specified netif!
2533 * This function is meant to implement advanced IPv6 routing together with
2534 * LWIP_HOOK_IP6_ROUTE(). The actual routing/gateway table implementation is
2535 * not part of lwIP but can e.g. be hidden in the netif's state argument.
2536*/
2537#ifdef __DOXYGEN__
2538#define LWIP_HOOK_ND6_GET_GW(netif, dest)
2539#endif
2540
2541/**
2542 * LWIP_HOOK_VLAN_CHECK(netif, eth_hdr, vlan_hdr):
2543 * - called from ethernet_input() if VLAN support is enabled
2544 * - netif: struct netif on which the packet has been received
2545 * - eth_hdr: struct eth_hdr of the packet
2546 * - vlan_hdr: struct eth_vlan_hdr of the packet
2547 * Return values:
2548 * - 0: Packet must be dropped.
2549 * - != 0: Packet must be accepted.
2550 */
2551#ifdef __DOXYGEN__
2552#define LWIP_HOOK_VLAN_CHECK(netif, eth_hdr, vlan_hdr)
2553#endif
2554
2555/**
2556 * LWIP_HOOK_VLAN_SET:
2557 * Hook can be used to set prio_vid field of vlan_hdr. If you need to store data
2558 * on per-netif basis to implement this callback, see @ref netif_cd.
2559 * Called from ethernet_output() if VLAN support (@ref ETHARP_SUPPORT_VLAN) is enabled.\n
2560 * Signature: s32_t my_hook_vlan_set(struct netif* netif, struct pbuf* pbuf, const struct eth_addr* src, const struct eth_addr* dst, u16_t eth_type);\n
2561 * Arguments:
2562 * - netif: struct netif that the packet will be sent through
2563 * - p: struct pbuf packet to be sent
2564 * - src: source eth address
2565 * - dst: destination eth address
2566 * - eth_type: ethernet type to packet to be sent\n
2567 *
2568 *
2569 * Return values:
2570 * - &lt;0: Packet shall not contain VLAN header.
2571 * - 0 &lt;= return value &lt;= 0xFFFF: Packet shall contain VLAN header. Return value is prio_vid in host byte order.
2572 */
2573#ifdef __DOXYGEN__
2574#define LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type)
2575#endif
2576
2577/**
2578 * LWIP_HOOK_MEMP_AVAILABLE(memp_t_type):
2579 * - called from memp_free() when a memp pool was empty and an item is now available
2580 */
2581#ifdef __DOXYGEN__
2582#define LWIP_HOOK_MEMP_AVAILABLE(memp_t_type)
2583#endif
2584
2585/**
2586 * LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(pbuf, netif):
2587 * Called from ethernet_input() when an unknown eth type is encountered.
2588 * Return ERR_OK if packet is accepted, any error code otherwise.
2589 * Payload points to ethernet header!
2590 */
2591#ifdef __DOXYGEN__
2592#define LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(pbuf, netif)
2593#endif
2594/**
2595 * @}
2596 */
2597
2598/*
2599   ---------------------------------------
2600   ---------- Debugging options ----------
2601   ---------------------------------------
2602*/
2603/**
2604 * @defgroup lwip_opts_debugmsg Debug messages
2605 * @ingroup lwip_opts_debug
2606 * @{
2607 */
2608/**
2609 * LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is
2610 * compared against this value. If it is smaller, then debugging
2611 * messages are written.
2612 * @see debugging_levels
2613 */
2614#if !defined LWIP_DBG_MIN_LEVEL || defined __DOXYGEN__
2615#define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_ALL
2616#endif
2617
2618/**
2619 * LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable
2620 * debug messages of certain types.
2621 * @see debugging_levels
2622 */
2623#if !defined LWIP_DBG_TYPES_ON || defined __DOXYGEN__
2624#define LWIP_DBG_TYPES_ON               LWIP_DBG_ON
2625#endif
2626
2627/**
2628 * ETHARP_DEBUG: Enable debugging in etharp.c.
2629 */
2630#if !defined ETHARP_DEBUG || defined __DOXYGEN__
2631#define ETHARP_DEBUG                    LWIP_DBG_OFF
2632#endif
2633
2634/**
2635 * NETIF_DEBUG: Enable debugging in netif.c.
2636 */
2637#if !defined NETIF_DEBUG || defined __DOXYGEN__
2638#define NETIF_DEBUG                     LWIP_DBG_OFF
2639#endif
2640
2641/**
2642 * PBUF_DEBUG: Enable debugging in pbuf.c.
2643 */
2644#if !defined PBUF_DEBUG || defined __DOXYGEN__
2645#define PBUF_DEBUG                      LWIP_DBG_OFF
2646#endif
2647
2648/**
2649 * API_LIB_DEBUG: Enable debugging in api_lib.c.
2650 */
2651#if !defined API_LIB_DEBUG || defined __DOXYGEN__
2652#define API_LIB_DEBUG                   LWIP_DBG_OFF
2653#endif
2654
2655/**
2656 * API_MSG_DEBUG: Enable debugging in api_msg.c.
2657 */
2658#if !defined API_MSG_DEBUG || defined __DOXYGEN__
2659#define API_MSG_DEBUG                   LWIP_DBG_OFF
2660#endif
2661
2662/**
2663 * SOCKETS_DEBUG: Enable debugging in sockets.c.
2664 */
2665#if !defined SOCKETS_DEBUG || defined __DOXYGEN__
2666#define SOCKETS_DEBUG                   LWIP_DBG_OFF
2667#endif
2668
2669/**
2670 * ICMP_DEBUG: Enable debugging in icmp.c.
2671 */
2672#if !defined ICMP_DEBUG || defined __DOXYGEN__
2673#define ICMP_DEBUG                      LWIP_DBG_OFF
2674#endif
2675
2676/**
2677 * IGMP_DEBUG: Enable debugging in igmp.c.
2678 */
2679#if !defined IGMP_DEBUG || defined __DOXYGEN__
2680#define IGMP_DEBUG                      LWIP_DBG_OFF
2681#endif
2682
2683/**
2684 * INET_DEBUG: Enable debugging in inet.c.
2685 */
2686#if !defined INET_DEBUG || defined __DOXYGEN__
2687#define INET_DEBUG                      LWIP_DBG_OFF
2688#endif
2689
2690/**
2691 * IP_DEBUG: Enable debugging for IP.
2692 */
2693#if !defined IP_DEBUG || defined __DOXYGEN__
2694#define IP_DEBUG                        LWIP_DBG_OFF
2695#endif
2696
2697/**
2698 * IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass.
2699 */
2700#if !defined IP_REASS_DEBUG || defined __DOXYGEN__
2701#define IP_REASS_DEBUG                  LWIP_DBG_OFF
2702#endif
2703
2704/**
2705 * RAW_DEBUG: Enable debugging in raw.c.
2706 */
2707#if !defined RAW_DEBUG || defined __DOXYGEN__
2708#define RAW_DEBUG                       LWIP_DBG_OFF
2709#endif
2710
2711/**
2712 * MEM_DEBUG: Enable debugging in mem.c.
2713 */
2714#if !defined MEM_DEBUG || defined __DOXYGEN__
2715#define MEM_DEBUG                       LWIP_DBG_OFF
2716#endif
2717
2718/**
2719 * MEMP_DEBUG: Enable debugging in memp.c.
2720 */
2721#if !defined MEMP_DEBUG || defined __DOXYGEN__
2722#define MEMP_DEBUG                      LWIP_DBG_OFF
2723#endif
2724
2725/**
2726 * SYS_DEBUG: Enable debugging in sys.c.
2727 */
2728#if !defined SYS_DEBUG || defined __DOXYGEN__
2729#define SYS_DEBUG                       LWIP_DBG_OFF
2730#endif
2731
2732/**
2733 * TIMERS_DEBUG: Enable debugging in timers.c.
2734 */
2735#if !defined TIMERS_DEBUG || defined __DOXYGEN__
2736#define TIMERS_DEBUG                    LWIP_DBG_OFF
2737#endif
2738
2739/**
2740 * TCP_DEBUG: Enable debugging for TCP.
2741 */
2742#if !defined TCP_DEBUG || defined __DOXYGEN__
2743#define TCP_DEBUG                       LWIP_DBG_OFF
2744#endif
2745
2746/**
2747 * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug.
2748 */
2749#if !defined TCP_INPUT_DEBUG || defined __DOXYGEN__
2750#define TCP_INPUT_DEBUG                 LWIP_DBG_OFF
2751#endif
2752
2753/**
2754 * TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit.
2755 */
2756#if !defined TCP_FR_DEBUG || defined __DOXYGEN__
2757#define TCP_FR_DEBUG                    LWIP_DBG_OFF
2758#endif
2759
2760/**
2761 * TCP_RTO_DEBUG: Enable debugging in TCP for retransmit
2762 * timeout.
2763 */
2764#if !defined TCP_RTO_DEBUG || defined __DOXYGEN__
2765#define TCP_RTO_DEBUG                   LWIP_DBG_OFF
2766#endif
2767
2768/**
2769 * TCP_CWND_DEBUG: Enable debugging for TCP congestion window.
2770 */
2771#if !defined TCP_CWND_DEBUG || defined __DOXYGEN__
2772#define TCP_CWND_DEBUG                  LWIP_DBG_OFF
2773#endif
2774
2775/**
2776 * TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating.
2777 */
2778#if !defined TCP_WND_DEBUG || defined __DOXYGEN__
2779#define TCP_WND_DEBUG                   LWIP_DBG_OFF
2780#endif
2781
2782/**
2783 * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions.
2784 */
2785#if !defined TCP_OUTPUT_DEBUG || defined __DOXYGEN__
2786#define TCP_OUTPUT_DEBUG                LWIP_DBG_OFF
2787#endif
2788
2789/**
2790 * TCP_RST_DEBUG: Enable debugging for TCP with the RST message.
2791 */
2792#if !defined TCP_RST_DEBUG || defined __DOXYGEN__
2793#define TCP_RST_DEBUG                   LWIP_DBG_OFF
2794#endif
2795
2796/**
2797 * TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths.
2798 */
2799#if !defined TCP_QLEN_DEBUG || defined __DOXYGEN__
2800#define TCP_QLEN_DEBUG                  LWIP_DBG_OFF
2801#endif
2802
2803/**
2804 * UDP_DEBUG: Enable debugging in UDP.
2805 */
2806#if !defined UDP_DEBUG || defined __DOXYGEN__
2807#define UDP_DEBUG                       LWIP_DBG_OFF
2808#endif
2809
2810/**
2811 * TCPIP_DEBUG: Enable debugging in tcpip.c.
2812 */
2813#if !defined TCPIP_DEBUG || defined __DOXYGEN__
2814#define TCPIP_DEBUG                     LWIP_DBG_OFF
2815#endif
2816
2817/**
2818 * SLIP_DEBUG: Enable debugging in slipif.c.
2819 */
2820#if !defined SLIP_DEBUG || defined __DOXYGEN__
2821#define SLIP_DEBUG                      LWIP_DBG_OFF
2822#endif
2823
2824/**
2825 * DHCP_DEBUG: Enable debugging in dhcp.c.
2826 */
2827#if !defined DHCP_DEBUG || defined __DOXYGEN__
2828#define DHCP_DEBUG                      LWIP_DBG_OFF
2829#endif
2830
2831/**
2832 * AUTOIP_DEBUG: Enable debugging in autoip.c.
2833 */
2834#if !defined AUTOIP_DEBUG || defined __DOXYGEN__
2835#define AUTOIP_DEBUG                    LWIP_DBG_OFF
2836#endif
2837
2838/**
2839 * DNS_DEBUG: Enable debugging for DNS.
2840 */
2841#if !defined DNS_DEBUG || defined __DOXYGEN__
2842#define DNS_DEBUG                       LWIP_DBG_OFF
2843#endif
2844
2845/**
2846 * IP6_DEBUG: Enable debugging for IPv6.
2847 */
2848#if !defined IP6_DEBUG || defined __DOXYGEN__
2849#define IP6_DEBUG                       LWIP_DBG_OFF
2850#endif
2851/**
2852 * @}
2853 */
2854
2855/*
2856   --------------------------------------------------
2857   ---------- Performance tracking options ----------
2858   --------------------------------------------------
2859*/
2860/**
2861 * @defgroup lwip_opts_perf Performance
2862 * @ingroup lwip_opts_debug
2863 * @{
2864 */
2865/**
2866 * LWIP_PERF: Enable performance testing for lwIP
2867 * (if enabled, arch/perf.h is included)
2868 */
2869#if !defined LWIP_PERF || defined __DOXYGEN__
2870#define LWIP_PERF                       0
2871#endif
2872/**
2873 * @}
2874 */
2875
2876#endif /* LWIP_HDR_OPT_H */
2877