]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/dns.h
Move all /WHOWAS related out of core and into cmd_whowas.
[user/henk/code/inspircd.git] / include / dns.h
index 4087e2476eef2bef4f176b1d583683bfa1236df5..cb7e0549a32b9f2ba3bd24f69d11970a6617c324 100644 (file)
@@ -50,7 +50,15 @@ class Module;
 /**
  * Result status, used internally
  */
-typedef std::pair<int,std::string> DNSResult;
+class DNSResult : public classbase
+{
+ public:
+       int id;
+       std::string result;
+       unsigned long ttl;
+
+       DNSResult(int i, const std::string &res, unsigned long timetolive) : id(i), result(res), ttl(timetolive) { }
+};
 
 /**
  * Information on a completed lookup, used internally
@@ -86,16 +94,6 @@ class DNSHeader;
  */
 class ResourceRecord;
 
-/**
- * A set of requests keyed by request id
- */
-typedef std::map<int,DNSRequest*> requestlist;
-
-/**
- * An iterator into a set of requests
- */
-typedef requestlist::iterator requestlist_iter;
-
 /**
  * Query and resource record types
  */
@@ -213,7 +211,7 @@ class Resolver : public Extensible
         * When your lookup completes, this method will be called.
         * @param result The resulting DNS lookup, either an IP address or a hostname.
         */
-       virtual void OnLookupComplete(const std::string &result) = 0;
+       virtual void OnLookupComplete(const std::string &result, unsigned int ttl) = 0;
        /**
         * If an error occurs (such as NXDOMAIN, no domain name found) then this method
         * will be called.
@@ -254,11 +252,6 @@ class DNS : public EventHandler
         */
        static const int MAX_REQUEST_ID = 0xFFFF;
 
-       /**
-        * Requests that are currently 'in flight'
-        */
-       requestlist requests;
-
        /**
         * Server address being used currently
         */
@@ -287,6 +280,10 @@ class DNS : public EventHandler
         * Currently active Resolver classes
         */
        Resolver* Classes[MAX_REQUEST_ID];
+       /**
+        * Requests that are currently 'in flight'
+        */
+       DNSRequest* requests[MAX_REQUEST_ID];
        /**
         * The port number DNS requests are made on,
         * and replies have as a source-port number.
@@ -363,6 +360,11 @@ class DNS : public EventHandler
         */
        DNS(InspIRCd* Instance);
 
+       /**
+        * Re-initialize the DNS subsystem.
+        */
+       void Rehash();
+
        /**
         * Destructor
         */