Example self-announcing webserver which controls a servo through a smallHTML userinterface.

Dependencies:   mbed

Committer:
dirkx
Date:
Sat Aug 14 15:56:01 2010 +0000
Revision:
0:a259777c45a3

        

Who changed what in which revision?

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