/** * @file * * lwIP Options Configuration */ /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels
* */ #ifndef __LWIPOPT_H__ #define __LWIPOPT_H__ /* ------------------------------------ ---------- Memory options ---------- ------------------------------------ */ /** * MEM_ALIGNMENT: should be set to the alignment of the CPU * 4 byte alignment -> #define MEM_ALIGNMENT 4 * 2 byte alignment -> #define MEM_ALIGNMENT 2 */ #ifndef MEM_ALIGNMENT #define MEM_ALIGNMENT 4 #endif /** * MEM_SIZE: the size of the heap memory. If the application will send * a lot of data that needs to be copied, this should be set high. */ #ifndef MEM_SIZE #define MEM_SIZE 1600 #endif /* ------------------------------------------------ ---------- Internal Memory Pool Sizes ---------- ------------------------------------------------ */ /** * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF). * If the application sends a lot of data out of ROM (or other static memory), * this should be set high. */ #ifndef MEMP_NUM_PBUF #define MEMP_NUM_PBUF 64 #endif /** * MEMP_NUM_RAW_PCB: Number of raw connection PCBs * (requires the LWIP_RAW option) */ #ifndef MEMP_NUM_RAW_PCB #define MEMP_NUM_RAW_PCB 16 #endif /** * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One * per active UDP "connection". * (requires the LWIP_UDP option) */ #ifndef MEMP_NUM_UDP_PCB #define MEMP_NUM_UDP_PCB 16 #endif /** * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. * (requires the LWIP_TCP option) */ #ifndef MEMP_NUM_TCP_PCB #define MEMP_NUM_TCP_PCB 16 #endif /** * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. * (requires the LWIP_TCP option) */ #ifndef MEMP_NUM_TCP_PCB_LISTEN #define MEMP_NUM_TCP_PCB_LISTEN 16 #endif /** * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. * (requires the LWIP_TCP option) */ #ifndef MEMP_NUM_TCP_SEG #define MEMP_NUM_TCP_SEG 64 #endif /** * MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for * reassembly (whole packets, not fragments!) */ #ifndef MEMP_NUM_REASSDATA #define MEMP_NUM_REASSDATA (IP_REASS_MAX_PBUFS/2) #endif /** * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. * (requires NO_SYS==0) /** * MEMP_NUM_NETBUF: the number of struct netbufs. * (only needed if you use the sequential API, like api_lib.c) */ #ifndef MEMP_NUM_NETBUF #define MEMP_NUM_NETBUF 16 #endif /** * MEMP_NUM_NETCONN: the number of struct netconns. * (only needed if you use the sequential API, like api_lib.c) */ #ifndef MEMP_NUM_NETCONN #define MEMP_NUM_NETCONN 16 #endif /** * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ #ifndef PBUF_POOL_SIZE #define PBUF_POOL_SIZE 16 // 1024 #endif /* ---------------------------------- ---------- DHCP options ---------- ---------------------------------- */ /** * LWIP_DHCP==1: Enable DHCP module. */ #if !defined LWIP_DHCP || defined __DOXYGEN__ #define LWIP_DHCP 1 #endif /* --------------------------------- ---------- TCP options ---------- --------------------------------- */ /** * TCP_TTL: Default Time-To-Live value. */ /** * TCP_WND: The size of a TCP window. This must be at least * (2 * TCP_MSS) for things to work well. * ATTENTION: when using TCP_RCV_SCALE, TCP_WND is the total size * with scaling applied. Maximum window value in the TCP header * will be TCP_WND >> TCP_RCV_SCALE */ #if !defined TCP_WND || defined __DOXYGEN__ #define TCP_WND (16 * TCP_MSS) #endif /** * TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default, * you might want to increase this.) * For the receive side, this MSS is advertised to the remote side * when opening a connection. For the transmit size, this MSS sets * an upper limit on the MSS advertised by the remote host. */ #if !defined TCP_MSS || defined __DOXYGEN__ #define TCP_MSS 1460 #endif /** * TCP_SND_BUF: TCP sender buffer space (bytes). * To achieve good performance, this should be at least 2 * TCP_MSS. */ #if !defined TCP_SND_BUF || defined __DOXYGEN__ #define TCP_SND_BUF (8 * TCP_MSS) #endif /* ------------------------------------------------ ---------- Network Interfaces options ---------- ------------------------------------------------ */ /** * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname * field. */ #if !defined LWIP_NETIF_HOSTNAME || defined __DOXYGEN__ #define LWIP_NETIF_HOSTNAME 0 #endif /** * LWIP_NETIF_API==1: Support netif api (in netifapi.c) */ #if !defined LWIP_NETIF_API || defined __DOXYGEN__ #define LWIP_NETIF_API 0 #endif /** * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface * changes its up/down status (i.e., due to DHCP IP acquisition) */ #if !defined LWIP_NETIF_STATUS_CALLBACK || defined __DOXYGEN__ #define LWIP_NETIF_STATUS_CALLBACK 0 #endif /** * LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface * whenever the link changes (i.e., link down) */ #if !defined LWIP_NETIF_LINK_CALLBACK || defined __DOXYGEN__ #define LWIP_NETIF_LINK_CALLBACK 0 #endif /** * LWIP_NETIF_REMOVE_CALLBACK==1: Support a callback function that is called * when a netif has been removed */ #if !defined LWIP_NETIF_REMOVE_CALLBACK || defined __DOXYGEN__ #define LWIP_NETIF_REMOVE_CALLBACK 0 #endif /** * LWIP_NETIF_HWADDRHINT==1: Cache link-layer-address hints (e.g. table * indices) in struct netif. TCP and UDP can make use of this to prevent * scanning the ARP table for every sent packet. While this is faster for big * ARP tables or many concurrent connections, it might be counterproductive * if you have a tiny ARP table or if there never are concurrent connections. */ #if !defined LWIP_NETIF_HWADDRHINT || defined __DOXYGEN__ #define LWIP_NETIF_HWADDRHINT 0 #endif /** * LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP tries to put all data * to be sent into one single pbuf. This is for compatibility with DMA-enabled * MACs that do not support scatter-gather. * Beware that this might involve CPU-memcpy before transmitting that would not * be needed without this flag! Use this only if you need to! * * @todo: TCP and IP-frag do not work with this, yet: */ #if !defined LWIP_NETIF_TX_SINGLE_PBUF || defined __DOXYGEN__ #define LWIP_NETIF_TX_SINGLE_PBUF 0 #endif /* LWIP_NETIF_TX_SINGLE_PBUF */ /** * LWIP_NUM_NETIF_CLIENT_DATA: Number of clients that may store * data in client_data member array of struct netif. */ #if !defined LWIP_NUM_NETIF_CLIENT_DATA || defined __DOXYGEN__ #define LWIP_NUM_NETIF_CLIENT_DATA 4 #endif /** * @} */ /* ------------------------------------ ---------- Thread options ---------- ------------------------------------ */ /** * TCPIP_THREAD_NAME: The name assigned to the main tcpip thread. */ #ifndef TCPIP_THREAD_NAME #define TCPIP_THREAD_NAME "tcpip_thread" #endif /** * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread. * The stack size value itself is platform-dependent, but is passed to * sys_thread_new() when the thread is created. */ #ifndef TCPIP_THREAD_STACKSIZE #define TCPIP_THREAD_STACKSIZE 1024 #endif /** * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread. * The priority value itself is platform-dependent, but is passed to * sys_thread_new() when the thread is created. */ #ifndef TCPIP_THREAD_PRIO #define TCPIP_THREAD_PRIO (LOWPRIO + 1) #endif /** * TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages * The queue size value itself is platform-dependent, but is passed to * sys_mbox_new() when tcpip_init is called. */ #if !defined TCPIP_MBOX_SIZE || defined __DOXYGEN__ #define TCPIP_MBOX_SIZE MEMP_NUM_PBUF #endif /** * SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread. * The stack size value itself is platform-dependent, but is passed to * sys_thread_new() when the thread is created. */ #if !defined SLIPIF_THREAD_STACKSIZE || defined __DOXYGEN__ #define SLIPIF_THREAD_STACKSIZE 1024 #endif /** * SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread. * The priority value itself is platform-dependent, but is passed to * sys_thread_new() when the thread is created. */ #if !defined SLIPIF_THREAD_PRIO || defined __DOXYGEN__ #define SLIPIF_THREAD_PRIO (LOWPRIO + 1) #endif /** * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread. * The stack size value itself is platform-dependent, but is passed to * sys_thread_new() when the thread is created. */ #if !defined DEFAULT_THREAD_STACKSIZE || defined __DOXYGEN__ #define DEFAULT_THREAD_STACKSIZE 1024 #endif /** * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread. * The priority value itself is platform-dependent, but is passed to * sys_thread_new() when the thread is created. */ #if !defined DEFAULT_THREAD_PRIO || defined __DOXYGEN__ #define DEFAULT_THREAD_PRIO (LOWPRIO + 1) #endif /** * DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a * NETCONN_RAW. The queue size value itself is platform-dependent, but is passed * to sys_mbox_new() when the recvmbox is created. */ #if !defined DEFAULT_RAW_RECVMBOX_SIZE || defined __DOXYGEN__ #define DEFAULT_RAW_RECVMBOX_SIZE 4 #endif /** * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a * NETCONN_UDP. The queue size value itself is platform-dependent, but is passed * to sys_mbox_new() when the recvmbox is created. */ #if !defined DEFAULT_UDP_RECVMBOX_SIZE || defined __DOXYGEN__ #define DEFAULT_UDP_RECVMBOX_SIZE 4 #endif /** * DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a * NETCONN_TCP. The queue size value itself is platform-dependent, but is passed * to sys_mbox_new() when the recvmbox is created. */ #if !defined DEFAULT_TCP_RECVMBOX_SIZE || defined __DOXYGEN__ #define DEFAULT_TCP_RECVMBOX_SIZE 40 #endif /** * DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections. * The queue size value itself is platform-dependent, but is passed to * sys_mbox_new() when the acceptmbox is created. */ #if !defined DEFAULT_ACCEPTMBOX_SIZE || defined __DOXYGEN__ #define DEFAULT_ACCEPTMBOX_SIZE 4 #endif /* ---------------------------------------------- ---------- Sequential layer options ---------- ---------------------------------------------- */ /** * LWIP_TCPIP_CORE_LOCKING: (EXPERIMENTAL!) * Don't use it if you're not an active lwIP project member */ #ifndef LWIP_TCPIP_CORE_LOCKING #define LWIP_TCPIP_CORE_LOCKING 0 #endif /** * LWIP_TCPIP_CORE_LOCKING_INPUT: (EXPERIMENTAL!) * Don't use it if you're not an active lwIP project member */ #ifndef LWIP_TCPIP_CORE_LOCKING_INPUT #define LWIP_TCPIP_CORE_LOCKING_INPUT 0 #endif /** LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout to create * timers running in tcpip_thread from another thread. */ #if !defined LWIP_TCPIP_TIMEOUT || defined __DOXYGEN__ #define LWIP_TCPIP_TIMEOUT 1 #endif #endif /* __LWIPOPT_H__ */