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 * lwip DNS resolver header file.
nxpfan 0:075157567b0c 3
nxpfan 0:075157567b0c 4 * Author: Jim Pettinato
nxpfan 0:075157567b0c 5 * April 2007
nxpfan 0:075157567b0c 6
nxpfan 0:075157567b0c 7 * ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels.
nxpfan 0:075157567b0c 8 *
nxpfan 0:075157567b0c 9 * Redistribution and use in source and binary forms, with or without
nxpfan 0:075157567b0c 10 * modification, are permitted provided that the following conditions
nxpfan 0:075157567b0c 11 * are met:
nxpfan 0:075157567b0c 12 * 1. Redistributions of source code must retain the above copyright
nxpfan 0:075157567b0c 13 * notice, this list of conditions and the following disclaimer.
nxpfan 0:075157567b0c 14 * 2. Redistributions in binary form must reproduce the above copyright
nxpfan 0:075157567b0c 15 * notice, this list of conditions and the following disclaimer in the
nxpfan 0:075157567b0c 16 * documentation and/or other materials provided with the distribution.
nxpfan 0:075157567b0c 17 * 3. The name of the author may not be used to endorse or promote
nxpfan 0:075157567b0c 18 * products derived from this software without specific prior
nxpfan 0:075157567b0c 19 * written permission.
nxpfan 0:075157567b0c 20 *
nxpfan 0:075157567b0c 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
nxpfan 0:075157567b0c 22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
nxpfan 0:075157567b0c 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
nxpfan 0:075157567b0c 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
nxpfan 0:075157567b0c 25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
nxpfan 0:075157567b0c 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
nxpfan 0:075157567b0c 27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
nxpfan 0:075157567b0c 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
nxpfan 0:075157567b0c 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
nxpfan 0:075157567b0c 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
nxpfan 0:075157567b0c 31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nxpfan 0:075157567b0c 32 */
nxpfan 0:075157567b0c 33
nxpfan 0:075157567b0c 34 #ifndef __LWIP_DNS_H__
nxpfan 0:075157567b0c 35 #define __LWIP_DNS_H__
nxpfan 0:075157567b0c 36
nxpfan 0:075157567b0c 37 #include "lwip/opt.h"
nxpfan 0:075157567b0c 38
nxpfan 0:075157567b0c 39 #if LWIP_DNS /* don't build if not configured for use in lwipopts.h */
nxpfan 0:075157567b0c 40
nxpfan 0:075157567b0c 41 /** DNS timer period */
nxpfan 0:075157567b0c 42 #define DNS_TMR_INTERVAL 1000
nxpfan 0:075157567b0c 43
nxpfan 0:075157567b0c 44 /** DNS field TYPE used for "Resource Records" */
nxpfan 0:075157567b0c 45 #define DNS_RRTYPE_A 1 /* a host address */
nxpfan 0:075157567b0c 46 #define DNS_RRTYPE_NS 2 /* an authoritative name server */
nxpfan 0:075157567b0c 47 #define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */
nxpfan 0:075157567b0c 48 #define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */
nxpfan 0:075157567b0c 49 #define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */
nxpfan 0:075157567b0c 50 #define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */
nxpfan 0:075157567b0c 51 #define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */
nxpfan 0:075157567b0c 52 #define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */
nxpfan 0:075157567b0c 53 #define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */
nxpfan 0:075157567b0c 54 #define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */
nxpfan 0:075157567b0c 55 #define DNS_RRTYPE_WKS 11 /* a well known service description */
nxpfan 0:075157567b0c 56 #define DNS_RRTYPE_PTR 12 /* a domain name pointer */
nxpfan 0:075157567b0c 57 #define DNS_RRTYPE_HINFO 13 /* host information */
nxpfan 0:075157567b0c 58 #define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */
nxpfan 0:075157567b0c 59 #define DNS_RRTYPE_MX 15 /* mail exchange */
nxpfan 0:075157567b0c 60 #define DNS_RRTYPE_TXT 16 /* text strings */
nxpfan 0:075157567b0c 61
nxpfan 0:075157567b0c 62 /** DNS field CLASS used for "Resource Records" */
nxpfan 0:075157567b0c 63 #define DNS_RRCLASS_IN 1 /* the Internet */
nxpfan 0:075157567b0c 64 #define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */
nxpfan 0:075157567b0c 65 #define DNS_RRCLASS_CH 3 /* the CHAOS class */
nxpfan 0:075157567b0c 66 #define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */
nxpfan 0:075157567b0c 67 #define DNS_RRCLASS_FLUSH 0x800 /* Flush bit */
nxpfan 0:075157567b0c 68
nxpfan 0:075157567b0c 69 /* The size used for the next line is rather a hack, but it prevents including socket.h in all files
nxpfan 0:075157567b0c 70 that include memp.h, and that would possibly break portability (since socket.h defines some types
nxpfan 0:075157567b0c 71 and constants possibly already define by the OS).
nxpfan 0:075157567b0c 72 Calculation rule:
nxpfan 0:075157567b0c 73 sizeof(struct addrinfo) + sizeof(struct sockaddr_in) + DNS_MAX_NAME_LENGTH + 1 byte zero-termination */
nxpfan 0:075157567b0c 74 #define NETDB_ELEM_SIZE (32 + 16 + DNS_MAX_NAME_LENGTH + 1)
nxpfan 0:075157567b0c 75
nxpfan 0:075157567b0c 76 #if DNS_LOCAL_HOSTLIST
nxpfan 0:075157567b0c 77 /** struct used for local host-list */
nxpfan 0:075157567b0c 78 struct local_hostlist_entry {
nxpfan 0:075157567b0c 79 /** static hostname */
nxpfan 0:075157567b0c 80 const char *name;
nxpfan 0:075157567b0c 81 /** static host address in network byteorder */
nxpfan 0:075157567b0c 82 ip_addr_t addr;
nxpfan 0:075157567b0c 83 struct local_hostlist_entry *next;
nxpfan 0:075157567b0c 84 };
nxpfan 0:075157567b0c 85 #if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
nxpfan 0:075157567b0c 86 #ifndef DNS_LOCAL_HOSTLIST_MAX_NAMELEN
nxpfan 0:075157567b0c 87 #define DNS_LOCAL_HOSTLIST_MAX_NAMELEN DNS_MAX_NAME_LENGTH
nxpfan 0:075157567b0c 88 #endif
nxpfan 0:075157567b0c 89 #define LOCALHOSTLIST_ELEM_SIZE ((sizeof(struct local_hostlist_entry) + DNS_LOCAL_HOSTLIST_MAX_NAMELEN + 1))
nxpfan 0:075157567b0c 90 #endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
nxpfan 0:075157567b0c 91 #endif /* DNS_LOCAL_HOSTLIST */
nxpfan 0:075157567b0c 92
nxpfan 0:075157567b0c 93 /** Callback which is invoked when a hostname is found.
nxpfan 0:075157567b0c 94 * A function of this type must be implemented by the application using the DNS resolver.
nxpfan 0:075157567b0c 95 * @param name pointer to the name that was looked up.
nxpfan 0:075157567b0c 96 * @param ipaddr pointer to an ip_addr_t containing the IP address of the hostname,
nxpfan 0:075157567b0c 97 * or NULL if the name could not be found (or on any other error).
nxpfan 0:075157567b0c 98 * @param callback_arg a user-specified callback argument passed to dns_gethostbyname
nxpfan 0:075157567b0c 99 */
nxpfan 0:075157567b0c 100 typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg);
nxpfan 0:075157567b0c 101
nxpfan 0:075157567b0c 102 void dns_init(void);
nxpfan 0:075157567b0c 103 void dns_tmr(void);
nxpfan 0:075157567b0c 104 void dns_setserver(u8_t numdns, ip_addr_t *dnsserver);
nxpfan 0:075157567b0c 105 ip_addr_t dns_getserver(u8_t numdns);
nxpfan 0:075157567b0c 106 err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
nxpfan 0:075157567b0c 107 dns_found_callback found, void *callback_arg);
nxpfan 0:075157567b0c 108
nxpfan 0:075157567b0c 109 #if DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
nxpfan 0:075157567b0c 110 int dns_local_removehost(const char *hostname, const ip_addr_t *addr);
nxpfan 0:075157567b0c 111 err_t dns_local_addhost(const char *hostname, const ip_addr_t *addr);
nxpfan 0:075157567b0c 112 #endif /* DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
nxpfan 0:075157567b0c 113
nxpfan 0:075157567b0c 114 #endif /* LWIP_DNS */
nxpfan 0:075157567b0c 115
nxpfan 0:075157567b0c 116 #endif /* __LWIP_DNS_H__ */