NetBurner 3.3.9
PDF Version
DNS - Domain Name System

Modules

 DNS Record Types
 
 DNS Return Codes
 

Functions

int GetHostByName4 (const char *name, IPADDR4 *pIpaddr, IPADDR4 dns_server, uint16_t timeout, uint16_t TYPE=DNS_A)
 Get the IPv4 address associated with the specified domain name. More...
 
int GetHostByName6 (const char *name, IPADDR *pIpaddr, const IPADDR &dns_server, uint16_t timeout, uint16_t TYPE1=DNS_A, uint16_t TYPE2=DNS_AAAA)
 Get the IPv6 address associated with the specified domain name. More...
 

Detailed Description

The Doman Name System (DNS) is used to look up the IP address for a DNS name, such as www.mysite.com. Applications normally use IPADDR objects as opposed to IPADDR4 and IPADDR, because it can hold either a IPv4 or IPv6 address. You can then use the GetHostByName() function instead of the GetHostByName4() or GetHostByName6().

Function Documentation

◆ GetHostByName4()

int GetHostByName4 ( const char *  name,
IPADDR4 pIpaddr,
IPADDR4  dns_server,
uint16_t  timeout,
uint16_t  TYPE = DNS_A 
)

Get the IPv4 address associated with the specified domain name.

Calling GetHostByName() in dual stack mode will automatically call the correct IPv4 or IPv6 function

Parameters
*namePointer to domain name to resolve
*pIpaddrPointer to variable of type IPADDR4 to store resultant IP address
&dns_serverSpecified the DNS server to use. Pass INADDR_ANY to use the DNS server associated with the interface
timeoutTime to wait for the DNS response, specified in TICKS_PER_SECOND
TYPEOptional DNS record type. If no type is specified the default is IPv4 DNS_A
Returns
DNS Return Codes
See also
GetHostByName6()

◆ GetHostByName6()

int GetHostByName6 ( const char *  name,
IPADDR pIpaddr,
const IPADDR dns_server,
uint16_t  timeout,
uint16_t  TYPE1 = DNS_A,
uint16_t  TYPE2 = DNS_AAAA 
)

Get the IPv6 address associated with the specified domain name.

Calling GetHostByName() in dual stack mode will automatically call the correct IPv4 or IPv6 function.

The function will attempt to retrieve record type 1 first. If successful the function returns. If if the attempt using type 1 fails, the function will attempt to get a record using the type 2 parameter. For example, lets say you wish your code to use IPv6, but its OK to fall back to IPv4. You can set type 1 to DNS_AAAA and type2 to DNS_A.

Parameters
*namePointer to domain name to resolve
*pIpaddrPointer to variable of type IPADDR4 to store resultant IP address
&dns_serverSpecified the DNS server to use. Pass INADDR_ANY to use the DNS server associated with the interface.
timeoutTime to wait for the DNS response, specified in TICKS_PER_SECOND
TYPE1Optional record type. If not specified will default to IPv4 DNS_A
TYPE2Optional record type. If not specified will default to IPv6 DNS_AAAA
Returns
DNS Return Codes
See also
GetHostByName4()