summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
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