Imported Upstream version 0.3.3
[anytun.git] / src / resolver.h
index b5553bc..35c2bc4 100644 (file)
  *  tunneling and relaying of packets of any protocol.
  *
  *
- *  Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, 
+ *  Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, 
  *                          Christian Pointner <satp@wirdorange.org>
  *
  *  This file is part of Anytun.
  *
  *  Anytun is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3 as
- *  published by the Free Software Foundation.
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  any later version.
  *
  *  Anytun is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -29,8 +30,8 @@
  *  along with anytun.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _RESOLVER_H_
-#define _RESOLVER_H_
+#ifndef ANYTUN_resolver_h_INCLUDED
+#define ANYTUN_resolver_h_INCLUDED
 
 #include <queue>
 #include <boost/asio.hpp>
 #include "datatypes.h"
 #include "threadUtils.hpp"
 
-typedef boost::function<void (boost::asio::ip::udp::endpoint)> UdpResolveCallback;
-typedef boost::function<void (boost::asio::ip::tcp::endpoint)> TcpResolveCallback;
+typedef boost::function<void (boost::asio::ip::udp::resolver::iterator)> UdpResolveCallback;
+typedef boost::function<void (boost::asio::ip::tcp::resolver::iterator)> TcpResolveCallback;
 typedef boost::function<void (std::runtime_error const&)> ErrorCallback;
 
 template<class Proto>
 class ResolveHandler
 {
 public:
-  ResolveHandler(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::basic_endpoint<Proto>)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r = ANY);
-  void operator()(const boost::system::error_code& e, const boost::asio::ip::basic_resolver_iterator<Proto>);
+  ResolveHandler(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::basic_resolver_iterator<Proto>)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r = ANY);
+  void operator()(const boost::system::error_code& e, boost::asio::ip::basic_resolver_iterator<Proto>);
 
 private:
   std::string addr_;
   std::string port_;
-  boost::function<void (boost::asio::ip::basic_endpoint<Proto>)> onResolve_;
+  boost::function<void (const boost::asio::ip::basic_resolver_iterator<Proto>)> onResolve_;
   ErrorCallback onError_;
   ResolvAddrType resolv_addr_type_;
 };