A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Committer:
root@mbed.org
Date:
Tue May 08 15:32:10 2012 +0100
Revision:
0:5e1631496985
initial commit

Who changed what in which revision?

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