diff options
author | Christian Pointner <equinox@anytun.org> | 2009-03-04 20:32:22 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-03-04 20:32:22 +0000 |
commit | 352a4127cfb100a3fb59064e4b4e0de7a3b885a0 (patch) | |
tree | 8ff1814e5e952d88af67bbc2a8f7ddbd611eed4c /src | |
parent | - extended gResolver: supports completion-callback (diff) |
fix build
Diffstat (limited to 'src')
-rw-r--r-- | src/anytun.cpp | 2 | ||||
-rw-r--r-- | src/resolver.cpp | 9 | ||||
-rw-r--r-- | src/resolver.h | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp index 1b71f15..0206055 100644 --- a/src/anytun.cpp +++ b/src/anytun.cpp @@ -452,7 +452,7 @@ int main(int argc, char* argv[]) if(gOpt.getRemoteAddr() != "") { - gResolver.resolveUdp(gOpt.getRemoteAddr(), gOpt.getRemotePort(), + gResolver.resolveUdp(gOpt.getRemoteAddr(), gOpt.getRemotePort(), boost::bind(createConnection, _1, gOpt.getSeqWindowSize(), gOpt.getMux())); ///*boost::asio::io_service io_service; //UDPPacketSource::proto::resolver resolver(io_service); diff --git a/src/resolver.cpp b/src/resolver.cpp index c4df658..5a230ae 100644 --- a/src/resolver.cpp +++ b/src/resolver.cpp @@ -30,21 +30,22 @@ */ #include <boost/bind.hpp> +#include <boost/system/error_code.hpp> #include "resolver.h" #include "log.h" -template<class Proto> ResolveHandler<Proto>::ResolveHandler(const std::string& addr, const std::string& port, boost::function<void(boost::asio::ip::udp::endpoint)> const& onResolve) : addr_(addr), port_(port), callback_(onResolve) +template<class Proto> ResolveHandler<Proto>::ResolveHandler(const std::string& addr, const std::string& port, boost::function<void(boost::asio::ip::basic_endpoint<Proto>)> const& onResolve) : addr_(addr), port_(port), callback_(onResolve) { } template<class Proto> void ResolveHandler<Proto>::operator()(const boost::system::error_code& e, const boost::asio::ip::basic_resolver_iterator<Proto> endpointIt) { cLog.msg(Log::PRIO_DEBUG) << "ResolveHandler<" << typeid(Proto).name() << ">() called, addr='" << addr_ << "', port='" << port_ << "'"; - if(boost::system::errc:success == e) { + if(boost::system::posix_error::success == e) { callback_(*endpointIt); } else { - cLog.msg(Log::PRIO_ERROR) << << "ResolveHandler<" << typeid(Proto).name() << ">(): " << e; + cLog.msg(Log::PRIO_ERROR) << "ResolveHandler<" << typeid(Proto).name() << ">(): " << e; } } @@ -100,7 +101,7 @@ void Resolver::resolveUdp(const std::string& addr, const std::string& port, boos udp_resolver_.async_resolve(query, handler); } -void Resolver::resolveTcp(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::udp::endpoint)> const& onResolve) +void Resolver::resolveTcp(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::tcp::endpoint)> const& onResolve) { cLog.msg(Log::PRIO_DEBUG) << "trying to resolv TCP: " << addr << " " << port; diff --git a/src/resolver.h b/src/resolver.h index 9fe51b2..96617f2 100644 --- a/src/resolver.h +++ b/src/resolver.h @@ -42,13 +42,13 @@ template<class Proto> class ResolveHandler { public: - ResolveHandler(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::udp::endpoint)> const& onResolve); + ResolveHandler(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::basic_endpoint<Proto>)> 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_; + boost::function<void (boost::asio::ip::basic_endpoint<Proto>)> callback_; }; typedef ResolveHandler<boost::asio::ip::udp> UdpResolveHandler; @@ -63,7 +63,7 @@ public: /*static */void run(/*void* s*/); 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); + void resolveTcp(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::tcp::endpoint)> const& onResolve); private: Resolver(); |