dns.c File Reference


Data Structures

struct  dns_hdr
struct  dns_query
struct  dns_answer
struct  dns_table_entry

Functions

void dns_init ()
void dns_setserver (u8_t numdns, struct ip_addr *dnsserver)
struct ip_addr dns_getserver (u8_t numdns)
void dns_tmr (void)
err_t dns_gethostbyname (const char *hostname, struct ip_addr *addr, dns_found_callback found, void *callback_arg)

Detailed Description

DNS - host name to IP address resolver.

Function Documentation

err_t dns_gethostbyname ( const char *  hostname,
struct ip_addr *  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:

Parameters:
hostname the hostname that is to be queried
addr pointer to a struct ip_addr 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
Returns:
a err_t return code.

struct ip_addr dns_getserver ( u8_t  numdns  )  [read]

Obtain one of the currently configured DNS server.

Parameters:
numdns the index of the DNS server
Returns:
IP address of the indexed DNS server or "ip_addr_any" if the DNS server has not been configured.

void dns_init ( void   ) 

Initialize the resolver: set up the UDP pcb and configure the default server (DNS_SERVER_ADDRESS).

void dns_setserver ( u8_t  numdns,
struct ip_addr *  dnsserver 
)

Initialize one of the DNS servers.

Parameters:
numdns the index of the DNS server to set must be < DNS_MAX_SERVERS
dnsserver IP address of the DNS server to set

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).


Generated on Sun Mar 23 19:22:46 2008 for lwIP 1.3.0 by  doxygen 1.5.4