* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
*
- * Written by Craig Edwards, Craig McLure, and others.
* This program is free but copyrighted software; see
- * the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
/**
* 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
*/
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
*/
enum QueryType
{
+ DNS_QUERY_NONE = 0, /* Uninitialized Query */
DNS_QUERY_A = 1, /* 'A' record: an ipv4 address */
DNS_QUERY_CNAME = 5, /* 'CNAME' record: An alias */
DNS_QUERY_PTR = 12, /* 'PTR' record: a hostname */
* 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.
*/
static const int MAX_REQUEST_ID = 0xFFFF;
- /**
- * Requests that are currently 'in flight'
- */
- requestlist requests;
-
/**
* Server address being used currently
*/
* 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.
*/
DNS(InspIRCd* Instance);
+ /**
+ * Re-initialize the DNS subsystem.
+ */
+ void Rehash();
+
/**
* Destructor
*/