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