NetBurner 3.5.0
PDF Version |
|
Topics | |
DNS Record Types | |
DNS Return Codes | |
Functions | |
bool | IsNameIPAddress (const char *name) |
Determine if the name is a valid IP Address and does not need to be looked up. | |
int | fd_dns_part1 (const char *name, const IPADDR &dns_server, uint16_t TYPE=DNS_A, uint16_t TYPE2=0, int ifn=-1) |
Open a UDP socket and initiate a DNS lookup. | |
bool | fd_dns_processresult (int fd, const char *name, IPADDR &addr_out, uint16_t TYPE=DNS_A, uint16_t TYPE2=DNS_AAAA, uint32_t *ttl=0) |
Process any responses on the UDP socket opened for DNS. | |
int | fd_outstanding_Responses (int fd) |
Check to see if there are any outstanding DNS requests. | |
bool | AnyDNSInterFaceActive () |
Determine if we have an active DNS route; DNS server is set for an active interface. | |
int | GetHostByName (const char *name, IPADDR *pIpaddr, const IPADDR &dns_server, const TickTimeout tout, uint16_t TYPE1=DNS_A, uint16_t TYPE2=extra_dns_t, uint32_t *ttl=NULL) |
Get the IP address associated with the specified domain name. | |
int | GetHostByNameViaIfNum (const char *name, IPADDR *pIpaddr, const IPADDR &dns_server, int ifn, const TickTimeout &tout, uint16_t TYPE1=DNS_A, uint16_t TYPE2=extra_dns_t, uint32_t *ttl=NULL) |
Get the IP address associated with the specified domain name on a specific interface. | |
#include< dns.h >
The current DNS system is agnostic about the use of IPADDR, IPADDR6 or IPADDR4. The capability of C++ is such that you pass in any of those types and the compiler will select the correct function for that type. This is a change from tools versions 3.4.0 and earlier in which explicit IPv4 and IPv6 functions were used.
The DNS system can be accessed as a blocking or synchronous operation with: GetHostByName(). If you want to do asynchronous non-blocking lookups, please refer to the functions:
bool AnyDNSInterFaceActive | ( | ) |
#include <dns.h>
Determine if we have an active DNS route; DNS server is set for an active interface.
int fd_dns_part1 | ( | const char * | name, |
const IPADDR & | dns_server, | ||
uint16_t | TYPE = DNS_A, | ||
uint16_t | TYPE2 = 0, | ||
int | ifn = -1 ) |
#include <dns.h>
Open a UDP socket and initiate a DNS lookup.
This socket can be put in a select and used for asynchronous DNS lookups. Opens a UDP receive FD and sends DNS queries.
name | Pointer to domain name to resolve |
dns_server | Reference to the DNS server to use. Pass INADDR_ANY to use the DNS server associated with the interface. |
TYPE | Optional DNS record type. If no type is specified the default is IPv4 DNS_A |
TYPE2 | Optional 2nd DNS record type. If no type is specified the default is no look up |
ifn | Which interface to use -1 uses the default active DNS interface |
bool fd_dns_processresult | ( | int | fd, |
const char * | name, | ||
IPADDR & | addr_out, | ||
uint16_t | TYPE = DNS_A, | ||
uint16_t | TYPE2 = DNS_AAAA, | ||
uint32_t * | ttl = 0 ) |
#include <dns.h>
Process any responses on the UDP socket opened for DNS.
This should only be called when the socket has data, otherwise it will block.
fd | The file descriptor opened with fd_dns_part1 |
name | Pointer to domain name to resolve |
addr_out | Reference to IPADDR variable to hold the result |
TYPE | DNS record type. If no type is specified the default is IPv4 DNS_A |
TYPE2 | 2nd DNS record type. If no type is specified the default is no look up |
ttl | Optional pointer to return variable for TimeToLive value for DNS record |
int fd_outstanding_Responses | ( | int | fd | ) |
#include <dns.h>
Check to see if there are any outstanding DNS requests.
If this returns 0 then all DNS responses have been processed and one can assume ther eis no such name.
fd | The file descriptor opened with fd_dns_part1 |
|
inline |
#include <dns.h>
Get the IP 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.
*name | Pointer to domain name to resolve |
*pIpaddr | Pointer to variable of type IPADDR (or IPADDR4) to store resultant IP address. |
&dns_server | Specified the DNS server to use. Pass INADDR_ANY to use the DNS server associated with the interface. |
tout | Number of time ticks to wait of type TickTimeout |
TYPE1 | Optional record type. If not specified will default to IPv4 DNS_A |
TYPE2 | Optional record type. If not specified will default to IPv6 DNS_AAAA |
ttl | Optional pointer to return variable for TimeToLive value for DNS record |
|
inline |
#include <dns.h>
Get the IP address associated with the specified domain name on a specific interface.
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.
*name | Pointer to domain name to resolve |
*pIpaddr | Pointer to variable of type IPADDR to store resultant IP address |
&dns_server | Specified the DNS server to use. Pass INADDR_ANY to use the DNS server associated with the interface. |
tout | A reference to the number of time ticks to wait of type TickTimeout |
TYPE1 | Optional record type. If not specified will default to IPv4 DNS_A |
TYPE2 | Optional record type. If not specified will default to IPv6 DNS_AAAA |
ifn | Interface number |
ttl | Optional pointer to return variable for TimeToLive value for DNS record |
bool IsNameIPAddress | ( | const char * | name | ) |
#include <dns.h>
Determine if the name is a valid IP Address and does not need to be looked up.
*name | Pointer to domain name to check |