Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
lwipopts.h
00001 /* Copyright (C) 2012 mbed.org, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00005 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00006 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00007 * furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #ifndef LWIPOPTS_H 00020 #define LWIPOPTS_H 00021 00022 #if MBED_CONF_LWIP_ETHERNET_ENABLED 00023 #include "lwipopts_conf.h" 00024 #endif 00025 00026 // Workaround for Linux timeval 00027 #if defined (TOOLCHAIN_GCC) 00028 #define LWIP_TIMEVAL_PRIVATE 0 00029 #include <sys/time.h> 00030 #endif 00031 00032 // Operating System 00033 #define NO_SYS 0 00034 00035 #if MBED_CONF_LWIP_IPV4_ENABLED 00036 #define LWIP_IPV4 1 00037 #else 00038 #define LWIP_IPV4 0 00039 #endif 00040 #if MBED_CONF_LWIP_IPV6_ENABLED 00041 #define LWIP_IPV6 1 00042 #else 00043 #define LWIP_IPV6 0 00044 #endif 00045 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED 00046 #error "Either IPv4 or IPv6 must be enabled." 00047 #endif 00048 00049 // On dual stack configuration how long to wait for both or preferred stack 00050 // addresses before completing bring up. 00051 #if LWIP_IPV4 && LWIP_IPV6 00052 #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE 00053 #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT 00054 #define PREF_ADDR_TIMEOUT 0 00055 #else 00056 #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT 00057 #define BOTH_ADDR_TIMEOUT 0 00058 #endif 00059 #else 00060 #define PREF_ADDR_TIMEOUT 0 00061 #define BOTH_ADDR_TIMEOUT 0 00062 #endif 00063 00064 #define DHCP_TIMEOUT 60 00065 00066 #define PREF_IPV4 1 00067 #define PREF_IPV6 2 00068 00069 #if MBED_CONF_LWIP_IP_VER_PREF == 4 00070 #define IP_VERSION_PREF PREF_IPV4 00071 #endif 00072 #if MBED_CONF_LWIP_IP_VER_PREF == 6 00073 #define IP_VERSION_PREF PREF_IPV6 00074 #endif 00075 #ifndef IP_VERSION_PREF 00076 #error "Either IPv4 or IPv6 must be preferred." 00077 #endif 00078 00079 #undef LWIP_DEBUG 00080 #if MBED_CONF_LWIP_DEBUG_ENABLED 00081 #define LWIP_DEBUG 1 00082 #endif 00083 00084 #if NO_SYS == 0 00085 #include "cmsis_os2.h" 00086 00087 #define SYS_LIGHTWEIGHT_PROT 1 00088 00089 #define LWIP_RAW 0 00090 00091 #define TCPIP_MBOX_SIZE 8 00092 #define DEFAULT_TCP_RECVMBOX_SIZE 8 00093 #define DEFAULT_UDP_RECVMBOX_SIZE 8 00094 #define DEFAULT_RAW_RECVMBOX_SIZE 8 00095 #define DEFAULT_ACCEPTMBOX_SIZE 8 00096 00097 // Thread stack size for lwip tcpip thread 00098 #ifndef MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE 00099 #define MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE 1200 00100 #endif 00101 00102 #ifdef LWIP_DEBUG 00103 #define TCPIP_THREAD_STACKSIZE MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2 00104 #else 00105 #define TCPIP_THREAD_STACKSIZE MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE 00106 #endif 00107 00108 #define TCPIP_THREAD_PRIO (osPriorityNormal) 00109 00110 // Thread stack size for lwip system threads 00111 #ifndef MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE 00112 #define MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE 512 00113 #endif 00114 00115 // Thread stack size for private PPP thread 00116 #ifndef MBED_CONF_LWIP_PPP_THREAD_STACKSIZE 00117 #define MBED_CONF_LWIP_PPP_THREAD_STACKSIZE 768 00118 #endif 00119 00120 #ifdef LWIP_DEBUG 00121 #define DEFAULT_THREAD_STACKSIZE MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2 00122 #define PPP_THREAD_STACK_SIZE MBED_CONF_LWIP_PPP_THREAD_STACKSIZE*2 00123 #else 00124 #define DEFAULT_THREAD_STACKSIZE MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE 00125 #define PPP_THREAD_STACK_SIZE MBED_CONF_LWIP_PPP_THREAD_STACKSIZE 00126 #endif 00127 00128 #define MEMP_NUM_SYS_TIMEOUT 16 00129 00130 #define sys_msleep(ms) sys_msleep(ms) 00131 00132 #endif 00133 00134 // 32-bit alignment 00135 #define MEM_ALIGNMENT 4 00136 00137 #define LWIP_RAM_HEAP_POINTER lwip_ram_heap 00138 00139 // Number of pool pbufs. 00140 // Each requires 684 bytes of RAM (if MSS=536 and PBUF_POOL_BUFSIZE defaulting to be based on MSS) 00141 #ifdef MBED_CONF_LWIP_PBUF_POOL_SIZE 00142 #undef PBUF_POOL_SIZE 00143 #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE 00144 #else 00145 #ifndef PBUF_POOL_SIZE 00146 #define PBUF_POOL_SIZE 5 00147 #endif 00148 #endif 00149 00150 #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE 00151 #undef PBUF_POOL_BUFSIZE 00152 #define PBUF_POOL_BUFSIZE MBED_CONF_LWIP_PBUF_POOL_BUFSIZE 00153 #else 00154 #ifndef PBUF_POOL_BUFSIZE 00155 #if LWIP_IPV6 00156 #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) 00157 #elif LWIP_IPV4 00158 #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) 00159 #endif 00160 #endif 00161 #endif 00162 00163 #ifdef MBED_CONF_LWIP_MEM_SIZE 00164 #undef MEM_SIZE 00165 #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE 00166 #endif 00167 00168 // One tcp_pcb_listen is needed for each TCPServer. 00169 // Each requires 72 bytes of RAM. 00170 #ifdef MBED_CONF_LWIP_TCP_SERVER_MAX 00171 #define MEMP_NUM_TCP_PCB_LISTEN MBED_CONF_LWIP_TCP_SERVER_MAX 00172 #else 00173 #define MEMP_NUM_TCP_PCB_LISTEN 4 00174 #endif 00175 00176 // One is tcp_pcb needed for each TCPSocket. 00177 // Each requires 196 bytes of RAM. 00178 #ifdef MBED_CONF_LWIP_TCP_SOCKET_MAX 00179 #define MEMP_NUM_TCP_PCB MBED_CONF_LWIP_TCP_SOCKET_MAX 00180 #else 00181 #define MEMP_NUM_TCP_PCB 4 00182 #endif 00183 00184 // One udp_pcb is needed for each UDPSocket. 00185 // Each requires 84 bytes of RAM (total rounded to multiple of 512). 00186 #ifdef MBED_CONF_LWIP_UDP_SOCKET_MAX 00187 #define MEMP_NUM_UDP_PCB MBED_CONF_LWIP_UDP_SOCKET_MAX 00188 #else 00189 #define MEMP_NUM_UDP_PCB 4 00190 #endif 00191 00192 // Number of non-pool pbufs. 00193 // Each requires 92 bytes of RAM. 00194 #ifndef MEMP_NUM_PBUF 00195 #define MEMP_NUM_PBUF 8 00196 #endif 00197 00198 // Each netbuf requires 64 bytes of RAM. 00199 #ifndef MEMP_NUM_NETBUF 00200 #define MEMP_NUM_NETBUF 8 00201 #endif 00202 00203 // One netconn is needed for each UDPSocket, TCPSocket or TCPServer. 00204 // Each requires 236 bytes of RAM (total rounded to multiple of 512). 00205 #ifdef MBED_CONF_LWIP_SOCKET_MAX 00206 #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX 00207 #else 00208 #define MEMP_NUM_NETCONN 4 00209 #endif 00210 00211 #if MBED_CONF_LWIP_TCP_ENABLED 00212 #define LWIP_TCP 1 00213 #define TCP_OVERSIZE 0 00214 #define LWIP_TCP_KEEPALIVE 1 00215 #else 00216 #define LWIP_TCP 0 00217 #endif 00218 00219 #define LWIP_DNS 1 00220 #define LWIP_SOCKET 0 00221 00222 #define SO_REUSE 1 00223 00224 // Support Multicast 00225 #include "stdlib.h" 00226 #define LWIP_IGMP LWIP_IPV4 00227 #define LWIP_RAND() lwip_get_random() 00228 00229 #define LWIP_COMPAT_SOCKETS 0 00230 #define LWIP_POSIX_SOCKETS_IO_NAMES 0 00231 #define LWIP_SO_RCVTIMEO 1 00232 00233 #define LWIP_BROADCAST_PING 1 00234 00235 // Fragmentation on, as per IPv4 default 00236 #define LWIP_IPV6_FRAG LWIP_IPV6 00237 00238 // Queuing "disabled", as per IPv4 default (so actually queues 1) 00239 #define LWIP_ND6_QUEUEING 0 00240 00241 // Debug Options 00242 #define NETIF_DEBUG LWIP_DBG_OFF 00243 #define PBUF_DEBUG LWIP_DBG_OFF 00244 #define API_LIB_DEBUG LWIP_DBG_OFF 00245 #define API_MSG_DEBUG LWIP_DBG_OFF 00246 #define SOCKETS_DEBUG LWIP_DBG_OFF 00247 #define ICMP_DEBUG LWIP_DBG_OFF 00248 #define IGMP_DEBUG LWIP_DBG_OFF 00249 #define INET_DEBUG LWIP_DBG_OFF 00250 #define IP_DEBUG LWIP_DBG_OFF 00251 #define IP_REASS_DEBUG LWIP_DBG_OFF 00252 #define RAW_DEBUG LWIP_DBG_OFF 00253 #define MEM_DEBUG LWIP_DBG_OFF 00254 #define MEMP_DEBUG LWIP_DBG_OFF 00255 #define SYS_DEBUG LWIP_DBG_OFF 00256 #define TIMERS_DEBUG LWIP_DBG_OFF 00257 #define TCP_DEBUG LWIP_DBG_OFF 00258 #define TCP_INPUT_DEBUG LWIP_DBG_OFF 00259 #define TCP_FR_DEBUG LWIP_DBG_OFF 00260 #define TCP_RTO_DEBUG LWIP_DBG_OFF 00261 #define TCP_CWND_DEBUG LWIP_DBG_OFF 00262 #define TCP_WND_DEBUG LWIP_DBG_OFF 00263 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF 00264 #define TCP_RST_DEBUG LWIP_DBG_OFF 00265 #define TCP_QLEN_DEBUG LWIP_DBG_OFF 00266 #define UDP_DEBUG LWIP_DBG_OFF 00267 #define TCPIP_DEBUG LWIP_DBG_OFF 00268 #define SLIP_DEBUG LWIP_DBG_OFF 00269 #define DHCP_DEBUG LWIP_DBG_OFF 00270 #define AUTOIP_DEBUG LWIP_DBG_OFF 00271 #define DNS_DEBUG LWIP_DBG_OFF 00272 #define IP6_DEBUG LWIP_DBG_OFF 00273 00274 #if MBED_CONF_LWIP_ENABLE_PPP_TRACE 00275 #define PPP_DEBUG LWIP_DBG_ON 00276 #else 00277 #define PPP_DEBUG LWIP_DBG_OFF 00278 #endif //MBED_CONF_LWIP_ENABLE_PPP_TRACE 00279 #define ETHARP_DEBUG LWIP_DBG_OFF 00280 #define UDP_LPC_EMAC LWIP_DBG_OFF 00281 00282 #ifdef LWIP_DEBUG 00283 #define MEMP_OVERFLOW_CHECK 1 00284 #define MEMP_SANITY_CHECK 1 00285 #define LWIP_DBG_TYPES_ON LWIP_DBG_ON 00286 #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL 00287 #else 00288 #define LWIP_NOASSERT 1 00289 #define LWIP_STATS 0 00290 #endif 00291 00292 #define TRACE_TO_ASCII_HEX_DUMP 0 00293 00294 #define LWIP_PLATFORM_BYTESWAP 1 00295 00296 #define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1 00297 00298 // Interface type configuration 00299 00300 #if MBED_CONF_LWIP_ETHERNET_ENABLED 00301 #define LWIP_ARP 1 00302 #define LWIP_ETHERNET 1 00303 #define LWIP_DHCP LWIP_IPV4 00304 #else 00305 #define LWIP_ARP 0 00306 #define LWIP_ETHERNET 0 00307 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED 00308 00309 // Note generic macro name used rather than MBED_CONF_LWIP_PPP_ENABLED 00310 // to allow users like PPPCellularInterface to detect that nsapi_ppp.h is available. 00311 #if NSAPI_PPP_AVAILABLE 00312 #define PPP_SUPPORT 1 00313 #if MBED_CONF_LWIP_IPV6_ENABLED 00314 #define PPP_IPV6_SUPPORT 1 00315 // Disable DAD for PPP 00316 #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 00317 #endif 00318 #define CHAP_SUPPORT 1 00319 #define PPP_INPROC_IRQ_SAFE 1 00320 // Save RAM 00321 #define PAP_SUPPORT 0 00322 #define VJ_SUPPORT 0 00323 #define PRINTPKT_SUPPORT 0 00324 00325 // Broadcast 00326 #define IP_SOF_BROADCAST 0 00327 #define IP_SOF_BROADCAST_RECV 0 00328 00329 #define MAXNAMELEN 64 /* max length of hostname or name for auth */ 00330 #define MAXSECRETLEN 64 00331 #endif // NSAPI_PPP_AVAILABLE 00332 00333 // Make sure we default these to off, so 00334 // LWIP doesn't default to on 00335 #ifndef LWIP_ARP 00336 #define LWIP_ARP 0 00337 #endif 00338 // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 00339 #define LWIP_CHECKSUM_ON_COPY 0 00340 00341 #define LWIP_NETIF_HOSTNAME 1 00342 #define LWIP_NETIF_STATUS_CALLBACK 1 00343 #define LWIP_NETIF_LINK_CALLBACK 1 00344 00345 #define DNS_TABLE_SIZE 2 00346 #define DNS_MAX_NAME_LENGTH 128 00347 00348 #include "lwip_random.h" 00349 #include "lwip_tcp_isn.h" 00350 #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn 00351 #ifdef MBEDTLS_MD5_C 00352 #include "mbedtls/inc/mbedtls/md5.h" 00353 #define LWIP_USE_EXTERNAL_MBEDTLS 1 00354 #endif 00355 00356 #endif /* LWIPOPTS_H_ */
Generated on Tue Jul 12 2022 12:32:38 by
