First step: AutoIP compiled in and working

Dependencies:   mbed

Committer:
darran
Date:
Fri Jun 18 15:54:21 2010 +0000
Revision:
1:4218cacaf696
Parent:
0:55a05330f8cc

        

Who changed what in which revision?

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