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_NETBUF_H__
nxpfan 0:075157567b0c 33 #define __LWIP_NETBUF_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
nxpfan 0:075157567b0c 39 #ifdef __cplusplus
nxpfan 0:075157567b0c 40 extern "C" {
nxpfan 0:075157567b0c 41 #endif
nxpfan 0:075157567b0c 42
nxpfan 0:075157567b0c 43 /** This netbuf has dest-addr/port set */
nxpfan 0:075157567b0c 44 #define NETBUF_FLAG_DESTADDR 0x01
nxpfan 0:075157567b0c 45 /** This netbuf includes a checksum */
nxpfan 0:075157567b0c 46 #define NETBUF_FLAG_CHKSUM 0x02
nxpfan 0:075157567b0c 47
nxpfan 0:075157567b0c 48 struct netbuf {
nxpfan 0:075157567b0c 49 struct pbuf *p, *ptr;
nxpfan 0:075157567b0c 50 ip_addr_t addr;
nxpfan 0:075157567b0c 51 u16_t port;
nxpfan 0:075157567b0c 52 #if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY
nxpfan 0:075157567b0c 53 #if LWIP_CHECKSUM_ON_COPY
nxpfan 0:075157567b0c 54 u8_t flags;
nxpfan 0:075157567b0c 55 #endif /* LWIP_CHECKSUM_ON_COPY */
nxpfan 0:075157567b0c 56 u16_t toport_chksum;
nxpfan 0:075157567b0c 57 #if LWIP_NETBUF_RECVINFO
nxpfan 0:075157567b0c 58 ip_addr_t toaddr;
nxpfan 0:075157567b0c 59 #endif /* LWIP_NETBUF_RECVINFO */
nxpfan 0:075157567b0c 60 #endif /* LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY */
nxpfan 0:075157567b0c 61 };
nxpfan 0:075157567b0c 62
nxpfan 0:075157567b0c 63 /* Network buffer functions: */
nxpfan 0:075157567b0c 64 struct netbuf * netbuf_new (void);
nxpfan 0:075157567b0c 65 void netbuf_delete (struct netbuf *buf);
nxpfan 0:075157567b0c 66 void * netbuf_alloc (struct netbuf *buf, u16_t size);
nxpfan 0:075157567b0c 67 void netbuf_free (struct netbuf *buf);
nxpfan 0:075157567b0c 68 err_t netbuf_ref (struct netbuf *buf,
nxpfan 0:075157567b0c 69 const void *dataptr, u16_t size);
nxpfan 0:075157567b0c 70 void netbuf_chain (struct netbuf *head,
nxpfan 0:075157567b0c 71 struct netbuf *tail);
nxpfan 0:075157567b0c 72
nxpfan 0:075157567b0c 73 err_t netbuf_data (struct netbuf *buf,
nxpfan 0:075157567b0c 74 void **dataptr, u16_t *len);
nxpfan 0:075157567b0c 75 s8_t netbuf_next (struct netbuf *buf);
nxpfan 0:075157567b0c 76 void netbuf_first (struct netbuf *buf);
nxpfan 0:075157567b0c 77
nxpfan 0:075157567b0c 78
nxpfan 0:075157567b0c 79 #define netbuf_copy_partial(buf, dataptr, len, offset) \
nxpfan 0:075157567b0c 80 pbuf_copy_partial((buf)->p, (dataptr), (len), (offset))
nxpfan 0:075157567b0c 81 #define netbuf_copy(buf,dataptr,len) netbuf_copy_partial(buf, dataptr, len, 0)
nxpfan 0:075157567b0c 82 #define netbuf_take(buf, dataptr, len) pbuf_take((buf)->p, dataptr, len)
nxpfan 0:075157567b0c 83 #define netbuf_len(buf) ((buf)->p->tot_len)
nxpfan 0:075157567b0c 84 #define netbuf_fromaddr(buf) (&((buf)->addr))
nxpfan 0:075157567b0c 85 #define netbuf_set_fromaddr(buf, fromaddr) ip_addr_set((&(buf)->addr), fromaddr)
nxpfan 0:075157567b0c 86 #define netbuf_fromport(buf) ((buf)->port)
nxpfan 0:075157567b0c 87 #if LWIP_NETBUF_RECVINFO
nxpfan 0:075157567b0c 88 #define netbuf_destaddr(buf) (&((buf)->toaddr))
nxpfan 0:075157567b0c 89 #define netbuf_set_destaddr(buf, destaddr) ip_addr_set((&(buf)->addr), destaddr)
nxpfan 0:075157567b0c 90 #define netbuf_destport(buf) (((buf)->flags & NETBUF_FLAG_DESTADDR) ? (buf)->toport_chksum : 0)
nxpfan 0:075157567b0c 91 #endif /* LWIP_NETBUF_RECVINFO */
nxpfan 0:075157567b0c 92 #if LWIP_CHECKSUM_ON_COPY
nxpfan 0:075157567b0c 93 #define netbuf_set_chksum(buf, chksum) do { (buf)->flags = NETBUF_FLAG_CHKSUM; \
nxpfan 0:075157567b0c 94 (buf)->toport_chksum = chksum; } while(0)
nxpfan 0:075157567b0c 95 #endif /* LWIP_CHECKSUM_ON_COPY */
nxpfan 0:075157567b0c 96
nxpfan 0:075157567b0c 97 #ifdef __cplusplus
nxpfan 0:075157567b0c 98 }
nxpfan 0:075157567b0c 99 #endif
nxpfan 0:075157567b0c 100
nxpfan 0:075157567b0c 101 #endif /* __LWIP_NETBUF_H__ */