]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/resolvers.h
'svn propset -R svn:eol-style CR *' Set to UNIX-style always. Binaries are auto skipp...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / resolvers.h
index 06fd05bad1ce15857d10b4329380ea9106ac8d59..0ba9d6bd6b81277fcd3b570291604fc1687284d2 100644 (file)
@@ -1,90 +1 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
- *
- * This program is free but copyrighted software; see
- *            the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __RESOLVERS__H__
-#define __RESOLVERS__H__
-
-#include "configreader.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
-#include "socket.h"
-#include "inspircd.h"
-#include "wildcard.h"
-#include "xline.h"
-#include "transport.h"
-
-#include "m_spanningtree/utils.h"
-#include "m_spanningtree/link.h"
-
-/** Handle resolving of server IPs for the cache
- */
-class SecurityIPResolver : public Resolver
-{
- private:
-       Link MyLink;
-       SpanningTreeUtilities* Utils;
-       Module* mine;
-       std::string host;
-       QueryType query;
- public:
-       SecurityIPResolver(Module* me, SpanningTreeUtilities* U, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt)
-               : Resolver(Instance, hostname, qt, cached, me), MyLink(x), Utils(U), mine(me), host(hostname), query(qt)
-       {
-       }
-
-       void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)
-       {
-               Utils->ValidIPs.push_back(result);
-       }
-
-       void OnError(ResolverError e, const std::string &errormessage)
-       {
-               if (query == DNS_QUERY_AAAA)
-               {
-                       bool cached;
-                       SecurityIPResolver* res = new SecurityIPResolver(mine, Utils, ServerInstance, host, MyLink, cached, DNS_QUERY_A);
-                       ServerInstance->AddResolver(res, cached);
-                       return;
-               }
-               ServerInstance->Log(DEFAULT,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str());
-       }
-};
-
-/** This class is used to resolve server hostnames during /connect and autoconnect.
- * As of 1.1, the resolver system is seperated out from InspSocket, so we must do this
- * resolver step first ourselves if we need it. This is totally nonblocking, and will
- * callback to OnLookupComplete or OnError when completed. Once it has completed we
- * will have an IP address which we can then use to continue our connection.
- */
-class ServernameResolver : public Resolver
-{
- private:
-        /** A copy of the Link tag info for what we're connecting to.
-         * We take a copy, rather than using a pointer, just in case the
-         * admin takes the tag away and rehashes while the domain is resolving.
-         */
-        Link MyLink;
-        SpanningTreeUtilities* Utils;
-       QueryType query;
-       std::string host;
-       Module* mine;
- public:
-        ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt);
-        void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached);
-        void OnError(ResolverError e, const std::string &errormessage);
-};
-
-#endif
+/*       +------------------------------------+\r *       | Inspire Internet Relay Chat Daemon |\r *       +------------------------------------+\r *\r *  InspIRCd: (C) 2002-2007 InspIRCd Development Team\r * See: http://www.inspircd.org/wiki/index.php/Credits\r *\r * This program is free but copyrighted software; see\r *            the file COPYING for details.\r *\r * ---------------------------------------------------\r */\r\r#ifndef __RESOLVERS__H__\r#define __RESOLVERS__H__\r\r#include "configreader.h"\r#include "users.h"\r#include "channels.h"\r#include "modules.h"\r#include "commands/cmd_whois.h"\r#include "commands/cmd_stats.h"\r#include "socket.h"\r#include "inspircd.h"\r#include "wildcard.h"\r#include "xline.h"\r#include "transport.h"\r\r#include "m_spanningtree/utils.h"\r#include "m_spanningtree/link.h"\r\r/** Handle resolving of server IPs for the cache\r */\rclass SecurityIPResolver : public Resolver\r{\r private:\r     Link MyLink;\r   SpanningTreeUtilities* Utils;\r  Module* mine;\r  std::string host;\r      QueryType query;\r public:\r      SecurityIPResolver(Module* me, SpanningTreeUtilities* U, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt)\r          : Resolver(Instance, hostname, qt, cached, me), MyLink(x), Utils(U), mine(me), host(hostname), query(qt)\r       {\r      }\r\r     void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)\r        {\r              Utils->ValidIPs.push_back(result);\r     }\r\r     void OnError(ResolverError e, const std::string &errormessage)\r {\r              if (query == DNS_QUERY_AAAA)\r           {\r                      bool cached;\r                   SecurityIPResolver* res = new SecurityIPResolver(mine, Utils, ServerInstance, host, MyLink, cached, DNS_QUERY_A);\r                      ServerInstance->AddResolver(res, cached);\r                      return;\r                }\r              ServerInstance->Log(DEFAULT,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str());\r    }\r};\r\r/** This class is used to resolve server hostnames during /connect and autoconnect.\r * As of 1.1, the resolver system is seperated out from InspSocket, so we must do this\r * resolver step first ourselves if we need it. This is totally nonblocking, and will\r * callback to OnLookupComplete or OnError when completed. Once it has completed we\r * will have an IP address which we can then use to continue our connection.\r */\rclass ServernameResolver : public Resolver\r{\r private:\r        /** A copy of the Link tag info for what we're connecting to.\r         * We take a copy, rather than using a pointer, just in case the\r         * admin takes the tag away and rehashes while the domain is resolving.\r         */\r        Link MyLink;\r        SpanningTreeUtilities* Utils;\r       QueryType query;\r       std::string host;\r      Module* mine;\r public:\r        ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt);\r        void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached);\r        void OnError(ResolverError e, const std::string &errormessage);\r};\r\r#endif\r
\ No newline at end of file