Official mbed lwIP library (version 1.4.0)

Dependents:   LwIPNetworking NetServicesMin EthernetInterface EthernetInterface_RSF ... more

Legacy Networking Libraries

This is an mbed 2 networking library. For mbed OS 5, lwip has been integrated with built-in networking interfaces. The networking libraries have been revised to better support additional network stacks and thread safety here.

This library is based on the code of lwIP v1.4.0

Copyright (c) 2001, 2002 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.
Committer:
mbed_official
Date:
Mon Mar 14 16:15:36 2016 +0000
Revision:
20:08f08bfc3f3d
Parent:
0:51ac1d130fd4
Synchronized with git revision fec574a5ed6db26aca1b13992ff271bf527d4a0d

Full URL: https://github.com/mbedmicro/mbed/commit/fec574a5ed6db26aca1b13992ff271bf527d4a0d/

Increased allocated netbufs to handle DTLS handshakes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:51ac1d130fd4 1 /**
mbed_official 0:51ac1d130fd4 2 * @file
mbed_official 0:51ac1d130fd4 3 * Modules initialization
mbed_official 0:51ac1d130fd4 4 *
mbed_official 0:51ac1d130fd4 5 */
mbed_official 0:51ac1d130fd4 6
mbed_official 0:51ac1d130fd4 7 /*
mbed_official 0:51ac1d130fd4 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
mbed_official 0:51ac1d130fd4 9 * All rights reserved.
mbed_official 0:51ac1d130fd4 10 *
mbed_official 0:51ac1d130fd4 11 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 0:51ac1d130fd4 12 * are permitted provided that the following conditions are met:
mbed_official 0:51ac1d130fd4 13 *
mbed_official 0:51ac1d130fd4 14 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 0:51ac1d130fd4 15 * this list of conditions and the following disclaimer.
mbed_official 0:51ac1d130fd4 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 0:51ac1d130fd4 17 * this list of conditions and the following disclaimer in the documentation
mbed_official 0:51ac1d130fd4 18 * and/or other materials provided with the distribution.
mbed_official 0:51ac1d130fd4 19 * 3. The name of the author may not be used to endorse or promote products
mbed_official 0:51ac1d130fd4 20 * derived from this software without specific prior written permission.
mbed_official 0:51ac1d130fd4 21 *
mbed_official 0:51ac1d130fd4 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mbed_official 0:51ac1d130fd4 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbed_official 0:51ac1d130fd4 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mbed_official 0:51ac1d130fd4 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mbed_official 0:51ac1d130fd4 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mbed_official 0:51ac1d130fd4 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbed_official 0:51ac1d130fd4 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbed_official 0:51ac1d130fd4 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mbed_official 0:51ac1d130fd4 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mbed_official 0:51ac1d130fd4 31 * OF SUCH DAMAGE.
mbed_official 0:51ac1d130fd4 32 *
mbed_official 0:51ac1d130fd4 33 * This file is part of the lwIP TCP/IP stack.
mbed_official 0:51ac1d130fd4 34 *
mbed_official 0:51ac1d130fd4 35 * Author: Adam Dunkels <adam@sics.se>
mbed_official 0:51ac1d130fd4 36 *
mbed_official 0:51ac1d130fd4 37 */
mbed_official 0:51ac1d130fd4 38
mbed_official 0:51ac1d130fd4 39 #include "lwip/opt.h"
mbed_official 0:51ac1d130fd4 40
mbed_official 0:51ac1d130fd4 41 #include "lwip/init.h"
mbed_official 0:51ac1d130fd4 42 #include "lwip/stats.h"
mbed_official 0:51ac1d130fd4 43 #include "lwip/sys.h"
mbed_official 0:51ac1d130fd4 44 #include "lwip/mem.h"
mbed_official 0:51ac1d130fd4 45 #include "lwip/memp.h"
mbed_official 0:51ac1d130fd4 46 #include "lwip/pbuf.h"
mbed_official 0:51ac1d130fd4 47 #include "lwip/netif.h"
mbed_official 0:51ac1d130fd4 48 #include "lwip/sockets.h"
mbed_official 0:51ac1d130fd4 49 #include "lwip/ip.h"
mbed_official 0:51ac1d130fd4 50 #include "lwip/raw.h"
mbed_official 0:51ac1d130fd4 51 #include "lwip/udp.h"
mbed_official 0:51ac1d130fd4 52 #include "lwip/tcp_impl.h"
mbed_official 0:51ac1d130fd4 53 #include "lwip/snmp_msg.h"
mbed_official 0:51ac1d130fd4 54 #include "lwip/autoip.h"
mbed_official 0:51ac1d130fd4 55 #include "lwip/igmp.h"
mbed_official 0:51ac1d130fd4 56 #include "lwip/dns.h"
mbed_official 0:51ac1d130fd4 57 #include "lwip/timers.h"
mbed_official 0:51ac1d130fd4 58 #include "netif/etharp.h"
mbed_official 0:51ac1d130fd4 59
mbed_official 0:51ac1d130fd4 60 /* Compile-time sanity checks for configuration errors.
mbed_official 0:51ac1d130fd4 61 * These can be done independently of LWIP_DEBUG, without penalty.
mbed_official 0:51ac1d130fd4 62 */
mbed_official 0:51ac1d130fd4 63 #ifndef BYTE_ORDER
mbed_official 0:51ac1d130fd4 64 #error "BYTE_ORDER is not defined, you have to define it in your cc.h"
mbed_official 0:51ac1d130fd4 65 #endif
mbed_official 0:51ac1d130fd4 66 #if (!IP_SOF_BROADCAST && IP_SOF_BROADCAST_RECV)
mbed_official 0:51ac1d130fd4 67 #error "If you want to use broadcast filter per pcb on recv operations, you have to define IP_SOF_BROADCAST=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 68 #endif
mbed_official 0:51ac1d130fd4 69 #if (!LWIP_ARP && ARP_QUEUEING)
mbed_official 0:51ac1d130fd4 70 #error "If you want to use ARP Queueing, you have to define LWIP_ARP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 71 #endif
mbed_official 0:51ac1d130fd4 72 #if (!LWIP_UDP && LWIP_UDPLITE)
mbed_official 0:51ac1d130fd4 73 #error "If you want to use UDP Lite, you have to define LWIP_UDP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 74 #endif
mbed_official 0:51ac1d130fd4 75 #if (!LWIP_UDP && LWIP_SNMP)
mbed_official 0:51ac1d130fd4 76 #error "If you want to use SNMP, you have to define LWIP_UDP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 77 #endif
mbed_official 0:51ac1d130fd4 78 #if (!LWIP_UDP && LWIP_DHCP)
mbed_official 0:51ac1d130fd4 79 #error "If you want to use DHCP, you have to define LWIP_UDP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 80 #endif
mbed_official 0:51ac1d130fd4 81 #if (!LWIP_UDP && LWIP_IGMP)
mbed_official 0:51ac1d130fd4 82 #error "If you want to use IGMP, you have to define LWIP_UDP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 83 #endif
mbed_official 0:51ac1d130fd4 84 #if (!LWIP_UDP && LWIP_SNMP)
mbed_official 0:51ac1d130fd4 85 #error "If you want to use SNMP, you have to define LWIP_UDP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 86 #endif
mbed_official 0:51ac1d130fd4 87 #if (!LWIP_UDP && LWIP_DNS)
mbed_official 0:51ac1d130fd4 88 #error "If you want to use DNS, you have to define LWIP_UDP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 89 #endif
mbed_official 0:51ac1d130fd4 90 #if (LWIP_ARP && ARP_QUEUEING && (MEMP_NUM_ARP_QUEUE<=0))
mbed_official 0:51ac1d130fd4 91 #error "If you want to use ARP Queueing, you have to define MEMP_NUM_ARP_QUEUE>=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 92 #endif
mbed_official 0:51ac1d130fd4 93 #if (LWIP_RAW && (MEMP_NUM_RAW_PCB<=0))
mbed_official 0:51ac1d130fd4 94 #error "If you want to use RAW, you have to define MEMP_NUM_RAW_PCB>=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 95 #endif
mbed_official 0:51ac1d130fd4 96 #if (LWIP_UDP && (MEMP_NUM_UDP_PCB<=0))
mbed_official 0:51ac1d130fd4 97 #error "If you want to use UDP, you have to define MEMP_NUM_UDP_PCB>=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 98 #endif
mbed_official 0:51ac1d130fd4 99 #if (LWIP_TCP && (MEMP_NUM_TCP_PCB<=0))
mbed_official 0:51ac1d130fd4 100 #error "If you want to use TCP, you have to define MEMP_NUM_TCP_PCB>=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 101 #endif
mbed_official 0:51ac1d130fd4 102 #if (LWIP_TCP && (TCP_WND > 0xffff))
mbed_official 0:51ac1d130fd4 103 #error "If you want to use TCP, TCP_WND must fit in an u16_t, so, you have to reduce it in your lwipopts.h"
mbed_official 0:51ac1d130fd4 104 #endif
mbed_official 0:51ac1d130fd4 105 #if (LWIP_TCP && (TCP_SND_QUEUELEN > 0xffff))
mbed_official 0:51ac1d130fd4 106 #error "If you want to use TCP, TCP_SND_QUEUELEN must fit in an u16_t, so, you have to reduce it in your lwipopts.h"
mbed_official 0:51ac1d130fd4 107 #endif
mbed_official 0:51ac1d130fd4 108 #if (LWIP_TCP && (TCP_SND_QUEUELEN < 2))
mbed_official 0:51ac1d130fd4 109 #error "TCP_SND_QUEUELEN must be at least 2 for no-copy TCP writes to work"
mbed_official 0:51ac1d130fd4 110 #endif
mbed_official 0:51ac1d130fd4 111 #if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12)))
mbed_official 0:51ac1d130fd4 112 #error "If you want to use TCP, TCP_MAXRTX and TCP_SYNMAXRTX must less or equal to 12 (due to tcp_backoff table), so, you have to reduce them in your lwipopts.h"
mbed_official 0:51ac1d130fd4 113 #endif
mbed_official 0:51ac1d130fd4 114 #if (LWIP_TCP && TCP_LISTEN_BACKLOG && (TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xff))
mbed_official 0:51ac1d130fd4 115 #error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u8_t"
mbed_official 0:51ac1d130fd4 116 #endif
mbed_official 0:51ac1d130fd4 117 #if (LWIP_IGMP && (MEMP_NUM_IGMP_GROUP<=1))
mbed_official 0:51ac1d130fd4 118 #error "If you want to use IGMP, you have to define MEMP_NUM_IGMP_GROUP>1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 119 #endif
mbed_official 0:51ac1d130fd4 120 #if (LWIP_NETIF_API && (NO_SYS==1))
mbed_official 0:51ac1d130fd4 121 #error "If you want to use NETIF API, you have to define NO_SYS=0 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 122 #endif
mbed_official 0:51ac1d130fd4 123 #if ((LWIP_SOCKET || LWIP_NETCONN) && (NO_SYS==1))
mbed_official 0:51ac1d130fd4 124 #error "If you want to use Sequential API, you have to define NO_SYS=0 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 125 #endif
mbed_official 0:51ac1d130fd4 126 #if ((LWIP_NETCONN || LWIP_SOCKET) && (MEMP_NUM_TCPIP_MSG_API<=0))
mbed_official 0:51ac1d130fd4 127 #error "If you want to use Sequential API, you have to define MEMP_NUM_TCPIP_MSG_API>=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 128 #endif
mbed_official 0:51ac1d130fd4 129 #if (!LWIP_NETCONN && LWIP_SOCKET)
mbed_official 0:51ac1d130fd4 130 #error "If you want to use Socket API, you have to define LWIP_NETCONN=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 131 #endif
mbed_official 0:51ac1d130fd4 132 #if (((!LWIP_DHCP) || (!LWIP_AUTOIP)) && LWIP_DHCP_AUTOIP_COOP)
mbed_official 0:51ac1d130fd4 133 #error "If you want to use DHCP/AUTOIP cooperation mode, you have to define LWIP_DHCP=1 and LWIP_AUTOIP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 134 #endif
mbed_official 0:51ac1d130fd4 135 #if (((!LWIP_DHCP) || (!LWIP_ARP)) && DHCP_DOES_ARP_CHECK)
mbed_official 0:51ac1d130fd4 136 #error "If you want to use DHCP ARP checking, you have to define LWIP_DHCP=1 and LWIP_ARP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 137 #endif
mbed_official 0:51ac1d130fd4 138 #if (!LWIP_ARP && LWIP_AUTOIP)
mbed_official 0:51ac1d130fd4 139 #error "If you want to use AUTOIP, you have to define LWIP_ARP=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 140 #endif
mbed_official 0:51ac1d130fd4 141 #if (LWIP_SNMP && (SNMP_CONCURRENT_REQUESTS<=0))
mbed_official 0:51ac1d130fd4 142 #error "If you want to use SNMP, you have to define SNMP_CONCURRENT_REQUESTS>=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 143 #endif
mbed_official 0:51ac1d130fd4 144 #if (LWIP_SNMP && (SNMP_TRAP_DESTINATIONS<=0))
mbed_official 0:51ac1d130fd4 145 #error "If you want to use SNMP, you have to define SNMP_TRAP_DESTINATIONS>=1 in your lwipopts.h"
mbed_official 0:51ac1d130fd4 146 #endif
mbed_official 0:51ac1d130fd4 147 #if (LWIP_TCP && ((LWIP_EVENT_API && LWIP_CALLBACK_API) || (!LWIP_EVENT_API && !LWIP_CALLBACK_API)))
mbed_official 0:51ac1d130fd4 148 #error "One and exactly one of LWIP_EVENT_API and LWIP_CALLBACK_API has to be enabled in your lwipopts.h"
mbed_official 0:51ac1d130fd4 149 #endif
mbed_official 0:51ac1d130fd4 150 /* There must be sufficient timeouts, taking into account requirements of the subsystems. */
mbed_official 0:51ac1d130fd4 151 #if LWIP_TIMERS && (MEMP_NUM_SYS_TIMEOUT < (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT))
mbed_official 0:51ac1d130fd4 152 #error "MEMP_NUM_SYS_TIMEOUT is too low to accomodate all required timeouts"
mbed_official 0:51ac1d130fd4 153 #endif
mbed_official 0:51ac1d130fd4 154 #if (IP_REASSEMBLY && (MEMP_NUM_REASSDATA > IP_REASS_MAX_PBUFS))
mbed_official 0:51ac1d130fd4 155 #error "MEMP_NUM_REASSDATA > IP_REASS_MAX_PBUFS doesn't make sense since each struct ip_reassdata must hold 2 pbufs at least!"
mbed_official 0:51ac1d130fd4 156 #endif
mbed_official 0:51ac1d130fd4 157 #if (MEM_LIBC_MALLOC && MEM_USE_POOLS)
mbed_official 0:51ac1d130fd4 158 #error "MEM_LIBC_MALLOC and MEM_USE_POOLS may not both be simultaneously enabled in your lwipopts.h"
mbed_official 0:51ac1d130fd4 159 #endif
mbed_official 0:51ac1d130fd4 160 #if (MEM_USE_POOLS && !MEMP_USE_CUSTOM_POOLS)
mbed_official 0:51ac1d130fd4 161 #error "MEM_USE_POOLS requires custom pools (MEMP_USE_CUSTOM_POOLS) to be enabled in your lwipopts.h"
mbed_official 0:51ac1d130fd4 162 #endif
mbed_official 0:51ac1d130fd4 163 #if (PBUF_POOL_BUFSIZE <= MEM_ALIGNMENT)
mbed_official 0:51ac1d130fd4 164 #error "PBUF_POOL_BUFSIZE must be greater than MEM_ALIGNMENT or the offset may take the full first pbuf"
mbed_official 0:51ac1d130fd4 165 #endif
mbed_official 0:51ac1d130fd4 166 #if (TCP_QUEUE_OOSEQ && !LWIP_TCP)
mbed_official 0:51ac1d130fd4 167 #error "TCP_QUEUE_OOSEQ requires LWIP_TCP"
mbed_official 0:51ac1d130fd4 168 #endif
mbed_official 0:51ac1d130fd4 169 #if (DNS_LOCAL_HOSTLIST && !DNS_LOCAL_HOSTLIST_IS_DYNAMIC && !(defined(DNS_LOCAL_HOSTLIST_INIT)))
mbed_official 0:51ac1d130fd4 170 #error "you have to define define DNS_LOCAL_HOSTLIST_INIT {{'host1', 0x123}, {'host2', 0x234}} to initialize DNS_LOCAL_HOSTLIST"
mbed_official 0:51ac1d130fd4 171 #endif
mbed_official 0:51ac1d130fd4 172 #if PPP_SUPPORT && !PPPOS_SUPPORT & !PPPOE_SUPPORT
mbed_official 0:51ac1d130fd4 173 #error "PPP_SUPPORT needs either PPPOS_SUPPORT or PPPOE_SUPPORT turned on"
mbed_official 0:51ac1d130fd4 174 #endif
mbed_official 0:51ac1d130fd4 175 #if !LWIP_ETHERNET && (LWIP_ARP || PPPOE_SUPPORT)
mbed_official 0:51ac1d130fd4 176 #error "LWIP_ETHERNET needs to be turned on for LWIP_ARP or PPPOE_SUPPORT"
mbed_official 0:51ac1d130fd4 177 #endif
mbed_official 0:51ac1d130fd4 178 #if LWIP_IGMP && !defined(LWIP_RAND)
mbed_official 0:51ac1d130fd4 179 #error "When using IGMP, LWIP_RAND() needs to be defined to a random-function returning an u32_t random value"
mbed_official 0:51ac1d130fd4 180 #endif
mbed_official 0:51ac1d130fd4 181 #if LWIP_TCPIP_CORE_LOCKING_INPUT && !LWIP_TCPIP_CORE_LOCKING
mbed_official 0:51ac1d130fd4 182 #error "When using LWIP_TCPIP_CORE_LOCKING_INPUT, LWIP_TCPIP_CORE_LOCKING must be enabled, too"
mbed_official 0:51ac1d130fd4 183 #endif
mbed_official 0:51ac1d130fd4 184 #if LWIP_TCP && LWIP_NETIF_TX_SINGLE_PBUF && !TCP_OVERSIZE
mbed_official 0:51ac1d130fd4 185 #error "LWIP_NETIF_TX_SINGLE_PBUF needs TCP_OVERSIZE enabled to create single-pbuf TCP packets"
mbed_official 0:51ac1d130fd4 186 #endif
mbed_official 0:51ac1d130fd4 187 #if IP_FRAG && IP_FRAG_USES_STATIC_BUF && LWIP_NETIF_TX_SINGLE_PBUF
mbed_official 0:51ac1d130fd4 188 #error "LWIP_NETIF_TX_SINGLE_PBUF does not work with IP_FRAG_USES_STATIC_BUF==1 as that creates pbuf queues"
mbed_official 0:51ac1d130fd4 189 #endif
mbed_official 0:51ac1d130fd4 190
mbed_official 0:51ac1d130fd4 191
mbed_official 0:51ac1d130fd4 192 /* Compile-time checks for deprecated options.
mbed_official 0:51ac1d130fd4 193 */
mbed_official 0:51ac1d130fd4 194 #ifdef MEMP_NUM_TCPIP_MSG
mbed_official 0:51ac1d130fd4 195 #error "MEMP_NUM_TCPIP_MSG option is deprecated. Remove it from your lwipopts.h."
mbed_official 0:51ac1d130fd4 196 #endif
mbed_official 0:51ac1d130fd4 197 #ifdef MEMP_NUM_API_MSG
mbed_official 0:51ac1d130fd4 198 #error "MEMP_NUM_API_MSG option is deprecated. Remove it from your lwipopts.h."
mbed_official 0:51ac1d130fd4 199 #endif
mbed_official 0:51ac1d130fd4 200 #ifdef TCP_REXMIT_DEBUG
mbed_official 0:51ac1d130fd4 201 #error "TCP_REXMIT_DEBUG option is deprecated. Remove it from your lwipopts.h."
mbed_official 0:51ac1d130fd4 202 #endif
mbed_official 0:51ac1d130fd4 203 #ifdef RAW_STATS
mbed_official 0:51ac1d130fd4 204 #error "RAW_STATS option is deprecated. Remove it from your lwipopts.h."
mbed_official 0:51ac1d130fd4 205 #endif
mbed_official 0:51ac1d130fd4 206 #ifdef ETHARP_QUEUE_FIRST
mbed_official 0:51ac1d130fd4 207 #error "ETHARP_QUEUE_FIRST option is deprecated. Remove it from your lwipopts.h."
mbed_official 0:51ac1d130fd4 208 #endif
mbed_official 0:51ac1d130fd4 209 #ifdef ETHARP_ALWAYS_INSERT
mbed_official 0:51ac1d130fd4 210 #error "ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h."
mbed_official 0:51ac1d130fd4 211 #endif
mbed_official 0:51ac1d130fd4 212
mbed_official 0:51ac1d130fd4 213 #ifdef LWIP_DEBUG
mbed_official 0:51ac1d130fd4 214 static void
mbed_official 0:51ac1d130fd4 215 lwip_sanity_check(void)
mbed_official 0:51ac1d130fd4 216 {
mbed_official 0:51ac1d130fd4 217 /* Warnings */
mbed_official 0:51ac1d130fd4 218 #if LWIP_NETCONN
mbed_official 0:51ac1d130fd4 219 if (MEMP_NUM_NETCONN > (MEMP_NUM_TCP_PCB+MEMP_NUM_TCP_PCB_LISTEN+MEMP_NUM_UDP_PCB+MEMP_NUM_RAW_PCB))
mbed_official 0:51ac1d130fd4 220 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: MEMP_NUM_NETCONN should be less than the sum of MEMP_NUM_{TCP,RAW,UDP}_PCB+MEMP_NUM_TCP_PCB_LISTEN\n"));
mbed_official 0:51ac1d130fd4 221 #endif /* LWIP_NETCONN */
mbed_official 0:51ac1d130fd4 222 #if LWIP_TCP
mbed_official 0:51ac1d130fd4 223 if (MEMP_NUM_TCP_SEG < TCP_SND_QUEUELEN)
mbed_official 0:51ac1d130fd4 224 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: MEMP_NUM_TCP_SEG should be at least as big as TCP_SND_QUEUELEN\n"));
mbed_official 0:51ac1d130fd4 225 if (TCP_SND_BUF < 2 * TCP_MSS)
mbed_official 0:51ac1d130fd4 226 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SND_BUF must be at least as much as (2 * TCP_MSS) for things to work smoothly\n"));
mbed_official 0:51ac1d130fd4 227 if (TCP_SND_QUEUELEN < (2 * (TCP_SND_BUF/TCP_MSS)))
mbed_official 0:51ac1d130fd4 228 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SND_QUEUELEN must be at least as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work\n"));
mbed_official 0:51ac1d130fd4 229 if (TCP_SNDLOWAT >= TCP_SND_BUF)
mbed_official 0:51ac1d130fd4 230 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF.\n"));
mbed_official 0:51ac1d130fd4 231 if (TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN)
mbed_official 0:51ac1d130fd4 232 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SNDQUEUELOWAT must be less than TCP_SND_QUEUELEN.\n"));
mbed_official 0:51ac1d130fd4 233 if (TCP_WND > (PBUF_POOL_SIZE*PBUF_POOL_BUFSIZE))
mbed_official 0:51ac1d130fd4 234 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_WND is larger than space provided by PBUF_POOL_SIZE*PBUF_POOL_BUFSIZE\n"));
mbed_official 0:51ac1d130fd4 235 if (TCP_WND < TCP_MSS)
mbed_official 0:51ac1d130fd4 236 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_WND is smaller than MSS\n"));
mbed_official 0:51ac1d130fd4 237 #endif /* LWIP_TCP */
mbed_official 0:51ac1d130fd4 238 #if LWIP_SOCKET
mbed_official 0:51ac1d130fd4 239 /* Check that the SO_* socket options and SOF_* lwIP-internal flags match */
mbed_official 0:51ac1d130fd4 240 if (SO_ACCEPTCONN != SOF_ACCEPTCONN)
mbed_official 0:51ac1d130fd4 241 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_ACCEPTCONN != SOF_ACCEPTCONN\n"));
mbed_official 0:51ac1d130fd4 242 if (SO_REUSEADDR != SOF_REUSEADDR)
mbed_official 0:51ac1d130fd4 243 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_REUSEADDR != SOF_REUSEADDR\n"));
mbed_official 0:51ac1d130fd4 244 if (SO_KEEPALIVE != SOF_KEEPALIVE)
mbed_official 0:51ac1d130fd4 245 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_KEEPALIVE != SOF_KEEPALIVE\n"));
mbed_official 0:51ac1d130fd4 246 if (SO_BROADCAST != SOF_BROADCAST)
mbed_official 0:51ac1d130fd4 247 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_BROADCAST != SOF_BROADCAST\n"));
mbed_official 0:51ac1d130fd4 248 if (SO_LINGER != SOF_LINGER)
mbed_official 0:51ac1d130fd4 249 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_LINGER != SOF_LINGER\n"));
mbed_official 0:51ac1d130fd4 250 #endif /* LWIP_SOCKET */
mbed_official 0:51ac1d130fd4 251 }
mbed_official 0:51ac1d130fd4 252 #else /* LWIP_DEBUG */
mbed_official 0:51ac1d130fd4 253 #define lwip_sanity_check()
mbed_official 0:51ac1d130fd4 254 #endif /* LWIP_DEBUG */
mbed_official 0:51ac1d130fd4 255
mbed_official 0:51ac1d130fd4 256 /**
mbed_official 0:51ac1d130fd4 257 * Perform Sanity check of user-configurable values, and initialize all modules.
mbed_official 0:51ac1d130fd4 258 */
mbed_official 0:51ac1d130fd4 259 void
mbed_official 0:51ac1d130fd4 260 lwip_init(void)
mbed_official 0:51ac1d130fd4 261 {
mbed_official 0:51ac1d130fd4 262 /* Sanity check user-configurable values */
mbed_official 0:51ac1d130fd4 263 lwip_sanity_check();
mbed_official 0:51ac1d130fd4 264
mbed_official 0:51ac1d130fd4 265 /* Modules initialization */
mbed_official 0:51ac1d130fd4 266 stats_init();
mbed_official 0:51ac1d130fd4 267 #if !NO_SYS
mbed_official 0:51ac1d130fd4 268 sys_init();
mbed_official 0:51ac1d130fd4 269 #endif /* !NO_SYS */
mbed_official 0:51ac1d130fd4 270 mem_init();
mbed_official 0:51ac1d130fd4 271 memp_init();
mbed_official 0:51ac1d130fd4 272 pbuf_init();
mbed_official 0:51ac1d130fd4 273 netif_init();
mbed_official 0:51ac1d130fd4 274 #if LWIP_SOCKET
mbed_official 0:51ac1d130fd4 275 lwip_socket_init();
mbed_official 0:51ac1d130fd4 276 #endif /* LWIP_SOCKET */
mbed_official 0:51ac1d130fd4 277 ip_init();
mbed_official 0:51ac1d130fd4 278 #if LWIP_ARP
mbed_official 0:51ac1d130fd4 279 etharp_init();
mbed_official 0:51ac1d130fd4 280 #endif /* LWIP_ARP */
mbed_official 0:51ac1d130fd4 281 #if LWIP_RAW
mbed_official 0:51ac1d130fd4 282 raw_init();
mbed_official 0:51ac1d130fd4 283 #endif /* LWIP_RAW */
mbed_official 0:51ac1d130fd4 284 #if LWIP_UDP
mbed_official 0:51ac1d130fd4 285 udp_init();
mbed_official 0:51ac1d130fd4 286 #endif /* LWIP_UDP */
mbed_official 0:51ac1d130fd4 287 #if LWIP_TCP
mbed_official 0:51ac1d130fd4 288 tcp_init();
mbed_official 0:51ac1d130fd4 289 #endif /* LWIP_TCP */
mbed_official 0:51ac1d130fd4 290 #if LWIP_SNMP
mbed_official 0:51ac1d130fd4 291 snmp_init();
mbed_official 0:51ac1d130fd4 292 #endif /* LWIP_SNMP */
mbed_official 0:51ac1d130fd4 293 #if LWIP_AUTOIP
mbed_official 0:51ac1d130fd4 294 autoip_init();
mbed_official 0:51ac1d130fd4 295 #endif /* LWIP_AUTOIP */
mbed_official 0:51ac1d130fd4 296 #if LWIP_IGMP
mbed_official 0:51ac1d130fd4 297 igmp_init();
mbed_official 0:51ac1d130fd4 298 #endif /* LWIP_IGMP */
mbed_official 0:51ac1d130fd4 299 #if LWIP_DNS
mbed_official 0:51ac1d130fd4 300 dns_init();
mbed_official 0:51ac1d130fd4 301 #endif /* LWIP_DNS */
mbed_official 0:51ac1d130fd4 302
mbed_official 0:51ac1d130fd4 303 #if LWIP_TIMERS
mbed_official 0:51ac1d130fd4 304 sys_timeouts_init();
mbed_official 0:51ac1d130fd4 305 #endif /* LWIP_TIMERS */
mbed_official 0:51ac1d130fd4 306 }