.TH "DNS" 3 "2 Apr 2005" "InspIRCd" \" -*- nroff -*- .ad l .nh .SH NAME DNS \- The DNS class allows fast nonblocking resolution of hostnames and ip addresses. .PP .SH SYNOPSIS .br .PP \fC#include \fP .PP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBDNS\fP ()" .br .RI "\fIThe default constructor uses dns addresses read from /etc/resolv.conf. \fP" .ti -1c .RI "\fBDNS\fP (std::string dnsserver)" .br .RI "\fIThis constructor accepts a dns server address. \fP" .ti -1c .RI "\fB~DNS\fP ()" .br .RI "\fIThe destructor frees all used structures. \fP" .ti -1c .RI "bool \fBReverseLookup\fP (std::string ip)" .br .RI "\fIThis method will start the reverse lookup of an ip given in dotted decimal format, e.g. \fP" .ti -1c .RI "bool \fBForwardLookup\fP (std::string host)" .br .RI "\fIThis method will start the forward lookup of a hostname, e.g. \fP" .ti -1c .RI "bool \fBHasResult\fP ()" .br .RI "\fIThis method will return true when the lookup is completed. \fP" .ti -1c .RI "std::string \fBGetResult\fP ()" .br .RI "\fIThis method returns the result of your query as a string, depending upon wether you called \fBDNS::ReverseLookup()\fP or \fBDNS::ForwardLookup\fP. \fP" .ti -1c .RI "int \fBGetFD\fP ()" .br .RI "\fIThis method returns the file handle used by the dns query socket or zero if the query is invalid for some reason, e.g. \fP" .in -1c .SS "Private Member Functions" .in +1c .ti -1c .RI "void \fBdns_init\fP ()" .br .ti -1c .RI "void \fBdns_init_2\fP (const char *dnsserver)" .br .ti -1c .RI "in_addr * \fBdns_aton4\fP (const char *const ipstring)" .br .ti -1c .RI "char * \fBdns_ntoa4\fP (const in_addr *const ip)" .br .ti -1c .RI "int \fBdns_getip4\fP (const char *const name)" .br .ti -1c .RI "int \fBdns_getip4list\fP (const char *const name)" .br .ti -1c .RI "int \fBdns_getname4\fP (const in_addr *const ip)" .br .ti -1c .RI "char * \fBdns_getresult\fP (const int \fBfd\fP)" .br .ti -1c .RI "in_addr * \fBdns_aton4_s\fP (const char *const ipstring, in_addr *const ip)" .br .ti -1c .RI "char * \fBdns_ntoa4_s\fP (const in_addr *const ip, char *const \fBresult\fP)" .br .ti -1c .RI "char * \fBdns_getresult_s\fP (const int \fBfd\fP, char *const \fBresult\fP)" .br .ti -1c .RI "in_addr * \fBdns_aton4_r\fP (const char *const ipstring)" .br .ti -1c .RI "char * \fBdns_ntoa4_r\fP (const in_addr *const ip)" .br .ti -1c .RI "char * \fBdns_getresult_r\fP (const int \fBfd\fP)" .br .in -1c .SS "Private Attributes" .in +1c .ti -1c .RI "char * \fBresult\fP" .br .ti -1c .RI "in_addr * \fBbinip\fP" .br .ti -1c .RI "int \fBt\fP" .br .ti -1c .RI "int \fBi\fP" .br .ti -1c .RI "unsigned int \fBfd\fP" .br .in -1c .SH "Detailed Description" .PP The DNS class allows fast nonblocking resolution of hostnames and ip addresses. It is based heavily upon firedns by Ian Gulliver. .PP Definition at line 35 of file dns.h. .SH "Constructor & Destructor Documentation" .PP .SS "DNS::DNS ()" .PP 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. .SS "DNS::DNS (std::string dnsserver)" .PP This constructor accepts a dns server address. The address must be in dotted decimal form, e.g. 1.2.3.4. .SS "DNS::~\fBDNS\fP ()" .PP The destructor frees all used structures. .SH "Member Function Documentation" .PP .SS "in_addr* DNS::dns_aton4 (const char *const ipstring)\fC [private]\fP" .PP .SS "in_addr* DNS::dns_aton4_r (const char *const ipstring)\fC [private]\fP" .PP .SS "in_addr* DNS::dns_aton4_s (const char *const ipstring, in_addr *const ip)\fC [private]\fP" .PP .SS "int DNS::dns_getip4 (const char *const name)\fC [private]\fP" .PP .SS "int DNS::dns_getip4list (const char *const name)\fC [private]\fP" .PP .SS "int DNS::dns_getname4 (const in_addr *const ip)\fC [private]\fP" .PP .SS "char* DNS::dns_getresult (const int fd)\fC [private]\fP" .PP .SS "char* DNS::dns_getresult_r (const int fd)\fC [private]\fP" .PP .SS "char* DNS::dns_getresult_s (const int fd, char *const result)\fC [private]\fP" .PP .SS "void DNS::dns_init ()\fC [private]\fP" .PP .SS "void DNS::dns_init_2 (const char * dnsserver)\fC [private]\fP" .PP .SS "char* DNS::dns_ntoa4 (const in_addr *const ip)\fC [private]\fP" .PP .SS "char* DNS::dns_ntoa4_r (const in_addr *const ip)\fC [private]\fP" .PP .SS "char* DNS::dns_ntoa4_s (const in_addr *const ip, char *const result)\fC [private]\fP" .PP .SS "bool DNS::ForwardLookup (std::string host)" .PP This method will start the forward lookup of a hostname, e.g. www.inspircd.org, and returns true if the lookup was successfully initiated. .SS "int DNS::GetFD ()" .PP 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. .SS "std::string DNS::GetResult ()" .PP This method returns the result of your query as a string, depending upon wether you called \fBDNS::ReverseLookup()\fP or \fBDNS::ForwardLookup\fP. .SS "bool DNS::HasResult ()" .PP This method will return true when the lookup is completed. It uses poll internally to determine the status of the socket. .SS "bool DNS::ReverseLookup (std::string ip)" .PP 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. .SH "Member Data Documentation" .PP .SS "in_addr* \fBDNS::binip\fP\fC [private]\fP" .PP Definition at line 39 of file dns.h. .SS "unsigned int \fBDNS::fd\fP\fC [private]\fP" .PP Definition at line 42 of file dns.h. .SS "int \fBDNS::i\fP\fC [private]\fP" .PP Definition at line 40 of file dns.h. .SS "char* \fBDNS::result\fP\fC [private]\fP" .PP Definition at line 38 of file dns.h. .SS "int \fBDNS::t\fP\fC [private]\fP" .PP Definition at line 40 of file dns.h. .SH "Author" .PP Generated automatically by Doxygen for InspIRCd from the source code.