2 * lwip DNS resolver header file.
\r
4 * Author: Jim Pettinato
\r
7 * ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels.
\r
9 * Redistribution and use in source and binary forms, with or without
\r
10 * modification, are permitted provided that the following conditions
\r
12 * 1. Redistributions of source code must retain the above copyright
\r
13 * notice, this list of conditions and the following disclaimer.
\r
14 * 2. Redistributions in binary form must reproduce the above copyright
\r
15 * notice, this list of conditions and the following disclaimer in the
\r
16 * documentation and/or other materials provided with the distribution.
\r
17 * 3. The name of the author may not be used to endorse or promote
\r
18 * products derived from this software without specific prior
\r
19 * written permission.
\r
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
\r
22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
\r
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
\r
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
\r
27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
\r
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
\r
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
34 #ifndef __LWIP_DNS_H__
\r
35 #define __LWIP_DNS_H__
\r
37 #include "lwip/opt.h"
\r
39 #if LWIP_DNS /* don't build if not configured for use in lwipopts.h */
\r
41 /** DNS timer period */
\r
42 #define DNS_TMR_INTERVAL 1000
\r
44 /** DNS field TYPE used for "Resource Records" */
\r
45 #define DNS_RRTYPE_A 1 /* a host address */
\r
46 #define DNS_RRTYPE_NS 2 /* an authoritative name server */
\r
47 #define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */
\r
48 #define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */
\r
49 #define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */
\r
50 #define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */
\r
51 #define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */
\r
52 #define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */
\r
53 #define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */
\r
54 #define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */
\r
55 #define DNS_RRTYPE_WKS 11 /* a well known service description */
\r
56 #define DNS_RRTYPE_PTR 12 /* a domain name pointer */
\r
57 #define DNS_RRTYPE_HINFO 13 /* host information */
\r
58 #define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */
\r
59 #define DNS_RRTYPE_MX 15 /* mail exchange */
\r
60 #define DNS_RRTYPE_TXT 16 /* text strings */
\r
62 /** DNS field CLASS used for "Resource Records" */
\r
63 #define DNS_RRCLASS_IN 1 /* the Internet */
\r
64 #define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */
\r
65 #define DNS_RRCLASS_CH 3 /* the CHAOS class */
\r
66 #define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */
\r
67 #define DNS_RRCLASS_FLUSH 0x800 /* Flush bit */
\r
69 /** Callback which is invoked when a hostname is found.
\r
70 * A function of this type must be implemented by the application using the DNS resolver.
\r
71 * @param name pointer to the name that was looked up.
\r
72 * @param ipaddr pointer to a struct ip_addr containing the IP address of the hostname,
\r
73 * or NULL if the name could not be found (or on any other error).
\r
74 * @param callback_arg a user-specified callback argument passed to dns_gethostbyname
\r
76 typedef void (*dns_found_callback)(const char *name, struct ip_addr *ipaddr, void *callback_arg);
\r
79 void dns_init(void);
\r
83 void dns_setserver(u8_t numdns, struct ip_addr *dnsserver);
\r
85 struct ip_addr dns_getserver(u8_t numdns);
\r
87 err_t dns_gethostbyname(const char *hostname, struct ip_addr *addr,
\r
88 dns_found_callback found, void *callback_arg);
\r
90 #endif /* LWIP_DNS */
\r
92 #endif /* __LWIP_DNS_H__ */
\r