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 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
nxpfan 0:075157567b0c 3 * All rights reserved.
nxpfan 0:075157567b0c 4 *
nxpfan 0:075157567b0c 5 * Redistribution and use in source and binary forms, with or without modification,
nxpfan 0:075157567b0c 6 * are permitted provided that the following conditions are met:
nxpfan 0:075157567b0c 7 *
nxpfan 0:075157567b0c 8 * 1. Redistributions of source code must retain the above copyright notice,
nxpfan 0:075157567b0c 9 * this list of conditions and the following disclaimer.
nxpfan 0:075157567b0c 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
nxpfan 0:075157567b0c 11 * this list of conditions and the following disclaimer in the documentation
nxpfan 0:075157567b0c 12 * and/or other materials provided with the distribution.
nxpfan 0:075157567b0c 13 * 3. The name of the author may not be used to endorse or promote products
nxpfan 0:075157567b0c 14 * derived from this software without specific prior written permission.
nxpfan 0:075157567b0c 15 *
nxpfan 0:075157567b0c 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
nxpfan 0:075157567b0c 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
nxpfan 0:075157567b0c 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
nxpfan 0:075157567b0c 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
nxpfan 0:075157567b0c 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
nxpfan 0:075157567b0c 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
nxpfan 0:075157567b0c 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
nxpfan 0:075157567b0c 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
nxpfan 0:075157567b0c 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
nxpfan 0:075157567b0c 25 * OF SUCH DAMAGE.
nxpfan 0:075157567b0c 26 *
nxpfan 0:075157567b0c 27 * This file is part of the lwIP TCP/IP stack.
nxpfan 0:075157567b0c 28 *
nxpfan 0:075157567b0c 29 * Author: Adam Dunkels <adam@sics.se>
nxpfan 0:075157567b0c 30 *
nxpfan 0:075157567b0c 31 */
nxpfan 0:075157567b0c 32 #ifndef __LWIP_ICMP_H__
nxpfan 0:075157567b0c 33 #define __LWIP_ICMP_H__
nxpfan 0:075157567b0c 34
nxpfan 0:075157567b0c 35 #include "lwip/opt.h"
nxpfan 0:075157567b0c 36 #include "lwip/pbuf.h"
nxpfan 0:075157567b0c 37 #include "lwip/ip_addr.h"
nxpfan 0:075157567b0c 38 #include "lwip/netif.h"
nxpfan 0:075157567b0c 39
nxpfan 0:075157567b0c 40 #ifdef __cplusplus
nxpfan 0:075157567b0c 41 extern "C" {
nxpfan 0:075157567b0c 42 #endif
nxpfan 0:075157567b0c 43
nxpfan 0:075157567b0c 44 #define ICMP_ER 0 /* echo reply */
nxpfan 0:075157567b0c 45 #define ICMP_DUR 3 /* destination unreachable */
nxpfan 0:075157567b0c 46 #define ICMP_SQ 4 /* source quench */
nxpfan 0:075157567b0c 47 #define ICMP_RD 5 /* redirect */
nxpfan 0:075157567b0c 48 #define ICMP_ECHO 8 /* echo */
nxpfan 0:075157567b0c 49 #define ICMP_TE 11 /* time exceeded */
nxpfan 0:075157567b0c 50 #define ICMP_PP 12 /* parameter problem */
nxpfan 0:075157567b0c 51 #define ICMP_TS 13 /* timestamp */
nxpfan 0:075157567b0c 52 #define ICMP_TSR 14 /* timestamp reply */
nxpfan 0:075157567b0c 53 #define ICMP_IRQ 15 /* information request */
nxpfan 0:075157567b0c 54 #define ICMP_IR 16 /* information reply */
nxpfan 0:075157567b0c 55
nxpfan 0:075157567b0c 56 enum icmp_dur_type {
nxpfan 0:075157567b0c 57 ICMP_DUR_NET = 0, /* net unreachable */
nxpfan 0:075157567b0c 58 ICMP_DUR_HOST = 1, /* host unreachable */
nxpfan 0:075157567b0c 59 ICMP_DUR_PROTO = 2, /* protocol unreachable */
nxpfan 0:075157567b0c 60 ICMP_DUR_PORT = 3, /* port unreachable */
nxpfan 0:075157567b0c 61 ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */
nxpfan 0:075157567b0c 62 ICMP_DUR_SR = 5 /* source route failed */
nxpfan 0:075157567b0c 63 };
nxpfan 0:075157567b0c 64
nxpfan 0:075157567b0c 65 enum icmp_te_type {
nxpfan 0:075157567b0c 66 ICMP_TE_TTL = 0, /* time to live exceeded in transit */
nxpfan 0:075157567b0c 67 ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */
nxpfan 0:075157567b0c 68 };
nxpfan 0:075157567b0c 69
nxpfan 0:075157567b0c 70 #ifdef PACK_STRUCT_USE_INCLUDES
nxpfan 0:075157567b0c 71 # include "arch/bpstruct.h"
nxpfan 0:075157567b0c 72 #endif
nxpfan 0:075157567b0c 73 /* This is the standard ICMP header only that the u32_t data
nxpfan 0:075157567b0c 74 * is splitted to two u16_t like ICMP echo needs it.
nxpfan 0:075157567b0c 75 * This header is also used for other ICMP types that do not
nxpfan 0:075157567b0c 76 * use the data part.
nxpfan 0:075157567b0c 77 */
nxpfan 0:075157567b0c 78 PACK_STRUCT_BEGIN
nxpfan 0:075157567b0c 79 struct icmp_echo_hdr {
nxpfan 0:075157567b0c 80 PACK_STRUCT_FIELD(u8_t type);
nxpfan 0:075157567b0c 81 PACK_STRUCT_FIELD(u8_t code);
nxpfan 0:075157567b0c 82 PACK_STRUCT_FIELD(u16_t chksum);
nxpfan 0:075157567b0c 83 PACK_STRUCT_FIELD(u16_t id);
nxpfan 0:075157567b0c 84 PACK_STRUCT_FIELD(u16_t seqno);
nxpfan 0:075157567b0c 85 } PACK_STRUCT_STRUCT;
nxpfan 0:075157567b0c 86 PACK_STRUCT_END
nxpfan 0:075157567b0c 87 #ifdef PACK_STRUCT_USE_INCLUDES
nxpfan 0:075157567b0c 88 # include "arch/epstruct.h"
nxpfan 0:075157567b0c 89 #endif
nxpfan 0:075157567b0c 90
nxpfan 0:075157567b0c 91 #define ICMPH_TYPE(hdr) ((hdr)->type)
nxpfan 0:075157567b0c 92 #define ICMPH_CODE(hdr) ((hdr)->code)
nxpfan 0:075157567b0c 93
nxpfan 0:075157567b0c 94 /* Combines type and code to an u16_t */
nxpfan 0:075157567b0c 95 #define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t))
nxpfan 0:075157567b0c 96 #define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c))
nxpfan 0:075157567b0c 97
nxpfan 0:075157567b0c 98
nxpfan 0:075157567b0c 99 #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
nxpfan 0:075157567b0c 100
nxpfan 0:075157567b0c 101 void icmp_input(struct pbuf *p, struct netif *inp);
nxpfan 0:075157567b0c 102 void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
nxpfan 0:075157567b0c 103 void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
nxpfan 0:075157567b0c 104
nxpfan 0:075157567b0c 105 #endif /* LWIP_ICMP */
nxpfan 0:075157567b0c 106
nxpfan 0:075157567b0c 107 #ifdef __cplusplus
nxpfan 0:075157567b0c 108 }
nxpfan 0:075157567b0c 109 #endif
nxpfan 0:075157567b0c 110
nxpfan 0:075157567b0c 111 #endif /* __LWIP_ICMP_H__ */