Stripped down version of Segundos NetService library (http://mbed.org/users/segundo/libraries/NetServices ). I have removed all NetServices, and all functions which had been disabled. Use this version when you need only pure TCP or UDP functions - this library compiles faster.

Dependencies:   lwip lwip-sys

Dependents:   christmasLights device_server pop3demo device_server_udp ... more

Committer:
hlipka
Date:
Mon Jan 10 21:03:11 2011 +0000
Revision:
0:8b387bed54c2
initial version

Who changed what in which revision?

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