Version of http://mbed.org/cookbook/NetServicesTribute with setting set the same for LPC2368

Dependents:   UDPSocketExample 24LCxx_I2CApp WeatherPlatform_pachube HvZServerLib ... more

Committer:
simon
Date:
Tue Nov 23 14:15:36 2010 +0000
Revision:
0:350011bf8be7
Experimental version for testing UDP

Who changed what in which revision?

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