TwitterExample with newer library (2012Aug)

Dependencies:   EthernetNetIf HTTPClient mbed

Committer:
nxpfan
Date:
Wed Aug 29 03:50:19 2012 +0000
Revision:
0:075157567b0c
simple twitter example with newer library

Who changed what in which revision?

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