Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/lwip/dns.h need to be fixed.

0001 /**
0002  * lwip DNS resolver header file.
0003 
0004  * Author: Jim Pettinato 
0005  *   April 2007
0006 
0007  * ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels.
0008  *
0009  * Redistribution and use in source and binary forms, with or without
0010  * modification, are permitted provided that the following conditions
0011  * are met:
0012  * 1. Redistributions of source code must retain the above copyright
0013  *    notice, this list of conditions and the following disclaimer.
0014  * 2. Redistributions in binary form must reproduce the above copyright
0015  *    notice, this list of conditions and the following disclaimer in the
0016  *    documentation and/or other materials provided with the distribution.
0017  * 3. The name of the author may not be used to endorse or promote
0018  *    products derived from this software without specific prior
0019  *    written permission.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
0022  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
0023  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
0025  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0026  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
0027  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
0029  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
0030  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
0031  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0032  */
0033 
0034 #ifndef __LWIP_DNS_H__
0035 #define __LWIP_DNS_H__
0036 
0037 #include "lwip/opt.h"
0038 
0039 #if LWIP_DNS /* don't build if not configured for use in lwipopts.h */
0040 
0041 /** DNS timer period */
0042 #define DNS_TMR_INTERVAL          1000
0043 
0044 /** DNS field TYPE used for "Resource Records" */
0045 #define DNS_RRTYPE_A              1     /* a host address */
0046 #define DNS_RRTYPE_NS             2     /* an authoritative name server */
0047 #define DNS_RRTYPE_MD             3     /* a mail destination (Obsolete - use MX) */
0048 #define DNS_RRTYPE_MF             4     /* a mail forwarder (Obsolete - use MX) */
0049 #define DNS_RRTYPE_CNAME          5     /* the canonical name for an alias */
0050 #define DNS_RRTYPE_SOA            6     /* marks the start of a zone of authority */
0051 #define DNS_RRTYPE_MB             7     /* a mailbox domain name (EXPERIMENTAL) */
0052 #define DNS_RRTYPE_MG             8     /* a mail group member (EXPERIMENTAL) */
0053 #define DNS_RRTYPE_MR             9     /* a mail rename domain name (EXPERIMENTAL) */
0054 #define DNS_RRTYPE_NULL           10    /* a null RR (EXPERIMENTAL) */
0055 #define DNS_RRTYPE_WKS            11    /* a well known service description */
0056 #define DNS_RRTYPE_PTR            12    /* a domain name pointer */
0057 #define DNS_RRTYPE_HINFO          13    /* host information */
0058 #define DNS_RRTYPE_MINFO          14    /* mailbox or mail list information */
0059 #define DNS_RRTYPE_MX             15    /* mail exchange */
0060 #define DNS_RRTYPE_TXT            16    /* text strings */
0061 
0062 /** DNS field CLASS used for "Resource Records" */
0063 #define DNS_RRCLASS_IN            1     /* the Internet */
0064 #define DNS_RRCLASS_CS            2     /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */
0065 #define DNS_RRCLASS_CH            3     /* the CHAOS class */
0066 #define DNS_RRCLASS_HS            4     /* Hesiod [Dyer 87] */
0067 #define DNS_RRCLASS_FLUSH         0x800 /* Flush bit */
0068 
0069 /** Callback which is invoked when a hostname is found.
0070  * A function of this type must be implemented by the application using the DNS resolver.
0071  * @param name pointer to the name that was looked up.
0072  * @param ipaddr pointer to a struct ip_addr containing the IP address of the hostname,
0073  *        or NULL if the name could not be found (or on any other error).
0074  * @param callback_arg a user-specified callback argument passed to dns_gethostbyname
0075 */
0076 typedef void (*dns_found_callback)(const char *name, struct ip_addr *ipaddr, void *callback_arg);
0077 
0078 
0079 void           dns_init(void);
0080 
0081 void           dns_tmr(void);
0082 
0083 void           dns_setserver(u8_t numdns, struct ip_addr *dnsserver);
0084 
0085 struct ip_addr dns_getserver(u8_t numdns);
0086 
0087 err_t          dns_gethostbyname(const char *hostname, struct ip_addr *addr,
0088                                  dns_found_callback found, void *callback_arg);
0089 
0090 #if DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
0091 int            dns_local_removehost(const char *hostname, const struct ip_addr *addr);
0092 err_t          dns_local_addhost(const char *hostname, const struct ip_addr *addr);
0093 #endif /* DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
0094 
0095 #endif /* LWIP_DNS */
0096 
0097 #endif /* __LWIP_DNS_H__ */