diff options
author | Markus Grüneis <gimpf@gimpf.org> | 2009-03-04 20:12:33 +0000 |
---|---|---|
committer | Markus Grüneis <gimpf@gimpf.org> | 2009-03-04 20:12:33 +0000 |
commit | f639165c84f8e341cccde7aef93d1d59f8b95336 (patch) | |
tree | 64ffd6597f119fe1301618561bbd75d92ee4f917 /src/resolver.h | |
parent | updated FreeBSD device (diff) |
- extended gResolver: supports completion-callback
Diffstat (limited to 'src/resolver.h')
-rw-r--r-- | src/resolver.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/resolver.h b/src/resolver.h index 7f1336f..9fe51b2 100644 --- a/src/resolver.h +++ b/src/resolver.h @@ -34,6 +34,7 @@ #include <queue> #include <boost/asio.hpp> +#include <boost/function.hpp> #include "threadUtils.hpp" @@ -41,12 +42,13 @@ template<class Proto> class ResolveHandler { public: - ResolveHandler(const std::string& addr, const std::string& port); + ResolveHandler(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::udp::endpoint)> const& onResolve); void operator()(const boost::system::error_code& e, const boost::asio::ip::basic_resolver_iterator<Proto>); private: std::string addr_; std::string port_; + boost::function<void (boost::asio::ip::udp::endpoint)> callback_; }; typedef ResolveHandler<boost::asio::ip::udp> UdpResolveHandler; @@ -58,10 +60,10 @@ public: static Resolver& instance(); void init(); - static void run(void* s); + /*static */void run(/*void* s*/); - void resolveUdp(const std::string& addr, const std::string& port); - void resolveTcp(const std::string& addr, const std::string& port); + void resolveUdp(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::udp::endpoint)> const& onResolve); + void resolveTcp(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::udp::endpoint)> const& onResolve); private: Resolver(); |