summaryrefslogtreecommitdiff
path: root/src/resolver.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-02-28 21:50:44 +0100
committerJoel Klinghed <the_jk@yahoo.com>2017-02-28 21:50:44 +0100
commitc029d90d1975e124d237605f1edb2be16bd05b5d (patch)
tree9df87ffb365354bdb74a969440b32c8304bdbcb7 /src/resolver.hh
Initial commit
Diffstat (limited to 'src/resolver.hh')
-rw-r--r--src/resolver.hh28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/resolver.hh b/src/resolver.hh
new file mode 100644
index 0000000..d98458f
--- /dev/null
+++ b/src/resolver.hh
@@ -0,0 +1,28 @@
+// -*- mode: c++; c-basic-offset: 2; -*-
+
+#ifndef RESOLVER_HH
+#define RESOLVER_HH
+
+#include <functional>
+
+class Looper;
+
+class Resolver {
+public:
+ typedef std::function<void(int fd, bool connected,
+ char const* error)> Callback;
+
+ virtual ~Resolver() {}
+
+ static Resolver* create(Looper* looper);
+
+ virtual void* request(std::string const& host, uint16_t port,
+ Callback const& callback) = 0;
+ virtual void cancel(void* ptr) = 0;
+
+protected:
+ Resolver() {}
+ Resolver(Resolver const&) = delete;
+};
+
+#endif // RESOLVER_HH