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