#include "lwip/opt.h"
Macros | |
#define | DNS_RRCLASS_CH 3 /* the CHAOS class */ |
#define | DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */ |
#define | DNS_RRCLASS_FLUSH 0x800 /* Flush bit */ |
#define | DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */ |
#define | DNS_RRCLASS_IN 1 /* the Internet */ |
DNS field CLASS used for "Resource Records". More... | |
#define | DNS_RRTYPE_A 1 /* a host address */ |
DNS field TYPE used for "Resource Records". More... | |
#define | DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */ |
#define | DNS_RRTYPE_HINFO 13 /* host information */ |
#define | DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */ |
#define | DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */ |
#define | DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */ |
#define | DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */ |
#define | DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */ |
#define | DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */ |
#define | DNS_RRTYPE_MX 15 /* mail exchange */ |
#define | DNS_RRTYPE_NS 2 /* an authoritative name server */ |
#define | DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */ |
#define | DNS_RRTYPE_PTR 12 /* a domain name pointer */ |
#define | DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */ |
#define | DNS_RRTYPE_TXT 16 /* text strings */ |
#define | DNS_RRTYPE_WKS 11 /* a well known service description */ |
#define | DNS_TMR_INTERVAL 1000 |
lwip DNS resolver header file. More... | |
Typedefs | |
typedef void(* | dns_found_callback )(const char *name, ip_addr_t *ipaddr, void *callback_arg) |
Callback which is invoked when a hostname is found. More... | |
Functions | |
err_t | dns_gethostbyname (const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg) |
Resolve a hostname (string) into an IP address. More... | |
ip_addr_t * | dns_getserver (u8_t numdns) |
Obtain one of the currently configured DNS server. More... | |
void | dns_init (void) |
Initialize the resolver: set up the UDP pcb and configure the default server (DNS_SERVER_ADDRESS). More... | |
void | dns_setserver (u8_t numdns, ip_addr_t *dnsserver) |
Initialize one of the DNS servers. More... | |
void | dns_tmr (void) |
The DNS resolver client timer - handle retries and timeouts and should be called every DNS_TMR_INTERVAL milliseconds (every second by default). More... | |
#define DNS_RRCLASS_CH 3 /* the CHAOS class */ |
#define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */ |
#define DNS_RRCLASS_FLUSH 0x800 /* Flush bit */ |
#define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */ |
#define DNS_RRCLASS_IN 1 /* the Internet */ |
DNS field CLASS used for "Resource Records".
Referenced by dns_recv(), and dns_send().
#define DNS_RRTYPE_A 1 /* a host address */ |
DNS field TYPE used for "Resource Records".
Referenced by dns_recv(), and dns_send().
#define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */ |
#define DNS_RRTYPE_HINFO 13 /* host information */ |
#define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */ |
#define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */ |
#define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */ |
#define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */ |
#define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */ |
#define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */ |
#define DNS_RRTYPE_MX 15 /* mail exchange */ |
#define DNS_RRTYPE_NS 2 /* an authoritative name server */ |
#define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */ |
#define DNS_RRTYPE_PTR 12 /* a domain name pointer */ |
#define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */ |
#define DNS_RRTYPE_TXT 16 /* text strings */ |
#define DNS_RRTYPE_WKS 11 /* a well known service description */ |
#define DNS_TMR_INTERVAL 1000 |
lwip DNS resolver header file.
Author: Jim Pettinato April 2007
ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.DNS timer period
Referenced by dns_timer(), and sys_timeouts_init().
Callback which is invoked when a hostname is found.
A function of this type must be implemented by the application using the DNS resolver.
name | pointer to the name that was looked up. |
ipaddr | pointer to an ip_addr_t containing the IP address of the hostname, or NULL if the name could not be found (or on any other error). |
callback_arg | a user-specified callback argument passed to dns_gethostbyname |
err_t dns_gethostbyname | ( | const char * | hostname, |
ip_addr_t * | addr, | ||
dns_found_callback | found, | ||
void * | callback_arg | ||
) |
Resolve a hostname (string) into an IP address.
NON-BLOCKING callback version for use with raw API!!!
Returns immediately with one of err_t return codes:
hostname | the hostname that is to be queried |
addr | pointer to a ip_addr_t where to store the address if it is already cached in the dns_table (only valid if ERR_OK is returned!) |
found | a callback function to be called on success, failure or timeout (only if ERR_INPROGRESS is returned!) |
callback_arg | argument to pass to the callback function |
References DNS_DEBUG, dns_enqueue(), dns_lookup(), ERR_ARG, ERR_OK, ip4_addr_set_u32, ip_addr_set_loopback, ipaddr_addr(), IPADDR_NONE, LWIP_DEBUGF, and NULL.
Referenced by lwip_netconn_do_gethostbyname().
Obtain one of the currently configured DNS server.
numdns | the index of the DNS server |
References dns_servers, and IP_ADDR_ANY.
Initialize the resolver: set up the UDP pcb and configure the default server (DNS_SERVER_ADDRESS).
References DNS_DEBUG, dns_recv(), DNS_SERVER_ADDRESS, dns_setserver(), DNS_STATE_UNUSED, IP_ADDR_ANY, LWIP_ASSERT, LWIP_DEBUGF, NULL, SIZEOF_DNS_ANSWER_ASSERT, SIZEOF_DNS_QUERY, udp_bind(), udp_new(), and udp_recv().
Referenced by lwip_init().
Initialize one of the DNS servers.
numdns | the index of the DNS server to set must be < DNS_MAX_SERVERS |
dnsserver | IP address of the DNS server to set |
References dns_servers, IP_ADDR_ANY, and NULL.
Referenced by dhcp_handle_ack(), and dns_init().
The DNS resolver client timer - handle retries and timeouts and should be called every DNS_TMR_INTERVAL milliseconds (every second by default).
References dns_check_entries(), DNS_DEBUG, and LWIP_DEBUGF.
Referenced by dns_timer().