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