summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp')
-rw-r--r--3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp71
1 files changed, 68 insertions, 3 deletions
diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp
index 6e52a85..c32d702 100644
--- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp
+++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp
@@ -2,7 +2,7 @@
// ip/basic_resolver_iterator.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -26,6 +26,10 @@
#include <boost/asio/detail/socket_types.hpp>
#include <boost/asio/ip/basic_resolver_entry.hpp>
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <boost/asio/detail/winrt_utils.hpp>
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
#include <boost/asio/detail/push_options.hpp>
namespace boost {
@@ -86,8 +90,8 @@ public:
while (address_info)
{
- if (address_info->ai_family == PF_INET
- || address_info->ai_family == PF_INET6)
+ if (address_info->ai_family == BOOST_ASIO_OS_DEF(AF_INET)
+ || address_info->ai_family == BOOST_ASIO_OS_DEF(AF_INET6))
{
using namespace std; // For memcpy.
typename InternetProtocol::endpoint endpoint;
@@ -117,6 +121,67 @@ public:
return iter;
}
+ /// Create an iterator from a sequence of endpoints, host and service name.
+ template <typename EndpointIterator>
+ static basic_resolver_iterator create(
+ EndpointIterator begin, EndpointIterator end,
+ const std::string& host_name, const std::string& service_name)
+ {
+ basic_resolver_iterator iter;
+ if (begin != end)
+ {
+ iter.values_.reset(new values_type);
+ for (EndpointIterator ep_iter = begin; ep_iter != end; ++ep_iter)
+ {
+ iter.values_->push_back(
+ basic_resolver_entry<InternetProtocol>(
+ *ep_iter, host_name, service_name));
+ }
+ }
+ return iter;
+ }
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ /// Create an iterator from a Windows Runtime list of EndpointPair objects.
+ static basic_resolver_iterator create(
+ Windows::Foundation::Collections::IVectorView<
+ Windows::Networking::EndpointPair^>^ endpoints,
+ const boost::asio::detail::addrinfo_type& hints,
+ const std::string& host_name, const std::string& service_name)
+ {
+ basic_resolver_iterator iter;
+ if (endpoints->Size)
+ {
+ iter.values_.reset(new values_type);
+ for (unsigned int i = 0; i < endpoints->Size; ++i)
+ {
+ auto pair = endpoints->GetAt(i);
+
+ if (hints.ai_family == BOOST_ASIO_OS_DEF(AF_INET)
+ && pair->RemoteHostName->Type
+ != Windows::Networking::HostNameType::Ipv4)
+ continue;
+
+ if (hints.ai_family == BOOST_ASIO_OS_DEF(AF_INET6)
+ && pair->RemoteHostName->Type
+ != Windows::Networking::HostNameType::Ipv6)
+ continue;
+
+ iter.values_->push_back(
+ basic_resolver_entry<InternetProtocol>(
+ typename InternetProtocol::endpoint(
+ ip::address::from_string(
+ boost::asio::detail::winrt_utils::string(
+ pair->RemoteHostName->CanonicalName)),
+ boost::asio::detail::winrt_utils::integer(
+ pair->RemoteServiceName)),
+ host_name, service_name));
+ }
+ }
+ return iter;
+ }
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
/// Dereference an iterator.
const basic_resolver_entry<InternetProtocol>& operator*() const
{