diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-02 19:28:32 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-02 19:28:32 +0000 |
commit | 4705381691cba08c7d3e6ef982e2335bb7672960 (patch) | |
tree | 106520219a09d42534fccdff7fdff4b9504793f9 /include | |
parent | e877fb41803c301e28179bcd52d9912ebd37dc93 (diff) |
Added DNS class to documentation
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@952 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/dns.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/dns.h b/include/dns.h index 61c35b073..1b8c740ed 100644 --- a/include/dns.h +++ b/include/dns.h @@ -28,6 +28,10 @@ struct dns_ip4list { dns_ip4list *next; }; + +/** The DNS class allows fast nonblocking resolution of hostnames + * and ip addresses. It is based heavily upon firedns by Ian Gulliver. + */ class DNS { private: @@ -50,13 +54,40 @@ private: char *dns_ntoa4_r(const in_addr * const ip); char *dns_getresult_r(const int fd); public: + /** 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. + */ DNS(); + /** This constructor accepts a dns server address. The address must be in dotted + * decimal form, e.g. 1.2.3.4. + */ DNS(std::string dnsserver); + /** The destructor frees all used structures. + */ ~DNS(); + /** 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. + */ bool ReverseLookup(std::string ip); + /** This method will start the forward lookup of a hostname, e.g. www.inspircd.org, + * and returns true if the lookup was successfully initiated. + */ bool ForwardLookup(std::string host); + /** This method will return true when the lookup is completed. It uses poll internally + * to determine the status of the socket. + */ bool HasResult(); + /** This method returns the result of your query as a string, depending upon wether you + * called DNS::ReverseLookup() or DNS::ForwardLookup. + */ std::string GetResult(); + /** 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. + */ int GetFD(); }; |