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 * SETUP: Make sure we define everything we will need.
mbed_official 0:51ac1d130fd4 3 *
mbed_official 0:51ac1d130fd4 4 * We have create three types of pools:
mbed_official 0:51ac1d130fd4 5 * 1) MEMPOOL - standard pools
mbed_official 0:51ac1d130fd4 6 * 2) MALLOC_MEMPOOL - to be used by mem_malloc in mem.c
mbed_official 0:51ac1d130fd4 7 * 3) PBUF_MEMPOOL - a mempool of pbuf's, so include space for the pbuf struct
mbed_official 0:51ac1d130fd4 8 *
mbed_official 0:51ac1d130fd4 9 * If the include'r doesn't require any special treatment of each of the types
mbed_official 0:51ac1d130fd4 10 * above, then will declare #2 & #3 to be just standard mempools.
mbed_official 0:51ac1d130fd4 11 */
mbed_official 0:51ac1d130fd4 12 #ifndef LWIP_MALLOC_MEMPOOL
mbed_official 0:51ac1d130fd4 13 /* This treats "malloc pools" just like any other pool.
mbed_official 0:51ac1d130fd4 14 The pools are a little bigger to provide 'size' as the amount of user data. */
mbed_official 0:51ac1d130fd4 15 #define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + sizeof(struct memp_malloc_helper)), "MALLOC_"#size)
mbed_official 0:51ac1d130fd4 16 #define LWIP_MALLOC_MEMPOOL_START
mbed_official 0:51ac1d130fd4 17 #define LWIP_MALLOC_MEMPOOL_END
mbed_official 0:51ac1d130fd4 18 #endif /* LWIP_MALLOC_MEMPOOL */
mbed_official 0:51ac1d130fd4 19
mbed_official 0:51ac1d130fd4 20 #ifndef LWIP_PBUF_MEMPOOL
mbed_official 0:51ac1d130fd4 21 /* This treats "pbuf pools" just like any other pool.
mbed_official 0:51ac1d130fd4 22 * Allocates buffers for a pbuf struct AND a payload size */
mbed_official 0:51ac1d130fd4 23 #define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc)
mbed_official 0:51ac1d130fd4 24 #endif /* LWIP_PBUF_MEMPOOL */
mbed_official 0:51ac1d130fd4 25
mbed_official 0:51ac1d130fd4 26
mbed_official 0:51ac1d130fd4 27 /*
mbed_official 0:51ac1d130fd4 28 * A list of internal pools used by LWIP.
mbed_official 0:51ac1d130fd4 29 *
mbed_official 0:51ac1d130fd4 30 * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description)
mbed_official 0:51ac1d130fd4 31 * creates a pool name MEMP_pool_name. description is used in stats.c
mbed_official 0:51ac1d130fd4 32 */
mbed_official 0:51ac1d130fd4 33 #if LWIP_RAW
mbed_official 0:51ac1d130fd4 34 LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB")
mbed_official 0:51ac1d130fd4 35 #endif /* LWIP_RAW */
mbed_official 0:51ac1d130fd4 36
mbed_official 0:51ac1d130fd4 37 #if LWIP_UDP
mbed_official 0:51ac1d130fd4 38 LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB")
mbed_official 0:51ac1d130fd4 39 #endif /* LWIP_UDP */
mbed_official 0:51ac1d130fd4 40
mbed_official 0:51ac1d130fd4 41 #if LWIP_TCP
mbed_official 0:51ac1d130fd4 42 LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB")
mbed_official 0:51ac1d130fd4 43 LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN")
mbed_official 0:51ac1d130fd4 44 LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG")
mbed_official 0:51ac1d130fd4 45 #endif /* LWIP_TCP */
mbed_official 0:51ac1d130fd4 46
mbed_official 0:51ac1d130fd4 47 #if IP_REASSEMBLY
mbed_official 0:51ac1d130fd4 48 LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA")
mbed_official 0:51ac1d130fd4 49 #endif /* IP_REASSEMBLY */
mbed_official 0:51ac1d130fd4 50 #if IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF
mbed_official 0:51ac1d130fd4 51 LWIP_MEMPOOL(FRAG_PBUF, MEMP_NUM_FRAG_PBUF, sizeof(struct pbuf_custom_ref),"FRAG_PBUF")
mbed_official 0:51ac1d130fd4 52 #endif /* IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */
mbed_official 0:51ac1d130fd4 53
mbed_official 0:51ac1d130fd4 54 #if LWIP_NETCONN
mbed_official 0:51ac1d130fd4 55 LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF")
mbed_official 0:51ac1d130fd4 56 LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN")
mbed_official 0:51ac1d130fd4 57 #endif /* LWIP_NETCONN */
mbed_official 0:51ac1d130fd4 58
mbed_official 0:51ac1d130fd4 59 #if NO_SYS==0
mbed_official 0:51ac1d130fd4 60 LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API")
mbed_official 0:51ac1d130fd4 61 #if !LWIP_TCPIP_CORE_LOCKING_INPUT
mbed_official 0:51ac1d130fd4 62 LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT")
mbed_official 0:51ac1d130fd4 63 #endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
mbed_official 0:51ac1d130fd4 64 #endif /* NO_SYS==0 */
mbed_official 0:51ac1d130fd4 65
mbed_official 0:51ac1d130fd4 66 #if ARP_QUEUEING
mbed_official 0:51ac1d130fd4 67 LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE")
mbed_official 0:51ac1d130fd4 68 #endif /* ARP_QUEUEING */
mbed_official 0:51ac1d130fd4 69
mbed_official 0:51ac1d130fd4 70 #if LWIP_IGMP
mbed_official 0:51ac1d130fd4 71 LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP")
mbed_official 0:51ac1d130fd4 72 #endif /* LWIP_IGMP */
mbed_official 0:51ac1d130fd4 73
mbed_official 0:51ac1d130fd4 74 #if (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */
mbed_official 0:51ac1d130fd4 75 LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT")
mbed_official 0:51ac1d130fd4 76 #endif /* LWIP_TIMERS */
mbed_official 0:51ac1d130fd4 77
mbed_official 0:51ac1d130fd4 78 #if LWIP_SNMP
mbed_official 0:51ac1d130fd4 79 LWIP_MEMPOOL(SNMP_ROOTNODE, MEMP_NUM_SNMP_ROOTNODE, sizeof(struct mib_list_rootnode), "SNMP_ROOTNODE")
mbed_official 0:51ac1d130fd4 80 LWIP_MEMPOOL(SNMP_NODE, MEMP_NUM_SNMP_NODE, sizeof(struct mib_list_node), "SNMP_NODE")
mbed_official 0:51ac1d130fd4 81 LWIP_MEMPOOL(SNMP_VARBIND, MEMP_NUM_SNMP_VARBIND, sizeof(struct snmp_varbind), "SNMP_VARBIND")
mbed_official 0:51ac1d130fd4 82 LWIP_MEMPOOL(SNMP_VALUE, MEMP_NUM_SNMP_VALUE, SNMP_MAX_VALUE_SIZE, "SNMP_VALUE")
mbed_official 0:51ac1d130fd4 83 #endif /* LWIP_SNMP */
mbed_official 0:51ac1d130fd4 84 #if LWIP_DNS && LWIP_SOCKET
mbed_official 0:51ac1d130fd4 85 LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB")
mbed_official 0:51ac1d130fd4 86 #endif /* LWIP_DNS && LWIP_SOCKET */
mbed_official 0:51ac1d130fd4 87 #if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
mbed_official 0:51ac1d130fd4 88 LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE, "LOCALHOSTLIST")
mbed_official 0:51ac1d130fd4 89 #endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
mbed_official 0:51ac1d130fd4 90 #if PPP_SUPPORT && PPPOE_SUPPORT
mbed_official 0:51ac1d130fd4 91 LWIP_MEMPOOL(PPPOE_IF, MEMP_NUM_PPPOE_INTERFACES, sizeof(struct pppoe_softc), "PPPOE_IF")
mbed_official 0:51ac1d130fd4 92 #endif /* PPP_SUPPORT && PPPOE_SUPPORT */
mbed_official 0:51ac1d130fd4 93
mbed_official 0:51ac1d130fd4 94 /*
mbed_official 0:51ac1d130fd4 95 * A list of pools of pbuf's used by LWIP.
mbed_official 0:51ac1d130fd4 96 *
mbed_official 0:51ac1d130fd4 97 * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
mbed_official 0:51ac1d130fd4 98 * creates a pool name MEMP_pool_name. description is used in stats.c
mbed_official 0:51ac1d130fd4 99 * This allocates enough space for the pbuf struct and a payload.
mbed_official 0:51ac1d130fd4 100 * (Example: pbuf_payload_size=0 allocates only size for the struct)
mbed_official 0:51ac1d130fd4 101 */
mbed_official 0:51ac1d130fd4 102 LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM")
mbed_official 0:51ac1d130fd4 103 LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL")
mbed_official 0:51ac1d130fd4 104
mbed_official 0:51ac1d130fd4 105
mbed_official 0:51ac1d130fd4 106 /*
mbed_official 0:51ac1d130fd4 107 * Allow for user-defined pools; this must be explicitly set in lwipopts.h
mbed_official 0:51ac1d130fd4 108 * since the default is to NOT look for lwippools.h
mbed_official 0:51ac1d130fd4 109 */
mbed_official 0:51ac1d130fd4 110 #if MEMP_USE_CUSTOM_POOLS
mbed_official 0:51ac1d130fd4 111 #include "lwippools.h"
mbed_official 0:51ac1d130fd4 112 #endif /* MEMP_USE_CUSTOM_POOLS */
mbed_official 0:51ac1d130fd4 113
mbed_official 0:51ac1d130fd4 114 /*
mbed_official 0:51ac1d130fd4 115 * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later
mbed_official 0:51ac1d130fd4 116 * (#undef is ignored for something that is not defined)
mbed_official 0:51ac1d130fd4 117 */
mbed_official 0:51ac1d130fd4 118 #undef LWIP_MEMPOOL
mbed_official 0:51ac1d130fd4 119 #undef LWIP_MALLOC_MEMPOOL
mbed_official 0:51ac1d130fd4 120 #undef LWIP_MALLOC_MEMPOOL_START
mbed_official 0:51ac1d130fd4 121 #undef LWIP_MALLOC_MEMPOOL_END
mbed_official 0:51ac1d130fd4 122 #undef LWIP_PBUF_MEMPOOL