BadVPN – Blame information for rev 1

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