summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-12 12:20:36 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-12 12:20:36 +0000
commitb864f69ce98841fd54e2328b49e34b5be49525b8 (patch)
tree48ccb6337f68c1298822178f666b5f2967cff25e /include
parent150aaa6f9d8f88816437c9e89c19c77a5764e9d7 (diff)
Added class Resolver (needs testing)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4353 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/dns.h31
-rw-r--r--include/socketengine.h1
2 files changed, 32 insertions, 0 deletions
diff --git a/include/dns.h b/include/dns.h
index b0dc3636f..89dd4e270 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -29,6 +29,14 @@ struct dns_ip4list
dns_ip4list *next;
};
+enum ResolverError
+{
+ RESOLVER_NOERROR = 0,
+ RESOLVER_NSDOWN = 1,
+ RESOLVER_NXDOMAIN = 2,
+ RESOLVER_NOTREADY = 3
+};
+
/** The DNS class allows fast nonblocking resolution of hostnames
* and ip addresses. It is based heavily upon firedns by Ian Gulliver.
@@ -101,6 +109,29 @@ public:
void SetNS(const std::string &dnsserver);
};
+class Resolver : public Extensible
+{
+ private:
+ DNS Query;
+ std::string input;
+ bool fwd;
+ std::string server;
+ int fd;
+ std::string result;
+ public:
+ Resolver(const std::string &source, bool forward, const std::string &dnsserver);
+ virtual ~Resolver();
+ virtual void OnLookupComplete(const std::string &result);
+ virtual void OnError(ResolverError e);
+
+ bool ProcessResult();
+ int GetFd();
+};
+
+void init_dns();
+void dns_deal_with_classes(int fd);
+bool dns_add_class(Resolver* r);
+
/** This is the handler function for multi-threaded DNS.
* It cannot be a class member as pthread will not let us
* create a thread whos handler function is a member of
diff --git a/include/socketengine.h b/include/socketengine.h
index bbd34a302..e07642fa1 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -44,6 +44,7 @@ const char X_LISTEN = 1;
const char X_ESTAB_CLIENT = 2;
const char X_ESTAB_MODULE = 3;
const char X_ESTAB_DNS = 4;
+const char X_ESTAB_CLASSDNS = 5;
/**
* To indicate that a socket is readable, we