• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  * MEMMOVE: override this if you have a faster implementation at hand than the
150  * one included in your C library.  lwIP currently uses MEMMOVE only when IPv6
151  * fragmentation support is enabled.
152  */
153 #if !defined MEMMOVE || defined __DOXYGEN__
154 #define MEMMOVE(dst,src,len)            memmove(dst,src,len)
155 #endif
156 /**
157  * @}
158  */
159 
160 /*
161    ------------------------------------
162    ----------- Core locking -----------
163    ------------------------------------
164 */
165 /**
166  * @defgroup lwip_opts_lock Core locking and MPU
167  * @ingroup lwip_opts_infrastructure
168  * @{
169  */
170 /**
171  * LWIP_MPU_COMPATIBLE: enables special memory management mechanism
172  * which makes lwip able to work on MPU (Memory Protection Unit) system
173  * by not passing stack-pointers to other threads
174  * (this decreases performance as memory is allocated from pools instead
175  * of keeping it on the stack)
176  */
177 #if !defined LWIP_MPU_COMPATIBLE || defined __DOXYGEN__
178 #define LWIP_MPU_COMPATIBLE             0
179 #endif
180 
181 /**
182  * LWIP_TCPIP_CORE_LOCKING
183  * Creates a global mutex that is held during TCPIP thread operations.
184  * Can be locked by client code to perform lwIP operations without changing
185  * into TCPIP thread using callbacks. See LOCK_TCPIP_CORE() and
186  * UNLOCK_TCPIP_CORE().
187  * Your system should provide mutexes supporting priority inversion to use this.
188  */
189 #if !defined LWIP_TCPIP_CORE_LOCKING || defined __DOXYGEN__
190 #define LWIP_TCPIP_CORE_LOCKING         1
191 #endif
192 
193 /**
194  * LWIP_TCPIP_CORE_LOCKING_INPUT: when LWIP_TCPIP_CORE_LOCKING is enabled,
195  * this lets tcpip_input() grab the mutex for input packets as well,
196  * instead of allocating a message and passing it to tcpip_thread.
197  *
198  * ATTENTION: this does not work when tcpip_input() is called from
199  * interrupt context!
200  */
201 #if !defined LWIP_TCPIP_CORE_LOCKING_INPUT || defined __DOXYGEN__
202 #define LWIP_TCPIP_CORE_LOCKING_INPUT   0
203 #endif
204 
205 /**
206  * SYS_LIGHTWEIGHT_PROT==1: enable inter-task protection (and task-vs-interrupt
207  * protection) for certain critical regions during buffer allocation, deallocation
208  * and memory allocation and deallocation.
209  * ATTENTION: This is required when using lwIP from more than one context! If
210  * you disable this, you must be sure what you are doing!
211  */
212 #if !defined SYS_LIGHTWEIGHT_PROT || defined __DOXYGEN__
213 #define SYS_LIGHTWEIGHT_PROT            1
214 #endif
215 
216 /**
217  * Macro/function to check whether lwIP's threading/locking
218  * requirements are satisfied during current function call.
219  * This macro usually calls a function that is implemented in the OS-dependent
220  * sys layer and performs the following checks:
221  * - Not in ISR (this should be checked for NO_SYS==1, too!)
222  * - If @ref LWIP_TCPIP_CORE_LOCKING = 1: TCPIP core lock is held
223  * - If @ref LWIP_TCPIP_CORE_LOCKING = 0: function is called from TCPIP thread
224  * @see @ref multithreading
225  */
226 #if !defined LWIP_ASSERT_CORE_LOCKED || defined __DOXYGEN__
227 #define LWIP_ASSERT_CORE_LOCKED()
228 #endif
229 
230 
231 /**
232  * @}
233  */
234 
235 /*
236    ------------------------------------
237    ---------- Memory options ----------
238    ------------------------------------
239 */
240 /**
241  * @defgroup lwip_opts_mem Heap and memory pools
242  * @ingroup lwip_opts_infrastructure
243  * @{
244  */
245 /**
246  * MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library
247  * instead of the lwip internal allocator. Can save code size if you
248  * already use it. Specialized case of MEM_CUSTOM_ALLOCATOR.
249  * @see MEM_CUSTOM_ALLOCATOR
250  */
251 #if !defined MEM_LIBC_MALLOC || defined __DOXYGEN__
252 #define MEM_LIBC_MALLOC                 0
253 #elif MEM_LIBC_MALLOC
254 #define MEM_CUSTOM_ALLOCATOR            1
255 #define MEM_CUSTOM_FREE                 free
256 #define MEM_CUSTOM_MALLOC               malloc
257 #define MEM_CUSTOM_CALLOC               calloc
258 #endif
259 
260 /**
261  * MEM_CUSTOM_ALLOCATOR==1: Use malloc/free/realloc provided by a custom
262  * implementation instead of the lwip internal allocator. Can save code size if
263  * you already use it. If enabled, you have to define those functions:
264  *  \#define MEM_CUSTOM_FREE   my_free
265  *  \#define MEM_CUSTOM_MALLOC my_malloc
266  *  \#define MEM_CUSTOM_CALLOC my_calloc
267  */
268 #if !defined MEM_CUSTOM_ALLOCATOR || defined __DOXYGEN__
269 #define MEM_CUSTOM_ALLOCATOR            0
270 #endif
271 
272 /**
273  * MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator.
274  * Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution
275  * speed (heap alloc can be much slower than pool alloc) and usage from interrupts
276  * (especially if your netif driver allocates PBUF_POOL pbufs for received frames
277  * from interrupt)!
278  * ATTENTION: Currently, this uses the heap for ALL pools (also for private pools,
279  * not only for internal pools defined in memp_std.h)!
280  */
281 #if !defined MEMP_MEM_MALLOC || defined __DOXYGEN__
282 #define MEMP_MEM_MALLOC                 0
283 #endif
284 
285 /**
286  * MEMP_MEM_INIT==1: Force use of memset to initialize pool memory.
287  * Useful if pool are moved in uninitialized section of memory. This will ensure
288  * default values in pcbs struct are well initialized in all conditions.
289  */
290 #if !defined MEMP_MEM_INIT || defined __DOXYGEN__
291 #define MEMP_MEM_INIT                   0
292 #endif
293 
294 /**
295  * MEM_ALIGNMENT: should be set to the alignment of the CPU
296  *    4 byte alignment -> \#define MEM_ALIGNMENT 4
297  *    2 byte alignment -> \#define MEM_ALIGNMENT 2
298  */
299 #if !defined MEM_ALIGNMENT || defined __DOXYGEN__
300 #define MEM_ALIGNMENT                   1
301 #endif
302 
303 /**
304  * MEM_SIZE: the size of the heap memory. If the application will send
305  * a lot of data that needs to be copied, this should be set high.
306  */
307 #if !defined MEM_SIZE || defined __DOXYGEN__
308 #define MEM_SIZE                        1600
309 #endif
310 
311 /**
312  * MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable
313  * amount of bytes before and after each memp element in every pool and fills
314  * it with a prominent default value.
315  *    MEMP_OVERFLOW_CHECK == 0 no checking
316  *    MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed
317  *    MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time
318  *      memp_malloc() or memp_free() is called (useful but slow!)
319  */
320 #if !defined MEMP_OVERFLOW_CHECK || defined __DOXYGEN__
321 #define MEMP_OVERFLOW_CHECK             0
322 #endif
323 
324 /**
325  * MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make
326  * sure that there are no cycles in the linked lists.
327  */
328 #if !defined MEMP_SANITY_CHECK || defined __DOXYGEN__
329 #define MEMP_SANITY_CHECK               0
330 #endif
331 
332 /**
333  * MEM_OVERFLOW_CHECK: mem overflow protection reserves a configurable
334  * amount of bytes before and after each heap allocation chunk and fills
335  * it with a prominent default value.
336  *    MEM_OVERFLOW_CHECK == 0 no checking
337  *    MEM_OVERFLOW_CHECK == 1 checks each element when it is freed
338  *    MEM_OVERFLOW_CHECK >= 2 checks all heap elements every time
339  *      mem_malloc() or mem_free() is called (useful but slow!)
340  */
341 #if !defined MEM_OVERFLOW_CHECK || defined __DOXYGEN__
342 #define MEM_OVERFLOW_CHECK              0
343 #endif
344 
345 /**
346  * MEM_SANITY_CHECK==1: run a sanity check after each mem_free() to make
347  * sure that the linked list of heap elements is not corrupted.
348  */
349 #if !defined MEM_SANITY_CHECK || defined __DOXYGEN__
350 #define MEM_SANITY_CHECK                0
351 #endif
352 
353 /**
354  * MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set
355  * of memory pools of various sizes. When mem_malloc is called, an element of
356  * the smallest pool that can provide the length needed is returned.
357  * To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled.
358  */
359 #if !defined MEM_USE_POOLS || defined __DOXYGEN__
360 #define MEM_USE_POOLS                   0
361 #endif
362 
363 /**
364  * MEM_USE_POOLS_TRY_BIGGER_POOL==1: if one malloc-pool is empty, try the next
365  * bigger pool - WARNING: THIS MIGHT WASTE MEMORY but it can make a system more
366  * reliable. */
367 #if !defined MEM_USE_POOLS_TRY_BIGGER_POOL || defined __DOXYGEN__
368 #define MEM_USE_POOLS_TRY_BIGGER_POOL   0
369 #endif
370 
371 /**
372  * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h
373  * that defines additional pools beyond the "standard" ones required
374  * by lwIP. If you set this to 1, you must have lwippools.h in your
375  * include path somewhere.
376  */
377 #if !defined MEMP_USE_CUSTOM_POOLS || defined __DOXYGEN__
378 #define MEMP_USE_CUSTOM_POOLS           0
379 #endif
380 
381 /**
382  * Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from
383  * interrupt context (or another context that doesn't allow waiting for a
384  * semaphore).
385  * If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT,
386  * while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs
387  * with each loop so that mem_free can run.
388  *
389  * ATTENTION: As you can see from the above description, this leads to dis-/
390  * enabling interrupts often, which can be slow! Also, on low memory, mem_malloc
391  * can need longer.
392  *
393  * If you don't want that, at least for NO_SYS=0, you can still use the following
394  * functions to enqueue a deallocation call which then runs in the tcpip_thread
395  * context:
396  * - pbuf_free_callback(p);
397  * - mem_free_callback(m);
398  */
399 #if !defined LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT || defined __DOXYGEN__
400 #define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
401 #endif
402 /**
403  * @}
404  */
405 
406 /*
407    ------------------------------------------------
408    ---------- Internal Memory Pool Sizes ----------
409    ------------------------------------------------
410 */
411 /**
412  * @defgroup lwip_opts_memp Internal memory pools
413  * @ingroup lwip_opts_infrastructure
414  * @{
415  */
416 /**
417  * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
418  * If the application sends a lot of data out of ROM (or other static memory),
419  * this should be set high.
420  */
421 #if !defined MEMP_NUM_PBUF || defined __DOXYGEN__
422 #define MEMP_NUM_PBUF                   16
423 #endif
424 
425 /**
426  * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
427  * (requires the LWIP_RAW option)
428  */
429 #if !defined MEMP_NUM_RAW_PCB || defined __DOXYGEN__
430 #define MEMP_NUM_RAW_PCB                4
431 #endif
432 
433 /**
434  * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
435  * per active UDP "connection".
436  * (requires the LWIP_UDP option)
437  */
438 #if !defined MEMP_NUM_UDP_PCB || defined __DOXYGEN__
439 #define MEMP_NUM_UDP_PCB                4
440 #endif
441 
442 /**
443  * MEMP_NUM_TCP_PCB: the number of simultaneously active TCP connections.
444  * (requires the LWIP_TCP option)
445  */
446 #if !defined MEMP_NUM_TCP_PCB || defined __DOXYGEN__
447 #define MEMP_NUM_TCP_PCB                5
448 #endif
449 
450 /**
451  * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
452  * (requires the LWIP_TCP option)
453  */
454 #if !defined MEMP_NUM_TCP_PCB_LISTEN || defined __DOXYGEN__
455 #define MEMP_NUM_TCP_PCB_LISTEN         8
456 #endif
457 
458 /**
459  * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
460  * (requires the LWIP_TCP option)
461  */
462 #if !defined MEMP_NUM_TCP_SEG || defined __DOXYGEN__
463 #define MEMP_NUM_TCP_SEG                16
464 #endif
465 
466 /**
467  * MEMP_NUM_ALTCP_PCB: the number of simultaneously active altcp layer pcbs.
468  * (requires the LWIP_ALTCP option)
469  * Connections with multiple layers require more than one altcp_pcb (e.g. TLS
470  * over TCP requires 2 altcp_pcbs, one for TLS and one for TCP).
471  */
472 #if !defined MEMP_NUM_ALTCP_PCB || defined __DOXYGEN__
473 #define MEMP_NUM_ALTCP_PCB              MEMP_NUM_TCP_PCB
474 #endif
475 
476 /**
477  * MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for
478  * reassembly (whole packets, not fragments!)
479  */
480 #if !defined MEMP_NUM_REASSDATA || defined __DOXYGEN__
481 #define MEMP_NUM_REASSDATA              5
482 #endif
483 
484 /**
485  * MEMP_NUM_FRAG_PBUF: the number of IP fragments simultaneously sent
486  * (fragments, not whole packets!).
487  * This is only used with LWIP_NETIF_TX_SINGLE_PBUF==0 and only has to be > 1
488  * with DMA-enabled MACs where the packet is not yet sent when netif->output
489  * returns.
490  */
491 #if !defined MEMP_NUM_FRAG_PBUF || defined __DOXYGEN__
492 #define MEMP_NUM_FRAG_PBUF              15
493 #endif
494 
495 /**
496  * MEMP_NUM_ARP_QUEUE: the number of simultaneously queued outgoing
497  * packets (pbufs) that are waiting for an ARP request (to resolve
498  * their destination address) to finish.
499  * (requires the ARP_QUEUEING option)
500  */
501 #if !defined MEMP_NUM_ARP_QUEUE || defined __DOXYGEN__
502 #define MEMP_NUM_ARP_QUEUE              30
503 #endif
504 
505 /**
506  * MEMP_NUM_IGMP_GROUP: The number of multicast groups whose network interfaces
507  * can be members at the same time (one per netif - allsystems group -, plus one
508  * per netif membership).
509  * (requires the LWIP_IGMP option)
510  */
511 #if !defined MEMP_NUM_IGMP_GROUP || defined __DOXYGEN__
512 #define MEMP_NUM_IGMP_GROUP             8
513 #endif
514 
515 /**
516  * The number of sys timeouts used by the core stack (not apps)
517  * The default number of timeouts is calculated here for all enabled modules.
518  */
519 #define LWIP_NUM_SYS_TIMEOUT_INTERNAL   (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_ACD + LWIP_IGMP + LWIP_DNS + PPP_NUM_TIMEOUTS + (LWIP_IPV6 * (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD + LWIP_IPV6_DHCP6)))
520 
521 /**
522  * MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active timeouts.
523  * The default number of timeouts is calculated here for all enabled modules.
524  * The formula expects settings to be either '0' or '1'.
525  */
526 #if !defined MEMP_NUM_SYS_TIMEOUT || defined __DOXYGEN__
527 #define MEMP_NUM_SYS_TIMEOUT            LWIP_NUM_SYS_TIMEOUT_INTERNAL
528 #endif
529 
530 /**
531  * MEMP_NUM_NETBUF: the number of struct netbufs.
532  * (only needed if you use the sequential API, like api_lib.c)
533  */
534 #if !defined MEMP_NUM_NETBUF || defined __DOXYGEN__
535 #define MEMP_NUM_NETBUF                 2
536 #endif
537 
538 /**
539  * MEMP_NUM_NETCONN: the number of struct netconns.
540  * (only needed if you use the sequential API, like api_lib.c)
541  */
542 #if !defined MEMP_NUM_NETCONN || defined __DOXYGEN__
543 #define MEMP_NUM_NETCONN                4
544 #endif
545 
546 /**
547  * MEMP_NUM_SELECT_CB: the number of struct lwip_select_cb.
548  * (Only needed if you have LWIP_MPU_COMPATIBLE==1 and use the socket API.
549  * In that case, you need one per thread calling lwip_select.)
550  */
551 #if !defined MEMP_NUM_SELECT_CB || defined __DOXYGEN__
552 #define MEMP_NUM_SELECT_CB              4
553 #endif
554 
555 /**
556  * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
557  * for callback/timeout API communication.
558  * (only needed if you use tcpip.c)
559  */
560 #if !defined MEMP_NUM_TCPIP_MSG_API || defined __DOXYGEN__
561 #define MEMP_NUM_TCPIP_MSG_API          8
562 #endif
563 
564 /**
565  * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
566  * for incoming packets.
567  * (only needed if you use tcpip.c)
568  */
569 #if !defined MEMP_NUM_TCPIP_MSG_INPKT || defined __DOXYGEN__
570 #define MEMP_NUM_TCPIP_MSG_INPKT        8
571 #endif
572 
573 /**
574  * MEMP_NUM_NETDB: the number of concurrently running lwip_addrinfo() calls
575  * (before freeing the corresponding memory using lwip_freeaddrinfo()).
576  */
577 #if !defined MEMP_NUM_NETDB || defined __DOXYGEN__
578 #define MEMP_NUM_NETDB                  1
579 #endif
580 
581 /**
582  * MEMP_NUM_LOCALHOSTLIST: the number of host entries in the local host list
583  * if DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1.
584  */
585 #if !defined MEMP_NUM_LOCALHOSTLIST || defined __DOXYGEN__
586 #define MEMP_NUM_LOCALHOSTLIST          1
587 #endif
588 
589 /**
590  * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
591  */
592 #if !defined PBUF_POOL_SIZE || defined __DOXYGEN__
593 #define PBUF_POOL_SIZE                  16
594 #endif
595 
596 /** MEMP_NUM_API_MSG: the number of concurrently active calls to various
597  * socket, netconn, and tcpip functions
598  */
599 #if !defined MEMP_NUM_API_MSG || defined __DOXYGEN__
600 #define MEMP_NUM_API_MSG                MEMP_NUM_TCPIP_MSG_API
601 #endif
602 
603 /** MEMP_NUM_DNS_API_MSG: the number of concurrently active calls to netconn_gethostbyname
604  */
605 #if !defined MEMP_NUM_DNS_API_MSG || defined __DOXYGEN__
606 #define MEMP_NUM_DNS_API_MSG            MEMP_NUM_TCPIP_MSG_API
607 #endif
608 
609 /** MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA: the number of concurrently active calls
610  * to getsockopt/setsockopt
611  */
612 #if !defined MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA || defined __DOXYGEN__
613 #define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API
614 #endif
615 
616 /** MEMP_NUM_NETIFAPI_MSG: the number of concurrently active calls to the
617  * netifapi functions
618  */
619 #if !defined MEMP_NUM_NETIFAPI_MSG || defined __DOXYGEN__
620 #define MEMP_NUM_NETIFAPI_MSG           MEMP_NUM_TCPIP_MSG_API
621 #endif
622 /**
623  * @}
624  */
625 
626 /*
627    ---------------------------------
628    ---------- ARP options ----------
629    ---------------------------------
630 */
631 /**
632  * @defgroup lwip_opts_arp ARP
633  * @ingroup lwip_opts_ipv4
634  * @{
635  */
636 /**
637  * LWIP_ARP==1: Enable ARP functionality.
638  */
639 #if !defined LWIP_ARP || defined __DOXYGEN__
640 #define LWIP_ARP                        1
641 #endif
642 
643 /**
644  * ARP_TABLE_SIZE: Number of active MAC-IP address pairs cached.
645  */
646 #if !defined ARP_TABLE_SIZE || defined __DOXYGEN__
647 #define ARP_TABLE_SIZE                  10
648 #endif
649 
650 /** the time an ARP entry stays valid after its last update,
651  *  for ARP_TMR_INTERVAL = 1000, this is
652  *  (60 * 5) seconds = 5 minutes.
653  */
654 #if !defined ARP_MAXAGE || defined __DOXYGEN__
655 #define ARP_MAXAGE                      300
656 #endif
657 
658 /**
659  * ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address
660  * resolution. By default, only the most recent packet is queued per IP address.
661  * This is sufficient for most protocols and mainly reduces TCP connection
662  * startup time. Set this to 1 if you know your application sends more than one
663  * packet in a row to an IP address that is not in the ARP cache.
664  */
665 #if !defined ARP_QUEUEING || defined __DOXYGEN__
666 #define ARP_QUEUEING                    0
667 #endif
668 
669 /** The maximum number of packets which may be queued for each
670  *  unresolved address by other network layers. Defaults to 3, 0 means disabled.
671  *  Old packets are dropped, new packets are queued.
672  */
673 #if !defined ARP_QUEUE_LEN || defined __DOXYGEN__
674 #define ARP_QUEUE_LEN                   3
675 #endif
676 
677 /**
678  * ETHARP_SUPPORT_VLAN==1: support receiving and sending ethernet packets with
679  * VLAN header. See the description of LWIP_HOOK_VLAN_CHECK and
680  * LWIP_HOOK_VLAN_SET hooks to check/set VLAN headers.
681  * Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check.
682  * If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted.
683  * If ETHARP_VLAN_CHECK is not defined, all traffic is accepted.
684  * Alternatively, define a function/define ETHARP_VLAN_CHECK_FN(eth_hdr, vlan)
685  * that returns 1 to accept a packet or 0 to drop a packet.
686  */
687 #if !defined ETHARP_SUPPORT_VLAN || defined __DOXYGEN__
688 #define ETHARP_SUPPORT_VLAN             0
689 #endif
690 
691 /**
692  * LWIP_VLAN_PCP==1: Enable outgoing VLAN tagging of frames on a per-PCB basis
693  * for QoS purposes. With this feature enabled, each PCB has a new variable:
694  * "netif_hints.tci" (Tag Control Identifier).
695  * The TCI contains three fields: VID, CFI and PCP.
696  * - VID is the VLAN ID, which should be set to zero.
697  * - The "CFI" bit is used to enable or disable VLAN tags for the PCB.
698  * - PCP (Priority Code Point) is a 3 bit field used for Ethernet level QoS.
699  * See pcb_tci_*() functions to get/set/clear this.
700  */
701 #ifndef LWIP_VLAN_PCP
702 #define LWIP_VLAN_PCP                   0
703 #endif
704 
705 /** LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled
706  */
707 #if !defined LWIP_ETHERNET || defined __DOXYGEN__
708 #define LWIP_ETHERNET                   LWIP_ARP
709 #endif
710 
711 /** ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure
712  * alignment of payload after that header. Since the header is 14 bytes long,
713  * without this padding e.g. addresses in the IP header will not be aligned
714  * on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms.
715  */
716 #if !defined ETH_PAD_SIZE || defined __DOXYGEN__
717 #define ETH_PAD_SIZE                    0
718 #endif
719 
720 /** ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table
721  * entries (using etharp_add_static_entry/etharp_remove_static_entry).
722  */
723 #if !defined ETHARP_SUPPORT_STATIC_ENTRIES || defined __DOXYGEN__
724 #define ETHARP_SUPPORT_STATIC_ENTRIES   0
725 #endif
726 
727 /** ETHARP_TABLE_MATCH_NETIF==1: Match netif for ARP table entries.
728  * If disabled, duplicate IP address on multiple netifs are not supported
729  * (but this should only occur for AutoIP).
730  */
731 #if !defined ETHARP_TABLE_MATCH_NETIF || defined __DOXYGEN__
732 #define ETHARP_TABLE_MATCH_NETIF        !LWIP_SINGLE_NETIF
733 #endif
734 /**
735  * @}
736  */
737 
738 /*
739    --------------------------------
740    ---------- IP options ----------
741    --------------------------------
742 */
743 /**
744  * @defgroup lwip_opts_ipv4 IPv4
745  * @ingroup lwip_opts
746  * @{
747  */
748 /**
749  * LWIP_IPV4==1: Enable IPv4
750  */
751 #if !defined LWIP_IPV4 || defined __DOXYGEN__
752 #define LWIP_IPV4                       1
753 #endif
754 
755 /**
756  * IP_FORWARD==1: Enables the ability to forward IP packets across network
757  * interfaces. If you are going to run lwIP on a device with only one network
758  * interface, define this to 0.
759  */
760 #if !defined IP_FORWARD || defined __DOXYGEN__
761 #define IP_FORWARD                      0
762 #endif
763 
764 /**
765  * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
766  * this option does not affect outgoing packet sizes, which can be controlled
767  * via IP_FRAG.
768  */
769 #if !defined IP_REASSEMBLY || defined __DOXYGEN__
770 #define IP_REASSEMBLY                   1
771 #endif
772 
773 /**
774  * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
775  * that this option does not affect incoming packet sizes, which can be
776  * controlled via IP_REASSEMBLY.
777  */
778 #if !defined IP_FRAG || defined __DOXYGEN__
779 #define IP_FRAG                         1
780 #endif
781 
782 #if !LWIP_IPV4
783 /* disable IPv4 extensions when IPv4 is disabled */
784 #undef IP_FORWARD
785 #define IP_FORWARD                      0
786 #undef IP_REASSEMBLY
787 #define IP_REASSEMBLY                   0
788 #undef IP_FRAG
789 #define IP_FRAG                         0
790 #endif /* !LWIP_IPV4 */
791 
792 /**
793  * IP_OPTIONS_ALLOWED: Defines the behavior for IP options.
794  *      IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
795  *      IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
796  */
797 #if !defined IP_OPTIONS_ALLOWED || defined __DOXYGEN__
798 #define IP_OPTIONS_ALLOWED              1
799 #endif
800 
801 /**
802  * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
803  * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
804  * in this time, the whole packet is discarded.
805  */
806 #if !defined IP_REASS_MAXAGE || defined __DOXYGEN__
807 #define IP_REASS_MAXAGE                 15
808 #endif
809 
810 /**
811  * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
812  * Since the received pbufs are enqueued, be sure to configure
813  * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
814  * packets even if the maximum amount of fragments is enqueued for reassembly!
815  * When IPv4 *and* IPv6 are enabled, this even changes to
816  * (PBUF_POOL_SIZE > 2 * IP_REASS_MAX_PBUFS)!
817  */
818 #if !defined IP_REASS_MAX_PBUFS || defined __DOXYGEN__
819 #define IP_REASS_MAX_PBUFS              10
820 #endif
821 
822 /**
823  * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
824  */
825 #if !defined IP_DEFAULT_TTL || defined __DOXYGEN__
826 #define IP_DEFAULT_TTL                  255
827 #endif
828 
829 /**
830  * IP_SOF_BROADCAST=1: Use the SOF_BROADCAST field to enable broadcast
831  * filter per pcb on udp and raw send operations. To enable broadcast filter
832  * on recv operations, you also have to set IP_SOF_BROADCAST_RECV=1.
833  */
834 #if !defined IP_SOF_BROADCAST || defined __DOXYGEN__
835 #define IP_SOF_BROADCAST                0
836 #endif
837 
838 /**
839  * IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast
840  * filter on recv operations.
841  */
842 #if !defined IP_SOF_BROADCAST_RECV || defined __DOXYGEN__
843 #define IP_SOF_BROADCAST_RECV           0
844 #endif
845 
846 /**
847  * IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1: allow ip_forward() to send packets back
848  * out on the netif where it was received. This should only be used for
849  * wireless networks.
850  * ATTENTION: When this is 1, make sure your netif driver correctly marks incoming
851  * link-layer-broadcast/multicast packets as such using the corresponding pbuf flags!
852  */
853 #if !defined IP_FORWARD_ALLOW_TX_ON_RX_NETIF || defined __DOXYGEN__
854 #define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
855 #endif
856 /**
857  * @}
858  */
859 
860 /*
861    ----------------------------------
862    ---------- ICMP options ----------
863    ----------------------------------
864 */
865 /**
866  * @defgroup lwip_opts_icmp ICMP
867  * @ingroup lwip_opts_ipv4
868  * @{
869  */
870 /**
871  * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
872  * Be careful, disable that make your product non-compliant to RFC1122
873  */
874 #if !defined LWIP_ICMP || defined __DOXYGEN__
875 #define LWIP_ICMP                       1
876 #endif
877 
878 /**
879  * ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
880  */
881 #if !defined ICMP_TTL || defined __DOXYGEN__
882 #define ICMP_TTL                        IP_DEFAULT_TTL
883 #endif
884 
885 /**
886  * LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only)
887  */
888 #if !defined LWIP_BROADCAST_PING || defined __DOXYGEN__
889 #define LWIP_BROADCAST_PING             0
890 #endif
891 
892 /**
893  * LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only)
894  */
895 #if !defined LWIP_MULTICAST_PING || defined __DOXYGEN__
896 #define LWIP_MULTICAST_PING             0
897 #endif
898 /**
899  * @}
900  */
901 
902 /*
903    ---------------------------------
904    ---------- RAW options ----------
905    ---------------------------------
906 */
907 /**
908  * @defgroup lwip_opts_raw RAW
909  * @ingroup lwip_opts_callback
910  * @{
911  */
912 /**
913  * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
914  */
915 #if !defined LWIP_RAW || defined __DOXYGEN__
916 #define LWIP_RAW                        0
917 #endif
918 
919 /**
920  * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
921  */
922 #if !defined RAW_TTL || defined __DOXYGEN__
923 #define RAW_TTL                         IP_DEFAULT_TTL
924 #endif
925 /**
926  * @}
927  */
928 
929 /*
930    ----------------------------------
931    ---------- DHCP options ----------
932    ----------------------------------
933 */
934 /**
935  * @defgroup lwip_opts_dhcp DHCP
936  * @ingroup lwip_opts_ipv4
937  * @{
938  */
939 /**
940  * LWIP_DHCP==1: Enable DHCP module.
941  */
942 #if !defined LWIP_DHCP || defined __DOXYGEN__
943 #define LWIP_DHCP                       0
944 #endif
945 #if !LWIP_IPV4
946 /* disable DHCP when IPv4 is disabled */
947 #undef LWIP_DHCP
948 #define LWIP_DHCP                       0
949 #endif /* !LWIP_IPV4 */
950 
951 /**
952  * LWIP_DHCP_DOES_ACD_CHECK==1: Perform address conflict detection on the dhcp address.
953  */
954 #if !defined LWIP_DHCP_DOES_ACD_CHECK || defined __DOXYGEN__
955 #define LWIP_DHCP_DOES_ACD_CHECK        LWIP_DHCP
956 #endif
957 
958 /**
959  * LWIP_DHCP_BOOTP_FILE==1: Store offered_si_addr and boot_file_name.
960  */
961 #if !defined LWIP_DHCP_BOOTP_FILE || defined __DOXYGEN__
962 #define LWIP_DHCP_BOOTP_FILE            0
963 #endif
964 
965 /**
966  * LWIP_DHCP_GETS_NTP==1: Request NTP servers with discover/select. For each
967  * response packet, an callback is called, which has to be provided by the port:
968  * void dhcp_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs);
969 */
970 #if !defined LWIP_DHCP_GET_NTP_SRV || defined __DOXYGEN__
971 #define LWIP_DHCP_GET_NTP_SRV           0
972 #endif
973 
974 /**
975  * The maximum of NTP servers requested
976  */
977 #if !defined LWIP_DHCP_MAX_NTP_SERVERS || defined __DOXYGEN__
978 #define LWIP_DHCP_MAX_NTP_SERVERS       1
979 #endif
980 
981 /**
982  * LWIP_DHCP_MAX_DNS_SERVERS > 0: Request DNS servers with discover/select.
983  * DNS servers received in the response are passed to DNS via @ref dns_setserver()
984  * (up to the maximum limit defined here).
985  */
986 #if !defined LWIP_DHCP_MAX_DNS_SERVERS || defined __DOXYGEN__
987 #define LWIP_DHCP_MAX_DNS_SERVERS       DNS_MAX_SERVERS
988 #endif
989 
990 /** LWIP_DHCP_DISCOVER_ADD_HOSTNAME: Set to 0 to not include hostname opt in discover packets.
991  * If the hostname is not set in the DISCOVER packet, then some servers might issue an OFFER with hostname
992  * configured and consequently reject the REQUEST with any other hostname.
993  */
994 #if !defined LWIP_DHCP_DISCOVER_ADD_HOSTNAME || defined __DOXYGEN__
995 #define LWIP_DHCP_DISCOVER_ADD_HOSTNAME 1
996 #endif /* LWIP_DHCP_DISCOVER_ADD_HOSTNAME */
997 /**
998  * @}
999  */
1000 
1001 /*
1002    ------------------------------------
1003    ---------- AUTOIP options ----------
1004    ------------------------------------
1005 */
1006 /**
1007  * @defgroup lwip_opts_autoip AUTOIP
1008  * @ingroup lwip_opts_ipv4
1009  * @{
1010  */
1011 /**
1012  * LWIP_AUTOIP==1: Enable AUTOIP module.
1013  */
1014 #if !defined LWIP_AUTOIP || defined __DOXYGEN__
1015 #define LWIP_AUTOIP                     0
1016 #endif
1017 #if !LWIP_IPV4
1018 /* disable AUTOIP when IPv4 is disabled */
1019 #undef LWIP_AUTOIP
1020 #define LWIP_AUTOIP                     0
1021 #endif /* !LWIP_IPV4 */
1022 
1023 /**
1024  * LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on
1025  * the same interface at the same time.
1026  */
1027 #if !defined LWIP_DHCP_AUTOIP_COOP || defined __DOXYGEN__
1028 #define LWIP_DHCP_AUTOIP_COOP           0
1029 #endif
1030 
1031 /**
1032  * LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes
1033  * that should be sent before falling back on AUTOIP (the DHCP client keeps
1034  * running in this case). This can be set as low as 1 to get an AutoIP address
1035  * very  quickly, but you should be prepared to handle a changing IP address
1036  * when DHCP overrides AutoIP.
1037  */
1038 #if !defined LWIP_DHCP_AUTOIP_COOP_TRIES || defined __DOXYGEN__
1039 #define LWIP_DHCP_AUTOIP_COOP_TRIES     9
1040 #endif
1041 /**
1042  * @}
1043  */
1044 
1045 /*
1046    ------------------------------------
1047    ----------- ACD options ------------
1048    ------------------------------------
1049 */
1050 /**
1051  * @defgroup lwip_opts_acd ACD
1052  * @ingroup lwip_opts_ipv4
1053  * @{
1054  */
1055  /**
1056   * LWIP_ACD==1: Enable ACD module. ACD module is needed when using AUTOIP.
1057   */
1058 #if !defined LWIP_ACD || defined __DOXYGEN__
1059 #define LWIP_ACD                     (LWIP_AUTOIP || LWIP_DHCP_DOES_ACD_CHECK)
1060 #endif
1061 #if !LWIP_IPV4
1062 /* disable ACD when IPv4 is disabled */
1063 #undef LWIP_ACD
1064 #define LWIP_ACD                     0
1065 #endif /* !LWIP_IPV4 */
1066 /**
1067  * @}
1068  */
1069 
1070 /*
1071    ----------------------------------
1072    ----- SNMP MIB2 support      -----
1073    ----------------------------------
1074 */
1075 /**
1076  * @defgroup lwip_opts_mib2 SNMP MIB2 callbacks
1077  * @ingroup lwip_opts_infrastructure
1078  * @{
1079  */
1080 /**
1081  * LWIP_MIB2_CALLBACKS==1: Turn on SNMP MIB2 callbacks.
1082  * Turn this on to get callbacks needed to implement MIB2.
1083  * Usually MIB2_STATS should be enabled, too.
1084  */
1085 #if !defined LWIP_MIB2_CALLBACKS || defined __DOXYGEN__
1086 #define LWIP_MIB2_CALLBACKS             0
1087 #endif
1088 /**
1089  * @}
1090  */
1091 
1092 /*
1093    ----------------------------------
1094    -------- Multicast options -------
1095    ----------------------------------
1096 */
1097 /**
1098  * @defgroup lwip_opts_multicast Multicast
1099  * @ingroup lwip_opts_infrastructure
1100  * @{
1101  */
1102 /**
1103  * LWIP_MULTICAST_TX_OPTIONS==1: Enable multicast TX support like the socket options
1104  * IP_MULTICAST_TTL/IP_MULTICAST_IF/IP_MULTICAST_LOOP, as well as (currently only)
1105  * core support for the corresponding IPv6 options.
1106  */
1107 #if !defined LWIP_MULTICAST_TX_OPTIONS || defined __DOXYGEN__
1108 #define LWIP_MULTICAST_TX_OPTIONS       ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW))
1109 #endif
1110 /**
1111  * @}
1112  */
1113 
1114 /*
1115    ----------------------------------
1116    ---------- IGMP options ----------
1117    ----------------------------------
1118 */
1119 /**
1120  * @defgroup lwip_opts_igmp IGMP
1121  * @ingroup lwip_opts_ipv4
1122  * @{
1123  */
1124 /**
1125  * LWIP_IGMP==1: Turn on IGMP module.
1126  */
1127 #if !defined LWIP_IGMP || defined __DOXYGEN__
1128 #define LWIP_IGMP                       0
1129 #endif
1130 #if !LWIP_IPV4
1131 #undef LWIP_IGMP
1132 #define LWIP_IGMP                       0
1133 #endif
1134 /**
1135  * @}
1136  */
1137 
1138 /*
1139    ----------------------------------
1140    ---------- DNS options -----------
1141    ----------------------------------
1142 */
1143 /**
1144  * @defgroup lwip_opts_dns DNS
1145  * @ingroup lwip_opts_callback
1146  * @{
1147  */
1148 /**
1149  * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
1150  * transport.
1151  */
1152 #if !defined LWIP_DNS || defined __DOXYGEN__
1153 #define LWIP_DNS                        0
1154 #endif
1155 
1156 /** DNS maximum number of entries to maintain locally. */
1157 #if !defined DNS_TABLE_SIZE || defined __DOXYGEN__
1158 #define DNS_TABLE_SIZE                  4
1159 #endif
1160 
1161 /** DNS maximum host name length supported in the name table. */
1162 #if !defined DNS_MAX_NAME_LENGTH || defined __DOXYGEN__
1163 #define DNS_MAX_NAME_LENGTH             256
1164 #endif
1165 
1166 /** The maximum of DNS servers
1167  * The first server can be initialized automatically by defining
1168  * DNS_SERVER_ADDRESS(ipaddr), where 'ipaddr' is an 'ip_addr_t*'
1169  */
1170 #if !defined DNS_MAX_SERVERS || defined __DOXYGEN__
1171 #define DNS_MAX_SERVERS                 2
1172 #endif
1173 
1174 /** DNS maximum number of retries when asking for a name, before "timeout". */
1175 #if !defined DNS_MAX_RETRIES || defined __DOXYGEN__
1176 #define DNS_MAX_RETRIES                 4
1177 #endif
1178 
1179 /** DNS do a name checking between the query and the response. */
1180 #if !defined DNS_DOES_NAME_CHECK || defined __DOXYGEN__
1181 #define DNS_DOES_NAME_CHECK             1
1182 #endif
1183 
1184 /** LWIP_DNS_SECURE: controls the security level of the DNS implementation
1185  * Use all DNS security features by default.
1186  * This is overridable but should only be needed by very small targets
1187  * or when using against non standard DNS servers. */
1188 #if !defined LWIP_DNS_SECURE || defined __DOXYGEN__
1189 #define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
1190 #endif
1191 
1192 /* A list of DNS security features follows */
1193 #define LWIP_DNS_SECURE_RAND_XID                1
1194 #define LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING 2
1195 #define LWIP_DNS_SECURE_RAND_SRC_PORT           4
1196 
1197 /** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled, you have to define an initializer:
1198  *  \#define DNS_LOCAL_HOSTLIST_INIT {DNS_LOCAL_HOSTLIST_ELEM("host_ip4", IPADDR4_INIT_BYTES(1,2,3,4)), \
1199  *                                    DNS_LOCAL_HOSTLIST_ELEM("host_ip6", IPADDR6_INIT_HOST(123, 234, 345, 456)}
1200  *
1201  *  Instead, you can also use an external function:
1202  *  \#define DNS_LOOKUP_LOCAL_EXTERN(name, namelen, addr, dns_addrtype) my_lookup_function(name, namelen, addr, dns_addrtype)
1203  *  with function signature:
1204  *  extern err_t my_lookup_function(const char *name, size_t namelen, ip_addr_t *addr, u8_t dns_addrtype)
1205  *  that looks up the IP address and returns ERR_OK if found (LWIP_DNS_ADDRTYPE_xxx is passed in dns_addrtype).
1206  */
1207 #if !defined DNS_LOCAL_HOSTLIST || defined __DOXYGEN__
1208 #define DNS_LOCAL_HOSTLIST              0
1209 #endif /* DNS_LOCAL_HOSTLIST */
1210 
1211 /** If this is turned on, the local host-list can be dynamically changed
1212  *  at runtime. */
1213 #if !defined DNS_LOCAL_HOSTLIST_IS_DYNAMIC || defined __DOXYGEN__
1214 #define DNS_LOCAL_HOSTLIST_IS_DYNAMIC   0
1215 #endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
1216 
1217 /** Set this to 1 to enable querying ".local" names via mDNS
1218  *  using a One-Shot Multicast DNS Query */
1219 #if !defined LWIP_DNS_SUPPORT_MDNS_QUERIES || defined __DOXYGEN__
1220 #define LWIP_DNS_SUPPORT_MDNS_QUERIES   0
1221 #endif
1222 /**
1223  * @}
1224  */
1225 
1226 /*
1227    ---------------------------------
1228    ---------- UDP options ----------
1229    ---------------------------------
1230 */
1231 /**
1232  * @defgroup lwip_opts_udp UDP
1233  * @ingroup lwip_opts_callback
1234  * @{
1235  */
1236 /**
1237  * LWIP_UDP==1: Turn on UDP.
1238  */
1239 #if !defined LWIP_UDP || defined __DOXYGEN__
1240 #define LWIP_UDP                        1
1241 #endif
1242 
1243 /**
1244  * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP)
1245  */
1246 #if !defined LWIP_UDPLITE || defined __DOXYGEN__
1247 #define LWIP_UDPLITE                    0
1248 #endif
1249 
1250 /**
1251  * UDP_TTL: Default Time-To-Live value.
1252  */
1253 #if !defined UDP_TTL || defined __DOXYGEN__
1254 #define UDP_TTL                         IP_DEFAULT_TTL
1255 #endif
1256 
1257 /**
1258  * LWIP_NETBUF_RECVINFO==1: append destination addr and port to every netbuf.
1259  */
1260 #if !defined LWIP_NETBUF_RECVINFO || defined __DOXYGEN__
1261 #define LWIP_NETBUF_RECVINFO            0
1262 #endif
1263 /**
1264  * @}
1265  */
1266 
1267 /*
1268    ---------------------------------
1269    ---------- TCP options ----------
1270    ---------------------------------
1271 */
1272 /**
1273  * @defgroup lwip_opts_tcp TCP
1274  * @ingroup lwip_opts_callback
1275  * @{
1276  */
1277 /**
1278  * LWIP_TCP==1: Turn on TCP.
1279  */
1280 #if !defined LWIP_TCP || defined __DOXYGEN__
1281 #define LWIP_TCP                        1
1282 #endif
1283 
1284 /**
1285  * TCP_TTL: Default Time-To-Live value.
1286  */
1287 #if !defined TCP_TTL || defined __DOXYGEN__
1288 #define TCP_TTL                         IP_DEFAULT_TTL
1289 #endif
1290 
1291 /**
1292  * TCP_WND: The size of a TCP window.  This must be at least
1293  * (2 * TCP_MSS) for things to work well.
1294  * ATTENTION: when using TCP_RCV_SCALE, TCP_WND is the total size
1295  * with scaling applied. Maximum window value in the TCP header
1296  * will be TCP_WND >> TCP_RCV_SCALE
1297  */
1298 #if !defined TCP_WND || defined __DOXYGEN__
1299 #define TCP_WND                         (4 * TCP_MSS)
1300 #endif
1301 
1302 /**
1303  * TCP_MAXRTX: Maximum number of retransmissions of data segments.
1304  */
1305 #if !defined TCP_MAXRTX || defined __DOXYGEN__
1306 #define TCP_MAXRTX                      12
1307 #endif
1308 
1309 /**
1310  * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments.
1311  */
1312 #if !defined TCP_SYNMAXRTX || defined __DOXYGEN__
1313 #define TCP_SYNMAXRTX                   6
1314 #endif
1315 
1316 /**
1317  * TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order.
1318  * Define to 0 if your device is low on memory.
1319  */
1320 #if !defined TCP_QUEUE_OOSEQ || defined __DOXYGEN__
1321 #define TCP_QUEUE_OOSEQ                 LWIP_TCP
1322 #endif
1323 
1324 /**
1325  * LWIP_TCP_SACK_OUT==1: TCP will support sending selective acknowledgements (SACKs).
1326  */
1327 #if !defined LWIP_TCP_SACK_OUT || defined __DOXYGEN__
1328 #define LWIP_TCP_SACK_OUT               0
1329 #endif
1330 
1331 /**
1332  * LWIP_TCP_MAX_SACK_NUM: The maximum number of SACK values to include in TCP segments.
1333  * Must be at least 1, but is only used if LWIP_TCP_SACK_OUT is enabled.
1334  * NOTE: Even though we never send more than 3 or 4 SACK ranges in a single segment
1335  * (depending on other options), setting this option to values greater than 4 is not pointless.
1336  * This is basically the max number of SACK ranges we want to keep track of.
1337  * As new data is delivered, some of the SACK ranges may be removed or merged.
1338  * In that case some of those older SACK ranges may be used again.
1339  * The amount of memory used to store SACK ranges is LWIP_TCP_MAX_SACK_NUM * 8 bytes for each TCP PCB.
1340  */
1341 #if !defined LWIP_TCP_MAX_SACK_NUM || defined __DOXYGEN__
1342 #define LWIP_TCP_MAX_SACK_NUM           4
1343 #endif
1344 
1345 /**
1346  * TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default,
1347  * you might want to increase this.)
1348  * For the receive side, this MSS is advertised to the remote side
1349  * when opening a connection. For the transmit size, this MSS sets
1350  * an upper limit on the MSS advertised by the remote host.
1351  */
1352 #if !defined TCP_MSS || defined __DOXYGEN__
1353 #define TCP_MSS                         536
1354 #endif
1355 
1356 /**
1357  * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really
1358  * sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which
1359  * reflects the available reassembly buffer size at the remote host) and the
1360  * largest size permitted by the IP layer" (RFC 1122)
1361  * Setting this to 1 enables code that checks TCP_MSS against the MTU of the
1362  * netif used for a connection and limits the MSS if it would be too big otherwise.
1363  */
1364 #if !defined TCP_CALCULATE_EFF_SEND_MSS || defined __DOXYGEN__
1365 #define TCP_CALCULATE_EFF_SEND_MSS      1
1366 #endif
1367 
1368 /**
1369  * LWIP_TCP_RTO_TIME: Initial TCP retransmission timeout (ms).
1370  * This defaults to 3 seconds as traditionally defined in the TCP protocol.
1371  * For improving timely recovery on faster networks, this value could
1372  * be lowered down to 1 second (RFC 6298)
1373  */
1374 #if !defined LWIP_TCP_RTO_TIME || defined __DOXYGEN__
1375 #define LWIP_TCP_RTO_TIME               3000
1376 #endif
1377 
1378 /**
1379  * TCP_SND_BUF: TCP sender buffer space (bytes).
1380  * To achieve good performance, this should be at least 2 * TCP_MSS.
1381  */
1382 #if !defined TCP_SND_BUF || defined __DOXYGEN__
1383 #define TCP_SND_BUF                     (2 * TCP_MSS)
1384 #endif
1385 
1386 /**
1387  * TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
1388  * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work.
1389  */
1390 #if !defined TCP_SND_QUEUELEN || defined __DOXYGEN__
1391 #define TCP_SND_QUEUELEN                ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
1392 #endif
1393 
1394 /**
1395  * TCP_SNDLOWAT: TCP writable space (bytes). This must be less than
1396  * TCP_SND_BUF. It is the amount of space which must be available in the
1397  * TCP snd_buf for select to return writable (combined with TCP_SNDQUEUELOWAT).
1398  */
1399 #if !defined TCP_SNDLOWAT || defined __DOXYGEN__
1400 #define TCP_SNDLOWAT                    LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1)
1401 #endif
1402 
1403 /**
1404  * TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be less
1405  * than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below
1406  * this number, select returns writable (combined with TCP_SNDLOWAT).
1407  */
1408 #if !defined TCP_SNDQUEUELOWAT || defined __DOXYGEN__
1409 #define TCP_SNDQUEUELOWAT               LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
1410 #endif
1411 
1412 /**
1413  * TCP_OOSEQ_MAX_BYTES: The default maximum number of bytes queued on ooseq per
1414  * pcb if TCP_OOSEQ_BYTES_LIMIT is not defined. Default is 0 (no limit).
1415  * Only valid for TCP_QUEUE_OOSEQ==1.
1416  */
1417 #if !defined TCP_OOSEQ_MAX_BYTES || defined __DOXYGEN__
1418 #define TCP_OOSEQ_MAX_BYTES             0
1419 #endif
1420 
1421 /**
1422  * TCP_OOSEQ_BYTES_LIMIT(pcb): Return the maximum number of bytes to be queued
1423  * on ooseq per pcb, given the pcb. Only valid for TCP_QUEUE_OOSEQ==1 &&
1424  * TCP_OOSEQ_MAX_BYTES==1.
1425  * Use this to override TCP_OOSEQ_MAX_BYTES to a dynamic value per pcb.
1426  */
1427 #if !defined TCP_OOSEQ_BYTES_LIMIT
1428 #if TCP_OOSEQ_MAX_BYTES
1429 #define TCP_OOSEQ_BYTES_LIMIT(pcb)      TCP_OOSEQ_MAX_BYTES
1430 #elif defined __DOXYGEN__
1431 #define TCP_OOSEQ_BYTES_LIMIT(pcb)
1432 #endif
1433 #endif
1434 
1435 /**
1436  * TCP_OOSEQ_MAX_PBUFS: The default maximum number of pbufs queued on ooseq per
1437  * pcb if TCP_OOSEQ_BYTES_LIMIT is not defined. Default is 0 (no limit).
1438  * Only valid for TCP_QUEUE_OOSEQ==1.
1439  */
1440 #if !defined TCP_OOSEQ_MAX_PBUFS || defined __DOXYGEN__
1441 #define TCP_OOSEQ_MAX_PBUFS             0
1442 #endif
1443 
1444 /**
1445  * TCP_OOSEQ_PBUFS_LIMIT(pcb): Return the maximum number of pbufs to be queued
1446  * on ooseq per pcb, given the pcb.  Only valid for TCP_QUEUE_OOSEQ==1 &&
1447  * TCP_OOSEQ_MAX_PBUFS==1.
1448  * Use this to override TCP_OOSEQ_MAX_PBUFS to a dynamic value per pcb.
1449  */
1450 #if !defined TCP_OOSEQ_PBUFS_LIMIT
1451 #if TCP_OOSEQ_MAX_PBUFS
1452 #define TCP_OOSEQ_PBUFS_LIMIT(pcb)      TCP_OOSEQ_MAX_PBUFS
1453 #elif defined __DOXYGEN__
1454 #define TCP_OOSEQ_PBUFS_LIMIT(pcb)
1455 #endif
1456 #endif
1457 
1458 /**
1459  * TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
1460  */
1461 #if !defined TCP_LISTEN_BACKLOG || defined __DOXYGEN__
1462 #define TCP_LISTEN_BACKLOG              0
1463 #endif
1464 
1465 /**
1466  * The maximum allowed backlog for TCP listen netconns.
1467  * This backlog is used unless another is explicitly specified.
1468  * 0xff is the maximum (u8_t).
1469  */
1470 #if !defined TCP_DEFAULT_LISTEN_BACKLOG || defined __DOXYGEN__
1471 #define TCP_DEFAULT_LISTEN_BACKLOG      0xff
1472 #endif
1473 
1474 /**
1475  * TCP_OVERSIZE: The maximum number of bytes that tcp_write may
1476  * allocate ahead of time in an attempt to create shorter pbuf chains
1477  * for transmission. The meaningful range is 0 to TCP_MSS. Some
1478  * suggested values are:
1479  *
1480  * 0:         Disable oversized allocation. Each tcp_write() allocates a new
1481               pbuf (old behaviour).
1482  * 1:         Allocate size-aligned pbufs with minimal excess. Use this if your
1483  *            scatter-gather DMA requires aligned fragments.
1484  * 128:       Limit the pbuf/memory overhead to 20%.
1485  * TCP_MSS:   Try to create unfragmented TCP packets.
1486  * TCP_MSS/4: Try to create 4 fragments or less per TCP packet.
1487  */
1488 #if !defined TCP_OVERSIZE || defined __DOXYGEN__
1489 #define TCP_OVERSIZE                    TCP_MSS
1490 #endif
1491 
1492 /**
1493  * LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option.
1494  * The timestamp option is currently only used to help remote hosts, it is not
1495  * really used locally. Therefore, it is only enabled when a TS option is
1496  * received in the initial SYN packet from a remote host.
1497  */
1498 #if !defined LWIP_TCP_TIMESTAMPS || defined __DOXYGEN__
1499 #define LWIP_TCP_TIMESTAMPS             0
1500 #endif
1501 
1502 /**
1503  * TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an
1504  * explicit window update
1505  */
1506 #if !defined TCP_WND_UPDATE_THRESHOLD || defined __DOXYGEN__
1507 #define TCP_WND_UPDATE_THRESHOLD        LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4))
1508 #endif
1509 
1510 /**
1511  * LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1.
1512  *     LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all
1513  *         events (accept, sent, etc) that happen in the system.
1514  *     LWIP_CALLBACK_API==1: The PCB callback function is called directly
1515  *         for the event. This is the default.
1516  */
1517 #if !defined(LWIP_EVENT_API) && !defined(LWIP_CALLBACK_API) || defined __DOXYGEN__
1518 #define LWIP_EVENT_API                  0
1519 #define LWIP_CALLBACK_API               1
1520 #else
1521 #ifndef LWIP_EVENT_API
1522 #define LWIP_EVENT_API                  0
1523 #endif
1524 #ifndef LWIP_CALLBACK_API
1525 #define LWIP_CALLBACK_API               0
1526 #endif
1527 #endif
1528 
1529 /**
1530  * LWIP_WND_SCALE and TCP_RCV_SCALE:
1531  * Set LWIP_WND_SCALE to 1 to enable window scaling.
1532  * Set TCP_RCV_SCALE to the desired scaling factor (shift count in the
1533  * range of [0..14]).
1534  * When LWIP_WND_SCALE is enabled but TCP_RCV_SCALE is 0, we can use a large
1535  * send window while having a small receive window only.
1536  */
1537 #if !defined LWIP_WND_SCALE || defined __DOXYGEN__
1538 #define LWIP_WND_SCALE                  0
1539 #define TCP_RCV_SCALE                   0
1540 #endif
1541 
1542 /**
1543  * LWIP_TCP_PCB_NUM_EXT_ARGS:
1544  * When this is > 0, every tcp pcb (including listen pcb) includes a number of
1545  * additional argument entries in an array (see tcp_ext_arg_alloc_id)
1546  */
1547 #if !defined LWIP_TCP_PCB_NUM_EXT_ARGS || defined __DOXYGEN__
1548 #define LWIP_TCP_PCB_NUM_EXT_ARGS       0
1549 #endif
1550 
1551 /** LWIP_ALTCP==1: enable the altcp API.
1552  * altcp is an abstraction layer that prevents applications linking against the
1553  * tcp.h functions but provides the same functionality. It is used to e.g. add
1554  * SSL/TLS or proxy-connect support to an application written for the tcp callback
1555  * API without that application knowing the protocol details.
1556  *
1557  * With LWIP_ALTCP==0, applications written against the altcp API can still be
1558  * compiled but are directly linked against the tcp.h callback API and then
1559  * cannot use layered protocols.
1560  *
1561  * See @ref altcp_api
1562  */
1563 #if !defined LWIP_ALTCP || defined __DOXYGEN__
1564 #define LWIP_ALTCP                      0
1565 #endif
1566 
1567 /** LWIP_ALTCP_TLS==1: enable TLS support for altcp API.
1568  * This needs a port of the functions in altcp_tls.h to a TLS library.
1569  * A port to ARM mbedtls is provided with lwIP, see apps/altcp_tls/ directory
1570  * and LWIP_ALTCP_TLS_MBEDTLS option.
1571  */
1572 #if !defined LWIP_ALTCP_TLS || defined __DOXYGEN__
1573 #define LWIP_ALTCP_TLS                  0
1574 #endif
1575 
1576 /**
1577  * @}
1578  */
1579 
1580 /*
1581    ----------------------------------
1582    ---------- Pbuf options ----------
1583    ----------------------------------
1584 */
1585 /**
1586  * @defgroup lwip_opts_pbuf PBUF
1587  * @ingroup lwip_opts
1588  * @{
1589  */
1590 /**
1591  * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
1592  * link level header. The default is 14, the standard value for
1593  * Ethernet.
1594  */
1595  #if !defined PBUF_LINK_HLEN || defined __DOXYGEN__
1596 #if (defined LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP) && !defined __DOXYGEN__
1597  #define PBUF_LINK_HLEN                  (18 + ETH_PAD_SIZE)
1598 #else /* LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP */
1599  #define PBUF_LINK_HLEN                  (14 + ETH_PAD_SIZE)
1600 #endif /* LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP */
1601  #endif
1602 
1603 /**
1604  * PBUF_LINK_ENCAPSULATION_HLEN: the number of bytes that should be allocated
1605  * for an additional encapsulation header before ethernet headers (e.g. 802.11)
1606  */
1607 #if !defined PBUF_LINK_ENCAPSULATION_HLEN || defined __DOXYGEN__
1608 #define PBUF_LINK_ENCAPSULATION_HLEN    0
1609 #endif
1610 
1611 /**
1612  * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
1613  * designed to accommodate single full size TCP frame in one pbuf, including
1614  * TCP_MSS, IP header, and link header.
1615  */
1616 #if !defined PBUF_POOL_BUFSIZE || defined __DOXYGEN__
1617 #define PBUF_POOL_BUFSIZE               LWIP_MEM_ALIGN_SIZE(TCP_MSS+PBUF_IP_HLEN+PBUF_TRANSPORT_HLEN+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
1618 #endif
1619 
1620 /**
1621  * LWIP_PBUF_REF_T: Refcount type in pbuf.
1622  * Default width of u8_t can be increased if 255 refs are not enough for you.
1623  */
1624 #if !defined LWIP_PBUF_REF_T || defined __DOXYGEN__
1625 #define LWIP_PBUF_REF_T                 u8_t
1626 #endif
1627 
1628 /**
1629  * LWIP_PBUF_CUSTOM_DATA: Store private data on pbufs (e.g. timestamps)
1630  * This extends struct pbuf so user can store custom data on every pbuf.
1631  * e.g.:
1632  *  \#define LWIP_PBUF_CUSTOM_DATA   u32_t myref;
1633  */
1634 #if !defined LWIP_PBUF_CUSTOM_DATA || defined __DOXYGEN__
1635 #define LWIP_PBUF_CUSTOM_DATA
1636 #endif
1637 
1638 /**
1639  * LWIP_PBUF_CUSTOM_DATA_INIT: Initialize private data on pbufs.
1640  * e.g. for the above example definition:
1641  *  \#define LWIP_PBUF_CUSTOM_DATA(p) (p)->myref = 0
1642  */
1643 #if !defined LWIP_PBUF_CUSTOM_DATA_INIT || defined __DOXYGEN__
1644 #define LWIP_PBUF_CUSTOM_DATA_INIT(p)
1645 #endif
1646 
1647 /**
1648  * @}
1649  */
1650 
1651 /*
1652    ------------------------------------------------
1653    ---------- Network Interfaces options ----------
1654    ------------------------------------------------
1655 */
1656 /**
1657  * @defgroup lwip_opts_netif NETIF
1658  * @ingroup lwip_opts
1659  * @{
1660  */
1661 /**
1662  * LWIP_SINGLE_NETIF==1: use a single netif only. This is the common case for
1663  * small real-life targets. Some code like routing etc. can be left out.
1664  */
1665 #if !defined LWIP_SINGLE_NETIF || defined __DOXYGEN__
1666 #define LWIP_SINGLE_NETIF               0
1667 #endif
1668 
1669 /**
1670  * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname
1671  * field.
1672  */
1673 #if !defined LWIP_NETIF_HOSTNAME || defined __DOXYGEN__
1674 #define LWIP_NETIF_HOSTNAME             0
1675 #endif
1676 
1677 /**
1678  * LWIP_NETIF_API==1: Support netif api (in netifapi.c)
1679  */
1680 #if !defined LWIP_NETIF_API || defined __DOXYGEN__
1681 #define LWIP_NETIF_API                  0
1682 #endif
1683 
1684 /**
1685  * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
1686  * changes its up/down status (i.e., due to DHCP IP acquisition)
1687  */
1688 #if !defined LWIP_NETIF_STATUS_CALLBACK || defined __DOXYGEN__
1689 #define LWIP_NETIF_STATUS_CALLBACK      0
1690 #endif
1691 
1692 /**
1693  * LWIP_NETIF_EXT_STATUS_CALLBACK==1: Support an extended callback function
1694  * for several netif related event that supports multiple subscribers.
1695  * @see netif_ext_status_callback
1696  */
1697 #if !defined LWIP_NETIF_EXT_STATUS_CALLBACK || defined __DOXYGEN__
1698 #define LWIP_NETIF_EXT_STATUS_CALLBACK  0
1699 #endif
1700 
1701 /**
1702  * LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
1703  * whenever the link changes (i.e., link down)
1704  */
1705 #if !defined LWIP_NETIF_LINK_CALLBACK || defined __DOXYGEN__
1706 #define LWIP_NETIF_LINK_CALLBACK        0
1707 #endif
1708 
1709 /**
1710  * LWIP_NETIF_REMOVE_CALLBACK==1: Support a callback function that is called
1711  * when a netif has been removed
1712  */
1713 #if !defined LWIP_NETIF_REMOVE_CALLBACK || defined __DOXYGEN__
1714 #define LWIP_NETIF_REMOVE_CALLBACK      0
1715 #endif
1716 
1717 /**
1718  * LWIP_NETIF_HWADDRHINT==1: Cache link-layer-address hints (e.g. table
1719  * indices) in struct netif. TCP and UDP can make use of this to prevent
1720  * scanning the ARP table for every sent packet. While this is faster for big
1721  * ARP tables or many concurrent connections, it might be counterproductive
1722  * if you have a tiny ARP table or if there never are concurrent connections.
1723  */
1724 #if !defined LWIP_NETIF_HWADDRHINT || defined __DOXYGEN__
1725 #define LWIP_NETIF_HWADDRHINT           0
1726 #endif
1727 
1728 /**
1729  * LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP *tries* to put all data
1730  * to be sent into one single pbuf. This is for compatibility with DMA-enabled
1731  * MACs that do not support scatter-gather.
1732  * Beware that this might involve CPU-memcpy before transmitting that would not
1733  * be needed without this flag! Use this only if you need to!
1734  *
1735  * ATTENTION: a driver should *NOT* rely on getting single pbufs but check TX
1736  * pbufs for being in one piece. If not, @ref pbuf_clone can be used to get
1737  * a single pbuf:
1738  *   if (p->next != NULL) {
1739  *     struct pbuf *q = pbuf_clone(PBUF_RAW, PBUF_RAM, p);
1740  *     if (q == NULL) {
1741  *       return ERR_MEM;
1742  *     }
1743  *     p = q; ATTENTION: do NOT free the old 'p' as the ref belongs to the caller!
1744  *   }
1745  */
1746 #if !defined LWIP_NETIF_TX_SINGLE_PBUF || defined __DOXYGEN__
1747 #define LWIP_NETIF_TX_SINGLE_PBUF       0
1748 #endif /* LWIP_NETIF_TX_SINGLE_PBUF */
1749 
1750 /**
1751  * LWIP_NUM_NETIF_CLIENT_DATA: Number of clients that may store
1752  * data in client_data member array of struct netif (max. 256).
1753  */
1754 #if !defined LWIP_NUM_NETIF_CLIENT_DATA || defined __DOXYGEN__
1755 #define LWIP_NUM_NETIF_CLIENT_DATA      0
1756 #endif
1757 /**
1758  * @}
1759  */
1760 
1761 /*
1762    ------------------------------------
1763    ---------- LOOPIF options ----------
1764    ------------------------------------
1765 */
1766 /**
1767  * @defgroup lwip_opts_loop Loopback interface
1768  * @ingroup lwip_opts_netif
1769  * @{
1770  */
1771 /**
1772  * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1).
1773  * This is only needed when no real netifs are available. If at least one other
1774  * netif is available, loopback traffic uses this netif.
1775  */
1776 #if !defined LWIP_HAVE_LOOPIF || defined __DOXYGEN__
1777 #define LWIP_HAVE_LOOPIF                (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF)
1778 #endif
1779 
1780 /**
1781  * LWIP_LOOPIF_MULTICAST==1: Support multicast/IGMP on loop interface (127.0.0.1).
1782  */
1783 #if !defined LWIP_LOOPIF_MULTICAST || defined __DOXYGEN__
1784 #define LWIP_LOOPIF_MULTICAST           0
1785 #endif
1786 
1787 /**
1788  * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP
1789  * address equal to the netif IP address, looping them back up the stack.
1790  */
1791 #if !defined LWIP_NETIF_LOOPBACK || defined __DOXYGEN__
1792 #define LWIP_NETIF_LOOPBACK             0
1793 #endif
1794 
1795 /**
1796  * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback
1797  * sending for each netif (0 = disabled)
1798  */
1799 #if !defined LWIP_LOOPBACK_MAX_PBUFS || defined __DOXYGEN__
1800 #define LWIP_LOOPBACK_MAX_PBUFS         0
1801 #endif
1802 
1803 /**
1804  * LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in
1805  * the system, as netifs must change how they behave depending on this setting
1806  * for the LWIP_NETIF_LOOPBACK option to work.
1807  * Setting this is needed to avoid reentering non-reentrant functions like
1808  * tcp_input().
1809  *    LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a
1810  *       multithreaded environment like tcpip.c. In this case, netif->input()
1811  *       is called directly.
1812  *    LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup.
1813  *       The packets are put on a list and netif_poll() must be called in
1814  *       the main application loop.
1815  */
1816 #if !defined LWIP_NETIF_LOOPBACK_MULTITHREADING || defined __DOXYGEN__
1817 #define LWIP_NETIF_LOOPBACK_MULTITHREADING    (!NO_SYS)
1818 #endif
1819 /**
1820  * @}
1821  */
1822 
1823 /*
1824    ------------------------------------
1825    ---------- Thread options ----------
1826    ------------------------------------
1827 */
1828 /**
1829  * @defgroup lwip_opts_thread Threading
1830  * @ingroup lwip_opts_infrastructure
1831  * @{
1832  */
1833 /**
1834  * TCPIP_THREAD_NAME: The name assigned to the main tcpip thread.
1835  */
1836 #if !defined TCPIP_THREAD_NAME || defined __DOXYGEN__
1837 #define TCPIP_THREAD_NAME               "tcpip_thread"
1838 #endif
1839 
1840 /**
1841  * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
1842  * The stack size value itself is platform-dependent, but is passed to
1843  * sys_thread_new() when the thread is created.
1844  */
1845 #if !defined TCPIP_THREAD_STACKSIZE || defined __DOXYGEN__
1846 #define TCPIP_THREAD_STACKSIZE          0
1847 #endif
1848 
1849 /**
1850  * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
1851  * The priority value itself is platform-dependent, but is passed to
1852  * sys_thread_new() when the thread is created.
1853  */
1854 #if !defined TCPIP_THREAD_PRIO || defined __DOXYGEN__
1855 #define TCPIP_THREAD_PRIO               1
1856 #endif
1857 
1858 /**
1859  * TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
1860  * The queue size value itself is platform-dependent, but is passed to
1861  * sys_mbox_new() when tcpip_init is called.
1862  */
1863 #if !defined TCPIP_MBOX_SIZE || defined __DOXYGEN__
1864 #define TCPIP_MBOX_SIZE                 0
1865 #endif
1866 
1867 /**
1868  * Define this to something that triggers a watchdog. This is called from
1869  * tcpip_thread after processing a message.
1870  */
1871 #if !defined LWIP_TCPIP_THREAD_ALIVE || defined __DOXYGEN__
1872 #define LWIP_TCPIP_THREAD_ALIVE()
1873 #endif
1874 
1875 /**
1876  * SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread.
1877  */
1878 #if !defined SLIPIF_THREAD_NAME || defined __DOXYGEN__
1879 #define SLIPIF_THREAD_NAME              "slipif_loop"
1880 #endif
1881 
1882 /**
1883  * SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread.
1884  * The stack size value itself is platform-dependent, but is passed to
1885  * sys_thread_new() when the thread is created.
1886  */
1887 #if !defined SLIPIF_THREAD_STACKSIZE || defined __DOXYGEN__
1888 #define SLIPIF_THREAD_STACKSIZE         0
1889 #endif
1890 
1891 /**
1892  * SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread.
1893  * The priority value itself is platform-dependent, but is passed to
1894  * sys_thread_new() when the thread is created.
1895  */
1896 #if !defined SLIPIF_THREAD_PRIO || defined __DOXYGEN__
1897 #define SLIPIF_THREAD_PRIO              1
1898 #endif
1899 
1900 /**
1901  * DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread.
1902  */
1903 #if !defined DEFAULT_THREAD_NAME || defined __DOXYGEN__
1904 #define DEFAULT_THREAD_NAME             "lwIP"
1905 #endif
1906 
1907 /**
1908  * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
1909  * The stack size value itself is platform-dependent, but is passed to
1910  * sys_thread_new() when the thread is created.
1911  */
1912 #if !defined DEFAULT_THREAD_STACKSIZE || defined __DOXYGEN__
1913 #define DEFAULT_THREAD_STACKSIZE        0
1914 #endif
1915 
1916 /**
1917  * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread.
1918  * The priority value itself is platform-dependent, but is passed to
1919  * sys_thread_new() when the thread is created.
1920  */
1921 #if !defined DEFAULT_THREAD_PRIO || defined __DOXYGEN__
1922 #define DEFAULT_THREAD_PRIO             1
1923 #endif
1924 
1925 /**
1926  * DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
1927  * NETCONN_RAW. The queue size value itself is platform-dependent, but is passed
1928  * to sys_mbox_new() when the recvmbox is created.
1929  */
1930 #if !defined DEFAULT_RAW_RECVMBOX_SIZE || defined __DOXYGEN__
1931 #define DEFAULT_RAW_RECVMBOX_SIZE       0
1932 #endif
1933 
1934 /**
1935  * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
1936  * NETCONN_UDP. The queue size value itself is platform-dependent, but is passed
1937  * to sys_mbox_new() when the recvmbox is created.
1938  */
1939 #if !defined DEFAULT_UDP_RECVMBOX_SIZE || defined __DOXYGEN__
1940 #define DEFAULT_UDP_RECVMBOX_SIZE       0
1941 #endif
1942 
1943 /**
1944  * DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
1945  * NETCONN_TCP. The queue size value itself is platform-dependent, but is passed
1946  * to sys_mbox_new() when the recvmbox is created.
1947  */
1948 #if !defined DEFAULT_TCP_RECVMBOX_SIZE || defined __DOXYGEN__
1949 #define DEFAULT_TCP_RECVMBOX_SIZE       0
1950 #endif
1951 
1952 /**
1953  * DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections.
1954  * The queue size value itself is platform-dependent, but is passed to
1955  * sys_mbox_new() when the acceptmbox is created.
1956  */
1957 #if !defined DEFAULT_ACCEPTMBOX_SIZE || defined __DOXYGEN__
1958 #define DEFAULT_ACCEPTMBOX_SIZE         0
1959 #endif
1960 /**
1961  * @}
1962  */
1963 
1964 /*
1965    ----------------------------------------------
1966    ---------- Sequential layer options ----------
1967    ----------------------------------------------
1968 */
1969 /**
1970  * @defgroup lwip_opts_netconn Netconn
1971  * @ingroup lwip_opts_threadsafe_apis
1972  * @{
1973  */
1974 /**
1975  * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
1976  */
1977 #if !defined LWIP_NETCONN || defined __DOXYGEN__
1978 #define LWIP_NETCONN                    1
1979 #endif
1980 
1981 /** LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout to create
1982  * timers running in tcpip_thread from another thread.
1983  */
1984 #if !defined LWIP_TCPIP_TIMEOUT || defined __DOXYGEN__
1985 #define LWIP_TCPIP_TIMEOUT              0
1986 #endif
1987 
1988 /** LWIP_NETCONN_SEM_PER_THREAD==1: Use one (thread-local) semaphore per
1989  * thread calling socket/netconn functions instead of allocating one
1990  * semaphore per netconn (and per select etc.)
1991  * ATTENTION: a thread-local semaphore for API calls is needed:
1992  * - LWIP_NETCONN_THREAD_SEM_GET() returning a sys_sem_t*
1993  * - LWIP_NETCONN_THREAD_SEM_ALLOC() creating the semaphore
1994  * - LWIP_NETCONN_THREAD_SEM_FREE() freeing the semaphore
1995  * The latter 2 can be invoked up by calling netconn_thread_init()/netconn_thread_cleanup().
1996  * Ports may call these for threads created with sys_thread_new().
1997  */
1998 #if !defined LWIP_NETCONN_SEM_PER_THREAD || defined __DOXYGEN__
1999 #define LWIP_NETCONN_SEM_PER_THREAD     0
2000 #endif
2001 
2002 /** LWIP_NETCONN_FULLDUPLEX==1: Enable code that allows reading from one thread,
2003  * writing from a 2nd thread and closing from a 3rd thread at the same time.
2004  * LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from
2005  * multiple threads at once!
2006  */
2007 #if !defined LWIP_NETCONN_FULLDUPLEX || defined __DOXYGEN__
2008 #define LWIP_NETCONN_FULLDUPLEX         0
2009 #endif
2010 /**
2011  * @}
2012  */
2013 
2014 /*
2015    ------------------------------------
2016    ---------- Socket options ----------
2017    ------------------------------------
2018 */
2019 /**
2020  * @defgroup lwip_opts_socket Sockets
2021  * @ingroup lwip_opts_threadsafe_apis
2022  * @{
2023  */
2024 /**
2025  * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
2026  */
2027 #if !defined LWIP_SOCKET || defined __DOXYGEN__
2028 #define LWIP_SOCKET                     1
2029 #endif
2030 
2031 /**
2032  * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names through defines.
2033  * LWIP_COMPAT_SOCKETS==2: Same as ==1 but correctly named functions are created.
2034  * While this helps code completion, it might conflict with existing libraries.
2035  * (only used if you use sockets.c)
2036  */
2037 #if !defined LWIP_COMPAT_SOCKETS || defined __DOXYGEN__
2038 #define LWIP_COMPAT_SOCKETS             1
2039 #endif
2040 
2041 /**
2042  * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names.
2043  * Disable this option if you use a POSIX operating system that uses the same
2044  * names (read, write & close). (only used if you use sockets.c)
2045  */
2046 #if !defined LWIP_POSIX_SOCKETS_IO_NAMES || defined __DOXYGEN__
2047 #define LWIP_POSIX_SOCKETS_IO_NAMES     1
2048 #endif
2049 
2050 /**
2051  * LWIP_SOCKET_OFFSET==n: Increases the file descriptor number created by LwIP with n.
2052  * This can be useful when there are multiple APIs which create file descriptors.
2053  * When they all start with a different offset and you won't make them overlap you can
2054  * re implement read/write/close/ioctl/fnctl to send the requested action to the right
2055  * library (sharing select will need more work though).
2056  */
2057 #if !defined LWIP_SOCKET_OFFSET || defined __DOXYGEN__
2058 #define LWIP_SOCKET_OFFSET              0
2059 #endif
2060 
2061 /**
2062  * LWIP_SOCKET_EXTERNAL_HEADERS==1: Use external headers instead of sockets.h
2063  * and inet.h. In this case, user must provide its own headers by setting the
2064  * values for LWIP_SOCKET_EXTERNAL_HEADER_SOCKETS_H and
2065  * LWIP_SOCKET_EXTERNAL_HEADER_INET_H to appropriate include file names and the
2066  * whole content of the default sockets.h and inet.h is skipped.
2067  */
2068 #if !defined LWIP_SOCKET_EXTERNAL_HEADERS || defined __DOXYGEN__
2069 #define LWIP_SOCKET_EXTERNAL_HEADERS    0
2070 #endif
2071 
2072 /**
2073  * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT
2074  * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set
2075  * in seconds. (does not require sockets.c, and will affect tcp.c)
2076  */
2077 #if !defined LWIP_TCP_KEEPALIVE || defined __DOXYGEN__
2078 #define LWIP_TCP_KEEPALIVE              0
2079 #endif
2080 
2081 /**
2082  * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and
2083  * SO_SNDTIMEO processing.
2084  */
2085 #if !defined LWIP_SO_SNDTIMEO || defined __DOXYGEN__
2086 #define LWIP_SO_SNDTIMEO                0
2087 #endif
2088 
2089 /**
2090  * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and
2091  * SO_RCVTIMEO processing.
2092  */
2093 #if !defined LWIP_SO_RCVTIMEO || defined __DOXYGEN__
2094 #define LWIP_SO_RCVTIMEO                0
2095 #endif
2096 
2097 /**
2098  * LWIP_SO_SNDRCVTIMEO_NONSTANDARD==1: SO_RCVTIMEO/SO_SNDTIMEO take an int
2099  * (milliseconds, much like winsock does) instead of a struct timeval (default).
2100  */
2101 #if !defined LWIP_SO_SNDRCVTIMEO_NONSTANDARD || defined __DOXYGEN__
2102 #define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0
2103 #endif
2104 
2105 /**
2106  * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
2107  */
2108 #if !defined LWIP_SO_RCVBUF || defined __DOXYGEN__
2109 #define LWIP_SO_RCVBUF                  0
2110 #endif
2111 
2112 /**
2113  * LWIP_SO_LINGER==1: Enable SO_LINGER processing.
2114  */
2115 #if !defined LWIP_SO_LINGER || defined __DOXYGEN__
2116 #define LWIP_SO_LINGER                  0
2117 #endif
2118 
2119 /**
2120  * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize.
2121  */
2122 #if !defined RECV_BUFSIZE_DEFAULT || defined __DOXYGEN__
2123 #define RECV_BUFSIZE_DEFAULT            INT_MAX
2124 #endif
2125 
2126 /**
2127  * By default, TCP socket/netconn close waits 20 seconds max to send the FIN
2128  */
2129 #if !defined LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT || defined __DOXYGEN__
2130 #define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000
2131 #endif
2132 
2133 /**
2134  * SO_REUSE==1: Enable SO_REUSEADDR option.
2135  */
2136 #if !defined SO_REUSE || defined __DOXYGEN__
2137 #define SO_REUSE                        0
2138 #endif
2139 
2140 /**
2141  * SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets
2142  * to all local matches if SO_REUSEADDR is turned on.
2143  * WARNING: Adds a memcpy for every packet if passing to more than one pcb!
2144  */
2145 #if !defined SO_REUSE_RXTOALL || defined __DOXYGEN__
2146 #define SO_REUSE_RXTOALL                0
2147 #endif
2148 
2149 /**
2150  * LWIP_FIONREAD_LINUXMODE==0 (default): ioctl/FIONREAD returns the amount of
2151  * pending data in the network buffer. This is the way windows does it. It's
2152  * the default for lwIP since it is smaller.
2153  * LWIP_FIONREAD_LINUXMODE==1: ioctl/FIONREAD returns the size of the next
2154  * pending datagram in bytes. This is the way linux does it. This code is only
2155  * here for compatibility.
2156  */
2157 #if !defined LWIP_FIONREAD_LINUXMODE || defined __DOXYGEN__
2158 #define LWIP_FIONREAD_LINUXMODE         0
2159 #endif
2160 
2161 /**
2162  * LWIP_SOCKET_SELECT==1 (default): enable select() for sockets (uses a netconn
2163  * callback to keep track of events).
2164  * This saves RAM (counters per socket) and code (netconn event callback), which
2165  * should improve performance a bit).
2166  */
2167 #if !defined LWIP_SOCKET_SELECT || defined __DOXYGEN__
2168 #define LWIP_SOCKET_SELECT              1
2169 #endif
2170 
2171 /**
2172  * LWIP_SOCKET_POLL==1 (default): enable poll() for sockets (including
2173  * struct pollfd, nfds_t, and constants)
2174  */
2175 #if !defined LWIP_SOCKET_POLL || defined __DOXYGEN__
2176 #define LWIP_SOCKET_POLL                1
2177 #endif
2178 /**
2179  * @}
2180  */
2181 
2182 /*
2183    ----------------------------------------
2184    ---------- Statistics options ----------
2185    ----------------------------------------
2186 */
2187 /**
2188  * @defgroup lwip_opts_stats Statistics
2189  * @ingroup lwip_opts_debug
2190  * @{
2191  */
2192 /**
2193  * LWIP_STATS==1: Enable statistics collection in lwip_stats.
2194  */
2195 #if !defined LWIP_STATS || defined __DOXYGEN__
2196 #define LWIP_STATS                      1
2197 #endif
2198 
2199 #if LWIP_STATS
2200 
2201 /**
2202  * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions.
2203  */
2204 #if !defined LWIP_STATS_DISPLAY || defined __DOXYGEN__
2205 #define LWIP_STATS_DISPLAY              0
2206 #endif
2207 
2208 /**
2209  * LINK_STATS==1: Enable link stats.
2210  */
2211 #if !defined LINK_STATS || defined __DOXYGEN__
2212 #define LINK_STATS                      1
2213 #endif
2214 
2215 /**
2216  * ETHARP_STATS==1: Enable etharp stats.
2217  */
2218 #if !defined ETHARP_STATS || defined __DOXYGEN__
2219 #define ETHARP_STATS                    (LWIP_ARP)
2220 #endif
2221 
2222 /**
2223  * IP_STATS==1: Enable IP stats.
2224  */
2225 #if !defined IP_STATS || defined __DOXYGEN__
2226 #define IP_STATS                        1
2227 #endif
2228 
2229 /**
2230  * IPFRAG_STATS==1: Enable IP fragmentation stats. Default is
2231  * on if using either frag or reass.
2232  */
2233 #if !defined IPFRAG_STATS || defined __DOXYGEN__
2234 #define IPFRAG_STATS                    (IP_REASSEMBLY || IP_FRAG)
2235 #endif
2236 
2237 /**
2238  * ICMP_STATS==1: Enable ICMP stats.
2239  */
2240 #if !defined ICMP_STATS || defined __DOXYGEN__
2241 #define ICMP_STATS                      1
2242 #endif
2243 
2244 /**
2245  * IGMP_STATS==1: Enable IGMP stats.
2246  */
2247 #if !defined IGMP_STATS || defined __DOXYGEN__
2248 #define IGMP_STATS                      (LWIP_IGMP)
2249 #endif
2250 
2251 /**
2252  * UDP_STATS==1: Enable UDP stats. Default is on if
2253  * UDP enabled, otherwise off.
2254  */
2255 #if !defined UDP_STATS || defined __DOXYGEN__
2256 #define UDP_STATS                       (LWIP_UDP)
2257 #endif
2258 
2259 /**
2260  * TCP_STATS==1: Enable TCP stats. Default is on if TCP
2261  * enabled, otherwise off.
2262  */
2263 #if !defined TCP_STATS || defined __DOXYGEN__
2264 #define TCP_STATS                       (LWIP_TCP)
2265 #endif
2266 
2267 /**
2268  * MEM_STATS==1: Enable mem.c stats.
2269  */
2270 #if !defined MEM_STATS || defined __DOXYGEN__
2271 #define MEM_STATS                       ((MEM_CUSTOM_ALLOCATOR == 0) && (MEM_USE_POOLS == 0))
2272 #endif
2273 
2274 /**
2275  * MEMP_STATS==1: Enable memp.c pool stats.
2276  */
2277 #if !defined MEMP_STATS || defined __DOXYGEN__
2278 #define MEMP_STATS                      (MEMP_MEM_MALLOC == 0)
2279 #endif
2280 
2281 /**
2282  * SYS_STATS==1: Enable system stats (sem and mbox counts, etc).
2283  */
2284 #if !defined SYS_STATS || defined __DOXYGEN__
2285 #define SYS_STATS                       (NO_SYS == 0)
2286 #endif
2287 
2288 /**
2289  * IP6_STATS==1: Enable IPv6 stats.
2290  */
2291 #if !defined IP6_STATS || defined __DOXYGEN__
2292 #define IP6_STATS                       (LWIP_IPV6)
2293 #endif
2294 
2295 /**
2296  * ICMP6_STATS==1: Enable ICMP for IPv6 stats.
2297  */
2298 #if !defined ICMP6_STATS || defined __DOXYGEN__
2299 #define ICMP6_STATS                     (LWIP_IPV6 && LWIP_ICMP6)
2300 #endif
2301 
2302 /**
2303  * IP6_FRAG_STATS==1: Enable IPv6 fragmentation stats.
2304  */
2305 #if !defined IP6_FRAG_STATS || defined __DOXYGEN__
2306 #define IP6_FRAG_STATS                  (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS))
2307 #endif
2308 
2309 /**
2310  * MLD6_STATS==1: Enable MLD for IPv6 stats.
2311  */
2312 #if !defined MLD6_STATS || defined __DOXYGEN__
2313 #define MLD6_STATS                      (LWIP_IPV6 && LWIP_IPV6_MLD)
2314 #endif
2315 
2316 /**
2317  * ND6_STATS==1: Enable Neighbor discovery for IPv6 stats.
2318  */
2319 #if !defined ND6_STATS || defined __DOXYGEN__
2320 #define ND6_STATS                       (LWIP_IPV6)
2321 #endif
2322 
2323 /**
2324  * MIB2_STATS==1: Stats for SNMP MIB2.
2325  */
2326 #if !defined MIB2_STATS || defined __DOXYGEN__
2327 #define MIB2_STATS                      0
2328 #endif
2329 
2330 #else
2331 
2332 #define LINK_STATS                      0
2333 #define ETHARP_STATS                    0
2334 #define IP_STATS                        0
2335 #define IPFRAG_STATS                    0
2336 #define ICMP_STATS                      0
2337 #define IGMP_STATS                      0
2338 #define UDP_STATS                       0
2339 #define TCP_STATS                       0
2340 #define MEM_STATS                       0
2341 #define MEMP_STATS                      0
2342 #define SYS_STATS                       0
2343 #define LWIP_STATS_DISPLAY              0
2344 #define IP6_STATS                       0
2345 #define ICMP6_STATS                     0
2346 #define IP6_FRAG_STATS                  0
2347 #define MLD6_STATS                      0
2348 #define ND6_STATS                       0
2349 #define MIB2_STATS                      0
2350 
2351 #endif /* LWIP_STATS */
2352 /**
2353  * @}
2354  */
2355 
2356 /*
2357    --------------------------------------
2358    ---------- Checksum options ----------
2359    --------------------------------------
2360 */
2361 /**
2362  * @defgroup lwip_opts_checksum Checksum
2363  * @ingroup lwip_opts_infrastructure
2364  * @{
2365  */
2366 /**
2367  * LWIP_CHECKSUM_CTRL_PER_NETIF==1: Checksum generation/check can be enabled/disabled
2368  * per netif.
2369  * ATTENTION: if enabled, the CHECKSUM_GEN_* and CHECKSUM_CHECK_* defines must be enabled!
2370  */
2371 #if !defined LWIP_CHECKSUM_CTRL_PER_NETIF || defined __DOXYGEN__
2372 #define LWIP_CHECKSUM_CTRL_PER_NETIF    0
2373 #endif
2374 
2375 /**
2376  * CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.
2377  */
2378 #if !defined CHECKSUM_GEN_IP || defined __DOXYGEN__
2379 #define CHECKSUM_GEN_IP                 1
2380 #endif
2381 
2382 /**
2383  * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.
2384  */
2385 #if !defined CHECKSUM_GEN_UDP || defined __DOXYGEN__
2386 #define CHECKSUM_GEN_UDP                1
2387 #endif
2388 
2389 /**
2390  * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.
2391  */
2392 #if !defined CHECKSUM_GEN_TCP || defined __DOXYGEN__
2393 #define CHECKSUM_GEN_TCP                1
2394 #endif
2395 
2396 /**
2397  * CHECKSUM_GEN_ICMP==1: Generate checksums in software for outgoing ICMP packets.
2398  */
2399 #if !defined CHECKSUM_GEN_ICMP || defined __DOXYGEN__
2400 #define CHECKSUM_GEN_ICMP               1
2401 #endif
2402 
2403 /**
2404  * CHECKSUM_GEN_ICMP6==1: Generate checksums in software for outgoing ICMP6 packets.
2405  */
2406 #if !defined CHECKSUM_GEN_ICMP6 || defined __DOXYGEN__
2407 #define CHECKSUM_GEN_ICMP6              1
2408 #endif
2409 
2410 /**
2411  * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
2412  */
2413 #if !defined CHECKSUM_CHECK_IP || defined __DOXYGEN__
2414 #define CHECKSUM_CHECK_IP               1
2415 #endif
2416 
2417 /**
2418  * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
2419  */
2420 #if !defined CHECKSUM_CHECK_UDP || defined __DOXYGEN__
2421 #define CHECKSUM_CHECK_UDP              1
2422 #endif
2423 
2424 /**
2425  * CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.
2426  */
2427 #if !defined CHECKSUM_CHECK_TCP || defined __DOXYGEN__
2428 #define CHECKSUM_CHECK_TCP              1
2429 #endif
2430 
2431 /**
2432  * CHECKSUM_CHECK_ICMP==1: Check checksums in software for incoming ICMP packets.
2433  */
2434 #if !defined CHECKSUM_CHECK_ICMP || defined __DOXYGEN__
2435 #define CHECKSUM_CHECK_ICMP             1
2436 #endif
2437 
2438 /**
2439  * CHECKSUM_CHECK_ICMP6==1: Check checksums in software for incoming ICMPv6 packets
2440  */
2441 #if !defined CHECKSUM_CHECK_ICMP6 || defined __DOXYGEN__
2442 #define CHECKSUM_CHECK_ICMP6            1
2443 #endif
2444 
2445 /**
2446  * LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from
2447  * application buffers to pbufs.
2448  */
2449 #if !defined LWIP_CHECKSUM_ON_COPY || defined __DOXYGEN__
2450 #define LWIP_CHECKSUM_ON_COPY           0
2451 #endif
2452 /**
2453  * @}
2454  */
2455 
2456 /*
2457    ---------------------------------------
2458    ---------- IPv6 options ---------------
2459    ---------------------------------------
2460 */
2461 /**
2462  * @defgroup lwip_opts_ipv6 IPv6
2463  * @ingroup lwip_opts
2464  * @{
2465  */
2466 /**
2467  * LWIP_IPV6==1: Enable IPv6
2468  */
2469 #if !defined LWIP_IPV6 || defined __DOXYGEN__
2470 #define LWIP_IPV6                       0
2471 #endif
2472 
2473 /**
2474  * IPV6_REASS_MAXAGE: Maximum time (in multiples of IP6_REASS_TMR_INTERVAL - so seconds, normally)
2475  * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
2476  * in this time, the whole packet is discarded.
2477  */
2478 #if !defined IPV6_REASS_MAXAGE || defined __DOXYGEN__
2479 #define IPV6_REASS_MAXAGE               60
2480 #endif
2481 
2482 /**
2483  * LWIP_IPV6_SCOPES==1: Enable support for IPv6 address scopes, ensuring that
2484  * e.g. link-local addresses are really treated as link-local. Disable this
2485  * setting only for single-interface configurations.
2486  * All addresses that have a scope according to the default policy (link-local
2487  * unicast addresses, interface-local and link-local multicast addresses) should
2488  * now have a zone set on them before being passed to the core API, although
2489  * lwIP will currently attempt to select a zone on the caller's behalf when
2490  * necessary. Applications that directly assign IPv6 addresses to interfaces
2491  * (which is NOT recommended) must now ensure that link-local addresses carry
2492  * the netif's zone. See the new ip6_zone.h header file for more information and
2493  * relevant macros. For now it is still possible to turn off scopes support
2494  * through the new LWIP_IPV6_SCOPES option. When upgrading an implementation that
2495  * uses the core API directly, it is highly recommended to enable
2496  * LWIP_IPV6_SCOPES_DEBUG at least for a while, to ensure e.g. proper address
2497  * initialization.
2498  */
2499 #if !defined LWIP_IPV6_SCOPES || defined __DOXYGEN__
2500 #define LWIP_IPV6_SCOPES                (LWIP_IPV6 && !LWIP_SINGLE_NETIF)
2501 #endif
2502 
2503 /**
2504  * LWIP_IPV6_SCOPES_DEBUG==1: Perform run-time checks to verify that addresses
2505  * are properly zoned (see ip6_zone.h on what that means) where it matters.
2506  * Enabling this setting is highly recommended when upgrading from an existing
2507  * installation that is not yet scope-aware; otherwise it may be too expensive.
2508  */
2509 #if !defined LWIP_IPV6_SCOPES_DEBUG || defined __DOXYGEN__
2510 #define LWIP_IPV6_SCOPES_DEBUG          0
2511 #endif
2512 
2513 /**
2514  * LWIP_IPV6_NUM_ADDRESSES: Number of IPv6 addresses per netif.
2515  */
2516 #if !defined LWIP_IPV6_NUM_ADDRESSES || defined __DOXYGEN__
2517 #define LWIP_IPV6_NUM_ADDRESSES         3
2518 #endif
2519 
2520 /**
2521  * LWIP_IPV6_FORWARD==1: Forward IPv6 packets across netifs
2522  */
2523 #if !defined LWIP_IPV6_FORWARD || defined __DOXYGEN__
2524 #define LWIP_IPV6_FORWARD               0
2525 #endif
2526 
2527 /**
2528  * LWIP_IPV6_FRAG==1: Fragment outgoing IPv6 packets that are too big.
2529  */
2530 #if !defined LWIP_IPV6_FRAG || defined __DOXYGEN__
2531 #define LWIP_IPV6_FRAG                  1
2532 #endif
2533 
2534 /**
2535  * LWIP_IPV6_REASS==1: reassemble incoming IPv6 packets that fragmented
2536  */
2537 #if !defined LWIP_IPV6_REASS || defined __DOXYGEN__
2538 #define LWIP_IPV6_REASS                 LWIP_IPV6
2539 #endif
2540 
2541 /**
2542  * LWIP_IPV6_SEND_ROUTER_SOLICIT==1: Send router solicitation messages during
2543  * network startup.
2544  */
2545 #if !defined LWIP_IPV6_SEND_ROUTER_SOLICIT || defined __DOXYGEN__
2546 #define LWIP_IPV6_SEND_ROUTER_SOLICIT   LWIP_IPV6
2547 #endif
2548 
2549 /**
2550  * LWIP_IPV6_AUTOCONFIG==1: Enable stateless address autoconfiguration as per RFC 4862.
2551  */
2552 #if !defined LWIP_IPV6_AUTOCONFIG || defined __DOXYGEN__
2553 #define LWIP_IPV6_AUTOCONFIG            LWIP_IPV6
2554 #endif
2555 
2556 /**
2557  * LWIP_IPV6_ADDRESS_LIFETIMES==1: Keep valid and preferred lifetimes for each
2558  * IPv6 address. Required for LWIP_IPV6_AUTOCONFIG. May still be enabled
2559  * otherwise, in which case the application may assign address lifetimes with
2560  * the appropriate macros. Addresses with no lifetime are assumed to be static.
2561  * If this option is disabled, all addresses are assumed to be static.
2562  */
2563 #if !defined LWIP_IPV6_ADDRESS_LIFETIMES || defined __DOXYGEN__
2564 #define LWIP_IPV6_ADDRESS_LIFETIMES     LWIP_IPV6_AUTOCONFIG
2565 #endif
2566 
2567 /**
2568  * LWIP_IPV6_DUP_DETECT_ATTEMPTS=[0..7]: Number of duplicate address detection attempts.
2569  */
2570 #if !defined LWIP_IPV6_DUP_DETECT_ATTEMPTS || defined __DOXYGEN__
2571 #define LWIP_IPV6_DUP_DETECT_ATTEMPTS   1
2572 #endif
2573 /**
2574  * @}
2575  */
2576 
2577 /**
2578  * @defgroup lwip_opts_icmp6 ICMP6
2579  * @ingroup lwip_opts_ipv6
2580  * @{
2581  */
2582 /**
2583  * LWIP_ICMP6==1: Enable ICMPv6 (mandatory per RFC)
2584  */
2585 #if !defined LWIP_ICMP6 || defined __DOXYGEN__
2586 #define LWIP_ICMP6                      LWIP_IPV6
2587 #endif
2588 
2589 /**
2590  * LWIP_ICMP6_DATASIZE: bytes from original packet to send back in
2591  * ICMPv6 error messages (0 = default of IP6_MIN_MTU_LENGTH)
2592  * ATTENTION: RFC4443 section 2.4 says IP6_MIN_MTU_LENGTH is a MUST,
2593  * so override this only if you absolutely have to!
2594  */
2595 #if !defined LWIP_ICMP6_DATASIZE || defined __DOXYGEN__
2596 #define LWIP_ICMP6_DATASIZE             0
2597 #endif
2598 
2599 /**
2600  * LWIP_ICMP6_HL: default hop limit for ICMPv6 messages
2601  */
2602 #if !defined LWIP_ICMP6_HL || defined __DOXYGEN__
2603 #define LWIP_ICMP6_HL                   255
2604 #endif
2605 /**
2606  * @}
2607  */
2608 
2609 /**
2610  * @defgroup lwip_opts_mld6 Multicast listener discovery
2611  * @ingroup lwip_opts_ipv6
2612  * @{
2613  */
2614 /**
2615  * LWIP_IPV6_MLD==1: Enable multicast listener discovery protocol.
2616  * If LWIP_IPV6 is enabled but this setting is disabled, the MAC layer must
2617  * indiscriminately pass all inbound IPv6 multicast traffic to lwIP.
2618  */
2619 #if !defined LWIP_IPV6_MLD || defined __DOXYGEN__
2620 #define LWIP_IPV6_MLD                   LWIP_IPV6
2621 #endif
2622 
2623 /**
2624  * MEMP_NUM_MLD6_GROUP: Max number of IPv6 multicast groups that can be joined.
2625  * There must be enough groups so that each netif can join the solicited-node
2626  * multicast group for each of its local addresses, plus one for MDNS if
2627  * applicable, plus any number of groups to be joined on UDP sockets.
2628  */
2629 #if !defined MEMP_NUM_MLD6_GROUP || defined __DOXYGEN__
2630 #define MEMP_NUM_MLD6_GROUP             4
2631 #endif
2632 /**
2633  * @}
2634  */
2635 
2636 /**
2637  * @defgroup lwip_opts_nd6 Neighbor discovery
2638  * @ingroup lwip_opts_ipv6
2639  * @{
2640  */
2641 /**
2642  * LWIP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address
2643  * is being resolved.
2644  */
2645 #if !defined LWIP_ND6_QUEUEING || defined __DOXYGEN__
2646 #define LWIP_ND6_QUEUEING               LWIP_IPV6
2647 #endif
2648 
2649 /**
2650  * MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution.
2651  */
2652 #if !defined MEMP_NUM_ND6_QUEUE || defined __DOXYGEN__
2653 #define MEMP_NUM_ND6_QUEUE              20
2654 #endif
2655 
2656 /**
2657  * LWIP_ND6_NUM_NEIGHBORS: Number of entries in IPv6 neighbor cache
2658  */
2659 #if !defined LWIP_ND6_NUM_NEIGHBORS || defined __DOXYGEN__
2660 #define LWIP_ND6_NUM_NEIGHBORS          10
2661 #endif
2662 
2663 /**
2664  * LWIP_ND6_NUM_DESTINATIONS: number of entries in IPv6 destination cache
2665  */
2666 #if !defined LWIP_ND6_NUM_DESTINATIONS || defined __DOXYGEN__
2667 #define LWIP_ND6_NUM_DESTINATIONS       10
2668 #endif
2669 
2670 /**
2671  * LWIP_ND6_NUM_PREFIXES: number of entries in IPv6 on-link prefixes cache
2672  */
2673 #if !defined LWIP_ND6_NUM_PREFIXES || defined __DOXYGEN__
2674 #define LWIP_ND6_NUM_PREFIXES           5
2675 #endif
2676 
2677 /**
2678  * LWIP_ND6_NUM_ROUTERS: number of entries in IPv6 default router cache
2679  */
2680 #if !defined LWIP_ND6_NUM_ROUTERS || defined __DOXYGEN__
2681 #define LWIP_ND6_NUM_ROUTERS            3
2682 #endif
2683 
2684 /**
2685  * LWIP_ND6_MAX_MULTICAST_SOLICIT: max number of multicast solicit messages to send
2686  * (neighbor solicit and router solicit)
2687  */
2688 #if !defined LWIP_ND6_MAX_MULTICAST_SOLICIT || defined __DOXYGEN__
2689 #define LWIP_ND6_MAX_MULTICAST_SOLICIT  3
2690 #endif
2691 
2692 /**
2693  * LWIP_ND6_MAX_UNICAST_SOLICIT: max number of unicast neighbor solicitation messages
2694  * to send during neighbor reachability detection.
2695  */
2696 #if !defined LWIP_ND6_MAX_UNICAST_SOLICIT || defined __DOXYGEN__
2697 #define LWIP_ND6_MAX_UNICAST_SOLICIT    3
2698 #endif
2699 
2700 /**
2701  * Unused: See ND RFC (time in milliseconds).
2702  */
2703 #if !defined LWIP_ND6_MAX_ANYCAST_DELAY_TIME || defined __DOXYGEN__
2704 #define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000
2705 #endif
2706 
2707 /**
2708  * Unused: See ND RFC
2709  */
2710 #if !defined LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT || defined __DOXYGEN__
2711 #define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT  3
2712 #endif
2713 
2714 /**
2715  * LWIP_ND6_REACHABLE_TIME: default neighbor reachable time (in milliseconds).
2716  * May be updated by router advertisement messages.
2717  */
2718 #if !defined LWIP_ND6_REACHABLE_TIME || defined __DOXYGEN__
2719 #define LWIP_ND6_REACHABLE_TIME         30000
2720 #endif
2721 
2722 /**
2723  * LWIP_ND6_RETRANS_TIMER: default retransmission timer for solicitation messages
2724  */
2725 #if !defined LWIP_ND6_RETRANS_TIMER || defined __DOXYGEN__
2726 #define LWIP_ND6_RETRANS_TIMER          1000
2727 #endif
2728 
2729 /**
2730  * LWIP_ND6_DELAY_FIRST_PROBE_TIME: Delay before first unicast neighbor solicitation
2731  * message is sent, during neighbor reachability detection.
2732  */
2733 #if !defined LWIP_ND6_DELAY_FIRST_PROBE_TIME || defined __DOXYGEN__
2734 #define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000
2735 #endif
2736 
2737 /**
2738  * LWIP_ND6_ALLOW_RA_UPDATES==1: Allow Router Advertisement messages to update
2739  * Reachable time and retransmission timers, and netif MTU.
2740  */
2741 #if !defined LWIP_ND6_ALLOW_RA_UPDATES || defined __DOXYGEN__
2742 #define LWIP_ND6_ALLOW_RA_UPDATES       1
2743 #endif
2744 
2745 /**
2746  * LWIP_ND6_TCP_REACHABILITY_HINTS==1: Allow TCP to provide Neighbor Discovery
2747  * with reachability hints for connected destinations. This helps avoid sending
2748  * unicast neighbor solicitation messages.
2749  */
2750 #if !defined LWIP_ND6_TCP_REACHABILITY_HINTS || defined __DOXYGEN__
2751 #define LWIP_ND6_TCP_REACHABILITY_HINTS 1
2752 #endif
2753 
2754 /**
2755  * LWIP_ND6_RDNSS_MAX_DNS_SERVERS > 0: Use IPv6 Router Advertisement Recursive
2756  * DNS Server Option (as per RFC 6106) to copy a defined maximum number of DNS
2757  * servers to the DNS module.
2758  */
2759 #if !defined LWIP_ND6_RDNSS_MAX_DNS_SERVERS || defined __DOXYGEN__
2760 #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS  0
2761 #endif
2762 /**
2763  * @}
2764  */
2765 
2766 /**
2767  * @defgroup lwip_opts_dhcpv6 DHCPv6
2768  * @ingroup lwip_opts_ipv6
2769  * @{
2770  */
2771 /**
2772  * LWIP_IPV6_DHCP6==1: enable DHCPv6 stateful/stateless address autoconfiguration.
2773  */
2774 #if !defined LWIP_IPV6_DHCP6 || defined __DOXYGEN__
2775 #define LWIP_IPV6_DHCP6                 0
2776 #endif
2777 
2778 /**
2779  * LWIP_IPV6_DHCP6_STATEFUL==1: enable DHCPv6 stateful address autoconfiguration.
2780  * (not supported, yet!)
2781  */
2782 #if !defined LWIP_IPV6_DHCP6_STATEFUL || defined __DOXYGEN__
2783 #define LWIP_IPV6_DHCP6_STATEFUL        0
2784 #endif
2785 
2786 /**
2787  * LWIP_IPV6_DHCP6_STATELESS==1: enable DHCPv6 stateless address autoconfiguration.
2788  */
2789 #if !defined LWIP_IPV6_DHCP6_STATELESS || defined __DOXYGEN__
2790 #define LWIP_IPV6_DHCP6_STATELESS       LWIP_IPV6_DHCP6
2791 #endif
2792 
2793 /**
2794  * LWIP_DHCP6_GETS_NTP==1: Request NTP servers via DHCPv6. For each
2795  * response packet, a callback is called, which has to be provided by the port:
2796  * void dhcp6_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs);
2797 */
2798 #if !defined LWIP_DHCP6_GET_NTP_SRV || defined __DOXYGEN__
2799 #define LWIP_DHCP6_GET_NTP_SRV          0
2800 #endif
2801 
2802 /**
2803  * The maximum of NTP servers requested
2804  */
2805 #if !defined LWIP_DHCP6_MAX_NTP_SERVERS || defined __DOXYGEN__
2806 #define LWIP_DHCP6_MAX_NTP_SERVERS      1
2807 #endif
2808 
2809 /**
2810  * LWIP_DHCP6_MAX_DNS_SERVERS > 0: Request DNS servers via DHCPv6.
2811  * DNS servers received in the response are passed to DNS via @ref dns_setserver()
2812  * (up to the maximum limit defined here).
2813  */
2814 #if !defined LWIP_DHCP6_MAX_DNS_SERVERS || defined __DOXYGEN__
2815 #define LWIP_DHCP6_MAX_DNS_SERVERS      DNS_MAX_SERVERS
2816 #endif
2817 /**
2818  * @}
2819  */
2820 
2821 /*
2822    ---------------------------------------
2823    ---------- Hook options ---------------
2824    ---------------------------------------
2825 */
2826 
2827 /**
2828  * @defgroup lwip_opts_hooks Hooks
2829  * @ingroup lwip_opts_infrastructure
2830  * Hooks are undefined by default, define them to a function if you need them.
2831  * @{
2832  */
2833 
2834 /**
2835  * LWIP_HOOK_FILENAME: Custom filename to \#include in files that provide hooks.
2836  * Declare your hook function prototypes in there, you may also \#include all headers
2837  * providing data types that are need in this file.
2838  */
2839 #ifdef __DOXYGEN__
2840 #define LWIP_HOOK_FILENAME "path/to/my/lwip_hooks.h"
2841 #endif
2842 
2843 /**
2844  * LWIP_HOOK_TCP_ISN:
2845  * Hook for generation of the Initial Sequence Number (ISN) for a new TCP
2846  * connection. The default lwIP ISN generation algorithm is very basic and may
2847  * allow for TCP spoofing attacks. This hook provides the means to implement
2848  * the standardized ISN generation algorithm from RFC 6528 (see contrib/adons/tcp_isn),
2849  * or any other desired algorithm as a replacement.
2850  * Called from tcp_connect() and tcp_listen_input() when an ISN is needed for
2851  * a new TCP connection, if TCP support (@ref LWIP_TCP) is enabled.<br>
2852  * Signature:\code{.c}
2853  * 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);
2854  * \endcode
2855  * - it may be necessary to use "struct ip_addr" (ip4_addr, ip6_addr) instead of "ip_addr_t" in function declarations<br>
2856  * Arguments:
2857  * - local_ip: pointer to the local IP address of the connection
2858  * - local_port: local port number of the connection (host-byte order)
2859  * - remote_ip: pointer to the remote IP address of the connection
2860  * - remote_port: remote port number of the connection (host-byte order)<br>
2861  * Return value:
2862  * - the 32-bit Initial Sequence Number to use for the new TCP connection.
2863  */
2864 #ifdef __DOXYGEN__
2865 #define LWIP_HOOK_TCP_ISN(local_ip, local_port, remote_ip, remote_port)
2866 #endif
2867 
2868 /**
2869  * LWIP_HOOK_TCP_INPACKET_PCB:
2870  * Hook for intercepting incoming packets before they are passed to a pcb. This
2871  * allows updating some state or even dropping a packet.
2872  * Signature:\code{.c}
2873  * err_t my_hook_tcp_inpkt(struct tcp_pcb *pcb, struct tcp_hdr *hdr, u16_t optlen, u16_t opt1len, u8_t *opt2, struct pbuf *p);
2874  * \endcode
2875  * Arguments:
2876  * - pcb: tcp_pcb selected for input of this packet (ATTENTION: this may be
2877  *        struct tcp_pcb_listen if pcb->state == LISTEN)
2878  * - hdr: pointer to tcp header (ATTENTION: tcp options may not be in one piece!)
2879  * - optlen: tcp option length
2880  * - opt1len: tcp option length 1st part
2881  * - opt2: if this is != NULL, tcp options are split among 2 pbufs. In that case,
2882  *         options start at right after the tcp header ('(u8_t*)(hdr + 1)') for
2883  *         the first 'opt1len' bytes and the rest starts at 'opt2'. opt2len can
2884  *         be simply calculated: 'opt2len = optlen - opt1len;'
2885  * - p: input packet, p->payload points to application data (that's why tcp hdr
2886  *      and options are passed in separately)
2887  * Return value:
2888  * - ERR_OK: continue input of this packet as normal
2889  * - != ERR_OK: drop this packet for input (don't continue input processing)
2890  *
2891  * ATTENTION: don't call any tcp api functions that might change tcp state (pcb
2892  * state or any pcb lists) from this callback!
2893  */
2894 #ifdef __DOXYGEN__
2895 #define LWIP_HOOK_TCP_INPACKET_PCB(pcb, hdr, optlen, opt1len, opt2, p)
2896 #endif
2897 
2898 /**
2899  * LWIP_HOOK_TCP_OUT_TCPOPT_LENGTH:
2900  * Hook for increasing the size of the options allocated with a tcp header.
2901  * Together with LWIP_HOOK_TCP_OUT_ADD_TCPOPTS, this can be used to add custom
2902  * options to outgoing tcp segments.
2903  * Signature:\code{.c}
2904  * u8_t my_hook_tcp_out_tcpopt_length(const struct tcp_pcb *pcb, u8_t internal_option_length);
2905  * \endcode
2906  * Arguments:
2907  * - pcb: tcp_pcb that transmits (ATTENTION: this may be NULL or
2908  *        struct tcp_pcb_listen if pcb->state == LISTEN)
2909  * - internal_option_length: tcp option length used by the stack internally
2910  * Return value:
2911  * - a number of bytes to allocate for tcp options (internal_option_length <= ret <= 40)
2912  *
2913  * ATTENTION: don't call any tcp api functions that might change tcp state (pcb
2914  * state or any pcb lists) from this callback!
2915  */
2916 #ifdef __DOXYGEN__
2917 #define LWIP_HOOK_TCP_OUT_TCPOPT_LENGTH(pcb, internal_len)
2918 #endif
2919 
2920 /**
2921  * LWIP_HOOK_TCP_OUT_ADD_TCPOPTS:
2922  * Hook for adding custom options to outgoing tcp segments.
2923  * Space for these custom options has to be reserved via LWIP_HOOK_TCP_OUT_TCPOPT_LENGTH.
2924  * Signature:\code{.c}
2925  * u32_t *my_hook_tcp_out_add_tcpopts(struct pbuf *p, struct tcp_hdr *hdr, const struct tcp_pcb *pcb, u32_t *opts);
2926  * \endcode
2927  * Arguments:
2928  * - p: output packet, p->payload pointing to tcp header, data follows
2929  * - hdr: tcp header
2930  * - pcb: tcp_pcb that transmits (ATTENTION: this may be NULL or
2931  *        struct tcp_pcb_listen if pcb->state == LISTEN)
2932  * - opts: pointer where to add the custom options (there may already be options
2933  *         between the header and these)
2934  * Return value:
2935  * - pointer pointing directly after the inserted options
2936  *
2937  * ATTENTION: don't call any tcp api functions that might change tcp state (pcb
2938  * state or any pcb lists) from this callback!
2939  */
2940 #ifdef __DOXYGEN__
2941 #define LWIP_HOOK_TCP_OUT_ADD_TCPOPTS(p, hdr, pcb, opts)
2942 #endif
2943 
2944 /**
2945  * LWIP_HOOK_IP4_INPUT(pbuf, input_netif):
2946  * Called from ip_input() (IPv4)
2947  * Signature:\code{.c}
2948  *   int my_hook(struct pbuf *pbuf, struct netif *input_netif);
2949  * \endcode
2950  * Arguments:
2951  * - pbuf: received struct pbuf passed to ip_input()
2952  * - input_netif: struct netif on which the packet has been received
2953  * Return values:
2954  * - 0: Hook has not consumed the packet, packet is processed as normal
2955  * - != 0: Hook has consumed the packet.
2956  * If the hook consumed the packet, 'pbuf' is in the responsibility of the hook
2957  * (i.e. free it when done).
2958  */
2959 #ifdef __DOXYGEN__
2960 #define LWIP_HOOK_IP4_INPUT(pbuf, input_netif)
2961 #endif
2962 
2963 /**
2964  * LWIP_HOOK_IP4_ROUTE(dest):
2965  * Called from ip_route() (IPv4)
2966  * Signature:\code{.c}
2967  *   struct netif *my_hook(const ip4_addr_t *dest);
2968  * \endcode
2969  * Arguments:
2970  * - dest: destination IPv4 address
2971  * Returns values:
2972  * - the destination netif
2973  * - NULL if no destination netif is found. In that case, ip_route() continues as normal.
2974  */
2975 #ifdef __DOXYGEN__
2976 #define LWIP_HOOK_IP4_ROUTE()
2977 #endif
2978 
2979 /**
2980  * LWIP_HOOK_IP4_ROUTE_SRC(src, dest):
2981  * Source-based routing for IPv4 - called from ip_route() (IPv4)
2982  * Signature:\code{.c}
2983  *   struct netif *my_hook(const ip4_addr_t *src, const ip4_addr_t *dest);
2984  * \endcode
2985  * Arguments:
2986  * - src: local/source IPv4 address
2987  * - dest: destination IPv4 address
2988  * Returns values:
2989  * - the destination netif
2990  * - NULL if no destination netif is found. In that case, ip_route() continues as normal.
2991  */
2992 #ifdef __DOXYGEN__
2993 #define LWIP_HOOK_IP4_ROUTE_SRC(src, dest)
2994 #endif
2995 
2996 /**
2997  * LWIP_HOOK_IP4_CANFORWARD(src, dest):
2998  * Check if an IPv4 can be forwarded - called from:
2999  * ip4_input() -> ip4_forward() -> ip4_canforward() (IPv4)
3000  * - source address is available via ip4_current_src_addr()
3001  * - calling an output function in this context (e.g. multicast router) is allowed
3002  * Signature:\code{.c}
3003  *   int my_hook(struct pbuf *p, u32_t dest_addr_hostorder);
3004  * \endcode
3005  * Arguments:
3006  * - p: packet to forward
3007  * - dest: destination IPv4 address
3008  * Returns values:
3009  * - 1: forward
3010  * - 0: don't forward
3011  * - -1: no decision. In that case, ip4_canforward() continues as normal.
3012  */
3013 #ifdef __DOXYGEN__
3014 #define LWIP_HOOK_IP4_CANFORWARD(src, dest)
3015 #endif
3016 
3017 /**
3018  * LWIP_HOOK_ETHARP_GET_GW(netif, dest):
3019  * Called from etharp_output() (IPv4)
3020  * Signature:\code{.c}
3021  *   const ip4_addr_t *my_hook(struct netif *netif, const ip4_addr_t *dest);
3022  * \endcode
3023  * Arguments:
3024  * - netif: the netif used for sending
3025  * - dest: the destination IPv4 address
3026  * Return values:
3027  * - the IPv4 address of the gateway to handle the specified destination IPv4 address
3028  * - NULL, in which case the netif's default gateway is used
3029  *
3030  * The returned address MUST be directly reachable on the specified netif!
3031  * This function is meant to implement advanced IPv4 routing together with
3032  * LWIP_HOOK_IP4_ROUTE(). The actual routing/gateway table implementation is
3033  * not part of lwIP but can e.g. be hidden in the netif's state argument.
3034 */
3035 #ifdef __DOXYGEN__
3036 #define LWIP_HOOK_ETHARP_GET_GW(netif, dest)
3037 #endif
3038 
3039 /**
3040  * LWIP_HOOK_IP6_INPUT(pbuf, input_netif):
3041  * Called from ip6_input() (IPv6)
3042  * Signature:\code{.c}
3043  *   int my_hook(struct pbuf *pbuf, struct netif *input_netif);
3044  * \endcode
3045  * Arguments:
3046  * - pbuf: received struct pbuf passed to ip6_input()
3047  * - input_netif: struct netif on which the packet has been received
3048  * Return values:
3049  * - 0: Hook has not consumed the packet, packet is processed as normal
3050  * - != 0: Hook has consumed the packet.
3051  * If the hook consumed the packet, 'pbuf' is in the responsibility of the hook
3052  * (i.e. free it when done).
3053  */
3054 #ifdef __DOXYGEN__
3055 #define LWIP_HOOK_IP6_INPUT(pbuf, input_netif)
3056 #endif
3057 
3058 /**
3059  * LWIP_HOOK_IP6_ROUTE(src, dest):
3060  * Called from ip_route() (IPv6)
3061  * Signature:\code{.c}
3062  *   struct netif *my_hook(const ip6_addr_t *dest, const ip6_addr_t *src);
3063  * \endcode
3064  * Arguments:
3065  * - src: source IPv6 address
3066  * - dest: destination IPv6 address
3067  * Return values:
3068  * - the destination netif
3069  * - NULL if no destination netif is found. In that case, ip6_route() continues as normal.
3070  */
3071 #ifdef __DOXYGEN__
3072 #define LWIP_HOOK_IP6_ROUTE(src, dest)
3073 #endif
3074 
3075 /**
3076  * LWIP_HOOK_ND6_GET_GW(netif, dest):
3077  * Called from nd6_get_next_hop_entry() (IPv6)
3078  * Signature:\code{.c}
3079  *   const ip6_addr_t *my_hook(struct netif *netif, const ip6_addr_t *dest);
3080  * \endcode
3081  * Arguments:
3082  * - netif: the netif used for sending
3083  * - dest: the destination IPv6 address
3084  * Return values:
3085  * - the IPv6 address of the next hop to handle the specified destination IPv6 address
3086  * - NULL, in which case a NDP-discovered router is used instead
3087  *
3088  * The returned address MUST be directly reachable on the specified netif!
3089  * This function is meant to implement advanced IPv6 routing together with
3090  * LWIP_HOOK_IP6_ROUTE(). The actual routing/gateway table implementation is
3091  * not part of lwIP but can e.g. be hidden in the netif's state argument.
3092 */
3093 #ifdef __DOXYGEN__
3094 #define LWIP_HOOK_ND6_GET_GW(netif, dest)
3095 #endif
3096 
3097 /**
3098  * LWIP_HOOK_VLAN_CHECK(netif, eth_hdr, vlan_hdr):
3099  * Called from ethernet_input() if VLAN support is enabled
3100  * Signature:\code{.c}
3101  *   int my_hook(struct netif *netif, struct eth_hdr *eth_hdr, struct eth_vlan_hdr *vlan_hdr);
3102  * \endcode
3103  * Arguments:
3104  * - netif: struct netif on which the packet has been received
3105  * - eth_hdr: struct eth_hdr of the packet
3106  * - vlan_hdr: struct eth_vlan_hdr of the packet
3107  * Return values:
3108  * - 0: Packet must be dropped.
3109  * - != 0: Packet must be accepted.
3110  */
3111 #ifdef __DOXYGEN__
3112 #define LWIP_HOOK_VLAN_CHECK(netif, eth_hdr, vlan_hdr)
3113 #endif
3114 
3115 /**
3116  * LWIP_HOOK_VLAN_SET:
3117  * Hook can be used to set prio_vid field of vlan_hdr. If you need to store data
3118  * on per-netif basis to implement this callback, see @ref netif_cd.
3119  * Called from ethernet_output() if VLAN support (@ref ETHARP_SUPPORT_VLAN) is enabled.<br>
3120  * Signature:\code{.c}
3121  *   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);
3122  * \endcode
3123  * Arguments:
3124  * - netif: struct netif that the packet will be sent through
3125  * - p: struct pbuf packet to be sent
3126  * - src: source eth address
3127  * - dst: destination eth address
3128  * - eth_type: ethernet type to packet to be sent<br>
3129  *
3130  *
3131  * Return values:
3132  * - &lt;0: Packet shall not contain VLAN header.
3133  * - 0 &lt;= return value &lt;= 0xFFFF: Packet shall contain VLAN header. Return value is prio_vid in host byte order.
3134  */
3135 #ifdef __DOXYGEN__
3136 #define LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type)
3137 #endif
3138 
3139 /**
3140  * LWIP_HOOK_MEMP_AVAILABLE(memp_t_type):
3141  * Called from memp_free() when a memp pool was empty and an item is now available
3142  * Signature:\code{.c}
3143  *   void my_hook(memp_t type);
3144  * \endcode
3145  */
3146 #ifdef __DOXYGEN__
3147 #define LWIP_HOOK_MEMP_AVAILABLE(memp_t_type)
3148 #endif
3149 
3150 /**
3151  * LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(pbuf, netif):
3152  * Called from ethernet_input() when an unknown eth type is encountered.
3153  * Signature:\code{.c}
3154  *   err_t my_hook(struct pbuf* pbuf, struct netif* netif);
3155  * \endcode
3156  * Arguments:
3157  * - p: rx packet with unknown eth type
3158  * - netif: netif on which the packet has been received
3159  * Return values:
3160  * - ERR_OK if packet is accepted (hook function now owns the pbuf)
3161  * - any error code otherwise (pbuf is freed)
3162  *
3163  * Payload points to ethernet header!
3164  */
3165 #ifdef __DOXYGEN__
3166 #define LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(pbuf, netif)
3167 #endif
3168 
3169 /**
3170  * LWIP_HOOK_DHCP_APPEND_OPTIONS(netif, dhcp, state, msg, msg_type, options_len_ptr):
3171  * Called from various dhcp functions when sending a DHCP message.
3172  * This hook is called just before the DHCP message trailer is added, so the
3173  * options are at the end of a DHCP message.
3174  * Signature:\code{.c}
3175  *   void my_hook(struct netif *netif, struct dhcp *dhcp, u8_t state, struct dhcp_msg *msg,
3176  *                u8_t msg_type, u16_t *options_len_ptr);
3177  * \endcode
3178  * Arguments:
3179  * - netif: struct netif that the packet will be sent through
3180  * - dhcp: struct dhcp on that netif
3181  * - state: current dhcp state (dhcp_state_enum_t as an u8_t)
3182  * - msg: struct dhcp_msg that will be sent
3183  * - msg_type: dhcp message type to be sent (u8_t)
3184  * - options_len_ptr: pointer to the current length of options in the dhcp_msg "msg"
3185  *                    (must be increased when options are added!)
3186  *
3187  * Options need to appended like this:
3188  *   LWIP_ASSERT("dhcp option overflow", *options_len_ptr + option_len + 2 <= DHCP_OPTIONS_LEN);
3189  *   msg->options[(*options_len_ptr)++] = &lt;option_number&gt;;
3190  *   msg->options[(*options_len_ptr)++] = &lt;option_len&gt;;
3191  *   msg->options[(*options_len_ptr)++] = &lt;option_bytes&gt;;
3192  *   [...]
3193  */
3194 #ifdef __DOXYGEN__
3195 #define LWIP_HOOK_DHCP_APPEND_OPTIONS(netif, dhcp, state, msg, msg_type, options_len_ptr)
3196 #endif
3197 
3198 /**
3199  * LWIP_HOOK_DHCP_PARSE_OPTION(netif, dhcp, state, msg, msg_type, option, len, pbuf, option_value_offset):
3200  * Called from dhcp_parse_reply when receiving a DHCP message.
3201  * This hook is called for every option in the received message that is not handled internally.
3202  * Signature:\code{.c}
3203  *   void my_hook(struct netif *netif, struct dhcp *dhcp, u8_t state, struct dhcp_msg *msg,
3204  *                u8_t msg_type, u8_t option, u8_t option_len, struct pbuf *pbuf, u16_t option_value_offset);
3205  * \endcode
3206  * Arguments:
3207  * - netif: struct netif that the packet will be sent through
3208  * - dhcp: struct dhcp on that netif
3209  * - state: current dhcp state (dhcp_state_enum_t as an u8_t)
3210  * - msg: struct dhcp_msg that was received
3211  * - msg_type: dhcp message type received (u8_t, ATTENTION: only valid after
3212  *             the message type option has been parsed!)
3213  * - option: option value (u8_t)
3214  * - len: option data length (u8_t)
3215  * - pbuf: pbuf where option data is contained
3216  * - option_value_offset: offset in pbuf where option data begins
3217  *
3218  * A nice way to get the option contents is pbuf_get_contiguous():
3219  *  u8_t buf[32];
3220  *  u8_t *ptr = (u8_t*)pbuf_get_contiguous(p, buf, sizeof(buf), LWIP_MIN(option_len, sizeof(buf)), offset);
3221  */
3222 #ifdef __DOXYGEN__
3223 #define LWIP_HOOK_DHCP_PARSE_OPTION(netif, dhcp, state, msg, msg_type, option, len, pbuf, offset)
3224 #endif
3225 
3226 /**
3227  * LWIP_HOOK_DHCP6_APPEND_OPTIONS(netif, dhcp6, state, msg, msg_type, options_len_ptr, max_len):
3228  * Called from various dhcp6 functions when sending a DHCP6 message.
3229  * This hook is called just before the DHCP6 message is sent, so the
3230  * options are at the end of a DHCP6 message.
3231  * Signature:\code{.c}
3232  *   void my_hook(struct netif *netif, struct dhcp6 *dhcp, u8_t state, struct dhcp6_msg *msg,
3233  *                u8_t msg_type, u16_t *options_len_ptr);
3234  * \endcode
3235  * Arguments:
3236  * - netif: struct netif that the packet will be sent through
3237  * - dhcp6: struct dhcp6 on that netif
3238  * - state: current dhcp6 state (dhcp6_state_enum_t as an u8_t)
3239  * - msg: struct dhcp6_msg that will be sent
3240  * - msg_type: dhcp6 message type to be sent (u8_t)
3241  * - options_len_ptr: pointer to the current length of options in the dhcp6_msg "msg"
3242  *                    (must be increased when options are added!)
3243  *
3244  * Options need to appended like this:
3245  *   u8_t *options = (u8_t *)(msg + 1);
3246  *   LWIP_ASSERT("dhcp option overflow", sizeof(struct dhcp6_msg) + *options_len_ptr + newoptlen <= max_len);
3247  *   options[(*options_len_ptr)++] = &lt;option_data&gt;;
3248  *   [...]
3249  */
3250 #ifdef __DOXYGEN__
3251 #define LWIP_HOOK_DHCP6_APPEND_OPTIONS(netif, dhcp6, state, msg, msg_type, options_len_ptr, max_len)
3252 #endif
3253 
3254 /**
3255  * LWIP_HOOK_SOCKETS_SETSOCKOPT(s, sock, level, optname, optval, optlen, err)
3256  * Called from socket API to implement setsockopt() for options not provided by lwIP.
3257  * Core lock is held when this hook is called.
3258  * Signature:\code{.c}
3259  *   int my_hook(int s, struct lwip_sock *sock, int level, int optname, const void *optval, socklen_t optlen, int *err)
3260  * \endcode
3261  * Arguments:
3262  * - s: socket file descriptor
3263  * - sock: internal socket descriptor (see lwip/priv/sockets_priv.h)
3264  * - level: protocol level at which the option resides
3265  * - optname: option to set
3266  * - optval: value to set
3267  * - optlen: size of optval
3268  * - err: output error
3269  * Return values:
3270  * - 0: Hook has not consumed the option, code continues as normal (to internal options)
3271  * - != 0: Hook has consumed the option, 'err' is returned
3272  */
3273 #ifdef __DOXYGEN__
3274 #define LWIP_HOOK_SOCKETS_SETSOCKOPT(s, sock, level, optname, optval, optlen, err)
3275 #endif
3276 
3277 /**
3278  * LWIP_HOOK_SOCKETS_GETSOCKOPT(s, sock, level, optname, optval, optlen, err)
3279  * Called from socket API to implement getsockopt() for options not provided by lwIP.
3280  * Core lock is held when this hook is called.
3281  * Signature:\code{.c}
3282  *   int my_hook(int s, struct lwip_sock *sock, int level, int optname, void *optval, socklen_t *optlen, int *err)
3283  * \endcode
3284  * Arguments:
3285  * - s: socket file descriptor
3286  * - sock: internal socket descriptor (see lwip/priv/sockets_priv.h)
3287  * - level: protocol level at which the option resides
3288  * - optname: option to get
3289  * - optval: value to get
3290  * - optlen: size of optval
3291  * - err: output error
3292  * Return values:
3293  * - 0: Hook has not consumed the option, code continues as normal (to internal options)
3294  * - != 0: Hook has consumed the option, 'err' is returned
3295  */
3296 #ifdef __DOXYGEN__
3297 #define LWIP_HOOK_SOCKETS_GETSOCKOPT(s, sock, level, optname, optval, optlen, err)
3298 #endif
3299 
3300 /**
3301  * LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE(name, addr, addrtype, err)
3302  * Called from netconn APIs (not usable with callback apps) allowing an
3303  * external DNS resolver (which uses sequential API) to handle the query.
3304  * Signature:\code{.c}
3305  *   int my_hook(const char *name, ip_addr_t *addr, u8_t addrtype, err_t *err)
3306  * \endcode
3307  * Arguments:
3308  * - name: hostname to resolve
3309  * - addr: output host address
3310  * - addrtype: type of address to query
3311  * - err: output error
3312  * Return values:
3313  * - 0: Hook has not consumed hostname query, query continues into DNS module
3314  * - != 0: Hook has consumed the query
3315  *
3316  * err must also be checked to determine if the hook consumed the query, but
3317  * the query failed
3318  */
3319 #ifdef __DOXYGEN__
3320 #define LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE(name, addr, addrtype, err)
3321 #endif
3322 /**
3323  * @}
3324  */
3325 
3326 /*
3327    ---------------------------------------
3328    ---------- Debugging options ----------
3329    ---------------------------------------
3330 */
3331 /**
3332  * @defgroup lwip_opts_debugmsg Debug messages
3333  * @ingroup lwip_opts_debug
3334  * @{
3335  */
3336 /**
3337  * LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is
3338  * compared against this value. If it is smaller, then debugging
3339  * messages are written.
3340  * @see debugging_levels
3341  */
3342 #if !defined LWIP_DBG_MIN_LEVEL || defined __DOXYGEN__
3343 #define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_ALL
3344 #endif
3345 
3346 /**
3347  * LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable
3348  * debug messages of certain types.
3349  * @see debugging_levels
3350  */
3351 #if !defined LWIP_DBG_TYPES_ON || defined __DOXYGEN__
3352 #define LWIP_DBG_TYPES_ON               LWIP_DBG_ON
3353 #endif
3354 
3355 /**
3356  * ETHARP_DEBUG: Enable debugging in etharp.c.
3357  */
3358 #if !defined ETHARP_DEBUG || defined __DOXYGEN__
3359 #define ETHARP_DEBUG                    LWIP_DBG_OFF
3360 #endif
3361 
3362 /**
3363  * NETIF_DEBUG: Enable debugging in netif.c.
3364  */
3365 #if !defined NETIF_DEBUG || defined __DOXYGEN__
3366 #define NETIF_DEBUG                     LWIP_DBG_OFF
3367 #endif
3368 
3369 /**
3370  * PBUF_DEBUG: Enable debugging in pbuf.c.
3371  */
3372 #if !defined PBUF_DEBUG || defined __DOXYGEN__
3373 #define PBUF_DEBUG                      LWIP_DBG_OFF
3374 #endif
3375 
3376 /**
3377  * API_LIB_DEBUG: Enable debugging in api_lib.c.
3378  */
3379 #if !defined API_LIB_DEBUG || defined __DOXYGEN__
3380 #define API_LIB_DEBUG                   LWIP_DBG_OFF
3381 #endif
3382 
3383 /**
3384  * API_MSG_DEBUG: Enable debugging in api_msg.c.
3385  */
3386 #if !defined API_MSG_DEBUG || defined __DOXYGEN__
3387 #define API_MSG_DEBUG                   LWIP_DBG_OFF
3388 #endif
3389 
3390 /**
3391  * SOCKETS_DEBUG: Enable debugging in sockets.c.
3392  */
3393 #if !defined SOCKETS_DEBUG || defined __DOXYGEN__
3394 #define SOCKETS_DEBUG                   LWIP_DBG_OFF
3395 #endif
3396 
3397 /**
3398  * ICMP_DEBUG: Enable debugging in icmp.c.
3399  */
3400 #if !defined ICMP_DEBUG || defined __DOXYGEN__
3401 #define ICMP_DEBUG                      LWIP_DBG_OFF
3402 #endif
3403 
3404 /**
3405  * IGMP_DEBUG: Enable debugging in igmp.c.
3406  */
3407 #if !defined IGMP_DEBUG || defined __DOXYGEN__
3408 #define IGMP_DEBUG                      LWIP_DBG_OFF
3409 #endif
3410 
3411 /**
3412  * INET_DEBUG: Enable debugging in inet.c.
3413  */
3414 #if !defined INET_DEBUG || defined __DOXYGEN__
3415 #define INET_DEBUG                      LWIP_DBG_OFF
3416 #endif
3417 
3418 /**
3419  * IP_DEBUG: Enable debugging for IP.
3420  */
3421 #if !defined IP_DEBUG || defined __DOXYGEN__
3422 #define IP_DEBUG                        LWIP_DBG_OFF
3423 #endif
3424 
3425 /**
3426  * IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass.
3427  */
3428 #if !defined IP_REASS_DEBUG || defined __DOXYGEN__
3429 #define IP_REASS_DEBUG                  LWIP_DBG_OFF
3430 #endif
3431 
3432 /**
3433  * RAW_DEBUG: Enable debugging in raw.c.
3434  */
3435 #if !defined RAW_DEBUG || defined __DOXYGEN__
3436 #define RAW_DEBUG                       LWIP_DBG_OFF
3437 #endif
3438 
3439 /**
3440  * MEM_DEBUG: Enable debugging in mem.c.
3441  */
3442 #if !defined MEM_DEBUG || defined __DOXYGEN__
3443 #define MEM_DEBUG                       LWIP_DBG_OFF
3444 #endif
3445 
3446 /**
3447  * MEMP_DEBUG: Enable debugging in memp.c.
3448  */
3449 #if !defined MEMP_DEBUG || defined __DOXYGEN__
3450 #define MEMP_DEBUG                      LWIP_DBG_OFF
3451 #endif
3452 
3453 /**
3454  * SYS_DEBUG: Enable debugging in sys.c.
3455  */
3456 #if !defined SYS_DEBUG || defined __DOXYGEN__
3457 #define SYS_DEBUG                       LWIP_DBG_OFF
3458 #endif
3459 
3460 /**
3461  * TIMERS_DEBUG: Enable debugging in timers.c.
3462  */
3463 #if !defined TIMERS_DEBUG || defined __DOXYGEN__
3464 #define TIMERS_DEBUG                    LWIP_DBG_OFF
3465 #endif
3466 
3467 /**
3468  * TCP_DEBUG: Enable debugging for TCP.
3469  */
3470 #if !defined TCP_DEBUG || defined __DOXYGEN__
3471 #define TCP_DEBUG                       LWIP_DBG_OFF
3472 #endif
3473 
3474 /**
3475  * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug.
3476  */
3477 #if !defined TCP_INPUT_DEBUG || defined __DOXYGEN__
3478 #define TCP_INPUT_DEBUG                 LWIP_DBG_OFF
3479 #endif
3480 
3481 /**
3482  * TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit.
3483  */
3484 #if !defined TCP_FR_DEBUG || defined __DOXYGEN__
3485 #define TCP_FR_DEBUG                    LWIP_DBG_OFF
3486 #endif
3487 
3488 /**
3489  * TCP_RTO_DEBUG: Enable debugging in TCP for retransmit
3490  * timeout.
3491  */
3492 #if !defined TCP_RTO_DEBUG || defined __DOXYGEN__
3493 #define TCP_RTO_DEBUG                   LWIP_DBG_OFF
3494 #endif
3495 
3496 /**
3497  * TCP_CWND_DEBUG: Enable debugging for TCP congestion window.
3498  */
3499 #if !defined TCP_CWND_DEBUG || defined __DOXYGEN__
3500 #define TCP_CWND_DEBUG                  LWIP_DBG_OFF
3501 #endif
3502 
3503 /**
3504  * TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating.
3505  */
3506 #if !defined TCP_WND_DEBUG || defined __DOXYGEN__
3507 #define TCP_WND_DEBUG                   LWIP_DBG_OFF
3508 #endif
3509 
3510 /**
3511  * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions.
3512  */
3513 #if !defined TCP_OUTPUT_DEBUG || defined __DOXYGEN__
3514 #define TCP_OUTPUT_DEBUG                LWIP_DBG_OFF
3515 #endif
3516 
3517 /**
3518  * TCP_RST_DEBUG: Enable debugging for TCP with the RST message.
3519  */
3520 #if !defined TCP_RST_DEBUG || defined __DOXYGEN__
3521 #define TCP_RST_DEBUG                   LWIP_DBG_OFF
3522 #endif
3523 
3524 /**
3525  * TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths.
3526  */
3527 #if !defined TCP_QLEN_DEBUG || defined __DOXYGEN__
3528 #define TCP_QLEN_DEBUG                  LWIP_DBG_OFF
3529 #endif
3530 
3531 /**
3532  * UDP_DEBUG: Enable debugging in UDP.
3533  */
3534 #if !defined UDP_DEBUG || defined __DOXYGEN__
3535 #define UDP_DEBUG                       LWIP_DBG_OFF
3536 #endif
3537 
3538 /**
3539  * TCPIP_DEBUG: Enable debugging in tcpip.c.
3540  */
3541 #if !defined TCPIP_DEBUG || defined __DOXYGEN__
3542 #define TCPIP_DEBUG                     LWIP_DBG_OFF
3543 #endif
3544 
3545 /**
3546  * SLIP_DEBUG: Enable debugging in slipif.c.
3547  */
3548 #if !defined SLIP_DEBUG || defined __DOXYGEN__
3549 #define SLIP_DEBUG                      LWIP_DBG_OFF
3550 #endif
3551 
3552 /**
3553  * DHCP_DEBUG: Enable debugging in dhcp.c.
3554  */
3555 #if !defined DHCP_DEBUG || defined __DOXYGEN__
3556 #define DHCP_DEBUG                      LWIP_DBG_OFF
3557 #endif
3558 
3559 /**
3560  * AUTOIP_DEBUG: Enable debugging in autoip.c.
3561  */
3562 #if !defined AUTOIP_DEBUG || defined __DOXYGEN__
3563 #define AUTOIP_DEBUG                    LWIP_DBG_OFF
3564 #endif
3565 
3566 /**
3567  * ACD_DEBUG: Enable debugging in acd.c.
3568  */
3569 #if !defined ACD_DEBUG || defined __DOXYGEN__
3570 #define ACD_DEBUG                       LWIP_DBG_OFF
3571 #endif
3572 
3573 /**
3574  * DNS_DEBUG: Enable debugging for DNS.
3575  */
3576 #if !defined DNS_DEBUG || defined __DOXYGEN__
3577 #define DNS_DEBUG                       LWIP_DBG_OFF
3578 #endif
3579 
3580 /**
3581  * IP6_DEBUG: Enable debugging for IPv6.
3582  */
3583 #if !defined IP6_DEBUG || defined __DOXYGEN__
3584 #define IP6_DEBUG                       LWIP_DBG_OFF
3585 #endif
3586 
3587 /**
3588  * DHCP6_DEBUG: Enable debugging in dhcp6.c.
3589  */
3590 #if !defined DHCP6_DEBUG || defined __DOXYGEN__
3591 #define DHCP6_DEBUG                     LWIP_DBG_OFF
3592 #endif
3593 /**
3594  * @}
3595  */
3596 
3597 /**
3598  * LWIP_TESTMODE: Changes to make unit test possible
3599  */
3600 #if !defined LWIP_TESTMODE
3601 #define LWIP_TESTMODE                   0
3602 #endif
3603 
3604 /*
3605    --------------------------------------------------
3606    ---------- Performance tracking options ----------
3607    --------------------------------------------------
3608 */
3609 /**
3610  * @defgroup lwip_opts_perf Performance
3611  * @ingroup lwip_opts_debug
3612  * @{
3613  */
3614 /**
3615  * LWIP_PERF: Enable performance testing for lwIP
3616  * (if enabled, arch/perf.h is included)
3617  */
3618 #if !defined LWIP_PERF || defined __DOXYGEN__
3619 #define LWIP_PERF                       0
3620 #endif
3621 /**
3622  * @}
3623  */
3624 
3625 /**
3626  * enable LWIP_LOWPOWER macro to use lowpower function
3627  */
3628 #undef LWIP_LOWPOWER
3629 #if LWIP_TIMERS && !LWIP_TIMERS_CUSTOM
3630 #if defined (CONFIG_LWIP_LOWPOWER)
3631 #define LWIP_LOWPOWER 1
3632 #else
3633 #define LWIP_LOWPOWER 0
3634 #endif
3635 #else
3636 #define LWIP_LOWPOWER 0
3637 #endif
3638 
3639 #if LWIP_LOWPOWER
3640 
3641 /**
3642  * LOWPOWER_DEBUG: Enable debugging in lowpower.c.
3643  */
3644 #if !defined LOWPOWER_DEBUG || defined __DOXYGEN__
3645 #define LOWPOWER_DEBUG                 LWIP_DBG_OFF
3646 #endif
3647 
3648 #ifndef MEMP_NUM_TCPIP_MSG_LOWPOWER
3649 #define MEMP_NUM_TCPIP_MSG_LOWPOWER 10
3650 #endif
3651 
3652 #define LWIP_SNTP_TIMER    2
3653 
3654 #define LOWPOWER_TCP_TIMER 1
3655 
3656 #define MEMP_NUM_SYS_TIMEOUT_LOW (MEMP_NUM_SYS_TIMEOUT + LWIP_SNTP_TIMER + LOWPOWER_TCP_TIMER)
3657 #endif /* LWIP_LOWPOWER */
3658 
3659 #endif /* LWIP_HDR_OPT_H */
3660