From f1ca6c6d71f3e31b333e0be45294bcb30fd89b4d Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 7 Jan 2007 21:35:25 +0000 Subject: DNS caching stuff (almost done) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6252 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/dns.h | 14 +++++++++++++- include/inspircd.h | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/dns.h b/include/dns.h index 83e4ab902..bfced4184 100644 --- a/include/dns.h +++ b/include/dns.h @@ -194,6 +194,16 @@ class Resolver : public Extensible * The core uses this to route results to the correct objects. */ int myid; + + /** + * Cached result, if there is one + */ + CachedQuery *CQ; + + /** + * Time left before cache expiry + */ + int time_left; public: /** * Initiate DNS lookup. Your class should not attempt to delete or free these @@ -238,7 +248,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, unsigned int ttl); + 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. @@ -260,6 +270,8 @@ class Resolver : public Extensible * Returns the creator module, or NULL */ Module* GetCreator(); + + void TriggerCachedResult(); }; /** DNS is a singleton class used by the core to dispatch dns diff --git a/include/inspircd.h b/include/inspircd.h index 3f6b702f1..136914276 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -885,9 +885,10 @@ class InspIRCd : public classbase /** Add a dns Resolver class to this server's active set * @param r The resolver to add + * @param cached The value of 'cached' which you passed to the Resolver constructor before this function. * @return True if the resolver was added */ - bool AddResolver(Resolver* r); + bool AddResolver(Resolver* r, bool cached); /** Add a command to this server's command parser * @param f A command_t command handler object to add -- cgit v1.2.3