#include <dns.h>
Collaboration diagram for DNS:
Public Member Functions | |
DNS () | |
The default constructor uses dns addresses read from /etc/resolv.conf. | |
DNS (std::string dnsserver) | |
This constructor accepts a dns server address. | |
~DNS () | |
The destructor frees all used structures. | |
bool | ReverseLookup (std::string ip) |
This method will start the reverse lookup of an ip given in dotted decimal format, e.g. | |
bool | ForwardLookup (std::string host) |
This method will start the forward lookup of a hostname, e.g. | |
bool | HasResult () |
This method will return true when the lookup is completed. | |
std::string | GetResult () |
This method returns the result of your query as a string, depending upon wether you called DNS::ReverseLookup() or DNS::ForwardLookup. | |
int | GetFD () |
This method returns the file handle used by the dns query socket or zero if the query is invalid for some reason, e.g. | |
void | SetNS (std::string dnsserver) |
Private Member Functions | |
void | dns_init () |
void | dns_init_2 (const char *dnsserver) |
in_addr * | dns_aton4 (const char *const ipstring) |
char * | dns_ntoa4 (const in_addr *const ip) |
int | dns_getip4 (const char *const name) |
int | dns_getip4list (const char *const name) |
int | dns_getname4 (const in_addr *const ip) |
char * | dns_getresult (const int fd) |
in_addr * | dns_aton4_s (const char *const ipstring, in_addr *const ip) |
char * | dns_ntoa4_s (const in_addr *const ip, char *const result) |
char * | dns_getresult_s (const int fd, char *const result) |
in_addr * | dns_aton4_r (const char *const ipstring) |
char * | dns_ntoa4_r (const in_addr *const ip) |
char * | dns_getresult_r (const int fd) |
Private Attributes | |
in_addr * | binip |
char * | result |
int | t |
unsigned int | fd |
It is based heavily upon firedns by Ian Gulliver.
Definition at line 35 of file dns.h.
|
The default constructor uses dns addresses read from /etc/resolv.conf. Please note that it will re-read /etc/resolv.conf for each copy of the class you instantiate, causing disk access and slow lookups if you create a lot of them. Consider passing the constructor a server address as a parameter instead. |
|
This constructor accepts a dns server address. The address must be in dotted decimal form, e.g. 1.2.3.4. |
|
The destructor frees all used structures.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This method will start the forward lookup of a hostname, e.g. www.inspircd.org, and returns true if the lookup was successfully initiated. |
|
This method returns the file handle used by the dns query socket or zero if the query is invalid for some reason, e.g. the dns server not responding. |
|
This method returns the result of your query as a string, depending upon wether you called DNS::ReverseLookup() or DNS::ForwardLookup.
|
|
This method will return true when the lookup is completed. It uses poll internally to determine the status of the socket. |
|
This method will start the reverse lookup of an ip given in dotted decimal format, e.g. 1.2.3.4, and returns true if the lookup was successfully initiated. |
|
|
|
|
|
|
|
|
|
|