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 #ifndef LWIP_IPV6_PREFIX_LEN 48 #define LWIP_IPV6_PREFIX_LEN 64 49 #endif 50 51 /* 52 * Include user defined options first. Anything not defined in these files 53 * will be set to standard values. Override anything you don't like! 54 */ 55 #ifdef LWIP_CONFIG_FILE 56 #include LWIP_CONFIG_FILE 57 #else 58 #include "lwip/lwipopts.h" 59 #endif // LWIP_CONFIG_FILE 60 #include "lwip/debug.h" 61 #if LWIP_LITEOS_COMPAT || LWIP_FREERTOS_COMPAT 62 #include "sys/select.h" 63 #include "sys/ioctl.h" 64 #include "asm/atomic.h" 65 #include <stdio.h> 66 #include <string.h> 67 #include <fcntl.h> 68 #include <netdb.h> 69 #include <arpa/inet.h> 70 #include <net/if.h> 71 #include <net/route.h> 72 #include <ifaddrs.h> 73 #include <errno.h> 74 #include <netinet/tcp.h> 75 76 #include <sys/socket.h> 77 #include <netpacket/packet.h> 78 79 #include <netinet/in.h> 80 #include <netinet/icmp6.h> 81 82 #if !LWIP_FREERTOS_COMPAT 83 /* Added for missing declaration of IN6ADDR_ANY_INIT */ 84 #if !LWIP_LINUX_COMPAT 85 #include <netinet/in.h> 86 #else 87 #include <linux/ipv6.h> 88 #endif 89 90 #ifndef LWIP_LITEOS_A_COMPAT 91 /* Not available on linux */ 92 #if !LWIP_LINUX_COMPAT 93 #include "checksum.h" 94 #endif 95 #endif /* LWIP_LITEOS_A_COMPAT */ 96 #endif 97 98 #endif /* LWIP_LITEOS_COMPAT || LWIP_FREERTOS_COMPAT */ 99 100 #include "securec.h" 101 102 /** 103 * @defgroup lwip_opts Options (lwipopts.h) 104 * @ingroup lwip 105 * 106 * @defgroup lwip_opts_debug Debugging 107 * @ingroup lwip_opts 108 * 109 * @defgroup lwip_opts_infrastructure Infrastructure 110 * @ingroup lwip_opts 111 * 112 * @defgroup lwip_opts_callback Callback-style APIs 113 * @ingroup lwip_opts 114 * 115 * @defgroup lwip_opts_threadsafe_apis Thread-safe APIs 116 * @ingroup lwip_opts 117 */ 118 119 /* 120 ------------------------------------ 121 -------------- NO SYS -------------- 122 ------------------------------------ 123 */ 124 /** 125 * @defgroup lwip_opts_nosys NO_SYS 126 * @ingroup lwip_opts_infrastructure 127 * @{ 128 */ 129 /** 130 * NO_SYS==1: Use lwIP without OS-awareness (no thread, semaphores, mutexes or 131 * mboxes). This means threaded APIs cannot be used (socket, netconn, 132 * i.e. everything in the 'api' folder), only the callback-style raw API is 133 * available (and you have to watch out for yourself that you don't access 134 * lwIP functions/structures from more than one context at a time!) 135 */ 136 #if !defined NO_SYS || defined __DOXYGEN__ 137 #define NO_SYS 0 138 #endif 139 /** 140 * @} 141 */ 142 143 /** 144 * @defgroup lwip_opts_timers Timers 145 * @ingroup lwip_opts_infrastructure 146 * @{ 147 */ 148 /** 149 * LWIP_TIMERS==0: Drop support for sys_timeout and lwip-internal cyclic timers. 150 * (the array of lwip-internal cyclic timers is still provided) 151 * (check NO_SYS_NO_TIMERS for compatibility to old versions) 152 */ 153 #if !defined LWIP_TIMERS || defined __DOXYGEN__ 154 #ifdef NO_SYS_NO_TIMERS 155 #define LWIP_TIMERS (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) 156 #else 157 #define LWIP_TIMERS 1 158 #endif 159 #endif 160 161 /** 162 * LWIP_TIMERS_CUSTOM==1: Provide your own timer implementation. 163 * Function prototypes in timeouts.h and the array of lwip-internal cyclic timers 164 * are still included, but the implementation is not. The following functions 165 * will be required: sys_timeouts_init(), sys_timeout(), sys_untimeout(), 166 * sys_timeouts_mbox_fetch() 167 */ 168 #if !defined LWIP_TIMERS_CUSTOM || defined __DOXYGEN__ 169 #define LWIP_TIMERS_CUSTOM 0 170 #endif 171 /** 172 * @} 173 */ 174 175 #define lwIP_TRUE 1 176 #define lwIP_FALSE 0 177 178 /** 179 * @defgroup lwip_opts_memcpy memcpy 180 * @ingroup lwip_opts_infrastructure 181 * @{ 182 */ 183 /** 184 * MEMCPY: override this if you have a faster implementation at hand than the 185 * one included in your C library 186 */ 187 #if !defined MEMCPY || defined __DOXYGEN__ 188 #define MEMCPY(dst, src, len) (void)memcpy(dst, src, len) 189 #endif 190 191 /** 192 * SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a 193 * call to memcpy() if the length is known at compile time and is small. 194 */ 195 #if !defined SMEMCPY || defined __DOXYGEN__ 196 #define SMEMCPY(dst, src, len) (void)memcpy(dst, src, len) 197 #endif 198 199 /** 200 * MEMMOVE: override this if you have a faster implementation at hand than the 201 * one included in your C library. lwIP currently uses MEMMOVE only when IPv6 202 * fragmentation support is enabled. 203 */ 204 #if !defined MEMMOVE || defined __DOXYGEN__ 205 #define MEMMOVE(dst, src, len) memmove(dst, src, len) 206 #endif 207 208 extern volatile int tcpip_init_finish; 209 210 /** 211 * @} 212 */ 213 214 /* 215 ------------------------------------ 216 ----------- Core locking ----------- 217 ------------------------------------ 218 */ 219 /** 220 * @defgroup lwip_opts_lock Core locking and MPU 221 * @ingroup lwip_opts_infrastructure 222 * @{ 223 */ 224 /** 225 * LWIP_MPU_COMPATIBLE: enables special memory management mechanism 226 * which makes lwip able to work on MPU (Memory Protection Unit) system 227 * by not passing stack-pointers to other threads 228 * (this decreases performance as memory is allocated from pools instead 229 * of keeping it on the stack) 230 */ 231 #if !defined LWIP_MPU_COMPATIBLE || defined __DOXYGEN__ 232 #define LWIP_MPU_COMPATIBLE 0 233 #endif 234 235 /** 236 * LWIP_TCPIP_CORE_LOCKING 237 * Creates a global mutex that is held during TCPIP thread operations. 238 * Can be locked by client code to perform lwIP operations without changing 239 * into TCPIP thread using callbacks. See LOCK_TCPIP_CORE() and 240 * UNLOCK_TCPIP_CORE(). 241 * Your system should provide mutexes supporting priority inversion to use this. 242 */ 243 #if !defined LWIP_TCPIP_CORE_LOCKING || defined __DOXYGEN__ 244 #define LWIP_TCPIP_CORE_LOCKING 1 245 #endif 246 247 /** 248 * LWIP_TCPIP_CORE_LOCKING_INPUT: when LWIP_TCPIP_CORE_LOCKING is enabled, 249 * this lets tcpip_input() grab the mutex for input packets as well, 250 * instead of allocating a message and passing it to tcpip_thread. 251 * 252 * ATTENTION: this does not work when tcpip_input() is called from 253 * interrupt context! 254 */ 255 #if !defined LWIP_TCPIP_CORE_LOCKING_INPUT || defined __DOXYGEN__ 256 #define LWIP_TCPIP_CORE_LOCKING_INPUT 0 257 #endif 258 259 /** 260 * SYS_LIGHTWEIGHT_PROT==1: enable inter-task protection (and task-vs-interrupt 261 * protection) for certain critical regions during buffer allocation, deallocation 262 * and memory allocation and deallocation. 263 * ATTENTION: This is required when using lwIP from more than one context! If 264 * you disable this, you must be sure what you are doing! 265 */ 266 #if !defined SYS_LIGHTWEIGHT_PROT || defined __DOXYGEN__ 267 #define SYS_LIGHTWEIGHT_PROT 1 268 #endif 269 270 /** 271 * Macro/function to check whether lwIP's threading/locking 272 * requirements are satisfied during current function call. 273 * This macro usually calls a function that is implemented in the OS-dependent 274 * sys layer and performs the following checks: 275 * - Not in ISR (this should be checked for NO_SYS==1, too!) 276 * - If @ref LWIP_TCPIP_CORE_LOCKING = 1: TCPIP core lock is held 277 * - If @ref LWIP_TCPIP_CORE_LOCKING = 0: function is called from TCPIP thread 278 * @see @ref multithreading 279 */ 280 #if !defined LWIP_ASSERT_CORE_LOCKED || defined __DOXYGEN__ 281 #define LWIP_ASSERT_CORE_LOCKED() 282 #endif 283 284 /** 285 * Called as first thing in the lwIP TCPIP thread. Can be used in conjunction 286 * with @ref LWIP_ASSERT_CORE_LOCKED to check core locking. 287 * @see @ref multithreading 288 */ 289 #if !defined LWIP_MARK_TCPIP_THREAD || defined __DOXYGEN__ 290 #define LWIP_MARK_TCPIP_THREAD() 291 #endif 292 293 /** 294 * @} 295 */ 296 297 /* 298 ------------------------------------ 299 ---------- Memory options ---------- 300 ------------------------------------ 301 */ 302 /** 303 * @defgroup lwip_opts_mem Heap and memory pools 304 * @ingroup lwip_opts_infrastructure 305 * @{ 306 */ 307 /** 308 * MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library 309 * instead of the lwip internal allocator. Can save code size if you 310 * already use it. 311 */ 312 #if !defined MEM_LIBC_MALLOC || defined __DOXYGEN__ 313 #define MEM_LIBC_MALLOC 1 314 #endif 315 316 /** 317 * MEM_LIBC_MALLOC_TOTAL_SIZE_CHECK==1: Keep track of the total size allocated 318 * from the heap. This works only with both MEM_LIBC_MALLOC==1 and MEM_STATS==1. 319 */ 320 #ifndef MEM_LIBC_MALLOC_TOTAL_SIZE_CHECK 321 #define MEM_LIBC_MALLOC_TOTAL_SIZE_CHECK 0 322 #endif 323 324 /** 325 * Limit the maximum total size that can be allocated from heap by setting this 326 * macro to a non-zero value. This works with MEM_LIBC_MALLOC_TOTAL_SIZE_CHECK==1. 327 */ 328 #ifndef MEM_LIBC_MALLOC_TOTAL_SIZE_LIMIT 329 #define MEM_LIBC_MALLOC_TOTAL_SIZE_LIMIT 0 330 #endif 331 332 /** 333 * PBUF_RX_RATIONING==1: add pbuf_alloc_for_rx API that tries to alloc pbuf from 334 * PBUF_RAM and then from PBUF_POOL; also force tcp to announce a small window 335 * when pbuf_ram is in shortage. 336 */ 337 #ifndef PBUF_RX_RATIONING 338 #define PBUF_RX_RATIONING 0 339 #endif 340 341 /** 342 * MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator. 343 * Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution 344 * speed (heap alloc can be much slower than pool alloc) and usage from interrupts 345 * (especially if your netif driver allocates PBUF_POOL pbufs for received frames 346 * from interrupt)! 347 * ATTENTION: Currently, this uses the heap for ALL pools (also for private pools, 348 * not only for internal pools defined in memp_std.h)! 349 */ 350 #if !defined MEMP_MEM_MALLOC || defined __DOXYGEN__ 351 #define MEMP_MEM_MALLOC 0 352 #endif 353 354 /** 355 * MEMP_MEM_INIT==1: Force use of memset to initialize pool memory. 356 * Useful if pool are moved in uninitialized section of memory. This will ensure 357 * default values in pcbs struct are well initialized in all conditions. 358 */ 359 #if !defined MEMP_MEM_INIT || defined __DOXYGEN__ 360 #define MEMP_MEM_INIT 0 361 #endif 362 363 #ifndef TCP_PBUF_MALLOC 364 #define TCP_PBUF_MALLOC 1 365 #endif 366 367 /** 368 * MEM_ALIGNMENT: should be set to the alignment of the CPU 369 * 4 byte alignment -> \#define MEM_ALIGNMENT 4 370 * 2 byte alignment -> \#define MEM_ALIGNMENT 2 371 */ 372 #if !defined MEM_ALIGNMENT || defined __DOXYGEN__ 373 #ifdef __LP64__ 374 #define MEM_ALIGNMENT 8U /* for 64bit support */ 375 #else 376 #define MEM_ALIGNMENT 4U 377 #endif 378 #endif 379 380 /** 381 * This macro sets the minimum size required for pbuf with type PBUF_RAM 382 * When setting size using the pbuf_ram_size_set, the input size should be greater than the 383 * minimum size of PBUF_RAM_SIZE_MIN. 384 */ 385 #if !defined PBUF_RAM_SIZE_MIN || defined __DOXYGEN__ 386 #define PBUF_RAM_SIZE_MIN 1024 387 #endif 388 389 /** 390 * This macro sets the maximum length to be passed to pbuf alloc for PBUF_RAM type. 391 */ 392 #if !defined MAX_PBUF_RAM_SIZE_TO_ALLOC || defined __DOXYGEN__ 393 #define MAX_PBUF_RAM_SIZE_TO_ALLOC 65535U 394 #endif 395 396 /** 397 * This macro sets the align size of the DMA memory. If set to 1, then DMA is not used. 398 */ 399 #ifndef MEM_MALLOC_DMA_ALIGN 400 #define MEM_MALLOC_DMA_ALIGN 64 401 #endif 402 403 #ifndef PBUF_LINK_CHKSUM_LEN 404 #define PBUF_LINK_CHKSUM_LEN 0 405 #endif 406 407 /** 408 * MEM_SIZE: the size of the heap memory. If the application will send 409 * a lot of data that needs to be copied, this should be set high. 410 */ 411 #if !defined MEM_SIZE || defined __DOXYGEN__ 412 #define MEM_SIZE 1600 413 #endif 414 415 /** 416 * MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable 417 * amount of bytes before and after each memp element in every pool and fills 418 * it with a prominent default value. 419 * MEMP_OVERFLOW_CHECK == 0 no checking 420 * MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed 421 * MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time 422 * memp_malloc() or memp_free() is called (useful but slow!) 423 */ 424 #if !defined MEMP_OVERFLOW_CHECK || defined __DOXYGEN__ 425 #define MEMP_OVERFLOW_CHECK 0 426 #endif 427 428 /** 429 * MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make 430 * sure that there are no cycles in the linked lists. 431 */ 432 #if !defined MEMP_SANITY_CHECK || defined __DOXYGEN__ 433 #define MEMP_SANITY_CHECK 0 434 #endif 435 436 /** 437 * MEM_OVERFLOW_CHECK: mem overflow protection reserves a configurable 438 * amount of bytes before and after each heap allocation chunk and fills 439 * it with a prominent default value. 440 * MEM_OVERFLOW_CHECK == 0 no checking 441 * MEM_OVERFLOW_CHECK == 1 checks each element when it is freed 442 * MEM_OVERFLOW_CHECK >= 2 checks all heap elements every time 443 * mem_malloc() or mem_free() is called (useful but slow!) 444 */ 445 #if !defined MEM_OVERFLOW_CHECK || defined __DOXYGEN__ 446 #define MEM_OVERFLOW_CHECK 0 447 #endif 448 449 /** 450 * MEM_SANITY_CHECK==1: run a sanity check after each mem_free() to make 451 * sure that the linked list of heap elements is not corrupted. 452 */ 453 #if !defined MEM_SANITY_CHECK || defined __DOXYGEN__ 454 #define MEM_SANITY_CHECK 0 455 #endif 456 457 /** 458 * MEMP_DOUBLE_FREE_CHECK==1: bail out when a memp element double-free issue is detected. 459 * This feature is created to avoid memp linklist become a loop, but is costs memory size. 460 */ 461 #if !defined MEMP_DOUBLE_FREE_CHECK || defined __DOXYGEN__ 462 #define MEMP_DOUBLE_FREE_CHECK 0 463 #endif 464 465 /** 466 * MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set 467 * of memory pools of various sizes. When mem_malloc is called, an element of 468 * the smallest pool that can provide the length needed is returned. 469 * To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled. 470 */ 471 #if !defined MEM_USE_POOLS || defined __DOXYGEN__ 472 #define MEM_USE_POOLS 0 473 #endif 474 475 /** 476 * MEM_USE_POOLS_TRY_BIGGER_POOL==1: if one malloc-pool is empty, try the next 477 * bigger pool - WARNING: THIS MIGHT WASTE MEMORY but it can make a system more 478 * reliable. */ 479 #if !defined MEM_USE_POOLS_TRY_BIGGER_POOL || defined __DOXYGEN__ 480 #define MEM_USE_POOLS_TRY_BIGGER_POOL 0 481 #endif 482 483 /** 484 * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h 485 * that defines additional pools beyond the "standard" ones required 486 * by lwIP. If you set this to 1, you must have lwippools.h in your 487 * include path somewhere. 488 */ 489 #if !defined MEMP_USE_CUSTOM_POOLS || defined __DOXYGEN__ 490 #define MEMP_USE_CUSTOM_POOLS 0 491 #endif 492 493 /** 494 * Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from 495 * interrupt context (or another context that doesn't allow waiting for a 496 * semaphore). 497 * If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT, 498 * while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs 499 * with each loop so that mem_free can run. 500 * 501 * ATTENTION: As you can see from the above description, this leads to dis-/ 502 * enabling interrupts often, which can be slow! Also, on low memory, mem_malloc 503 * can need longer. 504 * 505 * If you don't want that, at least for NO_SYS=0, you can still use the following 506 * functions to enqueue a deallocation call which then runs in the tcpip_thread 507 * context: 508 * - pbuf_free_callback(p); 509 * - mem_free_callback(m); 510 */ 511 #if !defined LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT || defined __DOXYGEN__ 512 #define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0 513 #endif 514 515 /** 516 * MEM_PBUF_RAM_SIZE_LIMIT : This configuration if enabled, limits the memory size usage by MEM_SIZE 517 * value.The configuration can be enabled under MEM_LIBC_MALLOC . 518 */ 519 #ifndef MEM_PBUF_RAM_SIZE_LIMIT 520 #define MEM_PBUF_RAM_SIZE_LIMIT MEM_LIBC_MALLOC 521 #endif 522 #if MEM_PBUF_RAM_SIZE_LIMIT && !MEM_PBUF_RAM_SIZE_LIMIT 523 #undef MEM_PBUF_RAM_SIZE_LIMIT 524 #define MEM_PBUF_RAM_SIZE_LIMIT 0 525 #endif 526 527 #ifndef LWIP_NAT64_PRIORITY_KEEP 528 #define LWIP_NAT64_PRIORITY_KEEP 1 529 #endif 530 531 /** 532 * @} 533 */ 534 535 /* 536 ------------------------------------------------ 537 ---------- Internal Memory Pool Sizes ---------- 538 ------------------------------------------------ 539 */ 540 /** 541 * @defgroup lwip_opts_memp Internal memory pools 542 * @ingroup lwip_opts_infrastructure 543 * @{ 544 */ 545 /** 546 * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF). 547 * If the application sends a lot of data out of ROM (or other static memory), 548 * this should be set high. 549 */ 550 #if !defined MEMP_NUM_PBUF || defined __DOXYGEN__ 551 #define MEMP_NUM_PBUF 16 552 #endif 553 554 /** 555 * MEMP_NUM_RAW_PCB: Number of raw connection PCBs 556 * (requires the LWIP_RAW option) 557 */ 558 #if !defined MEMP_NUM_RAW_PCB || defined __DOXYGEN__ 559 #define MEMP_NUM_RAW_PCB 4 560 #endif 561 562 /** 563 * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One 564 * per active UDP "connection". 565 * (requires the LWIP_UDP option) 566 */ 567 #if !defined MEMP_NUM_UDP_PCB || defined __DOXYGEN__ 568 #define MEMP_NUM_UDP_PCB LWIP_CONFIG_NUM_SOCKETS 569 #endif 570 571 /** 572 * MEMP_NUM_TCP_PCB: the number of simultaneously active TCP connections. 573 * (requires the LWIP_TCP option) 574 */ 575 #if !defined MEMP_NUM_TCP_PCB || defined __DOXYGEN__ 576 #define MEMP_NUM_TCP_PCB LWIP_CONFIG_NUM_SOCKETS 577 #endif 578 579 /** 580 * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. 581 * (requires the LWIP_TCP option) 582 */ 583 #if !defined MEMP_NUM_TCP_PCB_LISTEN || defined __DOXYGEN__ 584 #define MEMP_NUM_TCP_PCB_LISTEN LWIP_CONFIG_NUM_SOCKETS 585 #endif 586 587 /** 588 * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. 589 * (requires the LWIP_TCP option) 590 */ 591 #if !defined MEMP_NUM_TCP_SEG || defined __DOXYGEN__ 592 #define MEMP_NUM_TCP_SEG 16 593 #endif 594 595 /** 596 * MEMP_NUM_ALTCP_PCB: the number of simultaneously active altcp layer pcbs. 597 * (requires the LWIP_ALTCP option) 598 * Connections with multiple layers require more than one altcp_pcb (e.g. TLS 599 * over TCP requires 2 altcp_pcbs, one for TLS and one for TCP). 600 */ 601 #if !defined MEMP_NUM_ALTCP_PCB || defined __DOXYGEN__ 602 #define MEMP_NUM_ALTCP_PCB MEMP_NUM_TCP_PCB 603 #endif 604 605 /** 606 * MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for 607 * reassembly (whole packets, not fragments!) 608 */ 609 #if !defined MEMP_NUM_REASSDATA || defined __DOXYGEN__ 610 #define MEMP_NUM_REASSDATA 5 611 #endif 612 613 /** 614 * MEMP_NUM_FRAG_PBUF: the number of IP fragments simultaneously sent 615 * (fragments, not whole packets!). 616 * This is only used with LWIP_NETIF_TX_SINGLE_PBUF==0 and only has to be > 1 617 * with DMA-enabled MACs where the packet is not yet sent when netif->output 618 * returns. 619 */ 620 #if !defined MEMP_NUM_FRAG_PBUF || defined __DOXYGEN__ 621 #define MEMP_NUM_FRAG_PBUF 15 622 #endif 623 624 /** 625 * MEMP_NUM_ARP_QUEUE: the number of simultaneously queued outgoing 626 * packets (pbufs) that are waiting for an ARP request (to resolve 627 * their destination address) to finish. 628 * (requires the ARP_QUEUEING option) 629 */ 630 #if !defined MEMP_NUM_ARP_QUEUE || defined __DOXYGEN__ 631 #define MEMP_NUM_ARP_QUEUE 30 632 #endif 633 634 /** 635 * MEMP_NUM_IGMP_GROUP: The number of multicast groups whose network interfaces 636 * can be members at the same time (one per netif - allsystems group -, plus one 637 * per netif membership). 638 * (requires the LWIP_IGMP option) 639 */ 640 #if !defined MEMP_NUM_IGMP_GROUP || defined __DOXYGEN__ 641 #define MEMP_NUM_IGMP_GROUP 8 642 #endif 643 644 /** 645 * Defines the number of default number of sockets 646 */ 647 #ifndef DEFAULT_LWIP_NUM_SOCKETS 648 #define DEFAULT_LWIP_NUM_SOCKETS 128 649 #endif 650 651 /* 652 * Provides flexibility to use configured values to spread across code 653 */ 654 /** 655 * LWIP_ALLOW_SOCKET_CONFIG ==0 allows stack to use default value of the number of sockets. 656 * That is LWIP_CONFIG_NUM_SOCKETS will be DEFAULT_LWIP_NUM_SOCKETS. 657 * LWIP_ALLOW_SOCKET_CONFIG ==1 allows application to use the configured value. 658 * Application can configure the Number of sockets using the API lwip_set_socket_num and retrieve the 659 * value through API lwip_get_socket_num. 660 */ 661 #ifndef LWIP_ALLOW_SOCKET_CONFIG 662 #define LWIP_ALLOW_SOCKET_CONFIG 0 663 #endif 664 665 #if LWIP_ALLOW_SOCKET_CONFIG == 0 666 #ifndef LWIP_CONFIG_NUM_SOCKETS 667 #define LWIP_CONFIG_NUM_SOCKETS DEFAULT_LWIP_NUM_SOCKETS 668 #endif 669 670 #else /* LWIP_ALLOW_SOCKET_CONFIG */ 671 #ifndef LWIP_CONFIG_NUM_SOCKETS 672 extern unsigned int g_lwip_num_sockets; 673 #define LWIP_CONFIG_NUM_SOCKETS g_lwip_num_sockets 674 #endif 675 #endif /* LWIP_ALLOW_SOCKET_CONFIG */ 676 677 #ifndef CONFIG_NFILE_DESCRIPTORS 678 #define CONFIG_NFILE_DESCRIPTORS 0 679 #endif 680 681 /** 682 * Defines the maximum number of sockets supported. 683 */ 684 #ifndef LWIP_NUM_SOCKETS_MAX 685 #define LWIP_NUM_SOCKETS_MAX (FD_SETSIZE - CONFIG_NFILE_DESCRIPTORS) 686 #endif 687 688 /** 689 * Defines the number of Maximum number of configurable sockets 690 */ 691 #ifndef LWIP_NUM_SOCKETS_MAX 692 #define LWIP_NUM_SOCKETS_MAX 128 693 #endif 694 695 /** 696 * Defines the number of simultaneously active timeouts. 697 * The default number of timeouts is calculated in this macro, for all enabled modules. 698 * The formula expects settings to be either '0' or '1'. 699 */ 700 #if !defined MEMP_NUM_SYS_TIMEOUT || defined __DOXYGEN__ 701 #define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + ((2 * (LWIP_DHCP))) + LWIP_AUTOIP + LWIP_SNTP + \ 702 LWIP_IGMP + LWIP_DNS + LWIP_LIBCOAP + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD + LWIP_IPV6_DHCP6 + \ 703 LWIP_RIPPLE_TIMER_COUNT + LWIP_6LOWPAN + LWIP_NAT64 + LWIP_IP6IN4) : 0)) 704 #endif 705 706 /** 707 * MEMP_NUM_NETBUF: the number of struct netbufs. 708 * (only needed if you use the sequential API, like api_lib.c) 709 */ 710 #if !defined MEMP_NUM_NETBUF || defined __DOXYGEN__ 711 #define MEMP_NUM_NETBUF 20 712 #endif 713 714 /** 715 * MEMP_NUM_NETCONN: the number of struct netconns. 716 * (only needed if you use the sequential API, like api_lib.c) 717 */ 718 #if !defined MEMP_NUM_NETCONN || defined __DOXYGEN__ 719 #define MEMP_NUM_NETCONN 512 720 #endif 721 722 /** 723 * MEMP_NUM_SELECT_CB: the number of struct lwip_select_cb. 724 * (Only needed if you have LWIP_MPU_COMPATIBLE==1 and use the socket API. 725 * In that case, you need one per thread calling lwip_select.) 726 */ 727 #if !defined MEMP_NUM_SELECT_CB || defined __DOXYGEN__ 728 #define MEMP_NUM_SELECT_CB 4 729 #endif 730 731 /** 732 * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used 733 * for callback/timeout API communication. 734 * (only needed if you use tcpip.c) 735 */ 736 #if !defined MEMP_NUM_TCPIP_MSG_API || defined __DOXYGEN__ 737 #define MEMP_NUM_TCPIP_MSG_API 8 738 #endif 739 740 /** 741 * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used 742 * for incoming packets. 743 * (only needed if you use tcpip.c) 744 */ 745 #if !defined MEMP_NUM_TCPIP_MSG_INPKT || defined __DOXYGEN__ 746 #define MEMP_NUM_TCPIP_MSG_INPKT 8 747 #endif 748 749 /** 750 * MEMP_NUM_NETDB: the number of concurrently running lwip_addrinfo() calls 751 * (before freeing the corresponding memory using lwip_freeaddrinfo()). 752 */ 753 #if !defined MEMP_NUM_NETDB || defined __DOXYGEN__ 754 #define MEMP_NUM_NETDB 8 755 #endif 756 757 /** 758 * MEMP_NUM_LOCALHOSTLIST: the number of host entries in the local host list 759 * if DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1. 760 */ 761 #if !defined MEMP_NUM_LOCALHOSTLIST || defined __DOXYGEN__ 762 #define MEMP_NUM_LOCALHOSTLIST 1 763 #endif 764 765 /** 766 * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. 767 */ 768 #if !defined PBUF_POOL_SIZE || defined __DOXYGEN__ 769 #define PBUF_POOL_SIZE 16 770 #endif 771 772 /** MEMP_NUM_API_MSG: the number of concurrently active calls to various 773 * socket, netconn, and tcpip functions 774 */ 775 #if !defined MEMP_NUM_API_MSG || defined __DOXYGEN__ 776 #define MEMP_NUM_API_MSG MEMP_NUM_TCPIP_MSG_API 777 #endif 778 779 /** MEMP_NUM_DNS_API_MSG: the number of concurrently active calls to netconn_gethostbyname 780 */ 781 #if !defined MEMP_NUM_DNS_API_MSG || defined __DOXYGEN__ 782 #define MEMP_NUM_DNS_API_MSG MEMP_NUM_TCPIP_MSG_API 783 #endif 784 785 /** MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA: the number of concurrently active calls 786 * to getsockopt/setsockopt 787 */ 788 #if !defined MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA || defined __DOXYGEN__ 789 #define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API 790 #endif 791 792 /** MEMP_NUM_NETIFAPI_MSG: the number of concurrently active calls to the 793 * netifapi functions 794 */ 795 #if !defined MEMP_NUM_NETIFAPI_MSG || defined __DOXYGEN__ 796 #define MEMP_NUM_NETIFAPI_MSG MEMP_NUM_TCPIP_MSG_API 797 #endif 798 /** 799 * @} 800 */ 801 802 /* 803 --------------------------------- 804 ---------- ARP options ---------- 805 --------------------------------- 806 */ 807 /** 808 * @defgroup lwip_opts_arp ARP 809 * @ingroup lwip_opts_ipv4 810 * @{ 811 */ 812 /** 813 * LWIP_ARP==1: Enable ARP functionality. 814 */ 815 #if !defined LWIP_ARP || defined __DOXYGEN__ 816 #define LWIP_ARP 1 817 #endif 818 819 #ifndef LWIP_ARP_GRATUITOUS_REXMIT 820 #define LWIP_ARP_GRATUITOUS_REXMIT 1 821 #endif 822 823 /** 824 * ARP_TABLE_SIZE: Number of active MAC-IP address pairs cached. 825 */ 826 #if !defined ARP_TABLE_SIZE || defined __DOXYGEN__ 827 #define ARP_TABLE_SIZE 10 828 #endif 829 830 /** the time an ARP entry stays valid after its last update, 831 * for ARP_TMR_INTERVAL = 1000, this is 832 * (60 * 5) seconds = 5 minutes. 833 */ 834 #if !defined ARP_MAXAGE || defined __DOXYGEN__ 835 #define ARP_MAXAGE 300 836 #endif 837 838 /** 839 * ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address 840 * resolution. By default, only the most recent packet is queued per IP address. 841 * This is sufficient for most protocols and mainly reduces TCP connection 842 * startup time. Set this to 1 if you know your application sends more than one 843 * packet in a row to an IP address that is not in the ARP cache. 844 */ 845 #if !defined ARP_QUEUEING || defined __DOXYGEN__ 846 #define ARP_QUEUEING 0 847 #endif 848 849 /** 850 * ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be 851 * updated with the source MAC and IP_add supplied in the packet. 852 * Disable this if you do not trust LAN peers to have the 853 * correct addresses, or as a limited approach to attempt to handle 854 * spoofing. If disabled, lwIP must make a new ARP request if 855 * the peer is not already in the ARP table, adding a little latency. 856 * The peer is in the ARP table if it requested our address earlier. 857 * Also note that this slows down input processing of every IP packet. 858 */ 859 #ifndef ETHARP_TRUST_IP_MAC 860 #define ETHARP_TRUST_IP_MAC 1 861 #endif 862 863 /** The maximum number of packets which may be queued for each 864 * unresolved address by other network layers. Defaults to 3, 0 means disabled. 865 * Old packets are dropped, new packets are queued. 866 */ 867 #if !defined ARP_QUEUE_LEN || defined __DOXYGEN__ 868 #define ARP_QUEUE_LEN 3 869 #endif 870 871 /** 872 * ETHARP_SUPPORT_VLAN==1: support receiving and sending ethernet packets with 873 * VLAN header. See the description of LWIP_HOOK_VLAN_CHECK and 874 * LWIP_HOOK_VLAN_SET hooks to check/set VLAN headers. 875 * Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check. 876 * If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted. 877 * If ETHARP_VLAN_CHECK is not defined, all traffic is accepted. 878 * Alternatively, define a function/define ETHARP_VLAN_CHECK_FN(eth_hdr, vlan) 879 * that returns 1 to accept a packet or 0 to drop a packet. 880 */ 881 #if !defined ETHARP_SUPPORT_VLAN || defined __DOXYGEN__ 882 #define ETHARP_SUPPORT_VLAN 0 883 #endif 884 885 /** LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled 886 */ 887 #if !defined LWIP_ETHERNET || defined __DOXYGEN__ 888 #define LWIP_ETHERNET LWIP_ARP 889 #endif 890 891 /** ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure 892 * alignment of payload after that header. Since the header is 14 bytes long, 893 * without this padding e.g. addresses in the IP header will not be aligned 894 * on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms. 895 */ 896 #if !defined ETH_PAD_SIZE || defined __DOXYGEN__ 897 #define ETH_PAD_SIZE 0 898 #endif 899 900 /** ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table 901 * entries (using etharp_add_static_entry/etharp_remove_static_entry). 902 */ 903 #if !defined ETHARP_SUPPORT_STATIC_ENTRIES || defined __DOXYGEN__ 904 #define ETHARP_SUPPORT_STATIC_ENTRIES 1 905 #endif 906 907 /** ETHARP_TABLE_MATCH_NETIF==1: Match netif for ARP table entries. 908 * If disabled, duplicate IP address on multiple netifs are not supported 909 * (but this should only occur for AutoIP). 910 */ 911 #if !defined ETHARP_TABLE_MATCH_NETIF || defined __DOXYGEN__ 912 #define ETHARP_TABLE_MATCH_NETIF !LWIP_SINGLE_NETIF 913 #endif 914 915 /** ETHARP_FAST_RTE==1: If an ip addr is unresolved in the last round of ARP 916 * probing and then gets queried again within a period of time, ERR_RTE will 917 * be raised without putting the packet into ARP queue. This is a fool-proof 918 * scheme to save MEMP_ARP_QUEUE for apps may try tirelessly to send packets 919 * to unreachable destinations. 920 */ 921 #if !defined ETHARP_FAST_RTE || defined __DOXYGEN__ 922 #define ETHARP_FAST_RTE 0 923 #endif 924 /** 925 * @} 926 */ 927 928 /* 929 -------------------------------- 930 ---------- IP options ---------- 931 -------------------------------- 932 */ 933 /** 934 * @defgroup lwip_opts_ipv4 IPv4 935 * @ingroup lwip_opts 936 * @{ 937 */ 938 /** 939 * LWIP_IPV4==1: Enable IPv4 940 */ 941 #if !defined LWIP_IPV4 || defined __DOXYGEN__ 942 #define LWIP_IPV4 1 943 #endif 944 945 /** 946 * IP_FORWARD==1: Enables the ability to forward IP packets across network 947 * interfaces. If you are going to run lwIP on a device with only one network 948 * interface, define this to 0. 949 */ 950 #if !defined IP_FORWARD || defined __DOXYGEN__ 951 #define IP_FORWARD 0 952 #endif 953 954 /** 955 * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that 956 * this option does not affect outgoing packet sizes, which can be controlled 957 * via IP_FRAG. 958 */ 959 #if !defined IP_REASSEMBLY || defined __DOXYGEN__ 960 #define IP_REASSEMBLY 1 961 #endif 962 963 /** 964 * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note 965 * that this option does not affect incoming packet sizes, which can be 966 * controlled via IP_REASSEMBLY. 967 */ 968 #if !defined IP_FRAG || defined __DOXYGEN__ 969 #define IP_FRAG 1 970 #endif 971 972 #if !LWIP_IPV4 973 /* disable IPv4 extensions when IPv4 is disabled */ 974 #undef IP_FORWARD 975 #define IP_FORWARD 0 976 #undef IP_REASSEMBLY 977 #define IP_REASSEMBLY 0 978 #undef IP_FRAG 979 #define IP_FRAG 0 980 #endif /* !LWIP_IPV4 */ 981 982 /** 983 * IP_OPTIONS_ALLOWED: Defines the behavior for IP options. 984 * IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped. 985 * IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed). 986 */ 987 #if !defined IP_OPTIONS_ALLOWED || defined __DOXYGEN__ 988 #define IP_OPTIONS_ALLOWED 1 989 #endif 990 991 /** 992 * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally) 993 * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived 994 * in this time, the whole packet is discarded. 995 */ 996 #if !defined IP_REASS_MAXAGE || defined __DOXYGEN__ 997 #define IP_REASS_MAXAGE 3 998 #endif 999 1000 /** 1001 * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled. 1002 * Since the received pbufs are enqueued, be sure to configure 1003 * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive 1004 * packets even if the maximum amount of fragments is enqueued for reassembly! 1005 * When IPv4 *and* IPv6 are enabled, this even changes to 1006 * (PBUF_POOL_SIZE > 2 * IP_REASS_MAX_PBUFS)! 1007 */ 1008 #if !defined IP_REASS_MAX_PBUFS || defined __DOXYGEN__ 1009 #define IP_REASS_MAX_PBUFS 10 1010 #endif 1011 1012 /* Max size(65535 + extra buffer(8192) per MAX MTU) */ 1013 #ifndef IP_REASS_MAX_PBUFS_PER_PKT 1014 #define IP_REASS_MAX_PBUFS_PER_PKT ((65535 + 8192) / (IP_FRAG_MAX_MTU - 20 - 8)) 1015 #endif 1016 1017 /** 1018 * Defines the assumed maximum MTU on any interface for IP fragment buffer 1019 * (requires IP_FRAG_USES_STATIC_BUF==1).This is not a configurable value. 1020 */ 1021 #if !defined(IP_FRAG_MAX_MTU) 1022 #define IP_FRAG_MAX_MTU 1500 1023 #endif 1024 /* As per RFC 791, "Every internet module must be able to forward a datagram of 68 1025 * octets without further fragmentation. This is because an internet header 1026 * may be up to 60 octets, and the minimum fragment is 8 octets." */ 1027 #if !defined(IP_FRAG_MIN_MTU) 1028 #define IP_FRAG_MIN_MTU 68 1029 #endif 1030 1031 /** 1032 * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers. 1033 */ 1034 #if !defined IP_DEFAULT_TTL || defined __DOXYGEN__ 1035 #define IP_DEFAULT_TTL 255 1036 #endif 1037 1038 #if !defined IP_MAX_TTL || defined __DOXYGEN__ 1039 #define IP_MAX_TTL 255 1040 #endif 1041 1042 /** 1043 * IP_USE_DEFAULT_TTL: -1 use default TTL. 1044 */ 1045 #if !defined IP_USE_DEFAULT_TTL || defined __DOXYGEN__ 1046 #define IP_USE_DEFAULT_TTL (-1) 1047 #endif 1048 1049 /** 1050 * IP_SOF_BROADCAST=1: Use the SOF_BROADCAST field to enable broadcast 1051 * filter per pcb on udp and raw send operations. To enable broadcast filter 1052 * on recv operations, you also have to set IP_SOF_BROADCAST_RECV=1. 1053 */ 1054 #if !defined IP_SOF_BROADCAST || defined __DOXYGEN__ 1055 #define IP_SOF_BROADCAST 1 1056 #endif 1057 1058 /** 1059 * IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast 1060 * filter on recv operations. 1061 */ 1062 #if !defined IP_SOF_BROADCAST_RECV || defined __DOXYGEN__ 1063 #define IP_SOF_BROADCAST_RECV 0 1064 #endif 1065 1066 /** 1067 * IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1: allow ip_forward() to send packets back 1068 * out on the netif where it was received. This should only be used for 1069 * wireless networks. 1070 * ATTENTION: When this is 1, make sure your netif driver correctly marks incoming 1071 * link-layer-broadcast/multicast packets as such using the corresponding pbuf flags! 1072 */ 1073 #if !defined IP_FORWARD_ALLOW_TX_ON_RX_NETIF || defined __DOXYGEN__ 1074 #define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0 1075 #endif 1076 /** 1077 * @} 1078 */ 1079 1080 /* 1081 ---------------------------------- 1082 ---------- ICMP options ---------- 1083 ---------------------------------- 1084 */ 1085 /** 1086 * @defgroup lwip_opts_icmp ICMP 1087 * @ingroup lwip_opts_ipv4 1088 * @{ 1089 */ 1090 /** 1091 * LWIP_ICMP==1: Enable ICMP module inside the IP stack. 1092 * Be careful, disable that make your product non-compliant to RFC1122 1093 */ 1094 #if !defined LWIP_ICMP || defined __DOXYGEN__ 1095 #define LWIP_ICMP 1 1096 #endif 1097 1098 /** 1099 * ICMP_TTL: Default value for Time-To-Live used by ICMP packets. 1100 */ 1101 #if !defined ICMP_TTL || defined __DOXYGEN__ 1102 #define ICMP_TTL IP_DEFAULT_TTL 1103 #endif 1104 1105 /** 1106 * LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only) 1107 */ 1108 #if !defined LWIP_BROADCAST_PING || defined __DOXYGEN__ 1109 #define LWIP_BROADCAST_PING 0 1110 #endif 1111 1112 /** 1113 * LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only) 1114 */ 1115 #if !defined LWIP_MULTICAST_PING || defined __DOXYGEN__ 1116 #define LWIP_MULTICAST_PING 1 1117 #endif 1118 1119 /* NETIF DRIVER STATUS BEGIN */ 1120 1121 /** 1122 * DRIVER_STATUS_CHECK =0. If enabled can create low performance 1123 * Usage should be avoided. 1124 */ 1125 #ifndef DRIVER_STATUS_CHECK 1126 #define DRIVER_STATUS_CHECK 0 1127 #endif 1128 1129 /** 1130 * DRIVER_WAKEUP_INTERVAL = 120000. Not a configurable value. 1131 */ 1132 #if DRIVER_STATUS_CHECK 1133 #ifndef DRIVER_WAKEUP_INTERVAL 1134 #define DRIVER_WAKEUP_INTERVAL 120000 1135 #endif 1136 #endif 1137 /* NETIF DRIVER STATUS END */ 1138 1139 /** 1140 * @} 1141 */ 1142 1143 /* netif ifindex MUST NOT start from 0 as this value means no netif was bond to sockets */ 1144 /** 1145 * LWIP_NETIF_IFINDEX_START==1: Defines the start index of the interface list. 1146 * Not a configurable value. 1147 */ 1148 #ifndef LWIP_NETIF_IFINDEX_START 1149 #define LWIP_NETIF_IFINDEX_START 1 1150 #endif /* LWIP_NETIF_IFINDEX_START */ 1151 1152 /** 1153 * LWIP_NETIF_IFINDEX_MAX==10: Defines the start index of the interface list. 1154 * Not a configurable value. 1155 */ 1156 #ifndef LWIP_NETIF_IFINDEX_MAX 1157 #define LWIP_NETIF_IFINDEX_MAX 0xFE 1158 #endif 1159 1160 /* 1161 * LWIP_NETIF_NUM_MAX==255: Defines the maximum support number of same type netif. 1162 */ 1163 /* Increase the count of netifs supported by stack. 1164 Currently stack restricts the number of netif to 5, but older versions of linux kernel supports 1165 upto 255 interfaces . New versions donot have these restrictions but we stick to 255 */ 1166 #ifndef LWIP_NETIF_NUM_MAX 1167 #define LWIP_NETIF_NUM_MAX 255 1168 #endif 1169 1170 /* 1171 --------------------------------- 1172 ---------- RAW options ---------- 1173 --------------------------------- 1174 */ 1175 /** 1176 * @defgroup lwip_opts_raw RAW 1177 * @ingroup lwip_opts_callback 1178 * @{ 1179 */ 1180 /** 1181 * LWIP_RAW==1: Enable application layer to hook into the IP layer itself. 1182 */ 1183 #if !defined LWIP_RAW || defined __DOXYGEN__ 1184 #define LWIP_RAW 1 1185 #endif 1186 1187 /** 1188 * LWIP_RAW==1: Enable application layer to hook into the IP layer itself. 1189 */ 1190 #if !defined RAW_TTL || defined __DOXYGEN__ 1191 #define RAW_TTL IP_DEFAULT_TTL 1192 #endif 1193 /** 1194 * @} 1195 */ 1196 1197 /** 1198 * If PF_PKT_SUPPORT==1 Enables support for PF packet raw sockets. 1199 * Requires LWIP_RAW ==1 to be enabled. 1200 */ 1201 #if LWIP_RAW 1202 #ifndef PF_PKT_SUPPORT 1203 #define PF_PKT_SUPPORT 1 1204 #endif 1205 #else 1206 #undef PF_PKT_SUPPORT 1207 #define PF_PKT_SUPPORT 0 1208 #endif 1209 1210 /* 1211 * implement sock filter based on BPF. 1212 * BPF-extension was not supported. 1213 * only AF_PACKET RAW socket support socket filter now. 1214 */ 1215 #if PF_PKT_SUPPORT 1216 #ifndef LWIP_SOCK_FILTER 1217 #define LWIP_SOCK_FILTER 1 1218 #endif 1219 #else 1220 #undef LWIP_SOCK_FILTER 1221 #define LWIP_SOCK_FILTER 0 1222 #endif 1223 1224 /** 1225 * If LWIP_NETIF_PROMISC==1 Enables the promiscuous mode of the netif. 1226 * Requires PF_PKT_SUPPORT ==1 to be enabled. 1227 */ 1228 #if PF_PKT_SUPPORT 1229 #ifndef LWIP_NETIF_PROMISC 1230 #define LWIP_NETIF_PROMISC 1 1231 #endif 1232 #else 1233 #undef LWIP_NETIF_PROMISC 1234 #define LWIP_NETIF_PROMISC 0 1235 #endif 1236 1237 #ifndef LWIP_MAX_PF_RAW_SEND_SIZE 1238 #define LWIP_MAX_PF_RAW_SEND_SIZE (0xFFFF - 40) // - IPv6 header 1239 #endif 1240 1241 /* 1242 ---------------------------------- 1243 ---------- DHCP options ---------- 1244 ---------------------------------- 1245 */ 1246 /** 1247 * @defgroup lwip_opts_dhcp DHCP 1248 * @ingroup lwip_opts_ipv4 1249 * @{ 1250 */ 1251 /** 1252 * LWIP_DHCP==1: Enable DHCP module. 1253 */ 1254 #if !defined LWIP_DHCP || defined __DOXYGEN__ 1255 #define LWIP_DHCP 1 1256 #endif 1257 #if !LWIP_IPV4 1258 /* disable DHCP when IPv4 is disabled */ 1259 #undef LWIP_DHCP 1260 #define LWIP_DHCP 0 1261 #endif /* !LWIP_IPV4 */ 1262 1263 #ifndef LWIP_DHCP_SUBSTITUTE 1264 #define LWIP_DHCP_SUBSTITUTE 0 1265 #endif 1266 1267 #ifndef LWIP_DHCP_SUBSTITUTE_MMBR 1268 #define LWIP_DHCP_SUBSTITUTE_MMBR 0 1269 #endif 1270 1271 #ifndef LWIP_DHCP_REQUEST_UNICAST 1272 #define LWIP_DHCP_REQUEST_UNICAST 0 1273 #endif 1274 1275 /** 1276 * LWIP_DHCP_LIMIT_CONCURRENT_REQUESTS==1: to limit the maximum of concurrent DHCP clients. 1277 */ 1278 #ifndef LWIP_DHCP_LIMIT_CONCURRENT_REQUESTS 1279 #define LWIP_DHCP_LIMIT_CONCURRENT_REQUESTS 0 1280 #endif 1281 1282 /** 1283 * (LWIP_DHCP_LIMIT_CONCURRENT_REQUESTS==1) && (LWIP_DHCP_MAX_CONCURRENT_REQUESTS_NUM!=0): 1284 * limit the maximum of concurrent DHCP clients to be LWIP_DHCP_MAX_CONCURRENT_REQUESTS_NUM. 1285 * 1286 * The value can be modified by function netifapi_dhcp_set_max_concurrent_num(). 1287 */ 1288 #ifndef LWIP_DHCP_MAX_CONCURRENT_REQUESTS_NUM 1289 #define LWIP_DHCP_MAX_CONCURRENT_REQUESTS_NUM 0 1290 #endif 1291 1292 /** 1293 * If LWIP_DHCPS==1: Enables the DHCP server handling. 1294 * Requires LWIP_DHCP ==1 to be enabled. 1295 */ 1296 #if !defined LWIP_DHCPS || defined __DOXYGEN__ 1297 #if LWIP_DHCP 1298 #define LWIP_DHCPS 1 1299 #else 1300 #define LWIP_DHCPS 0 1301 #endif 1302 #endif 1303 1304 #if !defined LWIP_DHCPS_DNS_OPTION || defined __DOXYGEN__ 1305 #define LWIP_DHCPS_DNS_OPTION (LWIP_DHCPS && LWIP_DNS) 1306 #endif 1307 1308 #ifndef LWIP_DHCPS_AGENT_INFO 1309 #define LWIP_DHCPS_AGENT_INFO 0 1310 #endif 1311 1312 #ifndef LWIP_DHCPS_START_ADDR_OFFSET 1313 #define LWIP_DHCPS_START_ADDR_OFFSET 1 1314 #endif 1315 1316 #ifndef LWIP_DHCPS_GW 1317 #define LWIP_DHCPS_GW 0 1318 #endif 1319 1320 /** 1321 * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address. 1322 */ 1323 #if !defined DHCP_DOES_ARP_CHECK || defined __DOXYGEN__ 1324 #define DHCP_DOES_ARP_CHECK (LWIP_DHCP && LWIP_ARP) 1325 #endif 1326 1327 /** 1328 * LWIP_DHCP_CHECK_LINK_UP==1: dhcp_start() only starts if the netif has 1329 * NETIF_FLAG_LINK_UP set in its flags. As this is only an optimization and 1330 * netif drivers might not set this flag, the default is off. If enabled, 1331 * netif_set_link_up() must be called to continue starting DHCP. 1332 */ 1333 #if !defined LWIP_DHCP_CHECK_LINK_UP 1334 #define LWIP_DHCP_CHECK_LINK_UP 0 1335 #endif 1336 1337 /** 1338 * LWIP_DHCP_BOOTP_FILE==1: Store offered_si_addr and boot_file_name. 1339 */ 1340 #if !defined LWIP_DHCP_BOOTP_FILE || defined __DOXYGEN__ 1341 #define LWIP_DHCP_BOOTP_FILE 0 1342 #endif 1343 1344 /** 1345 * LWIP_DHCP_VENDOR_CLASS_IDENTIFIER==1: use DHCP_OPTION_VCI into DHCP message. 1346 */ 1347 #ifndef LWIP_DHCP_VENDOR_CLASS_IDENTIFIER 1348 #define LWIP_DHCP_VENDOR_CLASS_IDENTIFIER LWIP_DHCP 1349 #endif 1350 1351 /** 1352 * LWIP_DHCP_GETS_NTP==1: Requests NTP servers with discover/select. For each 1353 * response packet, a callback is called, which has to be provided by the port: 1354 * void dhcp_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs); 1355 */ 1356 #if !defined LWIP_DHCP_GET_NTP_SRV || defined __DOXYGEN__ 1357 #define LWIP_DHCP_GET_NTP_SRV 0 1358 #endif 1359 1360 /** 1361 * The maximum of NTP servers requested 1362 */ 1363 #if !defined LWIP_DHCP_MAX_NTP_SERVERS || defined __DOXYGEN__ 1364 #define LWIP_DHCP_MAX_NTP_SERVERS 1 1365 #endif 1366 1367 /** 1368 * LWIP_DHCP_MAX_DNS_SERVERS > 0: Request DNS servers with discover/select. 1369 * DNS servers received in the response are passed to DNS via @ref dns_setserver() 1370 * (up to the maximum limit defined here). 1371 */ 1372 #if !defined LWIP_DHCP_MAX_DNS_SERVERS || defined __DOXYGEN__ 1373 #define LWIP_DHCP_MAX_DNS_SERVERS DNS_MAX_SERVERS 1374 #endif 1375 1376 #ifndef LWIP_ALWAYS_SEND_HWTYPE_AS_ETHER_IN_DHCP 1377 #define LWIP_ALWAYS_SEND_HWTYPE_AS_ETHER_IN_DHCP 1 1378 #endif 1379 /** 1380 * @} 1381 */ 1382 1383 /* 1384 ------------------------------------ 1385 ---------- AUTOIP options ---------- 1386 ------------------------------------ 1387 */ 1388 /** 1389 * @defgroup lwip_opts_autoip AUTOIP 1390 * @ingroup lwip_opts_ipv4 1391 * @{ 1392 */ 1393 /** 1394 * LWIP_AUTOIP==1: Enable AUTOIP module. 1395 */ 1396 #if !defined LWIP_AUTOIP || defined __DOXYGEN__ 1397 #define LWIP_AUTOIP 0 1398 #endif 1399 #if !LWIP_IPV4 1400 /* disable AUTOIP when IPv4 is disabled */ 1401 #undef LWIP_AUTOIP 1402 #define LWIP_AUTOIP 0 1403 #endif /* !LWIP_IPV4 */ 1404 1405 /** 1406 * LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on 1407 * the same interface at the same time. 1408 */ 1409 #if !defined LWIP_DHCP_AUTOIP_COOP || defined __DOXYGEN__ 1410 #define LWIP_DHCP_AUTOIP_COOP 0 1411 #endif 1412 1413 /** 1414 * LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes 1415 * that should be sent before falling back on AUTOIP (the DHCP client keeps 1416 * running in this case). This can be set as low as 1 to get an AutoIP address 1417 * very quickly, but you should be prepared to handle a changing IP address 1418 * when DHCP overrides AutoIP. 1419 */ 1420 #if !defined LWIP_DHCP_AUTOIP_COOP_TRIES || defined __DOXYGEN__ 1421 #define LWIP_DHCP_AUTOIP_COOP_TRIES 64 1422 #endif 1423 /** 1424 * @} 1425 */ 1426 1427 /* 1428 ---------------------------------- 1429 ----- SNMP MIB2 support ----- 1430 ---------------------------------- 1431 */ 1432 /** 1433 * @defgroup lwip_opts_mib2 SNMP MIB2 callbacks 1434 * @ingroup lwip_opts_infrastructure 1435 * @{ 1436 */ 1437 /** 1438 * LWIP_MIB2_CALLBACKS==1: Turn on SNMP MIB2 callbacks. 1439 * Turn this on to get callbacks needed to implement MIB2. 1440 * Usually MIB2_STATS should be enabled, too. 1441 */ 1442 #if !defined LWIP_MIB2_CALLBACKS || defined __DOXYGEN__ 1443 #define LWIP_MIB2_CALLBACKS 0 1444 #endif 1445 /** 1446 * @} 1447 */ 1448 1449 /* 1450 ---------------------------------- 1451 -------- Multicast options ------- 1452 ---------------------------------- 1453 */ 1454 /** 1455 * @defgroup lwip_opts_multicast Multicast 1456 * @ingroup lwip_opts_infrastructure 1457 * @{ 1458 */ 1459 /** 1460 * LWIP_MULTICAST_TX_OPTIONS==1: Enable multicast TX support like the socket options 1461 * IP_MULTICAST_TTL/IP_MULTICAST_IF/IP_MULTICAST_LOOP, as well as (currently only) 1462 * core support for the corresponding IPv6 options. 1463 */ 1464 #if !defined LWIP_MULTICAST_TX_OPTIONS || defined __DOXYGEN__ 1465 #define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW)) 1466 #endif 1467 /** 1468 * @} 1469 */ 1470 1471 /* 1472 ---------------------------------- 1473 ---------- IGMP options ---------- 1474 ---------------------------------- 1475 */ 1476 /** 1477 * @defgroup lwip_opts_igmp IGMP 1478 * @ingroup lwip_opts_ipv4 1479 * @{ 1480 */ 1481 /** 1482 * LWIP_IGMP==1: Turn on IGMP module. 1483 */ 1484 #if !defined LWIP_IGMP || defined __DOXYGEN__ 1485 #define LWIP_IGMP 0 1486 #endif 1487 #if !LWIP_IPV4 1488 #undef LWIP_IGMP 1489 #define LWIP_IGMP 0 1490 #endif 1491 1492 /** 1493 * times to send IGMP report messages 1494 * may increase this value depend on the packet loss rate 1495 */ 1496 #ifndef LWIP_IGMP_REPORT_TIMES 1497 #define LWIP_IGMP_REPORT_TIMES 2 1498 #endif 1499 /** 1500 * @} 1501 */ 1502 1503 /* 1504 ---------------------------------- 1505 ---------- DNS options ----------- 1506 ---------------------------------- 1507 */ 1508 /** 1509 * @defgroup lwip_opts_dns DNS 1510 * @ingroup lwip_opts_callback 1511 * @{ 1512 */ 1513 /** 1514 * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS 1515 * transport. 1516 */ 1517 #if !defined LWIP_DNS || defined __DOXYGEN__ 1518 #define LWIP_DNS 0 1519 #endif 1520 1521 #ifndef LWIP_DNS_REVERSE 1522 #define LWIP_DNS_REVERSE 0 1523 #endif 1524 1525 /** DNS maximum number of entries to maintain locally. */ 1526 #if !defined DNS_TABLE_SIZE || defined __DOXYGEN__ 1527 #define DNS_TABLE_SIZE 4 1528 #endif 1529 1530 /** DNS maximum host name length supported in the name table. */ 1531 #if !defined DNS_MAX_NAME_LENGTH || defined __DOXYGEN__ 1532 #define DNS_MAX_NAME_LENGTH 256 1533 #endif 1534 1535 /** The maximum of DNS servers 1536 * The first server can be initialized automatically by defining 1537 * DNS_SERVER_ADDRESS(ipaddr), where 'ipaddr' is an 'ip_addr_t*' 1538 */ 1539 #if !defined DNS_MAX_SERVERS || defined __DOXYGEN__ 1540 #define DNS_MAX_SERVERS 2 1541 #endif 1542 1543 /** Defines the maximum number of IP addresses supported.**/ 1544 #ifndef DNS_MAX_IPADDR 1545 #define DNS_MAX_IPADDR 10 1546 #endif 1547 /* The maximum as per RFC */ 1548 #ifndef DNS_MAX_LABEL_LENGTH 1549 #define DNS_MAX_LABEL_LENGTH 63 1550 #endif 1551 1552 /** DNS maximum number of retries when asking for a name, before "timeout". */ 1553 #if !defined DNS_MAX_RETRIES || defined __DOXYGEN__ 1554 #define DNS_MAX_RETRIES 4 1555 #endif 1556 1557 /** DNS do a name checking between the query and the response. */ 1558 #if !defined DNS_DOES_NAME_CHECK || defined __DOXYGEN__ 1559 #define DNS_DOES_NAME_CHECK 1 1560 #endif 1561 1562 /** LWIP_DNS_SECURE: controls the security level of the DNS implementation 1563 * Use all DNS security features by default. 1564 * This is overridable but should only be needed by very small targets 1565 * or when using against non standard DNS servers. */ 1566 #if !defined LWIP_DNS_SECURE || defined __DOXYGEN__ 1567 #define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT) 1568 #endif 1569 1570 /* A list of DNS security features follows */ 1571 #define LWIP_DNS_SECURE_RAND_XID 1 1572 #define LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING 2 1573 #define LWIP_DNS_SECURE_RAND_SRC_PORT 4 1574 1575 /** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled, you have to define an initializer: 1576 * \#define DNS_LOCAL_HOSTLIST_INIT {DNS_LOCAL_HOSTLIST_ELEM("host_ip4", IPADDR4_INIT_BYTES(1,2,3,4)), \ 1577 * DNS_LOCAL_HOSTLIST_ELEM("host_ip6", IPADDR6_INIT_HOST(123, 234, 345, 456)} 1578 * 1579 * Instead, you can also use an external function: 1580 * \#define DNS_LOOKUP_LOCAL_EXTERN(x) extern err_t my_lookup_function(const char *name, ip_addr_t *addr, u8_t dns_addrtype) 1581 * that looks up the IP address and returns ERR_OK if found (LWIP_DNS_ADDRTYPE_xxx is passed in dns_addrtype). 1582 */ 1583 #if !defined DNS_LOCAL_HOSTLIST || defined __DOXYGEN__ 1584 #define DNS_LOCAL_HOSTLIST 0 1585 #endif /* DNS_LOCAL_HOSTLIST */ 1586 1587 /** If this is turned on, the local host-list can be dynamically changed 1588 * at runtime. */ 1589 #if !defined DNS_LOCAL_HOSTLIST_IS_DYNAMIC || defined __DOXYGEN__ 1590 #define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0 1591 #endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ 1592 1593 /** Set this to 1 to enable querying ".local" names via mDNS 1594 * using a One-Shot Multicast DNS Query */ 1595 #if !defined LWIP_DNS_SUPPORT_MDNS_QUERIES || defined __DOXYGEN__ 1596 #define LWIP_DNS_SUPPORT_MDNS_QUERIES 0 1597 #endif 1598 /** 1599 * @} 1600 */ 1601 1602 1603 #ifndef LWIP_6LOWPAN 1604 #define LWIP_6LOWPAN 0 1605 #endif 1606 1607 /* 1608 --------------------------------- 1609 ---------- UDP options ---------- 1610 --------------------------------- 1611 */ 1612 /** 1613 * @defgroup lwip_opts_udp UDP 1614 * @ingroup lwip_opts_callback 1615 * @{ 1616 */ 1617 /** 1618 * LWIP_UDP==1: Turn on UDP. 1619 */ 1620 #if !defined LWIP_UDP || defined __DOXYGEN__ 1621 #define LWIP_UDP 1 1622 #endif 1623 1624 /** 1625 * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP) 1626 */ 1627 #if !defined LWIP_UDPLITE || defined __DOXYGEN__ 1628 #define LWIP_UDPLITE 0 1629 #endif 1630 1631 /** 1632 * UDP_TTL: Default Time-To-Live value. 1633 */ 1634 #if !defined UDP_TTL || defined __DOXYGEN__ 1635 #define UDP_TTL IP_DEFAULT_TTL 1636 #endif 1637 1638 /** 1639 * Defines multicast the default Time-To-Live value. 1640 */ 1641 #if !defined MC_TTL || defined __DOXYGEN__ 1642 #define MC_TTL 1 1643 #endif 1644 1645 /** 1646 * LWIP_NETBUF_RECVINFO==1: append destination addr and port to every netbuf. 1647 */ 1648 #if !defined LWIP_NETBUF_RECVINFO || defined __DOXYGEN__ 1649 #define LWIP_NETBUF_RECVINFO 0 1650 #endif 1651 /** 1652 * @} 1653 */ 1654 1655 #ifndef LWIP_LIBCOAP 1656 #define LWIP_LIBCOAP 0 1657 #endif 1658 1659 /* 1660 --------------------------------- 1661 ---------- TCP options ---------- 1662 --------------------------------- 1663 */ 1664 /** 1665 * @defgroup lwip_opts_tcp TCP 1666 * @ingroup lwip_opts_callback 1667 * @{ 1668 */ 1669 /** 1670 * LWIP_TCP==1: Turn on TCP. 1671 */ 1672 #if !defined LWIP_TCP || defined __DOXYGEN__ 1673 #define LWIP_TCP 1 1674 #endif 1675 1676 /** 1677 * TCP_TTL: Default Time-To-Live value. 1678 */ 1679 #if !defined TCP_TTL || defined __DOXYGEN__ 1680 #define TCP_TTL IP_DEFAULT_TTL 1681 #endif 1682 1683 /** 1684 * TCP_WND: The size of a TCP window. This must be at least 1685 * (2 * TCP_MSS) for things to work well. 1686 * ATTENTION: when using TCP_RCV_SCALE, TCP_WND is the total size 1687 * with scaling applied. Maximum window value in the TCP header 1688 * will be TCP_WND >> TCP_RCV_SCALE 1689 */ 1690 #if !defined TCP_WND || defined __DOXYGEN__ 1691 #define TCP_WND (4 * TCP_MSS) 1692 #endif 1693 1694 /** 1695 * Defines the maximum number of retransmissions. This value must not be less than 3. 1696 */ 1697 #ifndef TCP_MAXRTX_MIN_VALUE 1698 #define TCP_MAXRTX_MIN_VALUE 3 1699 #endif 1700 1701 /** 1702 * TCP_MAXRTX: Maximum number of retransmissions of data segments. 1703 */ 1704 #if !defined TCP_MAXRTX || defined __DOXYGEN__ 1705 #define TCP_MAXRTX 15 1706 #endif 1707 1708 /** 1709 * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments. 1710 */ 1711 #if !defined TCP_SYNMAXRTX || defined __DOXYGEN__ 1712 #define TCP_SYNMAXRTX 6 1713 #endif 1714 1715 /** 1716 * Defines the Maximum number of retransmissions of data segments in FIN_WAIT_1 or CLOSING. 1717 */ 1718 #ifndef TCP_FW1MAXRTX 1719 #define TCP_FW1MAXRTX 8 1720 #endif 1721 1722 #ifndef LWIP_TCP_INFO 1723 #define LWIP_TCP_INFO 1 1724 #endif 1725 1726 /** 1727 * TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order. 1728 * Define to 0 if your device is low on memory. 1729 */ 1730 #if !defined TCP_QUEUE_OOSEQ || defined __DOXYGEN__ 1731 #define TCP_QUEUE_OOSEQ LWIP_TCP 1732 #endif 1733 1734 #ifndef LWIP_SACK 1735 #define LWIP_SACK LWIP_TCP 1736 #endif 1737 #if !LWIP_TCP 1738 #undef LWIP_SACK 1739 #define LWIP_SACK 0 1740 #endif 1741 1742 #ifndef LWIP_SACK_DATA_SEG_PIGGYBACK 1743 #define LWIP_SACK_DATA_SEG_PIGGYBACK LWIP_SACK 1744 #endif 1745 #if !LWIP_SACK 1746 #undef LWIP_SACK_DATA_SEG_PIGGYBACK 1747 #define LWIP_SACK_DATA_SEG_PIGGYBACK 0 1748 #endif 1749 1750 #ifndef LWIP_SACK_PERF_OPT 1751 #define LWIP_SACK_PERF_OPT LWIP_SACK 1752 #else 1753 #if !LWIP_SACK 1754 #undef LWIP_SACK_PERF_OPT 1755 #define LWIP_SACK_PERF_OPT 0 1756 #endif 1757 #endif /* LWIP_SACK_PERF_OPT */ 1758 1759 #ifndef LWIP_SACK_CWND_OPT 1760 #define LWIP_SACK_CWND_OPT LWIP_SACK_PERF_OPT 1761 #else 1762 #if !LWIP_SACK_PERF_OPT 1763 #undef LWIP_SACK_CWND_OPT 1764 #define LWIP_SACK_CWND_OPT 0 1765 #endif 1766 #endif /* LWIP_SACK_PERF_OPT */ 1767 1768 #ifndef LWIP_TCP_TLP_SUPPORT 1769 #define LWIP_TCP_TLP_SUPPORT LWIP_SACK 1770 #else 1771 #if !LWIP_SACK 1772 #undef LWIP_TCP_TLP_SUPPORT 1773 #define LWIP_TCP_TLP_SUPPORT 0 1774 #endif 1775 #endif 1776 1777 #ifndef LWIP_FACK_THRESHOLD_BASED_FR 1778 #define LWIP_FACK_THRESHOLD_BASED_FR LWIP_SACK 1779 #else 1780 #if !LWIP_SACK 1781 #undef LWIP_FACK_THRESHOLD_BASED_FR 1782 #define LWIP_FACK_THRESHOLD_BASED_FR 0 1783 #endif 1784 #endif 1785 1786 /* 1787 @page RFC-5827 1788 @par RFC-5827 Appendix A. Compliance Information 1789 @par Compliant Sections 1790 <Appendix A. Research Issues in Adjusting the Duplicate ACK Threshold> 1791 @par Behavior Description 1792 <Behavior: Reducing the number of duplicate acks for fast retransmit has drawback during minor \n 1793 network reordering.\n 1794 Our node do not realize the mitigations proposed. So MITIGATION A.1, MITIGATION A.2 and \n 1795 MITIGATION A.3 are not implemented.> 1796 */ 1797 #ifndef LWIP_TCP_ER_SUPPORT 1798 #define LWIP_TCP_ER_SUPPORT LWIP_TCP 1799 #endif 1800 #if !LWIP_TCP 1801 #undef LWIP_TCP_ER_SUPPORT 1802 #define LWIP_TCP_ER_SUPPORT 0 1803 #endif 1804 1805 /** 1806 * TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default, 1807 * you might want to increase this.) 1808 * For the receive side, this MSS is advertised to the remote side 1809 * when opening a connection. For the transmit size, this MSS sets 1810 * an upper limit on the MSS advertised by the remote host. 1811 */ 1812 /* TCP Maximum segment size. */ 1813 #ifdef LWIP_TCP_MSS 1814 #undef TCP_MSS /* ensure TCP_MSS value is overridden by LWIP_TCP_MSS */ 1815 #define TCP_MSS LWIP_TCP_MSS 1816 #else /* LWIP_TCP_MSS */ 1817 #ifndef TCP_MSS 1818 #define TCP_MSS (IP_FRAG_MAX_MTU - 20 - 20) 1819 #endif /* TCP_MSS */ 1820 #endif /* LWIP_TCP_MSS */ 1821 1822 /** 1823 * Defines the minimum TTL value. This value cannot be less than 8. 1824 */ 1825 #ifndef TCP_TTL_MIN_VALUE 1826 #define TCP_TTL_MIN_VALUE 8 1827 #endif 1828 1829 #ifndef TCP_MIN_MSS 1830 #define TCP_MIN_MSS 88 1831 #endif /* TCP_MIN_MSS */ 1832 1833 #ifndef TCP_DEFAULT_MSS 1834 #define TCP_DEFAULT_MSS 536 1835 #endif /* TCP_DEFAULT_MSS */ 1836 1837 #ifndef TCP_MAX_MSS 1838 #define TCP_MAX_MSS (IP_FRAG_MAX_MTU - 20 - 20) 1839 #endif /* TCP_MAX_MSS */ 1840 1841 /** 1842 * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really 1843 * sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which 1844 * reflects the available reassembly buffer size at the remote host) and the 1845 * largest size permitted by the IP layer" (RFC 1122) 1846 * Setting this to 1 enables code that checks TCP_MSS against the MTU of the 1847 * netif used for a connection and limits the MSS if it would be too big otherwise. 1848 */ 1849 #if !defined TCP_CALCULATE_EFF_SEND_MSS || defined __DOXYGEN__ 1850 #define TCP_CALCULATE_EFF_SEND_MSS 1 1851 #endif 1852 1853 1854 /** 1855 * TCP_SND_BUF: TCP sender buffer space (bytes). 1856 * To achieve good performance, this should be at least 2 * TCP_MSS. 1857 */ 1858 #if !defined TCP_SND_BUF || defined __DOXYGEN__ 1859 #define TCP_SND_BUF (2 * TCP_MSS) 1860 #endif 1861 1862 /** 1863 * TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least 1864 * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. 1865 */ 1866 #if !defined TCP_SND_QUEUELEN || defined __DOXYGEN__ 1867 #define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS)) 1868 #endif 1869 1870 /** 1871 * TCP_SNDLOWAT: TCP writable space (bytes). This must be less than 1872 * TCP_SND_BUF. It is the amount of space which must be available in the 1873 * TCP snd_buf for select to return writable (combined with TCP_SNDQUEUELOWAT). 1874 */ 1875 #if !defined TCP_SNDLOWAT || defined __DOXYGEN__ 1876 #define TCP_SNDLOWAT LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1) 1877 #endif 1878 1879 /** 1880 * TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be less 1881 * than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below 1882 * this number, select returns writable (combined with TCP_SNDLOWAT). 1883 */ 1884 #if !defined TCP_SNDQUEUELOWAT || defined __DOXYGEN__ 1885 #define TCP_SNDQUEUELOWAT LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5) 1886 #endif 1887 1888 /** 1889 * TCP_OOSEQ_MAX_BYTES: The default maximum number of bytes queued on ooseq per 1890 * pcb if TCP_OOSEQ_BYTES_LIMIT is not defined. Default is 0 (no limit). 1891 * Only valid for TCP_QUEUE_OOSEQ==1. 1892 */ 1893 #if !defined TCP_OOSEQ_MAX_BYTES || defined __DOXYGEN__ 1894 #define TCP_OOSEQ_MAX_BYTES 0 1895 #endif 1896 1897 /** 1898 * TCP_OOSEQ_BYTES_LIMIT(pcb): Return the maximum number of bytes to be queued 1899 * on ooseq per pcb, given the pcb. Only valid for TCP_QUEUE_OOSEQ==1 && 1900 * TCP_OOSEQ_MAX_BYTES==1. 1901 * Use this to override TCP_OOSEQ_MAX_BYTES to a dynamic value per pcb. 1902 */ 1903 #if !defined TCP_OOSEQ_BYTES_LIMIT 1904 #if TCP_OOSEQ_MAX_BYTES 1905 #define TCP_OOSEQ_BYTES_LIMIT(pcb) TCP_OOSEQ_MAX_BYTES 1906 #elif defined __DOXYGEN__ 1907 #define TCP_OOSEQ_BYTES_LIMIT(pcb) 1908 #endif 1909 #endif 1910 1911 /** 1912 * TCP_OOSEQ_MAX_PBUFS: The default maximum number of pbufs queued on ooseq per 1913 * pcb if TCP_OOSEQ_BYTES_LIMIT is not defined. Default is 0 (no limit). 1914 * Only valid for TCP_QUEUE_OOSEQ==1. 1915 */ 1916 #if !defined TCP_OOSEQ_MAX_PBUFS || defined __DOXYGEN__ 1917 #define TCP_OOSEQ_MAX_PBUFS 0 1918 #endif 1919 1920 /** 1921 * TCP_OOSEQ_PBUFS_LIMIT(pcb): Return the maximum number of pbufs to be queued 1922 * on ooseq per pcb, given the pcb. Only valid for TCP_QUEUE_OOSEQ==1 && 1923 * TCP_OOSEQ_MAX_PBUFS==1. 1924 * Use this to override TCP_OOSEQ_MAX_PBUFS to a dynamic value per pcb. 1925 */ 1926 #if !defined TCP_OOSEQ_PBUFS_LIMIT 1927 #if TCP_OOSEQ_MAX_PBUFS 1928 #define TCP_OOSEQ_PBUFS_LIMIT(pcb) TCP_OOSEQ_MAX_PBUFS 1929 #elif defined __DOXYGEN__ 1930 #define TCP_OOSEQ_PBUFS_LIMIT(pcb) 1931 #endif 1932 #endif 1933 1934 /** 1935 * TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb. 1936 */ 1937 #if !defined TCP_LISTEN_BACKLOG || defined __DOXYGEN__ 1938 #define TCP_LISTEN_BACKLOG 1 1939 #endif 1940 1941 /** 1942 * The maximum allowed backlog for TCP listen netconns. 1943 * This backlog is used unless another is explicitly specified. 1944 * 0xff is the maximum (u8_t). 1945 */ 1946 #if !defined TCP_DEFAULT_LISTEN_BACKLOG || defined __DOXYGEN__ 1947 #define TCP_DEFAULT_LISTEN_BACKLOG 16 1948 #endif 1949 1950 /** 1951 * TCP_OVERSIZE: The maximum number of bytes that tcp_write may 1952 * allocate ahead of time in an attempt to create shorter pbuf chains 1953 * for transmission. The meaningful range is 0 to TCP_MSS. Some 1954 * suggested values are: 1955 * 1956 * 0: Disable oversized allocation. Each tcp_write() allocates a new 1957 pbuf (old behaviour). 1958 * 1: Allocate size-aligned pbufs with minimal excess. Use this if your 1959 * scatter-gather DMA requires aligned fragments. 1960 * 128: Limit the pbuf/memory overhead to 20%. 1961 * TCP_MSS: Try to create unfragmented TCP packets. 1962 * TCP_MSS/4: Try to create 4 fragments or less per TCP packet. 1963 */ 1964 #if !defined TCP_OVERSIZE || defined __DOXYGEN__ 1965 #define TCP_OVERSIZE TCP_MSS 1966 #endif 1967 1968 /** 1969 * LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option. 1970 * The timestamp option is currently only used to help remote hosts, it is not 1971 * really used locally. Therefore, it is only enabled when a TS option is 1972 * received in the initial SYN packet from a remote host. 1973 */ 1974 #if !defined LWIP_TCP_TIMESTAMPS || defined __DOXYGEN__ 1975 #define LWIP_TCP_TIMESTAMPS 0 1976 #endif 1977 1978 /** 1979 * TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an 1980 * explicit window update 1981 */ 1982 #if !defined TCP_WND_UPDATE_THRESHOLD || defined __DOXYGEN__ 1983 #define TCP_WND_UPDATE_THRESHOLD LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4)) 1984 #endif 1985 1986 /** 1987 * LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1. 1988 * LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all 1989 * events (accept, sent, etc) that happen in the system. 1990 * LWIP_CALLBACK_API==1: The PCB callback function is called directly 1991 * for the event. This is the default. 1992 */ 1993 #if !defined(LWIP_EVENT_API) && !defined(LWIP_CALLBACK_API) || defined __DOXYGEN__ 1994 #define LWIP_EVENT_API 0 1995 #define LWIP_CALLBACK_API 1 1996 #else 1997 #ifndef LWIP_EVENT_API 1998 #define LWIP_EVENT_API 0 1999 #endif 2000 #ifndef LWIP_CALLBACK_API 2001 #define LWIP_CALLBACK_API 0 2002 #endif 2003 #endif 2004 2005 /** 2006 * LWIP_WND_SCALE and TCP_RCV_SCALE: 2007 * Set LWIP_WND_SCALE to 1 to enable window scaling. 2008 * Set TCP_RCV_SCALE to the desired scaling factor (shift count in the 2009 * range of [0..14]). 2010 * When LWIP_WND_SCALE is enabled but TCP_RCV_SCALE is 0, we can use a large 2011 * send window while having a small receive window only. 2012 */ 2013 #if !defined LWIP_WND_SCALE || defined __DOXYGEN__ 2014 #define LWIP_WND_SCALE 1 2015 #define TCP_RCV_SCALE 7 2016 #else 2017 #if !defined TCP_RCV_SCALE || defined __DOXYGEN__ 2018 #define TCP_RCV_SCALE 7 2019 #endif 2020 #endif 2021 2022 /** 2023 * LWIP_TCP_PCB_NUM_EXT_ARGS: 2024 * When this is > 0, every tcp pcb (including listen pcb) includes a number of 2025 * additional argument entries in an array (see tcp_ext_arg_alloc_id) 2026 */ 2027 #if !defined LWIP_TCP_PCB_NUM_EXT_ARGS || defined __DOXYGEN__ 2028 #define LWIP_TCP_PCB_NUM_EXT_ARGS 0 2029 #endif 2030 2031 /** LWIP_ALTCP==1: enable the altcp API. 2032 * altcp is an abstraction layer that prevents applications linking against the 2033 * tcp.h functions but provides the same functionality. It is used to e.g. add 2034 * SSL/TLS or proxy-connect support to an application written for the tcp callback 2035 * API without that application knowing the protocol details. 2036 * 2037 * With LWIP_ALTCP==0, applications written against the altcp API can still be 2038 * compiled but are directly linked against the tcp.h callback API and then 2039 * cannot use layered protocols. 2040 * 2041 * See @ref altcp_api 2042 */ 2043 #if !defined LWIP_ALTCP || defined __DOXYGEN__ 2044 #define LWIP_ALTCP 0 2045 #endif 2046 2047 /** LWIP_ALTCP_TLS==1: enable TLS support for altcp API. 2048 * This needs a port of the functions in altcp_tls.h to a TLS library. 2049 * A port to ARM mbedtls is provided with lwIP, see apps/altcp_tls/ directory 2050 * and LWIP_ALTCP_TLS_MBEDTLS option. 2051 */ 2052 #if !defined LWIP_ALTCP_TLS || defined __DOXYGEN__ 2053 #define LWIP_ALTCP_TLS 0 2054 #endif 2055 2056 /** 2057 * @} 2058 */ 2059 2060 /** 2061 * LWIP_SNTP==1: Turn on SNTP module. 2062 */ 2063 #ifndef LWIP_SNTP 2064 #define LWIP_SNTP 1 2065 #endif 2066 2067 /* 2068 ---------------------------------- 2069 ---------- Pbuf options ---------- 2070 ---------------------------------- 2071 */ 2072 /** 2073 * @defgroup lwip_opts_pbuf PBUF 2074 * @ingroup lwip_opts 2075 * @{ 2076 */ 2077 /** 2078 * PBUF_LINK_HLEN: the number of bytes that should be allocated for a 2079 * link level header. The default is 14, the standard value for 2080 * Ethernet. 2081 */ 2082 #if !defined PBUF_LINK_HLEN || defined __DOXYGEN__ 2083 #if defined LWIP_HOOK_VLAN_SET && !defined __DOXYGEN__ 2084 #define PBUF_LINK_HLEN (18 + ETH_PAD_SIZE) 2085 #else /* LWIP_HOOK_VLAN_SET */ 2086 #define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE) 2087 #endif /* LWIP_HOOK_VLAN_SET */ 2088 #endif 2089 2090 /** 2091 * PBUF_LINK_ENCAPSULATION_HLEN: the number of bytes that should be allocated 2092 * for an additional encapsulation header before ethernet headers (e.g. 802.11) 2093 */ 2094 #if !defined PBUF_LINK_ENCAPSULATION_HLEN || defined __DOXYGEN__ 2095 #define PBUF_LINK_ENCAPSULATION_HLEN 0 2096 #endif 2097 2098 /** 2099 * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is 2100 * designed to accommodate single full size TCP frame in one pbuf, including 2101 * TCP_MSS, IP header, and link header. 2102 */ 2103 #if !defined PBUF_POOL_BUFSIZE || defined __DOXYGEN__ 2104 #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+PBUF_IP_HLEN+PBUF_TRANSPORT_HLEN+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) 2105 #endif 2106 2107 /** 2108 * LWIP_PBUF_REF_T: Refcount type in pbuf. 2109 * Default width of u8_t can be increased if 255 refs are not enough for you. 2110 */ 2111 #if !defined LWIP_PBUF_REF_T || defined __DOXYGEN__ 2112 #define LWIP_PBUF_REF_T u8_t 2113 #endif 2114 2115 /** 2116 * LWIP_PBUF_CUSTOM_DATA: Store private data on pbufs (e.g. timestamps) 2117 * This extends struct pbuf so user can store custom data on every pbuf. 2118 */ 2119 #if !defined LWIP_PBUF_CUSTOM_DATA || defined __DOXYGEN__ 2120 #define LWIP_PBUF_CUSTOM_DATA 2121 #endif 2122 /** 2123 * @} 2124 */ 2125 2126 /* 2127 ------------------------------------------------ 2128 ---------- Network Interfaces options ---------- 2129 ------------------------------------------------ 2130 */ 2131 /** 2132 * @defgroup lwip_opts_netif NETIF 2133 * @ingroup lwip_opts 2134 * @{ 2135 */ 2136 /** 2137 * LWIP_SINGLE_NETIF==1: use a single netif only. This is the common case for 2138 * small real-life targets. Some code like routing etc. can be left out. 2139 */ 2140 #if !defined LWIP_SINGLE_NETIF || defined __DOXYGEN__ 2141 #define LWIP_SINGLE_NETIF 0 2142 #endif 2143 2144 /** 2145 * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname 2146 * field. 2147 */ 2148 #if !defined LWIP_NETIF_HOSTNAME || defined __DOXYGEN__ 2149 #define LWIP_NETIF_HOSTNAME 1 2150 #endif 2151 2152 /** 2153 * LWIP_NETIF_HOSTNAME_DEFAULT: netif's hostname after init 2154 * field.This is not a configurable value. 2155 */ 2156 #if !defined LWIP_NETIF_HOSTNAME_DEFAULT || defined __DOXYGEN__ 2157 #define LWIP_NETIF_HOSTNAME_DEFAULT "DEFAULT" 2158 #endif 2159 2160 /** 2161 * NETIF_HOSTNAME_MAX_LEN: Max length for buffer store the hostname string. 2162 * The value should be 4 byte aligned and not exceed 256. The minimum value 2163 * requirement is capable to store string of LWIP_NETIF_HOSTNAME_DEFAULT 2164 * including tailing zero.This is not a configurable value. 2165 */ 2166 #if !defined NETIF_HOSTNAME_MAX_LEN || defined __DOXYGEN__ 2167 #define NETIF_HOSTNAME_MAX_LEN 32U 2168 #endif 2169 2170 /** 2171 * LWIP_NETIF_API==1: Support netif api (in netifapi.c) 2172 */ 2173 #if !defined LWIP_NETIF_API || defined __DOXYGEN__ 2174 #define LWIP_NETIF_API 1 2175 #endif 2176 2177 /** 2178 * LWIP_NETIF_NBR_CACHE_API==1: Support NBR Cache APIs (in netifapi.c) 2179 */ 2180 #if !defined LWIP_NETIF_NBR_CACHE_API || defined __DOXYGEN__ 2181 #define LWIP_NETIF_NBR_CACHE_API 1 2182 #endif 2183 2184 /** 2185 * LWIP_AUTO_CLEANUP_WHILE_NETIF_REMOVE==1: foolproof: clean up resources that are 2186 * bound to a netif being removed 2187 */ 2188 #ifndef LWIP_AUTO_CLEANUP_WHILE_NETIF_REMOVE 2189 #define LWIP_AUTO_CLEANUP_WHILE_NETIF_REMOVE 1 2190 #endif 2191 2192 /** 2193 * LWIP_NEIGHBOR_CLEANUP_WHILE_NETIF_LINK_DOWN==1: 2194 * call etharp_cleanup_netif() nd6_cleanup_netif() while netif_set_link_down() 2195 */ 2196 #ifndef LWIP_NEIGHBOR_CLEANUP_WHILE_NETIF_LINK_DOWN 2197 #define LWIP_NEIGHBOR_CLEANUP_WHILE_NETIF_LINK_DOWN 0 2198 #endif 2199 2200 /** 2201 * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function for wifi whenever 2202 * at command ifconfig up/down. 2203 */ 2204 #if !defined LWIP_L2_NETDEV_STATUS_CALLBACK || defined __DOXYGEN__ 2205 #define LWIP_L2_NETDEV_STATUS_CALLBACK 0 2206 #endif 2207 2208 /** 2209 * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface 2210 * changes its up/down status (i.e., due to DHCP IP acquisition) 2211 */ 2212 #if !defined LWIP_NETIF_STATUS_CALLBACK || defined __DOXYGEN__ 2213 #define LWIP_NETIF_STATUS_CALLBACK 0 2214 #endif 2215 2216 /** 2217 * LWIP_NETIF_EXT_STATUS_CALLBACK==1: Support an extended callback function 2218 * for several netif related event that supports multiple subscribers. 2219 * @see netif_ext_status_callback 2220 */ 2221 #if !defined LWIP_NETIF_EXT_STATUS_CALLBACK || defined __DOXYGEN__ 2222 #define LWIP_NETIF_EXT_STATUS_CALLBACK 1 2223 #endif 2224 2225 /** 2226 * LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface 2227 * whenever the link changes (i.e., link down) 2228 */ 2229 #if !defined LWIP_NETIF_LINK_CALLBACK || defined __DOXYGEN__ 2230 #define LWIP_NETIF_LINK_CALLBACK 1 2231 #endif 2232 2233 #ifndef LWIP_NETIF_DEFAULT_LINK_DOWN 2234 #define LWIP_NETIF_DEFAULT_LINK_DOWN 0 2235 #endif 2236 2237 /** 2238 * LWIP_DROP_PKT_WHEN_NETIF_DOWN==1: Support don't send any package 2239 * when driver or lwip state is down 2240 */ 2241 #if !defined LWIP_DROP_PKT_WHEN_NETIF_DOWN || defined __DOXYGEN__ 2242 #define LWIP_DROP_PKT_WHEN_NETIF_DOWN 0 2243 #endif 2244 2245 /** 2246 * LWIP_NETIF_REMOVE_CALLBACK==1: Support a callback function that is called 2247 * when a netif has been removed 2248 */ 2249 #if !defined LWIP_NETIF_REMOVE_CALLBACK || defined __DOXYGEN__ 2250 #define LWIP_NETIF_REMOVE_CALLBACK 0 2251 #endif 2252 2253 /** 2254 * LWIP_NETIF_HWADDRHINT==1: Cache link-layer-address hints (e.g. table 2255 * indices) in struct netif. TCP and UDP can make use of this to prevent 2256 * scanning the ARP table for every sent packet. While this is faster for big 2257 * ARP tables or many concurrent connections, it might be counterproductive 2258 * if you have a tiny ARP table or if there never are concurrent connections. 2259 */ 2260 #if !defined LWIP_NETIF_HWADDRHINT || defined __DOXYGEN__ 2261 #define LWIP_NETIF_HWADDRHINT 0 2262 #endif 2263 2264 /** 2265 * LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP *tries* to put all data 2266 * to be sent into one single pbuf. This is for compatibility with DMA-enabled 2267 * MACs that do not support scatter-gather. 2268 * Beware that this might involve CPU-memcpy before transmitting that would not 2269 * be needed without this flag! Use this only if you need to! 2270 * 2271 * ATTENTION: a driver should *NOT* rely on getting single pbufs but check TX 2272 * pbufs for being in one piece. If not, @ref pbuf_clone can be used to get 2273 * a single pbuf: 2274 * if (p->next != NULL) { 2275 * struct pbuf *q = pbuf_clone(PBUF_RAW, PBUF_RAM, p); 2276 * if (q == NULL) { 2277 * return ERR_MEM; 2278 * } 2279 * p = q; ATTENTION: do NOT free the old 'p' as the ref belongs to the caller! 2280 * } 2281 */ 2282 #if !defined LWIP_NETIF_TX_SINGLE_PBUF || defined __DOXYGEN__ 2283 #define LWIP_NETIF_TX_SINGLE_PBUF 1 2284 #endif /* LWIP_NETIF_TX_SINGLE_PBUF */ 2285 2286 #if !defined LWIP_CHECK_ADDR_ALIGN || defined __DOXYGEN__ 2287 #define LWIP_CHECK_ADDR_ALIGN 0 2288 #endif /* LWIP_CHECK_ADDR_ALIGN */ 2289 2290 /** 2291 * LWIP_NUM_NETIF_CLIENT_DATA: Number of clients that may store 2292 * data in client_data member array of struct netif (max. 256). 2293 */ 2294 #if !defined LWIP_NUM_NETIF_CLIENT_DATA || defined __DOXYGEN__ 2295 #define LWIP_NUM_NETIF_CLIENT_DATA 0 2296 #endif 2297 /** 2298 * @} 2299 */ 2300 2301 /* 2302 ------------------------------------ 2303 ---------- LOOPIF options ---------- 2304 ------------------------------------ 2305 */ 2306 /** 2307 * @defgroup lwip_opts_loop Loopback interface 2308 * @ingroup lwip_opts_netif 2309 * @{ 2310 */ 2311 /** 2312 * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1). 2313 * This is only needed when no real netifs are available. If at least one other 2314 * netif is available, loopback traffic uses this netif. 2315 */ 2316 #if !defined LWIP_HAVE_LOOPIF || defined __DOXYGEN__ 2317 #define LWIP_HAVE_LOOPIF (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF) 2318 #endif 2319 2320 /** 2321 * LWIP_LOOPIF_MULTICAST==1: Support multicast/IGMP on loop interface (127.0.0.1). 2322 */ 2323 #if !defined LWIP_LOOPIF_MULTICAST || defined __DOXYGEN__ 2324 #define LWIP_LOOPIF_MULTICAST 0 2325 #endif 2326 2327 /** 2328 * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP 2329 * address equal to the netif IP address, looping them back up the stack. 2330 */ 2331 #if !defined LWIP_NETIF_LOOPBACK || defined __DOXYGEN__ 2332 #define LWIP_NETIF_LOOPBACK 0 2333 #endif 2334 2335 /** 2336 * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback 2337 * sending for each netif (0 = disabled) 2338 */ 2339 #if !defined LWIP_LOOPBACK_MAX_PBUFS || defined __DOXYGEN__ 2340 #define LWIP_LOOPBACK_MAX_PBUFS 0 2341 #endif 2342 2343 /** 2344 * LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in 2345 * the system, as netifs must change how they behave depending on this setting 2346 * for the LWIP_NETIF_LOOPBACK option to work. 2347 * Setting this is needed to avoid reentering non-reentrant functions like 2348 * tcp_input(). 2349 * LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a 2350 * multithreaded environment like tcpip.c. In this case, netif->input() 2351 * is called directly. 2352 * LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup. 2353 * The packets are put on a list and netif_poll() must be called in 2354 * the main application loop. 2355 */ 2356 #if !defined LWIP_NETIF_LOOPBACK_MULTITHREADING || defined __DOXYGEN__ 2357 #define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS) 2358 #endif 2359 /** 2360 * @} 2361 */ 2362 2363 /* 2364 ------------------------------------ 2365 ---------- Thread options ---------- 2366 ------------------------------------ 2367 */ 2368 /** 2369 * @defgroup lwip_opts_thread Threading 2370 * @ingroup lwip_opts_infrastructure 2371 * @{ 2372 */ 2373 /** 2374 * TCPIP_THREAD_NAME: The name assigned to the main tcpip thread. 2375 */ 2376 #if !defined TCPIP_THREAD_NAME || defined __DOXYGEN__ 2377 #define TCPIP_THREAD_NAME "tcpip_thread" 2378 #endif 2379 2380 /** 2381 * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread. 2382 * The stack size value itself is platform-dependent, but is passed to 2383 * sys_thread_new() when the thread is created. 2384 */ 2385 #if !defined TCPIP_THREAD_STACKSIZE || defined __DOXYGEN__ 2386 #define TCPIP_THREAD_STACKSIZE 0 2387 #endif 2388 2389 /** 2390 * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread. 2391 * The priority value itself is platform-dependent, but is passed to 2392 * sys_thread_new() when the thread is created. 2393 */ 2394 #if !defined TCPIP_THREAD_PRIO || defined __DOXYGEN__ 2395 #define TCPIP_THREAD_PRIO 1 2396 #endif 2397 2398 /** 2399 * TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages 2400 * The queue size value itself is platform-dependent, but is passed to 2401 * sys_mbox_new() when tcpip_init is called. 2402 */ 2403 #if !defined TCPIP_MBOX_SIZE || defined __DOXYGEN__ 2404 #define TCPIP_MBOX_SIZE 512 2405 #endif 2406 2407 #ifndef LWIP_NETIF_ETHTOOL 2408 #define LWIP_NETIF_ETHTOOL 1 2409 #endif 2410 2411 /** 2412 * Define this to something that triggers a watchdog. This is called from 2413 * tcpip_thread after processing a message. 2414 */ 2415 #if !defined LWIP_TCPIP_THREAD_ALIVE || defined __DOXYGEN__ 2416 #define LWIP_TCPIP_THREAD_ALIVE() 2417 #endif 2418 2419 /** 2420 * SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread. 2421 */ 2422 #if !defined SLIPIF_THREAD_NAME || defined __DOXYGEN__ 2423 #define SLIPIF_THREAD_NAME "slipif_loop" 2424 #endif 2425 2426 /** 2427 * SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread. 2428 * The stack size value itself is platform-dependent, but is passed to 2429 * sys_thread_new() when the thread is created. 2430 */ 2431 #if !defined SLIPIF_THREAD_STACKSIZE || defined __DOXYGEN__ 2432 #define SLIPIF_THREAD_STACKSIZE 0 2433 #endif 2434 2435 /** 2436 * SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread. 2437 * The priority value itself is platform-dependent, but is passed to 2438 * sys_thread_new() when the thread is created. 2439 */ 2440 #if !defined SLIPIF_THREAD_PRIO || defined __DOXYGEN__ 2441 #define SLIPIF_THREAD_PRIO 1 2442 #endif 2443 2444 /** 2445 * DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread. 2446 */ 2447 #if !defined DEFAULT_THREAD_NAME || defined __DOXYGEN__ 2448 #define DEFAULT_THREAD_NAME "lwIP" 2449 #endif 2450 2451 /** 2452 * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread. 2453 * The stack size value itself is platform-dependent, but is passed to 2454 * sys_thread_new() when the thread is created. 2455 */ 2456 #if !defined DEFAULT_THREAD_STACKSIZE || defined __DOXYGEN__ 2457 #define DEFAULT_THREAD_STACKSIZE 0 2458 #endif 2459 2460 /** 2461 * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread. 2462 * The priority value itself is platform-dependent, but is passed to 2463 * sys_thread_new() when the thread is created. 2464 */ 2465 #if !defined DEFAULT_THREAD_PRIO || defined __DOXYGEN__ 2466 #define DEFAULT_THREAD_PRIO 1 2467 #endif 2468 2469 /** 2470 * DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a 2471 * NETCONN_RAW. The queue size value itself is platform-dependent, but is passed 2472 * to sys_mbox_new() when the recvmbox is created. 2473 */ 2474 #if !defined DEFAULT_RAW_RECVMBOX_SIZE || defined __DOXYGEN__ 2475 #define DEFAULT_RAW_RECVMBOX_SIZE 128 2476 #endif 2477 2478 /** 2479 * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a 2480 * NETCONN_UDP. The queue size value itself is platform-dependent, but is passed 2481 * to sys_mbox_new() when the recvmbox is created. 2482 */ 2483 #if !defined DEFAULT_UDP_RECVMBOX_SIZE || defined __DOXYGEN__ 2484 #define DEFAULT_UDP_RECVMBOX_SIZE 128 2485 #endif 2486 2487 /** 2488 * Maximum size of a UDP RAW packet. 2489 * Different memory alignment can limit max packet size. 2490 * LWIP_MAX_UDP_RAW_SEND_SIZE not a configurable value. 2491 */ 2492 #if (MEM_MALLOC_DMA_ALIGN != 1) 2493 #ifndef LWIP_MAX_UDP_RAW_SEND_SIZE 2494 #define LWIP_MAX_UDP_RAW_SEND_SIZE 65332 2495 #endif /* LWIP_MAX_UDP_RAW_SEND_SIZE */ 2496 #else 2497 #ifndef LWIP_MAX_UDP_RAW_SEND_SIZE 2498 #define LWIP_MAX_UDP_RAW_SEND_SIZE 65432 2499 #endif /* LWIP_MAX_UDP_RAW_SEND_SIZE */ 2500 #endif /* (MEM_MALLOC_DMA_ALIGN != 1) */ 2501 2502 /** 2503 * DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a 2504 * NETCONN_TCP. The queue size value itself is platform-dependent, but is passed 2505 * to sys_mbox_new() when the recvmbox is created. 2506 */ 2507 #if !defined DEFAULT_TCP_RECVMBOX_SIZE || defined __DOXYGEN__ 2508 #define DEFAULT_TCP_RECVMBOX_SIZE 128 2509 #endif 2510 2511 /** 2512 * DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections. 2513 * The queue size value itself is platform-dependent, but is passed to 2514 * sys_mbox_new() when the acceptmbox is created. 2515 */ 2516 #if !defined DEFAULT_ACCEPTMBOX_SIZE || defined __DOXYGEN__ 2517 #define DEFAULT_ACCEPTMBOX_SIZE 32 2518 #endif 2519 /** 2520 * @} 2521 */ 2522 2523 /* 2524 ---------------------------------------------- 2525 ---------- Sequential layer options ---------- 2526 ---------------------------------------------- 2527 */ 2528 /** 2529 * @defgroup lwip_opts_netconn Netconn 2530 * @ingroup lwip_opts_threadsafe_apis 2531 * @{ 2532 */ 2533 /** 2534 * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c) 2535 */ 2536 #if !defined LWIP_NETCONN || defined __DOXYGEN__ 2537 #define LWIP_NETCONN 1 2538 #endif 2539 2540 /** LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout to create 2541 * timers running in tcpip_thread from another thread. 2542 */ 2543 #if !defined LWIP_TCPIP_TIMEOUT || defined __DOXYGEN__ 2544 #define LWIP_TCPIP_TIMEOUT 0 2545 #endif 2546 2547 /** LWIP_NETCONN_SEM_PER_THREAD==1: Use one (thread-local) semaphore per 2548 * thread calling socket/netconn functions instead of allocating one 2549 * semaphore per netconn (and per select etc.) 2550 * ATTENTION: a thread-local semaphore for API calls is needed: 2551 * - LWIP_NETCONN_THREAD_SEM_GET() returning a sys_sem_t* 2552 * - LWIP_NETCONN_THREAD_SEM_ALLOC() creating the semaphore 2553 * - LWIP_NETCONN_THREAD_SEM_FREE() freeing the semaphore 2554 * The latter 2 can be invoked up by calling netconn_thread_init()/netconn_thread_cleanup(). 2555 * Ports may call these for threads created with sys_thread_new(). 2556 */ 2557 #if !defined LWIP_NETCONN_SEM_PER_THREAD || defined __DOXYGEN__ 2558 #define LWIP_NETCONN_SEM_PER_THREAD 0 2559 #endif 2560 2561 /** LWIP_NETCONN_FULLDUPLEX==1: Enable code that allows reading from one thread, 2562 * writing from a 2nd thread and closing from a 3rd thread at the same time. 2563 * LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from 2564 * multiple threads at once! 2565 */ 2566 #if !defined LWIP_NETCONN_FULLDUPLEX || defined __DOXYGEN__ 2567 #define LWIP_NETCONN_FULLDUPLEX 1 2568 #endif 2569 /** 2570 * @} 2571 */ 2572 2573 /* 2574 ------------------------------------ 2575 ---------- Socket options ---------- 2576 ------------------------------------ 2577 */ 2578 /** 2579 * @defgroup lwip_opts_socket Sockets 2580 * @ingroup lwip_opts_threadsafe_apis 2581 * @{ 2582 */ 2583 /** 2584 * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) 2585 */ 2586 #if !defined LWIP_SOCKET || defined __DOXYGEN__ 2587 #define LWIP_SOCKET 1 2588 #endif 2589 2590 /** 2591 * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names through defines. 2592 * LWIP_COMPAT_SOCKETS==2: Same as ==1 but correctly named functions are created. 2593 * While this helps code completion, it might conflict with existing libraries. 2594 * (only used if you use sockets.c) 2595 */ 2596 #if !defined LWIP_COMPAT_SOCKETS || defined __DOXYGEN__ 2597 #define LWIP_COMPAT_SOCKETS 1 2598 #endif 2599 2600 /** 2601 * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names. 2602 * Disable this option if you use a POSIX operating system that uses the same 2603 * names (read, write & close). (only used if you use sockets.c) 2604 */ 2605 #if !defined LWIP_POSIX_SOCKETS_IO_NAMES || defined __DOXYGEN__ 2606 #define LWIP_POSIX_SOCKETS_IO_NAMES 0 2607 #endif 2608 2609 /** 2610 * LWIP_SOCKET_OFFSET==n: Increases the file descriptor number created by LwIP with n. 2611 * This can be useful when there are multiple APIs which create file descriptors. 2612 * When they all start with a different offset and you won't make them overlap you can 2613 * re implement read/write/close/ioctl/fnctl to send the requested action to the right 2614 * library (sharing select will need more work though). 2615 */ 2616 #if !defined LWIP_SOCKET_OFFSET || defined __DOXYGEN__ 2617 #define LWIP_SOCKET_OFFSET 0 2618 #endif 2619 2620 /** 2621 * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT 2622 * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set 2623 * in seconds. (does not require sockets.c, and will affect tcp.c) 2624 */ 2625 #if !defined LWIP_TCP_KEEPALIVE || defined __DOXYGEN__ 2626 #define LWIP_TCP_KEEPALIVE 1 2627 #endif 2628 2629 /** 2630 * LWIP_TCP_MAXSEG==1: Enable TCP_MAXSEG options processing. 2631 */ 2632 #if !defined LWIP_TCP_MAXSEG || defined __DOXYGEN__ 2633 #define LWIP_TCP_MAXSEG 1 2634 #endif 2635 #if !LWIP_TCP 2636 /* disable LWIP_TCP_MAXSEG when LWIP_TCP is disabled */ 2637 #undef LWIP_TCP_MAXSEG 2638 #define LWIP_TCP_MAXSEG 0 2639 #endif /* !LWIP_TCP */ 2640 2641 /** 2642 * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and 2643 * SO_SNDTIMEO processing. 2644 */ 2645 #if !defined LWIP_SO_SNDTIMEO || defined __DOXYGEN__ 2646 #define LWIP_SO_SNDTIMEO 0 2647 #endif 2648 2649 /** 2650 * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and 2651 * SO_RCVTIMEO processing. 2652 */ 2653 #if !defined LWIP_SO_RCVTIMEO || defined __DOXYGEN__ 2654 #define LWIP_SO_RCVTIMEO 0 2655 #endif 2656 2657 /** 2658 * LWIP_SO_DONTROUTE==1: Enable don't use universal route entry 2659 */ 2660 #ifndef LWIP_SO_DONTROUTE 2661 #define LWIP_SO_DONTROUTE 1 2662 #endif 2663 2664 /** 2665 * LWIP_SO_SNDRCVTIMEO_NONSTANDARD==1: SO_RCVTIMEO/SO_SNDTIMEO take an int 2666 * (milliseconds, much like winsock does) instead of a struct timeval (default). 2667 */ 2668 #if !defined LWIP_SO_SNDRCVTIMEO_NONSTANDARD || defined __DOXYGEN__ 2669 #define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0 2670 #endif 2671 2672 /** 2673 * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing. 2674 */ 2675 #if !defined LWIP_SO_RCVBUF || defined __DOXYGEN__ 2676 #define LWIP_SO_RCVBUF 0 2677 #endif 2678 2679 #ifndef LWIP_SOCK_OPT_ICMP6_FILTER 2680 #define LWIP_SOCK_OPT_ICMP6_FILTER 1 2681 #endif 2682 2683 #ifndef LWIP_IPV6_PER_PROTO_CHKSUM 2684 #define LWIP_IPV6_PER_PROTO_CHKSUM 1 2685 #endif 2686 2687 #ifndef LWIP_SOCK_OPT_IPV6_UNICAST_HOPS 2688 #define LWIP_SOCK_OPT_IPV6_UNICAST_HOPS 1 2689 #endif 2690 2691 #ifndef LWIP_SOCK_OPT_TCP_QUEUE_SEQ 2692 #define LWIP_SOCK_OPT_TCP_QUEUE_SEQ 1 2693 #endif 2694 2695 #ifndef LWIP_LINK_MCAST_FILTER 2696 #define LWIP_LINK_MCAST_FILTER 1 2697 #endif 2698 2699 #ifndef LWIP_IOCTL_IPV6DPCTD 2700 #define LWIP_IOCTL_IPV6DPCTD 1 2701 #endif 2702 2703 #ifndef LWIP_IOCTL_ROUTE 2704 #define LWIP_IOCTL_ROUTE 1 2705 #endif 2706 2707 #ifndef LWIP_IOCTL_IF 2708 #define LWIP_IOCTL_IF 1 2709 #endif 2710 2711 /** 2712 * RECV_BUFSIZE_MIN =256 Defines the minimum buffer size required for SO_RCVBUF configuration. 2713 * Value not configurable. 2714 */ 2715 #ifndef RECV_BUFSIZE_MIN 2716 #define RECV_BUFSIZE_MIN 256 2717 #endif 2718 2719 /** 2720 * LWIP_SO_SNDBUF==1: Enables SO_SNDBUF processing. 2721 * Currently, only TCP socket in CLOSED or LISTEN state supports setting sndbuf. 2722 */ 2723 #ifndef LWIP_SO_SNDBUF 2724 #define LWIP_SO_SNDBUF 1 2725 #endif 2726 2727 /** 2728 * SEND_BUFSIZE_MIN Defines the minimum buffer size required for SO_SNDBUF configuration. 2729 * Value not configurable. 2730 */ 2731 #ifndef SEND_BUFSIZE_MIN 2732 #define SEND_BUFSIZE_MIN (TCP_MSS * 2) 2733 #endif 2734 2735 /** 2736 * SEND_BUFSIZE_MAX Defines the maximum buffer size allowed for SO_SNDBUF configuration. 2737 * Value not configurable. 2738 */ 2739 /** 2740 * be aware than the maximum send buffer could be greater than 64K even TCP window scale disabled. 2741 */ 2742 #ifndef SEND_BUFSIZE_MAX 2743 #define SEND_BUFSIZE_MAX 0x40000 2744 #endif 2745 2746 /** 2747 * LWIP_SO_LINGER==1: Enable SO_LINGER processing. 2748 */ 2749 #if !defined LWIP_SO_LINGER || defined __DOXYGEN__ 2750 #define LWIP_SO_LINGER 0 2751 #endif 2752 2753 /** 2754 * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize. 2755 */ 2756 #if !defined RECV_BUFSIZE_DEFAULT || defined __DOXYGEN__ 2757 #define RECV_BUFSIZE_DEFAULT 65535 2758 #endif 2759 2760 /** 2761 * RECV_BUFSIZE_MIN =256 Defines the minimum buffer size required for SO_RCVBUF configuration. 2762 * Value not configurable. 2763 */ 2764 #ifndef RECV_BUFSIZE_MIN 2765 #define RECV_BUFSIZE_MIN 256 2766 #endif 2767 2768 /** 2769 * By default, TCP socket/netconn close waits 20 seconds max to send the FIN 2770 */ 2771 #if !defined LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT || defined __DOXYGEN__ 2772 #define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000 2773 #endif 2774 2775 /** 2776 * SO_REUSE==1: Enable SO_REUSEADDR option. 2777 */ 2778 #if !defined SO_REUSE || defined __DOXYGEN__ 2779 #define SO_REUSE 0 2780 #endif 2781 2782 /** 2783 * SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets 2784 * to all local matches if SO_REUSEADDR is turned on. 2785 * WARNING: Adds a memcpy for every packet if passing to more than one pcb! 2786 */ 2787 #if !defined SO_REUSE_RXTOALL || defined __DOXYGEN__ 2788 #define SO_REUSE_RXTOALL 1 2789 #endif 2790 2791 /** 2792 * LWIP_FIONREAD_LINUXMODE==0 (default): ioctl/FIONREAD returns the amount of 2793 * pending data in the network buffer. This is the way windows does it. It's 2794 * the default for lwIP since it is smaller. 2795 * LWIP_FIONREAD_LINUXMODE==1: ioctl/FIONREAD returns the size of the next 2796 * pending datagram in bytes. This is the way linux does it. This code is only 2797 * here for compatibility. 2798 */ 2799 #if !defined LWIP_FIONREAD_LINUXMODE || defined __DOXYGEN__ 2800 #define LWIP_FIONREAD_LINUXMODE 0 2801 #endif 2802 2803 /** 2804 * LWIP_SO_PRIORITY==1: Enable SO_PRIORITY processing. We don't support any priority queue at IP 2805 layer. It just enables the user to inform the priority of application packets 2806 to the mac layer. 2807 */ 2808 #if !defined LWIP_SO_PRIORITY || defined __DOXYGEN__ 2809 #define LWIP_SO_PRIORITY 1 2810 #endif 2811 2812 #if LWIP_SO_PRIORITY 2813 typedef u8_t prio_t; 2814 #ifndef LWIP_PKT_PRIORITY_DEFAULT 2815 #define LWIP_PKT_PRIORITY_DEFAULT LWIP_PKT_PRIORITY_MIN 2816 #endif 2817 2818 #ifndef LWIP_PKT_PRIORITY_MIN 2819 #define LWIP_PKT_PRIORITY_MIN 0 2820 #endif 2821 2822 #ifndef LWIP_PKT_PRIORITY_MAX 2823 #define LWIP_PKT_PRIORITY_MAX 3 2824 #endif 2825 2826 #ifndef LWIP_PKT_PRIORITY_CTRL 2827 #define LWIP_PKT_PRIORITY_CTRL LWIP_PKT_PRIORITY_MAX 2828 #endif 2829 2830 #ifndef LWIP_PKT_PRIORITY_DHCP 2831 #define LWIP_PKT_PRIORITY_DHCP LWIP_PKT_PRIORITY_MAX 2832 #endif 2833 2834 #ifndef LWIP_PKT_PRIORITY_DHCPS 2835 #define LWIP_PKT_PRIORITY_DHCPS LWIP_PKT_PRIORITY_MAX 2836 #endif 2837 2838 #ifndef LWIP_PKT_PRIORITY_DHCP6 2839 #define LWIP_PKT_PRIORITY_DHCP6 LWIP_PKT_PRIORITY_MAX 2840 #endif 2841 2842 #ifndef LWIP_PKT_PRIORITY_DNS 2843 #define LWIP_PKT_PRIORITY_DNS LWIP_PKT_PRIORITY_MAX 2844 #endif 2845 2846 #ifndef LWIP_PKT_PRIORITY_SNTP 2847 #define LWIP_PKT_PRIORITY_SNTP LWIP_PKT_PRIORITY_MAX 2848 #endif 2849 #endif 2850 2851 #ifndef LWIP_IFADDRS 2852 #define LWIP_IFADDRS 1 2853 #endif 2854 2855 /** 2856 * LWIP_SOCKET_SELECT==1 (default): enable select() for sockets (uses a netconn 2857 * callback to keep track of events). 2858 * This saves RAM (counters per socket) and code (netconn event callback), which 2859 * should improve performance a bit). 2860 */ 2861 #if !defined LWIP_SOCKET_SELECT || defined __DOXYGEN__ 2862 #define LWIP_SOCKET_SELECT 1 2863 #endif 2864 2865 /** 2866 * LWIP_SOCKET_POLL==1 (default): enable poll() for sockets (including 2867 * struct pollfd, nfds_t, and constants) 2868 */ 2869 #if !defined LWIP_SOCKET_POLL || defined __DOXYGEN__ 2870 #define LWIP_SOCKET_POLL 0 2871 #endif 2872 2873 #ifndef LWIP_EXT_POLL_SUPPORT 2874 #define LWIP_EXT_POLL_SUPPORT 0 2875 #endif 2876 2877 #if !LWIP_SOCKET_POLL 2878 #undef LWIP_EXT_POLL_SUPPORT 2879 #define LWIP_EXT_POLL_SUPPORT 0 2880 #endif 2881 2882 /** 2883 * LWIP_FCNTL==1 : name lwip_fcntl() to fcntl(), which takes no variable 2884 * parameters. It might conflict with existing libraries. 2885 */ 2886 #ifndef LWIP_FCNTL 2887 #define LWIP_FCNTL 0 2888 #endif 2889 2890 #ifndef LWIP_INET_ADDR_FUNC 2891 #define LWIP_INET_ADDR_FUNC 1 2892 #endif 2893 2894 #ifndef LWIP_INET_NTOA_FUNC 2895 #define LWIP_INET_NTOA_FUNC 1 2896 #endif 2897 2898 #ifndef LWIP_INET_ATON_FUNC 2899 #define LWIP_INET_ATON_FUNC 1 2900 #endif 2901 2902 /** 2903 * @} 2904 */ 2905 2906 /* 2907 ---------------------------------------- 2908 ---------- Statistics options ---------- 2909 ---------------------------------------- 2910 */ 2911 /** 2912 * @defgroup lwip_opts_stats Statistics 2913 * @ingroup lwip_opts_debug 2914 * @{ 2915 */ 2916 /** 2917 * LWIP_STATS==1: Enable statistics collection in lwip_stats. 2918 */ 2919 #if !defined LWIP_STATS || defined __DOXYGEN__ 2920 #define LWIP_STATS 1 2921 #endif 2922 2923 #if LWIP_STATS 2924 2925 /** 2926 * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions. 2927 */ 2928 #if !defined LWIP_STATS_DISPLAY || defined __DOXYGEN__ 2929 #define LWIP_STATS_DISPLAY 0 2930 #endif 2931 2932 /** 2933 * LINK_STATS==1: Enable link stats. 2934 */ 2935 #if !defined LINK_STATS || defined __DOXYGEN__ 2936 #define LINK_STATS 1 2937 #endif 2938 2939 /** 2940 * ETHARP_STATS==1: Enable etharp stats. 2941 */ 2942 #if !defined ETHARP_STATS || defined __DOXYGEN__ 2943 #define ETHARP_STATS (LWIP_ARP) 2944 #endif 2945 2946 /** 2947 * IP_STATS==1: Enable IP stats. 2948 */ 2949 #if !defined IP_STATS || defined __DOXYGEN__ 2950 #define IP_STATS 1 2951 #endif 2952 2953 /** 2954 * IPFRAG_STATS==1: Enable IP fragmentation stats. Default is 2955 * on if using either frag or reass. 2956 */ 2957 #if !defined IPFRAG_STATS || defined __DOXYGEN__ 2958 #define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG) 2959 #endif 2960 2961 /** 2962 * ICMP_STATS==1: Enable ICMP stats. 2963 */ 2964 #if !defined ICMP_STATS || defined __DOXYGEN__ 2965 #define ICMP_STATS 1 2966 #endif 2967 2968 /** 2969 * IGMP_STATS==1: Enable IGMP stats. 2970 */ 2971 #if !defined IGMP_STATS || defined __DOXYGEN__ 2972 #define IGMP_STATS (LWIP_IGMP) 2973 #endif 2974 2975 /** 2976 * UDP_STATS==1: Enable UDP stats. Default is on if 2977 * UDP enabled, otherwise off. 2978 */ 2979 #if !defined UDP_STATS || defined __DOXYGEN__ 2980 #define UDP_STATS (LWIP_UDP) 2981 #endif 2982 2983 /** 2984 * TCP_STATS==1: Enable TCP stats. Default is on if TCP 2985 * enabled, otherwise off. 2986 */ 2987 #if !defined TCP_STATS || defined __DOXYGEN__ 2988 #define TCP_STATS (LWIP_TCP) 2989 #endif 2990 2991 /** 2992 * MEM_STATS==1: Enable mem.c stats. 2993 */ 2994 #if !defined MEM_STATS || defined __DOXYGEN__ 2995 #define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0)) 2996 #endif 2997 2998 /** 2999 * MEMP_STATS==1: Enable memp.c pool stats. 3000 */ 3001 #if !defined MEMP_STATS || defined __DOXYGEN__ 3002 #define MEMP_STATS (MEMP_MEM_MALLOC == 0) 3003 #endif 3004 3005 /** 3006 * SYS_STATS==1: Enable system stats (sem and mbox counts, etc). 3007 */ 3008 #if !defined SYS_STATS || defined __DOXYGEN__ 3009 #define SYS_STATS (NO_SYS == 0) 3010 #endif 3011 3012 /** 3013 * IP6_STATS==1: Enable IPv6 stats. 3014 */ 3015 #if !defined IP6_STATS || defined __DOXYGEN__ 3016 #define IP6_STATS (LWIP_IPV6) 3017 #endif 3018 3019 /** 3020 * ICMP6_STATS==1: Enable ICMP for IPv6 stats. 3021 */ 3022 #if !defined ICMP6_STATS || defined __DOXYGEN__ 3023 #define ICMP6_STATS (LWIP_IPV6 && LWIP_ICMP6) 3024 #endif 3025 3026 /** 3027 * IP6_FRAG_STATS==1: Enable IPv6 fragmentation stats. 3028 */ 3029 #if !defined IP6_FRAG_STATS || defined __DOXYGEN__ 3030 #define IP6_FRAG_STATS (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS)) 3031 #endif 3032 3033 /** 3034 * MLD6_STATS==1: Enable MLD for IPv6 stats. 3035 */ 3036 #if !defined MLD6_STATS || defined __DOXYGEN__ 3037 #define MLD6_STATS (LWIP_IPV6 && LWIP_IPV6_MLD) 3038 #endif 3039 3040 /** 3041 * ND6_STATS==1: Enable Neighbor discovery for IPv6 stats. 3042 */ 3043 #if !defined ND6_STATS || defined __DOXYGEN__ 3044 #define ND6_STATS (LWIP_IPV6) 3045 #endif 3046 3047 /** 3048 * MIB2_STATS==1: Stats for SNMP MIB2. 3049 */ 3050 #if !defined MIB2_STATS || defined __DOXYGEN__ 3051 #define MIB2_STATS 0 3052 #endif 3053 3054 /** 3055 * DHCP6_STATS==1: Enables stats for DHCPv6. 3056 */ 3057 #if !defined DHCP6_STATS || defined __DOXYGEN__ 3058 #define DHCP6_STATS (LWIP_IPV6_DHCP6) 3059 #endif 3060 3061 #else 3062 #undef LINK_STATS 3063 #undef ETHARP_STATS 3064 #undef IP_STATS 3065 #undef IPFRAG_STATS 3066 #undef ICMP_STATS 3067 #undef IGMP_STATS 3068 #undef UDP_STATS 3069 #undef TCP_STATS 3070 #undef MEM_STATS 3071 #undef MEMP_STATS 3072 #undef SYS_STATS 3073 #undef LWIP_STATS_DISPLAY 3074 #undef IP6_STATS 3075 #undef ICMP6_STATS 3076 #undef IP6_FRAG_STATS 3077 #undef MLD6_STATS 3078 #undef ND6_STATS 3079 #undef MIB2_STATS 3080 #undef DHCP6_STATS 3081 #define LINK_STATS 0 3082 #define ETHARP_STATS 0 3083 #define IP_STATS 0 3084 #define IPFRAG_STATS 0 3085 #define ICMP_STATS 0 3086 #define IGMP_STATS 0 3087 #define UDP_STATS 0 3088 #define TCP_STATS 0 3089 #define MEM_STATS 0 3090 #define MEMP_STATS 0 3091 #define SYS_STATS 0 3092 #define LWIP_STATS_DISPLAY 0 3093 #define IP6_STATS 0 3094 #define ICMP6_STATS 0 3095 #define IP6_FRAG_STATS 0 3096 #define MLD6_STATS 0 3097 #define ND6_STATS 0 3098 #define MIB2_STATS 0 3099 #define DHCP6_STATS 0 3100 3101 #endif /* LWIP_STATS */ 3102 /** 3103 * @} 3104 */ 3105 3106 /* 3107 -------------------------------------- 3108 ---------- Checksum options ---------- 3109 -------------------------------------- 3110 */ 3111 /** 3112 * @defgroup lwip_opts_checksum Checksum 3113 * @ingroup lwip_opts_infrastructure 3114 * @{ 3115 */ 3116 /** 3117 * LWIP_CHECKSUM_CTRL_PER_NETIF==1: Checksum generation/check can be enabled/disabled 3118 * per netif. 3119 * ATTENTION: if enabled, the CHECKSUM_GEN_* and CHECKSUM_CHECK_* defines must be enabled! 3120 */ 3121 #if !defined LWIP_CHECKSUM_CTRL_PER_NETIF || defined __DOXYGEN__ 3122 #define LWIP_CHECKSUM_CTRL_PER_NETIF 0 3123 #endif 3124 3125 /** 3126 * CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets. 3127 */ 3128 #if !defined CHECKSUM_GEN_IP || defined __DOXYGEN__ 3129 #define CHECKSUM_GEN_IP 1 3130 #endif 3131 3132 /** 3133 * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets. 3134 */ 3135 #if !defined CHECKSUM_GEN_UDP || defined __DOXYGEN__ 3136 #define CHECKSUM_GEN_UDP 1 3137 #endif 3138 3139 /** 3140 * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets. 3141 */ 3142 #if !defined CHECKSUM_GEN_TCP || defined __DOXYGEN__ 3143 #define CHECKSUM_GEN_TCP 1 3144 #endif 3145 3146 /** 3147 * CHECKSUM_GEN_ICMP==1: Generate checksums in software for outgoing ICMP packets. 3148 */ 3149 #if !defined CHECKSUM_GEN_ICMP || defined __DOXYGEN__ 3150 #define CHECKSUM_GEN_ICMP 1 3151 #endif 3152 3153 /** 3154 * CHECKSUM_GEN_ICMP6==1: Generate checksums in software for outgoing ICMP6 packets. 3155 */ 3156 #if !defined CHECKSUM_GEN_ICMP6 || defined __DOXYGEN__ 3157 #define CHECKSUM_GEN_ICMP6 1 3158 #endif 3159 3160 /** 3161 * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets. 3162 */ 3163 #if !defined CHECKSUM_CHECK_IP || defined __DOXYGEN__ 3164 #define CHECKSUM_CHECK_IP 1 3165 #endif 3166 3167 /** 3168 * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets. 3169 */ 3170 #if !defined CHECKSUM_CHECK_UDP || defined __DOXYGEN__ 3171 #define CHECKSUM_CHECK_UDP 1 3172 #endif 3173 3174 /** 3175 * CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets. 3176 */ 3177 #if !defined CHECKSUM_CHECK_TCP || defined __DOXYGEN__ 3178 #define CHECKSUM_CHECK_TCP 1 3179 #endif 3180 3181 /** 3182 * CHECKSUM_CHECK_ICMP==1: Check checksums in software for incoming ICMP packets. 3183 */ 3184 #if !defined CHECKSUM_CHECK_ICMP || defined __DOXYGEN__ 3185 #define CHECKSUM_CHECK_ICMP 1 3186 #endif 3187 3188 /** 3189 * CHECKSUM_CHECK_ICMP6==1: Check checksums in software for incoming ICMPv6 packets 3190 */ 3191 #if !defined CHECKSUM_CHECK_ICMP6 || defined __DOXYGEN__ 3192 #define CHECKSUM_CHECK_ICMP6 1 3193 #endif 3194 3195 /** 3196 * LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from 3197 * application buffers to pbufs. 3198 */ 3199 #if !defined LWIP_CHECKSUM_ON_COPY || defined __DOXYGEN__ 3200 #define LWIP_CHECKSUM_ON_COPY 1 3201 #endif 3202 /** 3203 * @} 3204 */ 3205 3206 /* 3207 --------------------------------------- 3208 ---------- Common options --------------- 3209 --------------------------------------- 3210 */ 3211 /** 3212 * LWIP_ENABLE_IP_CONFLICT_SIGNAL==1: Enables IP conflict detection 3213 */ 3214 #if LWIP_IPV4 && LWIP_ARP 3215 #ifndef LWIP_ENABLE_IP_CONFLICT_SIGNAL 3216 #define LWIP_ENABLE_IP_CONFLICT_SIGNAL 1 3217 #endif 3218 #else 3219 #define LWIP_ENABLE_IP_CONFLICT_SIGNAL 0 3220 #endif 3221 3222 /* 3223 --------------------------------------- 3224 ---------- IPv6 options --------------- 3225 --------------------------------------- 3226 */ 3227 /** 3228 * @defgroup lwip_opts_ipv6 IPv6 3229 * @ingroup lwip_opts 3230 * @{ 3231 */ 3232 #if !defined LWIP_ENABLE_ROUTER || defined __DOXYGEN__ 3233 #define LWIP_ENABLE_ROUTER 1 3234 #endif 3235 3236 /** 3237 * LWIP_IPV6==1: Enable IPv6 3238 */ 3239 #if !defined LWIP_IPV6 || defined __DOXYGEN__ 3240 #define LWIP_IPV6 1 3241 #endif 3242 3243 /** 3244 * IPV6_REASS_MAXAGE: Maximum time (in multiples of IP6_REASS_TMR_INTERVAL - so seconds, normally) 3245 * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived 3246 * in this time, the whole packet is discarded. 3247 */ 3248 #if !defined IPV6_REASS_MAXAGE || defined __DOXYGEN__ 3249 #define IPV6_REASS_MAXAGE 3 3250 #endif 3251 3252 /** 3253 * LWIP_IPV6_SCOPES==1: Enable support for IPv6 address scopes, ensuring that 3254 * e.g. link-local addresses are really treated as link-local. Disable this 3255 * setting only for single-interface configurations. 3256 * All addresses that have a scope according to the default policy (link-local 3257 * unicast addresses, interface-local and link-local multicast addresses) should 3258 * now have a zone set on them before being passed to the core API, although 3259 * lwIP will currently attempt to select a zone on the caller's behalf when 3260 * necessary. Applications that directly assign IPv6 addresses to interfaces 3261 * (which is NOT recommended) must now ensure that link-local addresses carry 3262 * the netif's zone. See the new ip6_zone.h header file for more information and 3263 * relevant macros. For now it is still possible to turn off scopes support 3264 * through the new LWIP_IPV6_SCOPES option. When upgrading an implementation that 3265 * uses the core API directly, it is highly recommended to enable 3266 * LWIP_IPV6_SCOPES_DEBUG at least for a while, to ensure e.g. proper address 3267 * initialization. 3268 */ 3269 #if !defined LWIP_IPV6_SCOPES || defined __DOXYGEN__ 3270 #define LWIP_IPV6_SCOPES (LWIP_IPV6 && !LWIP_SINGLE_NETIF) 3271 #endif 3272 3273 /** 3274 * LWIP_IPV6_SCOPES_DEBUG==1: Perform run-time checks to verify that addresses 3275 * are properly zoned (see ip6_zone.h on what that means) where it matters. 3276 * Enabling this setting is highly recommended when upgrading from an existing 3277 * installation that is not yet scope-aware; otherwise it may be too expensive. 3278 */ 3279 #if !defined LWIP_IPV6_SCOPES_DEBUG || defined __DOXYGEN__ 3280 #define LWIP_IPV6_SCOPES_DEBUG 0 3281 #endif 3282 3283 /** 3284 * LWIP_IPV6_NUM_ADDRESSES: Number of IPv6 addresses per netif. 3285 */ 3286 #if !defined LWIP_IPV6_NUM_ADDRESSES || defined __DOXYGEN__ 3287 #define LWIP_IPV6_NUM_ADDRESSES 5 3288 #endif 3289 3290 /** 3291 * LWIP_IPV6_FORWARD==1: Forward IPv6 packets across netifs 3292 */ 3293 #if !defined LWIP_IPV6_FORWARD || defined __DOXYGEN__ 3294 #define LWIP_IPV6_FORWARD 0 3295 #endif 3296 3297 /** 3298 * LWIP_IPV6_FRAG==1: Fragment outgoing IPv6 packets that are too big. 3299 */ 3300 #if !defined LWIP_IPV6_FRAG || defined __DOXYGEN__ 3301 #define LWIP_IPV6_FRAG 1 3302 #endif 3303 3304 /** 3305 * LWIP_IPV6_REASS==1: reassemble incoming IPv6 packets that fragmented 3306 */ 3307 #if !defined LWIP_IPV6_REASS || defined __DOXYGEN__ 3308 #define LWIP_IPV6_REASS LWIP_IPV6 3309 #endif 3310 3311 /** 3312 * LWIP_IPV6_SEND_ROUTER_SOLICIT==1: Send router solicitation messages during 3313 * network startup. 3314 */ 3315 #if !defined LWIP_IPV6_SEND_ROUTER_SOLICIT || defined __DOXYGEN__ 3316 #define LWIP_IPV6_SEND_ROUTER_SOLICIT LWIP_IPV6 3317 #endif 3318 3319 /** 3320 * LWIP_IPV6_AUTOCONFIG==1: Enable stateless address autoconfiguration as per RFC 4862. 3321 */ 3322 #if !defined LWIP_IPV6_AUTOCONFIG || defined __DOXYGEN__ 3323 #define LWIP_IPV6_AUTOCONFIG LWIP_IPV6 3324 #endif 3325 3326 /** 3327 * LWIP_IPV6_ADDRESS_LIFETIMES==1: Keep valid and preferred lifetimes for each 3328 * IPv6 address. Required for LWIP_IPV6_AUTOCONFIG. May still be enabled 3329 * otherwise, in which case the application may assign address lifetimes with 3330 * the appropriate macros. Addresses with no lifetime are assumed to be static. 3331 * If this option is disabled, all addresses are assumed to be static. 3332 */ 3333 #if !defined LWIP_IPV6_ADDRESS_LIFETIMES || defined __DOXYGEN__ 3334 #define LWIP_IPV6_ADDRESS_LIFETIMES LWIP_IPV6_AUTOCONFIG 3335 #endif 3336 3337 /** 3338 * LWIP_IPV6_DUP_DETECT_ATTEMPTS=[0..7]: Number of duplicate address detection attempts. 3339 */ 3340 #if !defined LWIP_IPV6_DUP_DETECT_ATTEMPTS || defined __DOXYGEN__ 3341 #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1 3342 #endif 3343 /** 3344 * @} 3345 */ 3346 3347 /** 3348 * LWIP_IP_FILTER==1: Support define a IP(v4) filter rule by user. 3349 */ 3350 #ifndef LWIP_IP_FILTER 3351 #define LWIP_IP_FILTER 1 3352 #endif 3353 #if !LWIP_IPV4 3354 /* disable LWIP_IP_FILTER when IPv4 is disabled */ 3355 #undef LWIP_IP_FILTER 3356 #define LWIP_IP_FILTER 0 3357 #endif /* !LWIP_IPV4 */ 3358 3359 /** 3360 * LWIP_IPV6_FILTER==1: Support define a IPv6 filter rule by user. 3361 */ 3362 #ifndef LWIP_IPV6_FILTER 3363 #define LWIP_IPV6_FILTER 1 3364 #endif 3365 #if !LWIP_IPV6 3366 /* disable LWIP_IPV6_FILTER when IPv6 is disabled */ 3367 #undef LWIP_IPV6_FILTER 3368 #define LWIP_IPV6_FILTER 0 3369 #endif /* !LWIP_IPV6 */ 3370 3371 /** 3372 * @defgroup lwip_opts_icmp6 ICMP6 3373 * @ingroup lwip_opts_ipv6 3374 * @{ 3375 */ 3376 /** 3377 * LWIP_ICMP6==1: Enable ICMPv6 (mandatory per RFC) 3378 */ 3379 #if !defined LWIP_ICMP6 || defined __DOXYGEN__ 3380 #define LWIP_ICMP6 LWIP_IPV6 3381 #endif 3382 3383 /** 3384 * LWIP_ICMP6_DATASIZE: bytes from original packet to send back in 3385 * ICMPv6 error messages (0 = default of IP6_MIN_MTU_LENGTH) 3386 * ATTENTION: RFC4443 section 2.4 says IP6_MIN_MTU_LENGTH is a MUST, 3387 * so override this only if you absolutely have to! 3388 */ 3389 #if !defined LWIP_ICMP6_DATASIZE || defined __DOXYGEN__ 3390 #define LWIP_ICMP6_DATASIZE 0 3391 #endif 3392 3393 /** 3394 * LWIP_ICMP6_HL: default hop limit for ICMPv6 messages 3395 */ 3396 #if !defined LWIP_ICMP6_HL || defined __DOXYGEN__ 3397 #define LWIP_ICMP6_HL 255 3398 #endif 3399 /** 3400 * @} 3401 */ 3402 3403 /** 3404 * @defgroup lwip_opts_mld6 Multicast listener discovery 3405 * @ingroup lwip_opts_ipv6 3406 * @{ 3407 */ 3408 /** 3409 * LWIP_IPV6_MLD==1: Enable multicast listener discovery protocol. 3410 * If LWIP_IPV6 is enabled but this setting is disabled, the MAC layer must 3411 * indiscriminately pass all inbound IPv6 multicast traffic to lwIP. 3412 */ 3413 #if !defined LWIP_IPV6_MLD || defined __DOXYGEN__ 3414 #define LWIP_IPV6_MLD LWIP_IPV6 3415 #endif 3416 3417 /** 3418 * LWIP_MLD6_ENABLE_MLD_ON_DAD==1:Enables sending MLD REPORT OR DONE for solicited node 3419 address when state changes during neighbour discovery. 3420 */ 3421 #if !defined LWIP_MLD6_ENABLE_MLD_ON_DAD || defined __DOXYGEN__ 3422 #define LWIP_MLD6_ENABLE_MLD_ON_DAD (0) 3423 #endif 3424 #if !LWIP_IPV6_MLD 3425 #undef LWIP_MLD6_ENABLE_MLD_ON_DAD 3426 #define LWIP_MLD6_ENABLE_MLD_ON_DAD 0 3427 #endif 3428 3429 3430 /** 3431 * LWIP_MLD6_DONE_ONLYFOR_LAST_REPORTER==1:Enables sending MLD DONE only if the group 3432 is the last listener on the interface for a specific multicast address. If group is not the last reporter 3433 Done message will not be sent. By disabling the configuration, stack will send Done irrespective of the 3434 last reporter flag. 3435 RFC 2710 If the node's most recent Report message was suppressed by hearing another Report 3436 message, it MAY send nothing, as it is highly likely that there is another listener 3437 for that address still present on the same link. If this optimization is implemented 3438 , it MUST be able to be turned off but SHOULD default to on. */ 3439 3440 #if !defined LWIP_MLD6_DONE_ONLYFOR_LAST_REPORTER || defined __DOXYGEN__ 3441 #define LWIP_MLD6_DONE_ONLYFOR_LAST_REPORTER LWIP_IPV6 && LWIP_IPV6_MLD 3442 #endif 3443 3444 /** 3445 * MEMP_NUM_MLD6_GROUP: Max number of IPv6 multicast groups that can be joined. 3446 * There must be enough groups so that each netif can join the solicited-node 3447 * multicast group for each of its local addresses, plus one for MDNS if 3448 * applicable, plus any number of groups to be joined on UDP sockets. 3449 */ 3450 #if !defined MEMP_NUM_MLD6_GROUP || defined __DOXYGEN__ 3451 #define MEMP_NUM_MLD6_GROUP 4 3452 #endif 3453 3454 /* LWIP_NETIF_IFINDEX_MAX_EX : The max value allowed for netif interface index: 3455 * Not a configurable value. 3456 */ 3457 /* As the ifindex variable is a uint8 value , restricting the number of index handled in the 3458 interface identification API */ 3459 #ifndef LWIP_NETIF_IFINDEX_MAX_EX 3460 #define LWIP_NETIF_IFINDEX_MAX_EX LWIP_NETIF_NUM_MAX 3461 #endif 3462 3463 /** Must be the maximum of all used hardware address lengths 3464 across all types of interfaces in use. 3465 This does not have to be changed, normally. */ 3466 #ifndef NETIF_MAX_HWADDR_LEN 3467 #define NETIF_MAX_HWADDR_LEN 6U 3468 #endif 3469 3470 /** 3471 * @} 3472 */ 3473 3474 /** 3475 * @defgroup lwip_opts_nd6 Neighbor discovery 3476 * @ingroup lwip_opts_ipv6 3477 * @{ 3478 */ 3479 /** 3480 * LWIP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address 3481 * is being resolved. 3482 */ 3483 #if !defined LWIP_ND6_QUEUEING || defined __DOXYGEN__ 3484 #define LWIP_ND6_QUEUEING LWIP_IPV6 3485 #endif 3486 3487 /** 3488 * MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution. 3489 */ 3490 #if !defined MEMP_NUM_ND6_QUEUE || defined __DOXYGEN__ 3491 #define MEMP_NUM_ND6_QUEUE 20 3492 #endif 3493 3494 /** 3495 * LWIP_ND6_NUM_NEIGHBORS: Number of entries in IPv6 neighbor cache 3496 */ 3497 #if !defined LWIP_ND6_NUM_NEIGHBORS || defined __DOXYGEN__ 3498 #define LWIP_ND6_NUM_NEIGHBORS 10 3499 #endif 3500 3501 /** 3502 * LWIP_ND6_NUM_DESTINATIONS: number of entries in IPv6 destination cache 3503 */ 3504 #if !defined LWIP_ND6_NUM_DESTINATIONS || defined __DOXYGEN__ 3505 #define LWIP_ND6_NUM_DESTINATIONS 10 3506 #endif 3507 3508 /** 3509 * LWIP_ND6_NUM_PREFIXES: number of entries in IPv6 on-link prefixes cache 3510 */ 3511 #if !defined LWIP_ND6_NUM_PREFIXES || defined __DOXYGEN__ 3512 #define LWIP_ND6_NUM_PREFIXES 10 3513 #endif 3514 3515 /** 3516 * LWIP_ND6_NUM_ROUTERS: number of entries in IPv6 default router cache 3517 */ 3518 #if !defined LWIP_ND6_NUM_ROUTERS || defined __DOXYGEN__ 3519 #define LWIP_ND6_NUM_ROUTERS 3 3520 #endif 3521 3522 /** 3523 * LWIP_ND6_MAX_MULTICAST_SOLICIT: max number of multicast solicit messages to send 3524 * (neighbor solicit and router solicit) 3525 */ 3526 #if !defined LWIP_ND6_MAX_MULTICAST_SOLICIT || defined __DOXYGEN__ 3527 #define LWIP_ND6_MAX_MULTICAST_SOLICIT 3 3528 #endif 3529 3530 /** 3531 * LWIP_ND6_MAX_UNICAST_SOLICIT: max number of unicast neighbor solicitation messages 3532 * to send during neighbor reachability detection. 3533 */ 3534 #if !defined LWIP_ND6_MAX_UNICAST_SOLICIT || defined __DOXYGEN__ 3535 #define LWIP_ND6_MAX_UNICAST_SOLICIT 3 3536 #endif 3537 3538 /** 3539 * Unused: See ND RFC (time in milliseconds). 3540 */ 3541 #if !defined LWIP_ND6_MAX_ANYCAST_DELAY_TIME || defined __DOXYGEN__ 3542 #define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000 3543 #endif 3544 3545 /** 3546 * Unused: See ND RFC 3547 */ 3548 #if !defined LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT || defined __DOXYGEN__ 3549 #define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT 3 3550 #endif 3551 3552 /** 3553 * LWIP_ND6_REACHABLE_TIME: default neighbor reachable time (in milliseconds). 3554 * May be updated by router advertisement messages. 3555 */ 3556 #if !defined LWIP_ND6_REACHABLE_TIME || defined __DOXYGEN__ 3557 #define LWIP_ND6_REACHABLE_TIME 30000 3558 #endif 3559 3560 /** 3561 * LWIP_ND6_RETRANS_TIMER: default retransmission timer for solicitation messages 3562 */ 3563 #if !defined LWIP_ND6_RETRANS_TIMER || defined __DOXYGEN__ 3564 #define LWIP_ND6_RETRANS_TIMER 1000 3565 #endif 3566 3567 /** 3568 * LWIP_ND6_DELAY_FIRST_PROBE_TIME: Delay before first unicast neighbor solicitation 3569 * message is sent, during neighbor reachability detection. 3570 */ 3571 #if !defined LWIP_ND6_DELAY_FIRST_PROBE_TIME || defined __DOXYGEN__ 3572 #define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000 3573 #endif 3574 3575 /** 3576 * LWIP_ND6_ALLOW_RA_UPDATES==1: Allow Router Advertisement messages to update 3577 * Reachable time and retransmission timers, and netif MTU. 3578 */ 3579 #if !defined LWIP_ND6_ALLOW_RA_UPDATES || defined __DOXYGEN__ 3580 #define LWIP_ND6_ALLOW_RA_UPDATES 1 3581 #endif 3582 3583 /** 3584 * LWIP_ND6_TCP_REACHABILITY_HINTS==1: Allow TCP to provide Neighbor Discovery 3585 * with reachability hints for connected destinations. This helps avoid sending 3586 * unicast neighbor solicitation messages. 3587 */ 3588 #if !defined LWIP_ND6_TCP_REACHABILITY_HINTS || defined __DOXYGEN__ 3589 #define LWIP_ND6_TCP_REACHABILITY_HINTS 1 3590 #endif 3591 3592 /** 3593 * LWIP_ND6_RDNSS_MAX_DNS_SERVERS > 0: Use IPv6 Router Advertisement Recursive 3594 * DNS Server Option (as per RFC 6106) to copy a defined maximum number of DNS 3595 * servers to the DNS module. 3596 */ 3597 #if !defined LWIP_ND6_RDNSS_MAX_DNS_SERVERS || defined __DOXYGEN__ 3598 #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0 3599 #endif 3600 /** 3601 * @} 3602 */ 3603 3604 /** 3605 * @defgroup lwip_opts_dhcpv6 DHCPv6 3606 * @ingroup lwip_opts_ipv6 3607 * @{ 3608 */ 3609 /** 3610 * LWIP_IPV6_DHCP6==1: enable DHCPv6 stateful/stateless address autoconfiguration. 3611 */ 3612 #if !defined LWIP_IPV6_DHCP6 || defined __DOXYGEN__ 3613 #define LWIP_IPV6_DHCP6 1 3614 #endif 3615 #if !LWIP_IPV6 3616 /* disable DHCP6 when IPv6 is disabled */ 3617 #undef LWIP_IPV6_DHCP6 3618 #define LWIP_IPV6_DHCP6 0 3619 #endif /* !LWIP_IPV6 */ 3620 3621 /** 3622 * LWIP_IPV6_DHCP6_STATEFUL==1: enable DHCPv6 stateful address autoconfiguration. 3623 */ 3624 #if !defined LWIP_IPV6_DHCP6_STATEFUL || defined __DOXYGEN__ 3625 #define LWIP_IPV6_DHCP6_STATEFUL 1 3626 #endif 3627 3628 /** 3629 * LWIP_IPV6_DHCP6_STATELESS==1: enable DHCPv6 stateless address autoconfiguration. 3630 */ 3631 #if !defined LWIP_IPV6_DHCP6_STATELESS || defined __DOXYGEN__ 3632 #define LWIP_IPV6_DHCP6_STATELESS LWIP_IPV6_DHCP6 3633 #endif 3634 3635 /** 3636 * LWIP_DHCP6_GETS_NTP==1: Request NTP servers via DHCPv6. For each 3637 * response packet, a callback is called, which has to be provided by the port: 3638 * void dhcp6_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs); 3639 */ 3640 #if !defined LWIP_DHCP6_GET_NTP_SRV || defined __DOXYGEN__ 3641 #define LWIP_DHCP6_GET_NTP_SRV 0 3642 #endif 3643 3644 /** 3645 * The maximum of NTP servers requested 3646 */ 3647 #if !defined LWIP_DHCP6_MAX_NTP_SERVERS || defined __DOXYGEN__ 3648 #define LWIP_DHCP6_MAX_NTP_SERVERS 1 3649 #endif 3650 3651 /** 3652 * LWIP_DHCP6_MAX_DNS_SERVERS > 0: Request DNS servers via DHCPv6. 3653 * DNS servers received in the response are passed to DNS via @ref dns_setserver() 3654 * (up to the maximum limit defined here). 3655 */ 3656 #if !defined LWIP_DHCP6_MAX_DNS_SERVERS || defined __DOXYGEN__ 3657 #define LWIP_DHCP6_MAX_DNS_SERVERS DNS_MAX_SERVERS 3658 #endif 3659 3660 /* 3661 * @defgroup lwip_icmp6_rate_limit 3662 * @ingroup lwip_icmp6_rate_limit 3663 * @{ 3664 */ 3665 3666 /** 3667 * LWIP_ICMP6_ERR==1: option to use rate limit feature or not 3668 */ 3669 #if !defined LWIP_ICMP6_ERR_RT_LMT || defined __DOXYGEN__ 3670 #if LWIP_ICMP6 3671 #define LWIP_ICMP6_ERR_RT_LMT 1 3672 #else 3673 #define LWIP_ICMP6_ERR_RT_LMT 0 3674 #endif 3675 #endif 3676 3677 /** 3678 * Defines the maximum number of Icmp6 error buckets to check the average rate. 3679 * bucket size need to be power of 2. Eg. Correct values will be 2,4,8,16,32... 3680 */ 3681 #if !defined ICMP6_ERR_BKT_SIZE || defined __DOXYGEN__ 3682 #define ICMP6_ERR_BKT_SIZE 2 3683 #endif 3684 3685 /** 3686 * Defines the max average/threshold rate at which the data can be recieved. 3687 */ 3688 #if !defined ICMP6_ERR_THRESHOLD_LEVEL || defined __DOXYGEN__ 3689 #define ICMP6_ERR_THRESHOLD_LEVEL 5 3690 #endif 3691 3692 /** 3693 * Enables the static neighbor entry support These entries can't be replaced. 3694 */ 3695 #if !defined LWIP_ND6_STATIC_NBR || defined __DOXYGEN__ 3696 #define LWIP_ND6_STATIC_NBR 1 3697 #endif 3698 3699 #ifndef LWIP_ND6_ROUTER 3700 #define LWIP_ND6_ROUTER 0 3701 #endif 3702 3703 #ifndef LWIP_ND6_DESTINATIONS_OLDTIME 3704 #define LWIP_ND6_DESTINATIONS_OLDTIME 0 3705 #endif 3706 3707 #ifndef LWIP_RA_PREFIX_DYNAMIC 3708 #define LWIP_RA_PREFIX_DYNAMIC 0 3709 #endif 3710 3711 #ifndef LWIP_RPL_RS_DAO 3712 #define LWIP_RPL_RS_DAO 0 3713 #endif 3714 3715 /* ---------- TFTP options ---------- */ 3716 #ifndef LWIP_TFTP 3717 #define LWIP_TFTP 1 3718 #endif 3719 3720 #ifndef LWIP_NA_PROXY 3721 #define LWIP_NA_PROXY 0 3722 #endif 3723 3724 #ifndef LWIP_NA_PROXY_UNSOLICITED 3725 #define LWIP_NA_PROXY_UNSOLICITED 1 3726 #endif 3727 3728 #ifndef LWIP_NAT64 3729 #define LWIP_NAT64 0 3730 #endif 3731 3732 #ifndef LWIP_DNS64 3733 #define LWIP_DNS64 0 3734 #endif 3735 3736 #ifndef LWIP_RIPPLE 3737 #define LWIP_RIPPLE 0 3738 #endif 3739 3740 #if LWIP_RIPPLE 3741 #ifndef LWIP_RIPPLE_TIMER_COUNT 3742 #define LWIP_RIPPLE_TIMER_COUNT 3 3743 #endif 3744 #else 3745 #undef LWIP_RIPPLE_TIMER_COUNT 3746 #define LWIP_RIPPLE_TIMER_COUNT 0 3747 #endif 3748 3749 /** 3750 * our nat64 module depends on rpl 3751 */ 3752 #if LWIP_RIPPLE == 0 3753 #if defined(LWIP_NAT64) && (LWIP_NAT64 != 0) 3754 #undef LWIP_NAT64 3755 #define LWIP_NAT64 0 3756 #endif 3757 #endif 3758 3759 #ifndef LWIP_NAT64_MIN_SUBSTITUTE 3760 #define LWIP_NAT64_MIN_SUBSTITUTE 0 3761 #endif 3762 3763 #ifndef LWIP_MMBR 3764 #define LWIP_MMBR 0 3765 #endif 3766 3767 #ifndef LWIP_IP6IN4 3768 #define LWIP_IP6IN4 0 3769 #endif 3770 3771 /** 3772 * This configuration if enabled, using ip6in4 entry to determine the arp dst ip. 3773 * the arp entry size will be cut down. 3774 */ 3775 #ifndef LWIP_NAT64_IP6IN4 3776 #define LWIP_NAT64_IP6IN4 1 3777 #endif 3778 3779 /** 3780 * This configuration if enabled, using ip6in4 first when transport the packet between MBRs. 3781 */ 3782 #ifndef LWIP_IP6IN4_PRIOR_NAT64 3783 #define LWIP_IP6IN4_PRIOR_NAT64 0 3784 #endif 3785 3786 #ifndef LWIP_MPL 3787 #define LWIP_MPL 0 3788 #endif 3789 3790 #ifndef LWIP_MPL_IPV4 3791 #define LWIP_MPL_IPV4 0 3792 #endif 3793 3794 #ifndef LWIP_MPL_IPV4_BCAST 3795 #define LWIP_MPL_IPV4_BCAST 0 3796 #endif 3797 3798 #ifndef LWIP_IPV6_MLD_QUERIER 3799 #define LWIP_IPV6_MLD_QUERIER 0 3800 #endif 3801 3802 /** 3803 * @} 3804 */ 3805 3806 /* 3807 --------------------------------------- 3808 ---------- Hook options --------------- 3809 --------------------------------------- 3810 */ 3811 3812 /** 3813 * @defgroup lwip_opts_hooks Hooks 3814 * @ingroup lwip_opts_infrastructure 3815 * Hooks are undefined by default, define them to a function if you need them. 3816 * @{ 3817 */ 3818 3819 /** 3820 * LWIP_HOOK_FILENAME: Custom filename to \#include in files that provide hooks. 3821 * Declare your hook function prototypes in there, you may also \#include all headers 3822 * providing data types that are need in this file. 3823 */ 3824 #ifdef __DOXYGEN__ 3825 #define LWIP_HOOK_FILENAME "path/to/my/lwip_hooks.h" 3826 #endif 3827 3828 /** 3829 * LWIP_HOOK_TCP_ISN: 3830 * Hook for generation of the Initial Sequence Number (ISN) for a new TCP 3831 * connection. The default lwIP ISN generation algorithm is very basic and may 3832 * allow for TCP spoofing attacks. This hook provides the means to implement 3833 * the standardized ISN generation algorithm from RFC 6528 (see contrib/adons/tcp_isn), 3834 * or any other desired algorithm as a replacement. 3835 * Called from tcp_connect() and tcp_listen_input() when an ISN is needed for 3836 * a new TCP connection, if TCP support (@ref LWIP_TCP) is enabled.\n 3837 * Signature:\code{.c} 3838 * 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); 3839 * \endcode 3840 * - it may be necessary to use "struct ip_addr" (ip4_addr, ip6_addr) instead of "ip_addr_t" in function declarations\n 3841 * Arguments: 3842 * - local_ip: pointer to the local IP address of the connection 3843 * - local_port: local port number of the connection (host-byte order) 3844 * - remote_ip: pointer to the remote IP address of the connection 3845 * - remote_port: remote port number of the connection (host-byte order)\n 3846 * Return value: 3847 * - the 32-bit Initial Sequence Number to use for the new TCP connection. 3848 */ 3849 #ifdef __DOXYGEN__ 3850 #define LWIP_HOOK_TCP_ISN(local_ip, local_port, remote_ip, remote_port) 3851 #endif 3852 3853 /** 3854 * LWIP_HOOK_TCP_INPACKET_PCB: 3855 * Hook for intercepting incoming packets before they are passed to a pcb. This 3856 * allows updating some state or even dropping a packet. 3857 * Signature:\code{.c} 3858 * err_t my_hook_tcp_inpkt(struct tcp_pcb *pcb, struct tcp_hdr *hdr, u16_t optlen, u16_t opt1len, u8_t *opt2, struct pbuf *p); 3859 * \endcode 3860 * Arguments: 3861 * - pcb: tcp_pcb selected for input of this packet (ATTENTION: this may be 3862 * struct tcp_pcb_listen if pcb->state == LISTEN) 3863 * - hdr: pointer to tcp header (ATTENTION: tcp options may not be in one piece!) 3864 * - optlen: tcp option length 3865 * - opt1len: tcp option length 1st part 3866 * - opt2: if this is != NULL, tcp options are split among 2 pbufs. In that case, 3867 * options start at right after the tcp header ('(u8_t*)(hdr + 1)') for 3868 * the first 'opt1len' bytes and the rest starts at 'opt2'. opt2len can 3869 * be simply calculated: 'opt2len = optlen - opt1len;' 3870 * - p: input packet, p->payload points to application data (that's why tcp hdr 3871 * and options are passed in seperately) 3872 * Return value: 3873 * - ERR_OK: continue input of this packet as normal 3874 * - != ERR_OK: drop this packet for input (don't continue input processing) 3875 * 3876 * ATTENTION: don't call any tcp api functions that might change tcp state (pcb 3877 * state or any pcb lists) from this callback! 3878 */ 3879 #ifdef __DOXYGEN__ 3880 #define LWIP_HOOK_TCP_INPACKET_PCB(pcb, hdr, optlen, opt1len, opt2, p) 3881 #endif 3882 3883 /** 3884 * LWIP_HOOK_TCP_OUT_TCPOPT_LENGTH: 3885 * Hook for increasing the size of the options allocated with a tcp header. 3886 * Together with LWIP_HOOK_TCP_OUT_ADD_TCPOPTS, this can be used to add custom 3887 * options to outgoing tcp segments. 3888 * Signature:\code{.c} 3889 * u8_t my_hook_tcp_out_tcpopt_length(const struct tcp_pcb *pcb, u8_t internal_option_length); 3890 * \endcode 3891 * Arguments: 3892 * - pcb: tcp_pcb that transmits (ATTENTION: this may be NULL or 3893 * struct tcp_pcb_listen if pcb->state == LISTEN) 3894 * - internal_option_length: tcp option length used by the stack internally 3895 * Return value: 3896 * - a number of bytes to allocate for tcp options (internal_option_length <= ret <= 40) 3897 * 3898 * ATTENTION: don't call any tcp api functions that might change tcp state (pcb 3899 * state or any pcb lists) from this callback! 3900 */ 3901 #ifdef __DOXYGEN__ 3902 #define LWIP_HOOK_TCP_OUT_TCPOPT_LENGTH(pcb, internal_len) 3903 #endif 3904 3905 /** 3906 * LWIP_HOOK_TCP_OUT_ADD_TCPOPTS: 3907 * Hook for adding custom options to outgoing tcp segments. 3908 * Space for these custom options has to be reserved via LWIP_HOOK_TCP_OUT_TCPOPT_LENGTH. 3909 * Signature:\code{.c} 3910 * u32_t *my_hook_tcp_out_add_tcpopts(struct pbuf *p, struct tcp_hdr *hdr, const struct tcp_pcb *pcb, u32_t *opts); 3911 * \endcode 3912 * Arguments: 3913 * - p: output packet, p->payload pointing to tcp header, data follows 3914 * - hdr: tcp header 3915 * - pcb: tcp_pcb that transmits (ATTENTION: this may be NULL or 3916 * struct tcp_pcb_listen if pcb->state == LISTEN) 3917 * - opts: pointer where to add the custom options (there may already be options 3918 * between the header and these) 3919 * Return value: 3920 * - pointer pointing directly after the inserted options 3921 * 3922 * ATTENTION: don't call any tcp api functions that might change tcp state (pcb 3923 * state or any pcb lists) from this callback! 3924 */ 3925 #ifdef __DOXYGEN__ 3926 #define LWIP_HOOK_TCP_OUT_ADD_TCPOPTS(p, hdr, pcb, opts) 3927 #endif 3928 3929 /** 3930 * LWIP_HOOK_IP4_INPUT(pbuf, input_netif): 3931 * Called from ip_input() (IPv4) 3932 * Signature:\code{.c} 3933 * int my_hook(struct pbuf *pbuf, struct netif *input_netif); 3934 * \endcode 3935 * Arguments: 3936 * - pbuf: received struct pbuf passed to ip_input() 3937 * - input_netif: struct netif on which the packet has been received 3938 * Return values: 3939 * - 0: Hook has not consumed the packet, packet is processed as normal 3940 * - != 0: Hook has consumed the packet. 3941 * If the hook consumed the packet, 'pbuf' is in the responsibility of the hook 3942 * (i.e. free it when done). 3943 */ 3944 #ifdef __DOXYGEN__ 3945 #define LWIP_HOOK_IP4_INPUT(pbuf, input_netif) 3946 #endif 3947 3948 /** 3949 * LWIP_HOOK_IP4_INPUT_AFTER_CHKSUM(pbuf, input_netif, iphdr_p, iphdr_hlen_p): 3950 * Called from ip_input() (IPv4) 3951 * Signature:\code{.c} 3952 * int my_hook(struct pbuf *pbuf, struct netif *input_netif, struct ip_hdr **iphdr_p, u16_t *iphdr_hlen_p); 3953 * \endcode 3954 * Arguments: 3955 * - pbuf: received struct pbuf passed to ip_input() 3956 * - input_netif: struct netif on which the packet has been received 3957 * - iphdr_p: pointer of struct ip_hdr which is extracted from the packet payload 3958 * - iphdr_hlen_p: pointer that indicates the length of iphdr 3959 * Return values: 3960 * - 0: Hook has not consumed the packet, packet is processed as normal 3961 * - != 0: Hook has consumed the packet. 3962 * If the hook consumed the packet, 'pbuf' is in the responsibility of the hook 3963 * (i.e. free it when done). 3964 */ 3965 #ifdef __DOXYGEN__ 3966 #define LWIP_HOOK_IP4_INPUT_AFTER_CHKSUM(pbuf, input_netif, iphdr_p, iphdr_hlen_p) 3967 #endif 3968 3969 /** 3970 * LWIP_HOOK_IP4_ROUTE(dest): 3971 * Called from ip_route() (IPv4) 3972 * Signature:\code{.c} 3973 * struct netif *my_hook(const ip4_addr_t *dest); 3974 * \endcode 3975 * Arguments: 3976 * - dest: destination IPv4 address 3977 * Returns values: 3978 * - the destination netif 3979 * - NULL if no destination netif is found. In that case, ip_route() continues as normal. 3980 */ 3981 #ifdef __DOXYGEN__ 3982 #define LWIP_HOOK_IP4_ROUTE() 3983 #endif 3984 3985 /** 3986 * LWIP_HOOK_IP4_ROUTE_SRC(src, dest): 3987 * Source-based routing for IPv4 - called from ip_route() (IPv4) 3988 * Signature:\code{.c} 3989 * struct netif *my_hook(const ip4_addr_t *src, const ip4_addr_t *dest); 3990 * \endcode 3991 * Arguments: 3992 * - src: local/source IPv4 address 3993 * - dest: destination IPv4 address 3994 * Returns values: 3995 * - the destination netif 3996 * - NULL if no destination netif is found. In that case, ip_route() continues as normal. 3997 */ 3998 #ifdef __DOXYGEN__ 3999 #define LWIP_HOOK_IP4_ROUTE_SRC(src, dest) 4000 #endif 4001 4002 /** 4003 * LWIP_HOOK_IP4_ROUTE_TUNNEL(): 4004 * Route to user specified tunnel netif - called from ip_route() (IPv4) 4005 * Signature:\code{.c} 4006 * struct netif *my_hook(void); 4007 * \endcode 4008 * Arguments: 4009 * - dest: destination IPv4 address 4010 * Return values: 4011 * - the destination netif 4012 * - NULL if no destination netif is found. In that case, ip_route() continues as normal. 4013 */ 4014 #ifdef __DOXYGEN__ 4015 #define LWIP_HOOK_IP4_ROUTE_TUNNEL(dest) 4016 #endif 4017 4018 /** 4019 * LWIP_HOOK_IP4_CANFORWARD(src, dest): 4020 * Check if an IPv4 can be forwarded - called from: 4021 * ip4_input() -> ip4_forward() -> ip4_canforward() (IPv4) 4022 * - source address is available via ip4_current_src_addr() 4023 * - calling an output function in this context (e.g. multicast router) is allowed 4024 * Signature:\code{.c} 4025 * int my_hook(struct pbuf *p, u32_t dest_addr_hostorder); 4026 * \endcode 4027 * Arguments: 4028 * - p: packet to forward 4029 * - dest: destination IPv4 address 4030 * Returns values: 4031 * - 1: forward 4032 * - 0: don't forward 4033 * - -1: no decision. In that case, ip4_canforward() continues as normal. 4034 */ 4035 #ifdef __DOXYGEN__ 4036 #define LWIP_HOOK_IP4_CANFORWARD(src, dest) 4037 #endif 4038 4039 /** 4040 * LWIP_HOOK_IP4_OUTPUT_SRC_DECORATOR(pbuf, proto, iphdr): 4041 * Modify src addr in iphdr - called from: ip4_output_if_src() (IPv4) 4042 * Signature:\code{.c} 4043 * void my_hook(struct pbuf *pbuf, u8_t proto, struct ip_hdr *iphdr); 4044 * \endcode 4045 * Arguments: 4046 * - pbuf: the packet to send 4047 * - proto: protocol type of the outgoing packet 4048 * - iphdr: struct ip_hdr which is extracted from the packet payload 4049 * Return values: 4050 * - None 4051 * Packet contents other than iphdr->src MUST NOT be modified. 4052 * In any case, 'pbuf' MUST NOT be freed in the hook. 4053 */ 4054 #ifdef __DOXYGEN__ 4055 #define LWIP_HOOK_IP4_OUTPUT_SRC_DECORATOR(pbuf, proto, iphdr) 4056 #endif 4057 4058 /** 4059 * LWIP_HOOK_IP4_OUTPUT_FORCE_REROUTE(pbuf, src, dest, ttl, tos, proto, netif): 4060 * Reroute and send packet in a customized way - called from: ip4_output_if_src() (IPv4) 4061 * Signature:\code{.c} 4062 * err_t my_hook(struct pbuf *pbuf, u32_t src, const ip4_addr_t *dest, 4063 * u8_t ttl, u8_t tos, u8_t proto, struct netif *netif); 4064 * \endcode 4065 * Arguments: 4066 * - pbuf: the packet to send 4067 * - src: src addr in the iphdr of the outgoing packet 4068 * - dest: dest addr (where the packet wants to go) 4069 * - ttl: TTL value of the outgoing packet 4070 * - tos: TOS value of the outgoing packet 4071 * - proto: protocol type of the outgoing packet 4072 * Return values: 4073 * - 0: the packet has been rerouted and sent successfully 4074 * - ERR_CLSD: the packet has not been rerouted 4075 * - != 0 && != ERR_CLSD: the packet has been rerouted but failed to be sent 4076 * In any case, 'pbuf' MUST NOT be freed in the hook. 4077 */ 4078 #ifdef __DOXYGEN__ 4079 #define LWIP_HOOK_IP4_OUTPUT_FORCE_REROUTE(pbuf, src, dest, ttl, tos, proto, netif) 4080 #endif 4081 4082 /** 4083 * LWIP_HOOK_ETHARP_GET_GW(netif, dest): 4084 * Called from etharp_output() (IPv4) 4085 * Signature:\code{.c} 4086 * const ip4_addr_t *my_hook(struct netif *netif, const ip4_addr_t *dest); 4087 * \endcode 4088 * Arguments: 4089 * - netif: the netif used for sending 4090 * - dest: the destination IPv4 address 4091 * Return values: 4092 * - the IPv4 address of the gateway to handle the specified destination IPv4 address 4093 * - NULL, in which case the netif's default gateway is used 4094 * 4095 * The returned address MUST be directly reachable on the specified netif! 4096 * This function is meant to implement advanced IPv4 routing together with 4097 * LWIP_HOOK_IP4_ROUTE(). The actual routing/gateway table implementation is 4098 * not part of lwIP but can e.g. be hidden in the netif's state argument. 4099 */ 4100 #ifdef __DOXYGEN__ 4101 #define LWIP_HOOK_ETHARP_GET_GW(netif, dest) 4102 #endif 4103 4104 /** 4105 * LWIP_HOOK_IP6_INPUT(pbuf, input_netif): 4106 * Called from ip6_input() (IPv6) 4107 * Signature:\code{.c} 4108 * int my_hook(struct pbuf *pbuf, struct netif *input_netif); 4109 * \endcode 4110 * Arguments: 4111 * - pbuf: received struct pbuf passed to ip6_input() 4112 * - input_netif: struct netif on which the packet has been received 4113 * Return values: 4114 * - 0: Hook has not consumed the packet, packet is processed as normal 4115 * - != 0: Hook has consumed the packet. 4116 * If the hook consumed the packet, 'pbuf' is in the responsibility of the hook 4117 * (i.e. free it when done). 4118 */ 4119 #ifdef __DOXYGEN__ 4120 #define LWIP_HOOK_IP6_INPUT(pbuf, input_netif) 4121 #endif 4122 4123 /** 4124 * LWIP_HOOK_IP6_ROUTE(src, dest): 4125 * Called from ip_route() (IPv6) 4126 * Signature:\code{.c} 4127 * struct netif *my_hook(const ip6_addr_t *dest, const ip6_addr_t *src); 4128 * \endcode 4129 * Arguments: 4130 * - src: source IPv6 address 4131 * - dest: destination IPv6 address 4132 * Return values: 4133 * - the destination netif 4134 * - NULL if no destination netif is found. In that case, ip6_route() continues as normal. 4135 */ 4136 #ifdef __DOXYGEN__ 4137 #define LWIP_HOOK_IP6_ROUTE(src, dest) 4138 #endif 4139 #if LWIP_RIPPLE 4140 #undef LWIP_HOOK_IP6_ROUTE 4141 #define LWIP_HOOK_IP6_ROUTE(src, dest) lwip_rpl_route_netif_lookup(src, dest) 4142 #endif 4143 4144 /** 4145 * LWIP_HOOK_ND6_GET_GW(netif, dest): 4146 * Called from nd6_get_next_hop_entry() (IPv6) 4147 * Signature:\code{.c} 4148 * const ip6_addr_t *my_hook(struct netif *netif, const ip6_addr_t *dest); 4149 * \endcode 4150 * Arguments: 4151 * - netif: the netif used for sending 4152 * - dest: the destination IPv6 address 4153 * Return values: 4154 * - the IPv6 address of the next hop to handle the specified destination IPv6 address 4155 * - NULL, in which case a NDP-discovered router is used instead 4156 * 4157 * The returned address MUST be directly reachable on the specified netif! 4158 * This function is meant to implement advanced IPv6 routing together with 4159 * LWIP_HOOK_IP6_ROUTE(). The actual routing/gateway table implementation is 4160 * not part of lwIP but can e.g. be hidden in the netif's state argument. 4161 */ 4162 #ifdef __DOXYGEN__ 4163 #define LWIP_HOOK_ND6_GET_GW(netif, dest) 4164 #endif 4165 #if LWIP_RIPPLE 4166 #undef LWIP_HOOK_ND6_GET_GW 4167 #define LWIP_HOOK_ND6_GET_GW(netif, dest) lwip_rpl_route_nexthop_lookup(netif, dest) 4168 #endif 4169 4170 /** 4171 * LWIP_HOOK_VLAN_CHECK(netif, eth_hdr, vlan_hdr): 4172 * Called from ethernet_input() if VLAN support is enabled 4173 * Signature:\code{.c} 4174 * int my_hook(struct netif *netif, struct eth_hdr *eth_hdr, struct eth_vlan_hdr *vlan_hdr); 4175 * \endcode 4176 * Arguments: 4177 * - netif: struct netif on which the packet has been received 4178 * - eth_hdr: struct eth_hdr of the packet 4179 * - vlan_hdr: struct eth_vlan_hdr of the packet 4180 * Return values: 4181 * - 0: Packet must be dropped. 4182 * - != 0: Packet must be accepted. 4183 */ 4184 #ifdef __DOXYGEN__ 4185 #define LWIP_HOOK_VLAN_CHECK(netif, eth_hdr, vlan_hdr) 4186 #endif 4187 4188 /** 4189 * LWIP_HOOK_VLAN_SET: 4190 * Hook can be used to set prio_vid field of vlan_hdr. If you need to store data 4191 * on per-netif basis to implement this callback, see @ref netif_cd. 4192 * Called from ethernet_output() if VLAN support (@ref ETHARP_SUPPORT_VLAN) is enabled.\n 4193 * Signature:\code{.c} 4194 * 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 4195 * \endcode 4196 * Arguments: 4197 * - netif: struct netif that the packet will be sent through 4198 * - p: struct pbuf packet to be sent 4199 * - src: source eth address 4200 * - dst: destination eth address 4201 * - eth_type: ethernet type to packet to be sent\n 4202 * 4203 * 4204 * Return values: 4205 * - <0: Packet shall not contain VLAN header. 4206 * - 0 <= return value <= 0xFFFF: Packet shall contain VLAN header. Return value is prio_vid in host byte order. 4207 */ 4208 #ifdef __DOXYGEN__ 4209 #define LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type) 4210 #endif 4211 4212 /** 4213 * LWIP_HOOK_MEMP_AVAILABLE(memp_t_type): 4214 * Called from memp_free() when a memp pool was empty and an item is now available 4215 * Signature:\code{.c} 4216 * void my_hook(memp_t type); 4217 * \endcode 4218 */ 4219 #ifdef __DOXYGEN__ 4220 #define LWIP_HOOK_MEMP_AVAILABLE(memp_t_type) 4221 #endif 4222 4223 /** 4224 * LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(pbuf, netif): 4225 * Called from ethernet_input() when an unknown eth type is encountered. 4226 * Signature:\code{.c} 4227 * err_t my_hook(struct pbuf* pbuf, struct netif* netif); 4228 * \endcode 4229 * Arguments: 4230 * - p: rx packet with unknown eth type 4231 * - netif: netif on which the packet has been received 4232 * Return values: 4233 * - ERR_OK if packet is accepted (hook function now owns the pbuf) 4234 * - any error code otherwise (pbuf is freed) 4235 * 4236 * Payload points to ethernet header! 4237 */ 4238 #ifdef __DOXYGEN__ 4239 #define LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(pbuf, netif) 4240 #endif 4241 4242 /** 4243 * LWIP_HOOK_DHCP_APPEND_OPTIONS(netif, dhcp, state, msg, msg_type, options_len_ptr): 4244 * Called from various dhcp functions when sending a DHCP message. 4245 * This hook is called just before the DHCP message trailer is added, so the 4246 * options are at the end of a DHCP message. 4247 * Signature:\code{.c} 4248 * void my_hook(struct netif *netif, struct dhcp *dhcp, u8_t state, struct dhcp_msg *msg, 4249 * u8_t msg_type, u16_t *options_len_ptr); 4250 * \endcode 4251 * Arguments: 4252 * - netif: struct netif that the packet will be sent through 4253 * - dhcp: struct dhcp on that netif 4254 * - state: current dhcp state (dhcp_state_enum_t as an u8_t) 4255 * - msg: struct dhcp_msg that will be sent 4256 * - msg_type: dhcp message type to be sent (u8_t) 4257 * - options_len_ptr: pointer to the current length of options in the dhcp_msg "msg" 4258 * (must be increased when options are added!) 4259 * 4260 * Options need to appended like this: 4261 * LWIP_ASSERT("dhcp option overflow", *options_len_ptr + option_len + 2 <= DHCP_OPTIONS_LEN); 4262 * msg->options[(*options_len_ptr)++] = <option_number>; 4263 * msg->options[(*options_len_ptr)++] = <option_len>; 4264 * msg->options[(*options_len_ptr)++] = <option_bytes>; 4265 * [...] 4266 */ 4267 #ifdef __DOXYGEN__ 4268 #define LWIP_HOOK_DHCP_APPEND_OPTIONS(netif, dhcp, state, msg, msg_type, options_len_ptr) 4269 #endif 4270 4271 /** 4272 * LWIP_HOOK_DHCP_PARSE_OPTION(netif, dhcp, state, msg, msg_type, option, len, pbuf, option_value_offset): 4273 * Called from dhcp_parse_reply when receiving a DHCP message. 4274 * This hook is called for every option in the received message that is not handled internally. 4275 * Signature:\code{.c} 4276 * void my_hook(struct netif *netif, struct dhcp *dhcp, u8_t state, struct dhcp_msg *msg, 4277 * u8_t msg_type, u8_t option, u8_t option_len, struct pbuf *pbuf, u16_t option_value_offset); 4278 * \endcode 4279 * Arguments: 4280 * - netif: struct netif that the packet will be sent through 4281 * - dhcp: struct dhcp on that netif 4282 * - state: current dhcp state (dhcp_state_enum_t as an u8_t) 4283 * - msg: struct dhcp_msg that was received 4284 * - msg_type: dhcp message type received (u8_t, ATTENTION: only valid after 4285 * the message type option has been parsed!) 4286 * - option: option value (u8_t) 4287 * - len: option data length (u8_t) 4288 * - pbuf: pbuf where option data is contained 4289 * - option_value_offset: offset in pbuf where option data begins 4290 * 4291 * A nice way to get the option contents is pbuf_get_contiguous(): 4292 * u8_t buf[32]; 4293 * u8_t *ptr = (u8_t*)pbuf_get_contiguous(p, buf, sizeof(buf), LWIP_MIN(option_len, sizeof(buf)), offset); 4294 */ 4295 #ifdef __DOXYGEN__ 4296 #define LWIP_HOOK_DHCP_PARSE_OPTION(netif, dhcp, state, msg, msg_type, option, len, pbuf, offset) 4297 #endif 4298 4299 /** 4300 * LWIP_HOOK_DHCP6_APPEND_OPTIONS(netif, dhcp6, state, msg, msg_type, options_len_ptr, max_len): 4301 * Called from various dhcp6 functions when sending a DHCP6 message. 4302 * This hook is called just before the DHCP6 message is sent, so the 4303 * options are at the end of a DHCP6 message. 4304 * Signature:\code{.c} 4305 * void my_hook(struct netif *netif, struct dhcp6 *dhcp, u8_t state, struct dhcp6_msg *msg, 4306 * u8_t msg_type, u16_t *options_len_ptr); 4307 * \endcode 4308 * Arguments: 4309 * - netif: struct netif that the packet will be sent through 4310 * - dhcp6: struct dhcp6 on that netif 4311 * - state: current dhcp6 state (dhcp6_state_enum_t as an u8_t) 4312 * - msg: struct dhcp6_msg that will be sent 4313 * - msg_type: dhcp6 message type to be sent (u8_t) 4314 * - options_len_ptr: pointer to the current length of options in the dhcp6_msg "msg" 4315 * (must be increased when options are added!) 4316 * 4317 * Options need to appended like this: 4318 * u8_t *options = (u8_t *)(msg + 1); 4319 * LWIP_ASSERT("dhcp option overflow", sizeof(struct dhcp6_msg) + *options_len_ptr + newoptlen <= max_len); 4320 * options[(*options_len_ptr)++] = <option_data>; 4321 * [...] 4322 */ 4323 #ifdef __DOXYGEN__ 4324 #define LWIP_HOOK_DHCP6_APPEND_OPTIONS(netif, dhcp6, state, msg, msg_type, options_len_ptr, max_len) 4325 #endif 4326 4327 /** 4328 * LWIP_HOOK_SOCKETS_SETSOCKOPT(s, sock, level, optname, optval, optlen, err) 4329 * Called from socket API to implement setsockopt() for options not provided by lwIP. 4330 * Core lock is held when this hook is called. 4331 * Signature:\code{.c} 4332 * int my_hook(int s, struct lwip_sock *sock, int level, int optname, const void *optval, socklen_t optlen, int *err) 4333 * \endcode 4334 * Arguments: 4335 * - s: socket file descriptor 4336 * - sock: internal socket descriptor (see lwip/priv/sockets_priv.h) 4337 * - level: protocol level at which the option resides 4338 * - optname: option to set 4339 * - optval: value to set 4340 * - optlen: size of optval 4341 * - err: output error 4342 * Return values: 4343 * - 0: Hook has not consumed the option, code continues as normal (to internal options) 4344 * - != 0: Hook has consumed the option, 'err' is returned 4345 */ 4346 #ifdef __DOXYGEN__ 4347 #define LWIP_HOOK_SOCKETS_SETSOCKOPT(s, sock, level, optname, optval, optlen, err) 4348 #endif 4349 4350 /** 4351 * LWIP_HOOK_SOCKETS_GETSOCKOPT(s, sock, level, optname, optval, optlen, err) 4352 * Called from socket API to implement getsockopt() for options not provided by lwIP. 4353 * Core lock is held when this hook is called. 4354 * Signature:\code{.c} 4355 * int my_hook(int s, struct lwip_sock *sock, int level, int optname, void *optval, socklen_t *optlen, int *err) 4356 * \endcode 4357 * Arguments: 4358 * - s: socket file descriptor 4359 * - sock: internal socket descriptor (see lwip/priv/sockets_priv.h) 4360 * - level: protocol level at which the option resides 4361 * - optname: option to get 4362 * - optval: value to get 4363 * - optlen: size of optval 4364 * - err: output error 4365 * Return values: 4366 * - 0: Hook has not consumed the option, code continues as normal (to internal options) 4367 * - != 0: Hook has consumed the option, 'err' is returned 4368 */ 4369 #ifdef __DOXYGEN__ 4370 #define LWIP_HOOK_SOCKETS_GETSOCKOPT(s, sock, level, optname, optval, optlen, err) 4371 #endif 4372 4373 /** 4374 * LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE(name, addr, addrtype, err) 4375 * Called from netconn APIs (not usable with callback apps) allowing an 4376 * external DNS resolver (which uses sequential API) to handle the query. 4377 * Signature:\code{.c} 4378 * int my_hook(const char *name, ip_addr_t *addr, u8_t addrtype, err_t *err) 4379 * \endcode 4380 * Arguments: 4381 * - name: hostname to resolve 4382 * - addr: output host address 4383 * - addrtype: type of address to query 4384 * - err: output error 4385 * Return values: 4386 * - 0: Hook has not consumed hostname query, query continues into DNS module 4387 * - != 0: Hook has consumed the query 4388 * 4389 * err must also be checked to determine if the hook consumed the query, but 4390 * the query failed 4391 */ 4392 #ifdef __DOXYGEN__ 4393 #define LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE(name, addr, addrtype, err) 4394 #endif 4395 /** 4396 * @} 4397 */ 4398 4399 /* 4400 --------------------------------------- 4401 ---------- Debugging options ---------- 4402 --------------------------------------- 4403 */ 4404 /** 4405 * @defgroup lwip_opts_debugmsg Debug messages 4406 * @ingroup lwip_opts_debug 4407 * @{ 4408 */ 4409 /** 4410 * LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is 4411 * compared against this value. If it is smaller, then debugging 4412 * messages are written. 4413 * @see debugging_levels 4414 */ 4415 #if !defined LWIP_DBG_MIN_LEVEL || defined __DOXYGEN__ 4416 #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL 4417 #endif 4418 4419 /** 4420 * LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable 4421 * debug messages of certain types. 4422 * @see debugging_levels 4423 */ 4424 #if !defined LWIP_DBG_TYPES_ON || defined __DOXYGEN__ 4425 #define LWIP_DBG_TYPES_ON LWIP_DBG_ON 4426 #endif 4427 4428 /** 4429 * ETHARP_DEBUG: Enable debugging in etharp.c. 4430 */ 4431 #if !defined ETHARP_DEBUG || defined __DOXYGEN__ 4432 #define ETHARP_DEBUG LWIP_DBG_OFF 4433 #endif 4434 4435 /** 4436 * NETIF_DEBUG: Enable debugging in netif.c. 4437 */ 4438 #if !defined NETIF_DEBUG || defined __DOXYGEN__ 4439 #define NETIF_DEBUG LWIP_DBG_OFF 4440 #endif 4441 4442 /** 4443 * PBUF_DEBUG: Enable debugging in pbuf.c. 4444 */ 4445 #if !defined PBUF_DEBUG || defined __DOXYGEN__ 4446 #define PBUF_DEBUG LWIP_DBG_OFF 4447 #endif 4448 4449 /** 4450 * API_LIB_DEBUG: Enable debugging in api_lib.c. 4451 */ 4452 #if !defined API_LIB_DEBUG || defined __DOXYGEN__ 4453 #define API_LIB_DEBUG LWIP_DBG_OFF 4454 #endif 4455 4456 /** 4457 * API_MSG_DEBUG: Enable debugging in api_msg.c. 4458 */ 4459 #if !defined API_MSG_DEBUG || defined __DOXYGEN__ 4460 #define API_MSG_DEBUG LWIP_DBG_OFF 4461 #endif 4462 4463 /** 4464 * SOCKETS_DEBUG: Enable debugging in sockets.c. 4465 */ 4466 #if !defined SOCKETS_DEBUG || defined __DOXYGEN__ 4467 #define SOCKETS_DEBUG LWIP_DBG_OFF 4468 #endif 4469 4470 /** 4471 * ICMP_DEBUG: Enable debugging in icmp.c. 4472 */ 4473 #if !defined ICMP_DEBUG || defined __DOXYGEN__ 4474 #define ICMP_DEBUG LWIP_DBG_OFF 4475 #endif 4476 4477 /** 4478 * IGMP_DEBUG: Enable debugging in igmp.c. 4479 */ 4480 #if !defined IGMP_DEBUG || defined __DOXYGEN__ 4481 #define IGMP_DEBUG LWIP_DBG_OFF 4482 #endif 4483 4484 /** 4485 * INET_DEBUG: Enable debugging in inet.c. 4486 */ 4487 #if !defined INET_DEBUG || defined __DOXYGEN__ 4488 #define INET_DEBUG LWIP_DBG_OFF 4489 #endif 4490 4491 /** 4492 * IP_DEBUG: Enable debugging for IP. 4493 */ 4494 #if !defined IP_DEBUG || defined __DOXYGEN__ 4495 #define IP_DEBUG LWIP_DBG_OFF 4496 #endif 4497 4498 /** 4499 * Defines whether to enable debugging for driver module. 4500 */ 4501 #ifndef DRIVERIF_DEBUG 4502 #define DRIVERIF_DEBUG LWIP_DBG_OFF 4503 #endif 4504 4505 /** 4506 * IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass. 4507 */ 4508 #if !defined IP_REASS_DEBUG || defined __DOXYGEN__ 4509 #define IP_REASS_DEBUG LWIP_DBG_OFF 4510 #endif 4511 4512 /** 4513 * RAW_DEBUG: Enable debugging in raw.c. 4514 */ 4515 #if !defined RAW_DEBUG || defined __DOXYGEN__ 4516 #define RAW_DEBUG LWIP_DBG_OFF 4517 #endif 4518 4519 /** 4520 * MEM_DEBUG: Enable debugging in mem.c. 4521 */ 4522 #if !defined MEM_DEBUG || defined __DOXYGEN__ 4523 #define MEM_DEBUG LWIP_DBG_OFF 4524 #endif 4525 4526 /** 4527 * MEMP_DEBUG: Enable debugging in memp.c. 4528 */ 4529 #if !defined MEMP_DEBUG || defined __DOXYGEN__ 4530 #define MEMP_DEBUG LWIP_DBG_OFF 4531 #endif 4532 4533 /** 4534 * SYS_DEBUG: Enable debugging in sys.c. 4535 */ 4536 #if !defined SYS_DEBUG || defined __DOXYGEN__ 4537 #define SYS_DEBUG LWIP_DBG_OFF 4538 #endif 4539 4540 /** 4541 * TIMERS_DEBUG: Enable debugging in timers.c. 4542 */ 4543 #if !defined TIMERS_DEBUG || defined __DOXYGEN__ 4544 #define TIMERS_DEBUG LWIP_DBG_OFF 4545 #endif 4546 4547 /** 4548 * TCP_DEBUG: Enable debugging for TCP. 4549 */ 4550 #if !defined TCP_DEBUG || defined __DOXYGEN__ 4551 #define TCP_DEBUG LWIP_DBG_OFF 4552 #endif 4553 4554 /** 4555 * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug. 4556 */ 4557 #if !defined TCP_INPUT_DEBUG || defined __DOXYGEN__ 4558 #define TCP_INPUT_DEBUG LWIP_DBG_OFF 4559 #endif 4560 4561 /** 4562 * TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit. 4563 */ 4564 #if !defined TCP_FR_DEBUG || defined __DOXYGEN__ 4565 #define TCP_FR_DEBUG LWIP_DBG_OFF 4566 #endif 4567 4568 /** 4569 * TCP_RTO_DEBUG: Enable debugging in TCP for retransmit 4570 * timeout. 4571 */ 4572 #if !defined TCP_RTO_DEBUG || defined __DOXYGEN__ 4573 #define TCP_RTO_DEBUG LWIP_DBG_OFF 4574 #endif 4575 4576 /** 4577 * TCP_CWND_DEBUG: Enable debugging for TCP congestion window. 4578 */ 4579 #if !defined TCP_CWND_DEBUG || defined __DOXYGEN__ 4580 #define TCP_CWND_DEBUG LWIP_DBG_OFF 4581 #endif 4582 4583 /** 4584 * TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating. 4585 */ 4586 #if !defined TCP_WND_DEBUG || defined __DOXYGEN__ 4587 #define TCP_WND_DEBUG LWIP_DBG_OFF 4588 #endif 4589 4590 /** 4591 * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions. 4592 */ 4593 #if !defined TCP_OUTPUT_DEBUG || defined __DOXYGEN__ 4594 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF 4595 #endif 4596 4597 /** 4598 * TCP_RST_DEBUG: Enable debugging for TCP with the RST message. 4599 */ 4600 #if !defined TCP_RST_DEBUG || defined __DOXYGEN__ 4601 #define TCP_RST_DEBUG LWIP_DBG_OFF 4602 #endif 4603 4604 /** 4605 * TCP_ERR_DEBUG: Enables debugging for TCP. 4606 */ 4607 #if !defined TCP_ERR_DEBUG || defined __DOXYGEN__ 4608 #define TCP_ERR_DEBUG LWIP_DBG_OFF 4609 #endif 4610 4611 /** 4612 * Defines whether to enable debugging for TCP Tail Loss Probe(TLP) 4613 */ 4614 #if !defined TCP_TLP_DEBUG || defined __DOXYGEN__ 4615 #define TCP_TLP_DEBUG LWIP_DBG_OFF 4616 #endif 4617 4618 /** 4619 * TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths. 4620 */ 4621 #if !defined TCP_QLEN_DEBUG || defined __DOXYGEN__ 4622 #define TCP_QLEN_DEBUG LWIP_DBG_OFF 4623 #endif 4624 4625 /** 4626 * Defines whether to enable debugging for TCP Selective ACK (SACK) 4627 */ 4628 #if !defined TCP_SACK_DEBUG || defined __DOXYGEN__ 4629 #define TCP_SACK_DEBUG LWIP_DBG_OFF 4630 #endif 4631 4632 /** 4633 * Defines whether to enable debugging for TCP Tail Loss Probe(TLP) 4634 */ 4635 #if !defined TCP_TLP_DEBUG || defined __DOXYGEN__ 4636 #define TCP_TLP_DEBUG LWIP_DBG_OFF 4637 #endif 4638 4639 /** 4640 * UDP_DEBUG: Enable debugging in UDP. 4641 */ 4642 #if !defined UDP_DEBUG || defined __DOXYGEN__ 4643 #define UDP_DEBUG LWIP_DBG_OFF 4644 #endif 4645 4646 /** 4647 * TCPIP_DEBUG: Enable debugging in tcpip.c. 4648 */ 4649 #if !defined TCPIP_DEBUG || defined __DOXYGEN__ 4650 #define TCPIP_DEBUG LWIP_DBG_OFF 4651 #endif 4652 4653 /** 4654 * L3_EVENT_MSG_DEBUG: Enable debugging in l3event.c. 4655 */ 4656 #if !defined L3_EVENT_MSG_DEBUG || defined __DOXYGEN__ 4657 #define L3_EVENT_MSG_DEBUG LWIP_DBG_OFF 4658 #endif 4659 4660 /** 4661 * SLIP_DEBUG: Enable debugging in slipif.c. 4662 */ 4663 #if !defined SLIP_DEBUG || defined __DOXYGEN__ 4664 #define SLIP_DEBUG LWIP_DBG_OFF 4665 #endif 4666 4667 /** 4668 * DHCP_DEBUG: Enable debugging in dhcp.c. 4669 */ 4670 #if !defined DHCP_DEBUG || defined __DOXYGEN__ 4671 #define DHCP_DEBUG LWIP_DBG_OFF 4672 #endif 4673 4674 /** 4675 * AUTOIP_DEBUG: Enable debugging in autoip.c. 4676 */ 4677 #if !defined AUTOIP_DEBUG || defined __DOXYGEN__ 4678 #define AUTOIP_DEBUG LWIP_DBG_OFF 4679 #endif 4680 4681 /** 4682 * DNS_DEBUG: Enable debugging for DNS. 4683 */ 4684 #if !defined DNS_DEBUG || defined __DOXYGEN__ 4685 #define DNS_DEBUG LWIP_DBG_OFF 4686 #endif 4687 4688 /** 4689 * Defines whether to enable debugging for DNS. 4690 */ 4691 #ifndef TFTP_DEBUG 4692 #define TFTP_DEBUG LWIP_DBG_OFF 4693 #endif 4694 4695 /** 4696 * IP6_DEBUG: Enable debugging for IPv6. 4697 */ 4698 #if !defined IP6_DEBUG || defined __DOXYGEN__ 4699 #define IP6_DEBUG LWIP_DBG_OFF 4700 #endif 4701 4702 /** 4703 * DHCP6_DEBUG: Enable debugging in dhcp6.c. 4704 */ 4705 #if !defined DHCP6_DEBUG || defined __DOXYGEN__ 4706 #define DHCP6_DEBUG LWIP_DBG_OFF 4707 #endif 4708 /** 4709 * @} 4710 */ 4711 4712 /** 4713 * Defines whether to enable debugging for Driver Status 4714 */ 4715 #ifndef DRV_STS_DEBUG 4716 #define DRV_STS_DEBUG LWIP_DBG_OFF 4717 #endif 4718 4719 /** 4720 * LWIP_TESTMODE: Changes to make unit test possible 4721 */ 4722 #if !defined LWIP_TESTMODE 4723 #define LWIP_TESTMODE 0 4724 #endif 4725 4726 /** 4727 * NAT64_DEBUG: Enable debugging for NAT64. 4728 */ 4729 #if !defined NAT64_DEBUG || defined __DOXYGEN__ 4730 #define NAT64_DEBUG LWIP_DBG_OFF 4731 #endif 4732 4733 #if !defined IP6IN4_DEBUG || defined __DOXYGEN__ 4734 #define IP6IN4_DEBUG LWIP_DBG_OFF 4735 #endif 4736 4737 /** 4738 * MLD6_DEBUG: Enable debugging for MLD6. 4739 */ 4740 #ifndef MLD6_DEBUG 4741 #define MLD6_DEBUG LWIP_DBG_OFF 4742 #endif 4743 4744 /* 4745 -------------------------------------------------- 4746 ---------- Performance tracking options ---------- 4747 -------------------------------------------------- 4748 */ 4749 /** 4750 * @defgroup lwip_opts_perf Performance 4751 * @ingroup lwip_opts_debug 4752 * @{ 4753 */ 4754 /** 4755 * LWIP_PERF: Enable performance testing for lwIP 4756 * (if enabled, arch/perf.h is included) 4757 */ 4758 #if !defined LWIP_PERF || defined __DOXYGEN__ 4759 #define LWIP_PERF 0 4760 #endif 4761 /** 4762 * @} 4763 */ 4764 4765 /** 4766 * enable LWIP_LOWPOWER macro to use lowpower function 4767 */ 4768 #undef LWIP_LOWPOWER 4769 #if LWIP_TIMERS && !LWIP_TIMERS_CUSTOM 4770 #if defined (CONFIG_LWIP_LOWPOWER) 4771 #define LWIP_LOWPOWER 1 4772 #else 4773 #define LWIP_LOWPOWER 0 4774 #endif 4775 #else 4776 #define LWIP_LOWPOWER 0 4777 #endif 4778 4779 #if LWIP_LOWPOWER 4780 4781 #ifndef LOWPOWER_DBG 4782 #define LOWPOWER_DBG 0 4783 #endif 4784 4785 #if LOWPOWER_DBG 4786 #define LOWPOWER_DEBUG(msg) printf msg 4787 #else 4788 #define LOWPOWER_DEBUG(msg) 4789 #endif 4790 4791 #ifndef MEMP_NUM_TCPIP_MSG_LOWPOWER 4792 #define MEMP_NUM_TCPIP_MSG_LOWPOWER 10 4793 #endif 4794 4795 #if LWIP_SNTP 4796 #define LWIP_NSTP_TIMER 2 4797 #else 4798 #define LWIP_NSTP_TIMER 0 4799 #endif 4800 4801 #define LOWPOWER_TCP_TIMER 1 4802 4803 #define MEMP_NUM_SYS_TIMEOUT_LOW (MEMP_NUM_SYS_TIMEOUT + LWIP_NSTP_TIMER + LOWPOWER_TCP_TIMER) 4804 #endif /* LWIP_LOWPOWER */ 4805 4806 #ifndef LWIP_L3_EVENT_MSG 4807 #define LWIP_L3_EVENT_MSG 0 4808 #endif 4809 4810 #ifndef RPL_CONF_SWITCH_MBR_BY_AUTOLINK 4811 #define RPL_CONF_SWITCH_MBR_BY_AUTOLINK 0 4812 #endif 4813 4814 #ifndef LWIP_SMALL_SIZE 4815 #define LWIP_SMALL_SIZE 0 4816 #endif 4817 4818 #ifndef LWIP_ENABLE_NET_CAPABILITY 4819 #define LWIP_ENABLE_NET_CAPABILITY 0 4820 #endif 4821 4822 #ifndef LWIP_ENABLE_CAP_NET_BROADCAST 4823 #define LWIP_ENABLE_CAP_NET_BROADCAST 0 4824 #endif 4825 4826 #endif /* LWIP_HDR_OPT_H */ 4827