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