]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/dns.h
XHTML 1.1 spec validation and charset
[user/henk/code/inspircd.git] / include / dns.h
index 91e65577561fe6fc9035ca9d1966afe5ca3ba9ad..b0dc3636f0caf4cc189147937425ed700cbd21a1 100644 (file)
@@ -18,12 +18,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #ifndef _DNS_H
 #define _DNS_H
 
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
 #include <string>
+#include "inspircd_config.h"
+#include "socket.h"
+#include "base.h"
 
-struct dns_ip4list {
+struct dns_ip4list
+{
        in_addr ip;
        dns_ip4list *next;
 };
@@ -32,7 +33,7 @@ struct dns_ip4list {
 /** The DNS class allows fast nonblocking resolution of hostnames
  * and ip addresses. It is based heavily upon firedns by Ian Gulliver.
  */
-class DNS
+class DNS : public Extensible
 {
 private:
        in_addr *binip;
@@ -65,7 +66,7 @@ public:
        /** 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);
+       DNS(const std::string &dnsserver);
        /** The destructor frees all used structures.
         */
        ~DNS();
@@ -73,14 +74,14 @@ public:
         * format, e.g. 1.2.3.4, and returns true if the lookup was successfully
         * initiated.
         */
-       bool ReverseLookup(std::string ip);
+       bool ReverseLookup(const 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);
+       bool ForwardLookup(const std::string &host);
        /** Used by modules to perform a dns lookup but have the socket engine poll a module, instead of the dns object directly.
         */
-       bool ForwardLookupWithFD(std::string host, int &fd);
+       bool ForwardLookupWithFD(const std::string &host, int &fd);
        /** This method will return true when the lookup is completed. It uses poll internally
         * to determine the status of the socket.
         */
@@ -97,7 +98,7 @@ public:
         * query is invalid for some reason, e.g. the dns server not responding.
         */
        int GetFD();
-       void SetNS(std::string dnsserver);
+       void SetNS(const std::string &dnsserver);
 };
 
 /** This is the handler function for multi-threaded DNS.