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 * Redistribution and use in source and binary forms, with or without modification,
nxpfan 0:075157567b0c 3 * are permitted provided that the following conditions are met:
nxpfan 0:075157567b0c 4 *
nxpfan 0:075157567b0c 5 * 1. Redistributions of source code must retain the above copyright notice,
nxpfan 0:075157567b0c 6 * this list of conditions and the following disclaimer.
nxpfan 0:075157567b0c 7 * 2. Redistributions in binary form must reproduce the above copyright notice,
nxpfan 0:075157567b0c 8 * this list of conditions and the following disclaimer in the documentation
nxpfan 0:075157567b0c 9 * and/or other materials provided with the distribution.
nxpfan 0:075157567b0c 10 * 3. The name of the author may not be used to endorse or promote products
nxpfan 0:075157567b0c 11 * derived from this software without specific prior written permission.
nxpfan 0:075157567b0c 12 *
nxpfan 0:075157567b0c 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
nxpfan 0:075157567b0c 14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
nxpfan 0:075157567b0c 15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
nxpfan 0:075157567b0c 16 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
nxpfan 0:075157567b0c 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
nxpfan 0:075157567b0c 18 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
nxpfan 0:075157567b0c 19 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
nxpfan 0:075157567b0c 20 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
nxpfan 0:075157567b0c 21 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
nxpfan 0:075157567b0c 22 * OF SUCH DAMAGE.
nxpfan 0:075157567b0c 23 *
nxpfan 0:075157567b0c 24 * This file is part of the lwIP TCP/IP stack.
nxpfan 0:075157567b0c 25 *
nxpfan 0:075157567b0c 26 * Author: Simon Goldschmidt
nxpfan 0:075157567b0c 27 *
nxpfan 0:075157567b0c 28 */
nxpfan 0:075157567b0c 29 #ifndef __LWIP_NETDB_H__
nxpfan 0:075157567b0c 30 #define __LWIP_NETDB_H__
nxpfan 0:075157567b0c 31
nxpfan 0:075157567b0c 32 #include "lwip/opt.h"
nxpfan 0:075157567b0c 33
nxpfan 0:075157567b0c 34 #if LWIP_DNS && LWIP_SOCKET
nxpfan 0:075157567b0c 35
nxpfan 0:075157567b0c 36 #include <stddef.h> /* for size_t */
nxpfan 0:075157567b0c 37
nxpfan 0:075157567b0c 38 #include "lwip/inet.h"
nxpfan 0:075157567b0c 39 #include "lwip/sockets.h"
nxpfan 0:075157567b0c 40
nxpfan 0:075157567b0c 41 /* some rarely used options */
nxpfan 0:075157567b0c 42 #ifndef LWIP_DNS_API_DECLARE_H_ERRNO
nxpfan 0:075157567b0c 43 #define LWIP_DNS_API_DECLARE_H_ERRNO 1
nxpfan 0:075157567b0c 44 #endif
nxpfan 0:075157567b0c 45
nxpfan 0:075157567b0c 46 #ifndef LWIP_DNS_API_DEFINE_ERRORS
nxpfan 0:075157567b0c 47 #define LWIP_DNS_API_DEFINE_ERRORS 1
nxpfan 0:075157567b0c 48 #endif
nxpfan 0:075157567b0c 49
nxpfan 0:075157567b0c 50 #ifndef LWIP_DNS_API_DECLARE_STRUCTS
nxpfan 0:075157567b0c 51 #define LWIP_DNS_API_DECLARE_STRUCTS 1
nxpfan 0:075157567b0c 52 #endif
nxpfan 0:075157567b0c 53
nxpfan 0:075157567b0c 54 #if LWIP_DNS_API_DEFINE_ERRORS
nxpfan 0:075157567b0c 55 /** Errors used by the DNS API functions, h_errno can be one of them */
nxpfan 0:075157567b0c 56 #define EAI_NONAME 200
nxpfan 0:075157567b0c 57 #define EAI_SERVICE 201
nxpfan 0:075157567b0c 58 #define EAI_FAIL 202
nxpfan 0:075157567b0c 59 #define EAI_MEMORY 203
nxpfan 0:075157567b0c 60
nxpfan 0:075157567b0c 61 #define HOST_NOT_FOUND 210
nxpfan 0:075157567b0c 62 #define NO_DATA 211
nxpfan 0:075157567b0c 63 #define NO_RECOVERY 212
nxpfan 0:075157567b0c 64 #define TRY_AGAIN 213
nxpfan 0:075157567b0c 65 #endif /* LWIP_DNS_API_DEFINE_ERRORS */
nxpfan 0:075157567b0c 66
nxpfan 0:075157567b0c 67 #if LWIP_DNS_API_DECLARE_STRUCTS
nxpfan 0:075157567b0c 68 struct hostent {
nxpfan 0:075157567b0c 69 char *h_name; /* Official name of the host. */
nxpfan 0:075157567b0c 70 char **h_aliases; /* A pointer to an array of pointers to alternative host names,
nxpfan 0:075157567b0c 71 terminated by a null pointer. */
nxpfan 0:075157567b0c 72 int h_addrtype; /* Address type. */
nxpfan 0:075157567b0c 73 int h_length; /* The length, in bytes, of the address. */
nxpfan 0:075157567b0c 74 char **h_addr_list; /* A pointer to an array of pointers to network addresses (in
nxpfan 0:075157567b0c 75 network byte order) for the host, terminated by a null pointer. */
nxpfan 0:075157567b0c 76 #define h_addr h_addr_list[0] /* for backward compatibility */
nxpfan 0:075157567b0c 77 };
nxpfan 0:075157567b0c 78
nxpfan 0:075157567b0c 79 struct addrinfo {
nxpfan 0:075157567b0c 80 int ai_flags; /* Input flags. */
nxpfan 0:075157567b0c 81 int ai_family; /* Address family of socket. */
nxpfan 0:075157567b0c 82 int ai_socktype; /* Socket type. */
nxpfan 0:075157567b0c 83 int ai_protocol; /* Protocol of socket. */
nxpfan 0:075157567b0c 84 socklen_t ai_addrlen; /* Length of socket address. */
nxpfan 0:075157567b0c 85 struct sockaddr *ai_addr; /* Socket address of socket. */
nxpfan 0:075157567b0c 86 char *ai_canonname; /* Canonical name of service location. */
nxpfan 0:075157567b0c 87 struct addrinfo *ai_next; /* Pointer to next in list. */
nxpfan 0:075157567b0c 88 };
nxpfan 0:075157567b0c 89 #endif /* LWIP_DNS_API_DECLARE_STRUCTS */
nxpfan 0:075157567b0c 90
nxpfan 0:075157567b0c 91 #if LWIP_DNS_API_DECLARE_H_ERRNO
nxpfan 0:075157567b0c 92 /* application accessable error code set by the DNS API functions */
nxpfan 0:075157567b0c 93 extern int h_errno;
nxpfan 0:075157567b0c 94 #endif /* LWIP_DNS_API_DECLARE_H_ERRNO*/
nxpfan 0:075157567b0c 95
nxpfan 0:075157567b0c 96 struct hostent *lwip_gethostbyname(const char *name);
nxpfan 0:075157567b0c 97 int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
nxpfan 0:075157567b0c 98 size_t buflen, struct hostent **result, int *h_errnop);
nxpfan 0:075157567b0c 99 void lwip_freeaddrinfo(struct addrinfo *ai);
nxpfan 0:075157567b0c 100 int lwip_getaddrinfo(const char *nodename,
nxpfan 0:075157567b0c 101 const char *servname,
nxpfan 0:075157567b0c 102 const struct addrinfo *hints,
nxpfan 0:075157567b0c 103 struct addrinfo **res);
nxpfan 0:075157567b0c 104
nxpfan 0:075157567b0c 105 #if LWIP_COMPAT_SOCKETS
nxpfan 0:075157567b0c 106 #define gethostbyname(name) lwip_gethostbyname(name)
nxpfan 0:075157567b0c 107 #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
nxpfan 0:075157567b0c 108 lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
nxpfan 0:075157567b0c 109 #define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo)
nxpfan 0:075157567b0c 110 #define getaddrinfo(nodname, servname, hints, res) \
nxpfan 0:075157567b0c 111 lwip_getaddrinfo(nodname, servname, hints, res)
nxpfan 0:075157567b0c 112 #endif /* LWIP_COMPAT_SOCKETS */
nxpfan 0:075157567b0c 113
nxpfan 0:075157567b0c 114 #endif /* LWIP_DNS && LWIP_SOCKET */
nxpfan 0:075157567b0c 115
nxpfan 0:075157567b0c 116 #endif /* __LWIP_NETDB_H__ */