1 #ifndef __RESOLVERS__H__
2 #define __RESOLVERS__H__
4 #include "configreader.h"
8 #include "commands/cmd_whois.h"
9 #include "commands/cmd_stats.h"
14 #include "transport.h"
16 #include "m_spanningtree/utils.h"
17 #include "m_spanningtree/link.h"
19 /** Handle resolving of server IPs for the cache
21 class SecurityIPResolver : public Resolver
25 SpanningTreeUtilities* Utils;
27 SecurityIPResolver(Module* me, SpanningTreeUtilities* U, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached)
28 : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), MyLink(x), Utils(U)
32 void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)
34 Utils->ValidIPs.push_back(result);
37 void OnError(ResolverError e, const std::string &errormessage)
39 ServerInstance->Log(DEFAULT,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str());
43 /** This class is used to resolve server hostnames during /connect and autoconnect.
44 * As of 1.1, the resolver system is seperated out from InspSocket, so we must do this
45 * resolver step first ourselves if we need it. This is totally nonblocking, and will
46 * callback to OnLookupComplete or OnError when completed. Once it has completed we
47 * will have an IP address which we can then use to continue our connection.
49 class ServernameResolver : public Resolver
52 /** A copy of the Link tag info for what we're connecting to.
53 * We take a copy, rather than using a pointer, just in case the
54 * admin takes the tag away and rehashes while the domain is resolving.
57 SpanningTreeUtilities* Utils;
59 ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached);
60 void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached);
61 void OnError(ResolverError e, const std::string &errormessage);