Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85764 - in trunk: boost/asio boost/asio/detail boost/asio/detail/impl boost/asio/generic boost/asio/impl boost/asio/ip boost/asio/ip/detail boost/asio/ip/detail/impl boost/asio/ip/impl libs/asio/test/generic libs/asio/test/ip
From: chris_at_[hidden]
Date: 2013-09-17 18:24:19


Author: chris_kohlhoff
Date: 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013)
New Revision: 85764
URL: http://svn.boost.org/trac/boost/changeset/85764

Log:
Initial port to Windows Runtime.

This change adds limited support for using Asio with the Windows
Runtime. It requires that the language extensions be enabled. Due to the
restricted facilities exposed by the Windows Runtime API, the port comes
with the following caveats:

* The core facilities such as the io_service, strand, buffers, composed
  operations, timers, etc., should all work as normal.

* For sockets, only client-side TCP is supported.

* Explicit binding of a client-side TCP socket is not supported.

* The cancel() function is not supported for sockets. Asynchronous
  operations may only be cancelled by closing the socket.

* Operations that use null_buffers are not supported.

* Only tcp::no_delay and socket_base::keep_alive options are supported.

* Resolvers do not support service names, only numbers. I.e. you must
  use 80 rather than http.

* Most resolver query flags have no effect.

Added:
   trunk/boost/asio/detail/impl/buffer_sequence_adapter.ipp (contents, props changed)
   trunk/boost/asio/detail/impl/winrt_ssocket_service_base.ipp (contents, props changed)
   trunk/boost/asio/detail/impl/winrt_timer_scheduler.hpp (contents, props changed)
   trunk/boost/asio/detail/impl/winrt_timer_scheduler.ipp (contents, props changed)
   trunk/boost/asio/detail/null_reactor.hpp (contents, props changed)
   trunk/boost/asio/detail/null_socket_service.hpp (contents, props changed)
   trunk/boost/asio/detail/std_event.hpp (contents, props changed)
   trunk/boost/asio/detail/std_mutex.hpp (contents, props changed)
   trunk/boost/asio/detail/std_static_mutex.hpp (contents, props changed)
   trunk/boost/asio/detail/std_thread.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_async_manager.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_async_op.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_resolve_op.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_resolver_service.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_socket_connect_op.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_socket_recv_op.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_socket_send_op.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_ssocket_service.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_ssocket_service_base.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_timer_scheduler.hpp (contents, props changed)
   trunk/boost/asio/detail/winrt_utils.hpp (contents, props changed)
Text files modified:
   trunk/boost/asio/datagram_socket_service.hpp | 10
   trunk/boost/asio/detail/buffer_sequence_adapter.hpp | 28 +
   trunk/boost/asio/detail/config.hpp | 107 ++++++
   trunk/boost/asio/detail/deadline_timer_service.hpp | 12
   trunk/boost/asio/detail/descriptor_ops.hpp | 8
   trunk/boost/asio/detail/event.hpp | 6
   trunk/boost/asio/detail/fd_set_adapter.hpp | 5
   trunk/boost/asio/detail/impl/buffer_sequence_adapter.ipp | 120 +++++++
   trunk/boost/asio/detail/impl/descriptor_ops.ipp | 8
   trunk/boost/asio/detail/impl/pipe_select_interrupter.ipp | 2
   trunk/boost/asio/detail/impl/reactive_descriptor_service.ipp | 8
   trunk/boost/asio/detail/impl/reactive_socket_service_base.ipp | 4
   trunk/boost/asio/detail/impl/select_reactor.hpp | 6
   trunk/boost/asio/detail/impl/select_reactor.ipp | 4
   trunk/boost/asio/detail/impl/signal_set_service.ipp | 80 +++-
   trunk/boost/asio/detail/impl/socket_ops.ipp | 389 +++++++++++++++++++++---
   trunk/boost/asio/detail/impl/socket_select_interrupter.ipp | 4
   trunk/boost/asio/detail/impl/winrt_ssocket_service_base.ipp | 608 ++++++++++++++++++++++++++++++++++++++++
   trunk/boost/asio/detail/impl/winrt_timer_scheduler.hpp | 81 +++++
   trunk/boost/asio/detail/impl/winrt_timer_scheduler.ipp | 124 ++++++++
   trunk/boost/asio/detail/io_control.hpp | 4
   trunk/boost/asio/detail/keyword_tss_ptr.hpp | 4
   trunk/boost/asio/detail/mutex.hpp | 6
   trunk/boost/asio/detail/null_reactor.hpp | 69 ++++
   trunk/boost/asio/detail/null_signal_blocker.hpp | 2
   trunk/boost/asio/detail/null_socket_service.hpp | 499 ++++++++++++++++++++++++++++++++
   trunk/boost/asio/detail/pipe_select_interrupter.hpp | 2
   trunk/boost/asio/detail/posix_fd_set_adapter.hpp | 8
   trunk/boost/asio/detail/push_options.hpp | 2
   trunk/boost/asio/detail/reactive_descriptor_service.hpp | 8
   trunk/boost/asio/detail/reactive_socket_service_base.hpp | 4
   trunk/boost/asio/detail/reactor.hpp | 2
   trunk/boost/asio/detail/reactor_fwd.hpp | 4
   trunk/boost/asio/detail/resolver_service.hpp | 5
   trunk/boost/asio/detail/resolver_service_base.hpp | 2
   trunk/boost/asio/detail/select_interrupter.hpp | 4
   trunk/boost/asio/detail/select_reactor.hpp | 6
   trunk/boost/asio/detail/signal_blocker.hpp | 2
   trunk/boost/asio/detail/signal_set_service.hpp | 8
   trunk/boost/asio/detail/socket_ops.hpp | 8
   trunk/boost/asio/detail/socket_option.hpp | 6
   trunk/boost/asio/detail/socket_select_interrupter.hpp | 4
   trunk/boost/asio/detail/socket_types.hpp | 238 ++++++++++++++-
   trunk/boost/asio/detail/static_mutex.hpp | 5
   trunk/boost/asio/detail/std_event.hpp | 129 ++++++++
   trunk/boost/asio/detail/std_mutex.hpp | 75 ++++
   trunk/boost/asio/detail/std_static_mutex.hpp | 83 +++++
   trunk/boost/asio/detail/std_thread.hpp | 67 ++++
   trunk/boost/asio/detail/thread.hpp | 6
   trunk/boost/asio/detail/timer_scheduler.hpp | 4
   trunk/boost/asio/detail/timer_scheduler_fwd.hpp | 4
   trunk/boost/asio/detail/winrt_async_manager.hpp | 296 +++++++++++++++++++
   trunk/boost/asio/detail/winrt_async_op.hpp | 67 ++++
   trunk/boost/asio/detail/winrt_resolve_op.hpp | 119 +++++++
   trunk/boost/asio/detail/winrt_resolver_service.hpp | 185 ++++++++++++
   trunk/boost/asio/detail/winrt_socket_connect_op.hpp | 92 ++++++
   trunk/boost/asio/detail/winrt_socket_recv_op.hpp | 106 ++++++
   trunk/boost/asio/detail/winrt_socket_send_op.hpp | 103 ++++++
   trunk/boost/asio/detail/winrt_ssocket_service.hpp | 234 +++++++++++++++
   trunk/boost/asio/detail/winrt_ssocket_service_base.hpp | 357 +++++++++++++++++++++++
   trunk/boost/asio/detail/winrt_timer_scheduler.hpp | 133 ++++++++
   trunk/boost/asio/detail/winrt_utils.hpp | 108 +++++++
   trunk/boost/asio/error.hpp | 10
   trunk/boost/asio/generic/datagram_protocol.hpp | 2
   trunk/boost/asio/generic/raw_protocol.hpp | 2
   trunk/boost/asio/generic/seq_packet_protocol.hpp | 2
   trunk/boost/asio/generic/stream_protocol.hpp | 2
   trunk/boost/asio/impl/src.hpp | 3
   trunk/boost/asio/ip/basic_resolver_iterator.hpp | 69 ++++
   trunk/boost/asio/ip/basic_resolver_query.hpp | 2
   trunk/boost/asio/ip/detail/endpoint.hpp | 2
   trunk/boost/asio/ip/detail/impl/endpoint.ipp | 16
   trunk/boost/asio/ip/icmp.hpp | 8
   trunk/boost/asio/ip/impl/address_v4.ipp | 5
   trunk/boost/asio/ip/impl/address_v6.ipp | 5
   trunk/boost/asio/ip/multicast.hpp | 27 +
   trunk/boost/asio/ip/resolver_query_base.hpp | 32 -
   trunk/boost/asio/ip/resolver_service.hpp | 12
   trunk/boost/asio/ip/tcp.hpp | 10
   trunk/boost/asio/ip/udp.hpp | 8
   trunk/boost/asio/ip/unicast.hpp | 5
   trunk/boost/asio/raw_socket_service.hpp | 10
   trunk/boost/asio/seq_packet_socket_service.hpp | 10
   trunk/boost/asio/socket_acceptor_service.hpp | 8
   trunk/boost/asio/socket_base.hpp | 45 +-
   trunk/boost/asio/stream_socket_service.hpp | 10
   trunk/libs/asio/test/generic/datagram_protocol.cpp | 30 +
   trunk/libs/asio/test/generic/raw_protocol.cpp | 30 +
   trunk/libs/asio/test/generic/seq_packet_protocol.cpp | 29 +
   trunk/libs/asio/test/generic/stream_protocol.cpp | 38 +
   trunk/libs/asio/test/ip/icmp.cpp | 4
   trunk/libs/asio/test/ip/tcp.cpp | 8
   trunk/libs/asio/test/ip/udp.cpp | 4
   93 files changed, 4851 insertions(+), 281 deletions(-)

Modified: trunk/boost/asio/datagram_socket_service.hpp
==============================================================================
--- trunk/boost/asio/datagram_socket_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/datagram_socket_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -22,7 +22,9 @@
 #include <boost/asio/error.hpp>
 #include <boost/asio/io_service.hpp>
 
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <boost/asio/detail/null_socket_service.hpp>
+#elif defined(BOOST_ASIO_HAS_IOCP)
 # include <boost/asio/detail/win_iocp_socket_service.hpp>
 #else
 # include <boost/asio/detail/reactive_socket_service.hpp>
@@ -56,7 +58,9 @@
 
 private:
   // The type of the platform-specific implementation.
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ typedef detail::null_socket_service<Protocol> service_impl_type;
+#elif defined(BOOST_ASIO_HAS_IOCP)
   typedef detail::win_iocp_socket_service<Protocol> service_impl_type;
 #else
   typedef detail::reactive_socket_service<Protocol> service_impl_type;
@@ -138,7 +142,7 @@
   boost::system::error_code open(implementation_type& impl,
       const protocol_type& protocol, boost::system::error_code& ec)
   {
- if (protocol.type() == SOCK_DGRAM)
+ if (protocol.type() == BOOST_ASIO_OS_DEF(SOCK_DGRAM))
       service_impl_.open(impl, protocol, ec);
     else
       ec = boost::asio::error::invalid_argument;

Modified: trunk/boost/asio/detail/buffer_sequence_adapter.hpp
==============================================================================
--- trunk/boost/asio/detail/buffer_sequence_adapter.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/buffer_sequence_adapter.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -29,7 +29,23 @@
 class buffer_sequence_adapter_base
 {
 protected:
-#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // The maximum number of buffers to support in a single operation.
+ enum { max_buffers = 1 };
+
+ typedef Windows::Storage::Streams::IBuffer^ native_buffer_type;
+
+ BOOST_ASIO_DECL static void init_native_buffer(
+ native_buffer_type& buf,
+ const boost::asio::mutable_buffer& buffer);
+
+ BOOST_ASIO_DECL static void init_native_buffer(
+ native_buffer_type& buf,
+ const boost::asio::const_buffer& buffer);
+#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+ // The maximum number of buffers to support in a single operation.
+ enum { max_buffers = 64 < max_iov_len ? 64 : max_iov_len };
+
   typedef WSABUF native_buffer_type;
 
   static void init_native_buffer(WSABUF& buf,
@@ -46,6 +62,9 @@
     buf.len = static_cast<ULONG>(boost::asio::buffer_size(buffer));
   }
 #else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+ // The maximum number of buffers to support in a single operation.
+ enum { max_buffers = 64 < max_iov_len ? 64 : max_iov_len };
+
   typedef iovec native_buffer_type;
 
   static void init_iov_base(void*& base, void* addr)
@@ -146,9 +165,6 @@
   }
 
 private:
- // The maximum number of buffers to support in a single operation.
- enum { max_buffers = 64 < max_iov_len ? 64 : max_iov_len };
-
   native_buffer_type buffers_[max_buffers];
   std::size_t count_;
   std::size_t total_buffer_size_;
@@ -362,4 +378,8 @@
 
 #include <boost/asio/detail/pop_options.hpp>
 
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/detail/impl/buffer_sequence_adapter.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
 #endif // BOOST_ASIO_DETAIL_BUFFER_SEQUENCE_ADAPTER_HPP

Modified: trunk/boost/asio/detail/config.hpp
==============================================================================
--- trunk/boost/asio/detail/config.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/config.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -380,13 +380,66 @@
 # endif // !defined(BOOST_ASIO_DISABLE_CSTDINT)
 #endif // !defined(BOOST_ASIO_HAS_CSTDINT)
 
-// Windows target.
+// Standard library support for the thread class.
+#if !defined(BOOST_ASIO_HAS_STD_THREAD)
+# if !defined(BOOST_ASIO_DISABLE_STD_THREAD)
+# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
+# define BOOST_ASIO_HAS_STD_THREAD 1
+# endif // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_STD_THREAD 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1700)
+# define BOOST_ASIO_HAS_STD_THREAD 1
+# endif // (_MSC_VER >= 1700)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_STD_THREAD)
+#endif // !defined(BOOST_ASIO_HAS_STD_THREAD)
+
+// Standard library support for the mutex and condition variable classes.
+#if !defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+# if !defined(BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
+# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
+# define BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
+# endif // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1700)
+# define BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
+# endif // (_MSC_VER >= 1700)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
+#endif // !defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+
+// WinRT target.
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# if defined(WINAPI_FAMILY)
+# if ((WINAPI_FAMILY & WINAPI_PARTITION_APP) != 0)
+# define BOOST_ASIO_WINDOWS_RUNTIME 1
+# endif // ((WINAPI_FAMILY & WINAPI_PARTITION_APP) != 0)
+# endif // defined(WINAPI_FAMILY)
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+// Windows target. Excludes WinRT.
 #if !defined(BOOST_ASIO_WINDOWS)
-# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
-# define BOOST_ASIO_WINDOWS 1
-# elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
-# define BOOST_ASIO_WINDOWS 1
-# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
+# if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
+# define BOOST_ASIO_WINDOWS 1
+# elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
+# define BOOST_ASIO_WINDOWS 1
+# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
+# endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 #endif // !defined(BOOST_ASIO_WINDOWS)
 
 // Windows: target OS version.
@@ -514,14 +567,18 @@
 // Serial ports.
 #if !defined(BOOST_ASIO_HAS_SERIAL_PORT)
 # if defined(BOOST_ASIO_HAS_IOCP) \
- || !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+ || !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
 # if !defined(__SYMBIAN32__)
 # if !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
 # define BOOST_ASIO_HAS_SERIAL_PORT 1
 # endif // !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
 # endif // !defined(__SYMBIAN32__)
 # endif // defined(BOOST_ASIO_HAS_IOCP)
- // || !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+ // || !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 #endif // !defined(BOOST_ASIO_HAS_SERIAL_PORT)
 
 // Windows: stream handles.
@@ -565,27 +622,39 @@
 // POSIX: stream-oriented file descriptors.
 #if !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
 # if !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
-# if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+# if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
 # define BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
-# endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+# endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 # endif // !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
 #endif // !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
 
 // UNIX domain sockets.
 #if !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
 # if !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
-# if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+# if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
 # define BOOST_ASIO_HAS_LOCAL_SOCKETS 1
-# endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+# endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 # endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
 #endif // !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
 
 // Can use sigaction() instead of signal().
 #if !defined(BOOST_ASIO_HAS_SIGACTION)
 # if !defined(BOOST_ASIO_DISABLE_SIGACTION)
-# if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+# if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
 # define BOOST_ASIO_HAS_SIGACTION 1
-# endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+# endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 # endif // !defined(BOOST_ASIO_DISABLE_SIGACTION)
 #endif // !defined(BOOST_ASIO_HAS_SIGACTION)
 
@@ -763,13 +832,23 @@
 # if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
 # if !defined(__INTEL_COMPILER) && !defined(__ICL)
 # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
+# define BOOST_ASIO_THREAD_KEYWORD __thread
 # elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
 # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
 # endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
 # endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
 # endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
 # endif // defined(__linux__)
+# if defined(BOOST_ASIO_MSVC) && defined(WINAPI_FAMILY)
+# if (_MSC_VER >= 1700)
+# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
+# define BOOST_ASIO_THREAD_KEYWORD __declspec(thread)
+# endif // (_MSC_VER >= 1700)
+# endif // defined(BOOST_ASIO_MSVC) && defined(WINAPI_FAMILY)
 #endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
+#if !defined(BOOST_ASIO_THREAD_KEYWORD)
+# define BOOST_ASIO_THREAD_KEYWORD __thread
+#endif // !defined(BOOST_ASIO_THREAD_KEYWORD)
 
 // Support for POSIX ssize_t typedef.
 #if !defined(BOOST_ASIO_DISABLE_SSIZE_T)

Modified: trunk/boost/asio/detail/deadline_timer_service.hpp
==============================================================================
--- trunk/boost/asio/detail/deadline_timer_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/deadline_timer_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -30,6 +30,11 @@
 #include <boost/asio/detail/wait_handler.hpp>
 #include <boost/asio/detail/wait_op.hpp>
 
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <chrono>
+# include <thread>
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #include <boost/asio/detail/push_options.hpp>
 
 namespace boost {
@@ -195,10 +200,17 @@
   template <typename Duration>
   void do_wait(const Duration& timeout, boost::system::error_code& ec)
   {
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ std::this_thread::sleep_for(
+ std::chrono::seconds(timeout.total_seconds())
+ + std::chrono::microseconds(timeout.total_microseconds()));
+ ec = boost::system::error_code();
+#else // defined(BOOST_ASIO_WINDOWS_RUNTIME)
     ::timeval tv;
     tv.tv_sec = timeout.total_seconds();
     tv.tv_usec = timeout.total_microseconds() % 1000000;
     socket_ops::select(0, 0, 0, 0, &tv, ec);
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
   }
 
   // The queue of timers.

Modified: trunk/boost/asio/detail/descriptor_ops.hpp
==============================================================================
--- trunk/boost/asio/detail/descriptor_ops.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/descriptor_ops.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,7 +17,9 @@
 
 #include <boost/asio/detail/config.hpp>
 
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
 
 #include <cstddef>
 #include <boost/system/error_code.hpp>
@@ -110,6 +112,8 @@
 # include <boost/asio/detail/impl/descriptor_ops.ipp>
 #endif // defined(BOOST_ASIO_HEADER_ONLY)
 
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 
 #endif // BOOST_ASIO_DETAIL_DESCRIPTOR_OPS_HPP

Modified: trunk/boost/asio/detail/event.hpp
==============================================================================
--- trunk/boost/asio/detail/event.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/event.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -23,8 +23,10 @@
 # include <boost/asio/detail/win_event.hpp>
 #elif defined(BOOST_ASIO_HAS_PTHREADS)
 # include <boost/asio/detail/posix_event.hpp>
+#elif defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+# include <boost/asio/detail/std_event.hpp>
 #else
-# error Only Windows and POSIX are supported!
+# error Only Windows, POSIX and std::condition_variable are supported!
 #endif
 
 namespace boost {
@@ -37,6 +39,8 @@
 typedef win_event event;
 #elif defined(BOOST_ASIO_HAS_PTHREADS)
 typedef posix_event event;
+#elif defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+typedef std_event event;
 #endif
 
 } // namespace detail

Modified: trunk/boost/asio/detail/fd_set_adapter.hpp
==============================================================================
--- trunk/boost/asio/detail/fd_set_adapter.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/fd_set_adapter.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -16,6 +16,9 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #include <boost/asio/detail/posix_fd_set_adapter.hpp>
 #include <boost/asio/detail/win_fd_set_adapter.hpp>
 
@@ -33,4 +36,6 @@
 } // namespace asio
 } // namespace boost
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #endif // BOOST_ASIO_DETAIL_FD_SET_ADAPTER_HPP

Added: trunk/boost/asio/detail/impl/buffer_sequence_adapter.ipp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/impl/buffer_sequence_adapter.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,120 @@
+//
+// detail/impl/buffer_sequence_adapter.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_IMPL_BUFFER_SEQUENCE_ADAPTER_IPP
+#define BOOST_ASIO_DETAIL_IMPL_BUFFER_SEQUENCE_ADAPTER_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <robuffer.h>
+#include <windows.storage.streams.h>
+#include <wrl/implements.h>
+#include <boost/asio/detail/buffer_sequence_adapter.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class winrt_buffer_impl :
+ public Microsoft::WRL::RuntimeClass<
+ Microsoft::WRL::RuntimeClassFlags<
+ Microsoft::WRL::RuntimeClassType::WinRtClassicComMix>,
+ ABI::Windows::Storage::Streams::IBuffer,
+ Windows::Storage::Streams::IBufferByteAccess>
+{
+public:
+ explicit winrt_buffer_impl(const boost::asio::const_buffer& b)
+ {
+ bytes_ = const_cast<byte*>(boost::asio::buffer_cast<const byte*>(b));
+ length_ = boost::asio::buffer_size(b);
+ capacity_ = boost::asio::buffer_size(b);
+ }
+
+ explicit winrt_buffer_impl(const boost::asio::mutable_buffer& b)
+ {
+ bytes_ = const_cast<byte*>(boost::asio::buffer_cast<const byte*>(b));
+ length_ = 0;
+ capacity_ = boost::asio::buffer_size(b);
+ }
+
+ ~winrt_buffer_impl()
+ {
+ }
+
+ STDMETHODIMP Buffer(byte** value)
+ {
+ *value = bytes_;
+ return S_OK;
+ }
+
+ STDMETHODIMP get_Capacity(UINT32* value)
+ {
+ *value = capacity_;
+ return S_OK;
+ }
+
+ STDMETHODIMP get_Length(UINT32 *value)
+ {
+ *value = length_;
+ return S_OK;
+ }
+
+ STDMETHODIMP put_Length(UINT32 value)
+ {
+ if (value > capacity_)
+ return E_INVALIDARG;
+ length_ = value;
+ return S_OK;
+ }
+
+private:
+ byte* bytes_;
+ UINT32 length_;
+ UINT32 capacity_;
+};
+
+void buffer_sequence_adapter_base::init_native_buffer(
+ buffer_sequence_adapter_base::native_buffer_type& buf,
+ const boost::asio::mutable_buffer& buffer)
+{
+ std::memset(&buf, 0, sizeof(native_buffer_type));
+ Microsoft::WRL::ComPtr<IInspectable> insp
+ = Microsoft::WRL::Make<winrt_buffer_impl>(buffer);
+ buf = reinterpret_cast<Windows::Storage::Streams::IBuffer^>(insp.Get());
+}
+
+void buffer_sequence_adapter_base::init_native_buffer(
+ buffer_sequence_adapter_base::native_buffer_type& buf,
+ const boost::asio::const_buffer& buffer)
+{
+ std::memset(&buf, 0, sizeof(native_buffer_type));
+ Microsoft::WRL::ComPtr<IInspectable> insp
+ = Microsoft::WRL::Make<winrt_buffer_impl>(buffer);
+ Platform::Object^ buf_obj = reinterpret_cast<Platform::Object^>(insp.Get());
+ buf = reinterpret_cast<Windows::Storage::Streams::IBuffer^>(insp.Get());
+}
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_IMPL_BUFFER_SEQUENCE_ADAPTER_IPP

Modified: trunk/boost/asio/detail/impl/descriptor_ops.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/descriptor_ops.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/impl/descriptor_ops.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -20,7 +20,9 @@
 #include <boost/asio/detail/descriptor_ops.hpp>
 #include <boost/asio/error.hpp>
 
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -444,6 +446,8 @@
 
 #include <boost/asio/detail/pop_options.hpp>
 
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 
 #endif // BOOST_ASIO_DETAIL_IMPL_DESCRIPTOR_OPS_IPP

Modified: trunk/boost/asio/detail/impl/pipe_select_interrupter.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/pipe_select_interrupter.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/impl/pipe_select_interrupter.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,6 +17,7 @@
 
 #include <boost/asio/detail/config.hpp>
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 #if !defined(BOOST_ASIO_WINDOWS)
 #if !defined(__CYGWIN__)
 #if !defined(__SYMBIAN32__)
@@ -120,5 +121,6 @@
 #endif // !defined(__SYMBIAN32__)
 #endif // !defined(__CYGWIN__)
 #endif // !defined(BOOST_ASIO_WINDOWS)
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #endif // BOOST_ASIO_DETAIL_IMPL_PIPE_SELECT_INTERRUPTER_IPP

Modified: trunk/boost/asio/detail/impl/reactive_descriptor_service.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/reactive_descriptor_service.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/impl/reactive_descriptor_service.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,7 +17,9 @@
 
 #include <boost/asio/detail/config.hpp>
 
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
 
 #include <boost/asio/error.hpp>
 #include <boost/asio/detail/reactive_descriptor_service.hpp>
@@ -201,6 +203,8 @@
 
 #include <boost/asio/detail/pop_options.hpp>
 
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 
 #endif // BOOST_ASIO_DETAIL_IMPL_REACTIVE_DESCRIPTOR_SERVICE_IPP

Modified: trunk/boost/asio/detail/impl/reactive_socket_service_base.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/reactive_socket_service_base.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/impl/reactive_socket_service_base.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,7 +17,8 @@
 
 #include <boost/asio/detail/config.hpp>
 
-#if !defined(BOOST_ASIO_HAS_IOCP)
+#if !defined(BOOST_ASIO_HAS_IOCP) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #include <boost/asio/detail/reactive_socket_service_base.hpp>
 
@@ -263,5 +264,6 @@
 #include <boost/asio/detail/pop_options.hpp>
 
 #endif // !defined(BOOST_ASIO_HAS_IOCP)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #endif // BOOST_ASIO_DETAIL_IMPL_REACTIVE_SOCKET_SERVICE_BASE_IPP

Modified: trunk/boost/asio/detail/impl/select_reactor.hpp
==============================================================================
--- trunk/boost/asio/detail/impl/select_reactor.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/impl/select_reactor.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -20,7 +20,8 @@
 #if defined(BOOST_ASIO_HAS_IOCP) \
   || (!defined(BOOST_ASIO_HAS_DEV_POLL) \
       && !defined(BOOST_ASIO_HAS_EPOLL) \
- && !defined(BOOST_ASIO_HAS_KQUEUE))
+ && !defined(BOOST_ASIO_HAS_KQUEUE) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME))
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -82,6 +83,7 @@
 #endif // defined(BOOST_ASIO_HAS_IOCP)
        // || (!defined(BOOST_ASIO_HAS_DEV_POLL)
        // && !defined(BOOST_ASIO_HAS_EPOLL)
- // && !defined(BOOST_ASIO_HAS_KQUEUE))
+ // && !defined(BOOST_ASIO_HAS_KQUEUE)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME))
 
 #endif // BOOST_ASIO_DETAIL_IMPL_SELECT_REACTOR_HPP

Modified: trunk/boost/asio/detail/impl/select_reactor.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/select_reactor.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/impl/select_reactor.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -20,7 +20,8 @@
 #if defined(BOOST_ASIO_HAS_IOCP) \
   || (!defined(BOOST_ASIO_HAS_DEV_POLL) \
       && !defined(BOOST_ASIO_HAS_EPOLL) \
- && !defined(BOOST_ASIO_HAS_KQUEUE))
+ && !defined(BOOST_ASIO_HAS_KQUEUE) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME))
 
 #include <boost/asio/detail/bind_handler.hpp>
 #include <boost/asio/detail/fd_set_adapter.hpp>
@@ -311,5 +312,6 @@
        // || (!defined(BOOST_ASIO_HAS_DEV_POLL)
        // && !defined(BOOST_ASIO_HAS_EPOLL)
        // && !defined(BOOST_ASIO_HAS_KQUEUE))
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME))
 
 #endif // BOOST_ASIO_DETAIL_IMPL_SELECT_REACTOR_IPP

Modified: trunk/boost/asio/detail/impl/signal_set_service.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/signal_set_service.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/impl/signal_set_service.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -59,23 +59,31 @@
 
 void asio_signal_handler(int signal_number)
 {
-#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) \
+ || defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ || defined(__CYGWIN__)
   signal_set_service::deliver_signal(signal_number);
-#else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+#else // defined(BOOST_ASIO_WINDOWS)
+ // || defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // || defined(__CYGWIN__)
   int saved_errno = errno;
   signal_state* state = get_signal_state();
   signed_size_type result = ::write(state->write_descriptor_,
       &signal_number, sizeof(signal_number));
   (void)result;
   errno = saved_errno;
-#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+#endif // defined(BOOST_ASIO_WINDOWS)
+ // || defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // || defined(__CYGWIN__)
 
 #if defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION)
   ::signal(signal_number, asio_signal_handler);
 #endif // defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION)
 }
 
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
 class signal_set_service::pipe_read_op : public reactor_op
 {
 public:
@@ -105,22 +113,32 @@
     delete o;
   }
 };
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 
 signal_set_service::signal_set_service(
     boost::asio::io_service& io_service)
   : io_service_(boost::asio::use_service<io_service_impl>(io_service)),
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
     reactor_(boost::asio::use_service<reactor>(io_service)),
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
     next_(0),
     prev_(0)
 {
   get_signal_state()->mutex_.init();
 
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
   reactor_.init_task();
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 
   for (int i = 0; i < max_signal_number; ++i)
     registrations_[i] = 0;
@@ -155,7 +173,9 @@
 void signal_set_service::fork_service(
     boost::asio::io_service::fork_event fork_ev)
 {
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
   signal_state* state = get_signal_state();
   static_mutex::scoped_lock lock(state->mutex_);
 
@@ -195,9 +215,13 @@
   default:
     break;
   }
-#else // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#else // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
   (void)fork_ev;
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 }
 
 void signal_set_service::construct(
@@ -489,13 +513,17 @@
     state->service_list_->prev_ = service;
   state->service_list_ = service;
 
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
   // Register for pipe readiness notifications.
   int read_descriptor = state->read_descriptor_;
   lock.unlock();
   service->reactor_.register_internal_descriptor(reactor::read_op,
       read_descriptor, service->reactor_data_, new pipe_read_op);
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 }
 
 void signal_set_service::remove_service(signal_set_service* service)
@@ -505,14 +533,18 @@
 
   if (service->next_ || service->prev_ || state->service_list_ == service)
   {
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
     // Disable the pipe readiness notifications.
     int read_descriptor = state->read_descriptor_;
     lock.unlock();
     service->reactor_.deregister_descriptor(
         read_descriptor, service->reactor_data_, false);
     lock.lock();
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 
     // Remove service from linked list of all services.
     if (state->service_list_ == service)
@@ -534,7 +566,9 @@
 
 void signal_set_service::open_descriptors()
 {
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
   signal_state* state = get_signal_state();
 
   int pipe_fds[2];
@@ -557,12 +591,16 @@
         boost::asio::error::get_system_category());
     boost::asio::detail::throw_error(ec, "signal_set_service pipe");
   }
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 }
 
 void signal_set_service::close_descriptors()
 {
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
   signal_state* state = get_signal_state();
 
   if (state->read_descriptor_ != -1)
@@ -572,7 +610,9 @@
   if (state->write_descriptor_ != -1)
     ::close(state->write_descriptor_);
   state->write_descriptor_ = -1;
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 }
 
 void signal_set_service::start_wait_op(

Modified: trunk/boost/asio/detail/impl/socket_ops.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/socket_ops.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/impl/socket_ops.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -16,6 +16,7 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
+
 #include <cctype>
 #include <cstdio>
 #include <cstdlib>
@@ -26,6 +27,12 @@
 #include <boost/asio/detail/socket_ops.hpp>
 #include <boost/asio/error.hpp>
 
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <codecvt>
+# include <locale>
+# include <string>
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) \
   || defined(__MACH__) && defined(__APPLE__)
 # if defined(BOOST_ASIO_HAS_PTHREADS)
@@ -41,6 +48,8 @@
 namespace detail {
 namespace socket_ops {
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
 struct msghdr { int msg_namelen; };
 #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
@@ -52,6 +61,8 @@
 extern "C" unsigned int if_nametoindex(const char*);
 #endif // defined(__hpux)
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 inline void clear_last_error()
 {
 #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
@@ -61,6 +72,8 @@
 #endif
 }
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 template <typename ReturnType>
 inline ReturnType error_wrapper(ReturnType return_value,
     boost::system::error_code& ec)
@@ -1334,7 +1347,7 @@
   if (s == invalid_socket)
     return s;
 
- if (af == AF_INET6)
+ if (af == BOOST_ASIO_OS_DEF(AF_INET6))
   {
     // Try to enable the POSIX default behaviour of having IPV6_V6ONLY set to
     // false. This will only succeed on Windows Vista and later versions of
@@ -1855,14 +1868,51 @@
        // || defined(__SYMBIAN32__)
 }
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 const char* inet_ntop(int af, const void* src, char* dest, size_t length,
     unsigned long scope_id, boost::system::error_code& ec)
 {
   clear_last_error();
-#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ using namespace std; // For sprintf.
+ const unsigned char* bytes = static_cast<const unsigned char*>(src);
+ if (af == BOOST_ASIO_OS_DEF(AF_INET))
+ {
+ sprintf_s(dest, length, "%u.%u.%u.%u",
+ bytes[0], bytes[1], bytes[2], bytes[3]);
+ return dest;
+ }
+ else if (af == BOOST_ASIO_OS_DEF(AF_INET6))
+ {
+ size_t n = 0, b = 0, z = 0;
+ while (n < length && b < 16)
+ {
+ if (bytes[b] == 0 && bytes[b + 1] == 0 && z == 0)
+ {
+ do b += 2; while (b < 16 && bytes[b] == 0 && bytes[b + 1] == 0);
+ n += sprintf_s(dest + n, length - n, ":%s", b < 16 ? "" : ":"), ++z;
+ }
+ else
+ {
+ n += sprintf_s(dest + n, length - n, "%s%x", b ? ":" : "",
+ (static_cast<u_long_type>(bytes[b]) << 8) | bytes[b + 1]);
+ b += 2;
+ }
+ }
+ if (scope_id)
+ n += sprintf_s(dest + n, length - n, "%%%lu", scope_id);
+ return dest;
+ }
+ else
+ {
+ ec = boost::asio::error::address_family_not_supported;
+ return 0;
+ }
+#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
   using namespace std; // For memcpy.
 
- if (af != AF_INET && af != AF_INET6)
+ if (af != BOOST_ASIO_OS_DEF(AF_INET) && af != BOOST_ASIO_OS_DEF(AF_INET6))
   {
     ec = boost::asio::error::address_family_not_supported;
     return 0;
@@ -1876,17 +1926,17 @@
     sockaddr_in6_type v6;
   } address;
   DWORD address_length;
- if (af == AF_INET)
+ if (af == BOOST_ASIO_OS_DEF(AF_INET))
   {
     address_length = sizeof(sockaddr_in4_type);
- address.v4.sin_family = AF_INET;
+ address.v4.sin_family = BOOST_ASIO_OS_DEF(AF_INET);
     address.v4.sin_port = 0;
     memcpy(&address.v4.sin_addr, src, sizeof(in4_addr_type));
   }
   else // AF_INET6
   {
     address_length = sizeof(sockaddr_in6_type);
- address.v6.sin6_family = AF_INET6;
+ address.v6.sin6_family = BOOST_ASIO_OS_DEF(AF_INET6);
     address.v6.sin6_port = 0;
     address.v6.sin6_flowinfo = 0;
     address.v6.sin6_scope_id = scope_id;
@@ -1918,7 +1968,7 @@
         af, src, dest, static_cast<int>(length)), ec);
   if (result == 0 && !ec)
     ec = boost::asio::error::invalid_argument;
- if (result != 0 && af == AF_INET6 && scope_id != 0)
+ if (result != 0 && af == BOOST_ASIO_OS_DEF(AF_INET6) && scope_id != 0)
   {
     using namespace std; // For strcat and sprintf.
     char if_name[IF_NAMESIZE + 1] = "%";
@@ -1938,10 +1988,154 @@
     unsigned long* scope_id, boost::system::error_code& ec)
 {
   clear_last_error();
-#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ using namespace std; // For sscanf.
+ unsigned char* bytes = static_cast<unsigned char*>(dest);
+ if (af == BOOST_ASIO_OS_DEF(AF_INET))
+ {
+ unsigned int b0, b1, b2, b3;
+ if (sscanf_s(src, "%u.%u.%u.%u", &b0, &b1, &b2, &b3) != 4)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return -1;
+ }
+ if (b0 > 255 || b1 > 255 || b2 > 255 || b3 > 255)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return -1;
+ }
+ bytes[0] = static_cast<unsigned char>(b0);
+ bytes[1] = static_cast<unsigned char>(b1);
+ bytes[2] = static_cast<unsigned char>(b2);
+ bytes[3] = static_cast<unsigned char>(b3);
+ ec = boost::system::error_code();
+ return 1;
+ }
+ else if (af == BOOST_ASIO_OS_DEF(AF_INET6))
+ {
+ unsigned char* bytes = static_cast<unsigned char*>(dest);
+ std::memset(bytes, 0, 16);
+ unsigned char back_bytes[16] = { 0 };
+ int num_front_bytes = 0, num_back_bytes = 0;
+ const char* p = src;
+
+ enum { fword, fcolon, bword, scope, done } state = fword;
+ unsigned long current_word = 0;
+ while (state != done)
+ {
+ if (current_word > 0xFFFF)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return -1;
+ }
+
+ switch (state)
+ {
+ case fword:
+ if (*p >= '0' && *p <= '9')
+ current_word = current_word * 16 + *p++ - '0';
+ else if (*p >= 'a' && *p <= 'f')
+ current_word = current_word * 16 + *p++ - 'a' + 10;
+ else if (*p >= 'A' && *p <= 'F')
+ current_word = current_word * 16 + *p++ - 'A' + 10;
+ else
+ {
+ if (num_front_bytes == 16)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return -1;
+ }
+
+ bytes[num_front_bytes++] = (current_word >> 8) & 0xFF;
+ bytes[num_front_bytes++] = current_word & 0xFF;
+ current_word = 0;
+
+ if (*p == ':')
+ state = fcolon, ++p;
+ else if (*p == '%')
+ state = scope, ++p;
+ else if (*p == 0)
+ state = done;
+ else
+ {
+ ec = boost::asio::error::invalid_argument;
+ return -1;
+ }
+ }
+ break;
+
+ case fcolon:
+ if (*p == ':')
+ state = bword, ++p;
+ else
+ state = fword;
+ break;
+
+ case bword:
+ if (*p >= '0' && *p <= '9')
+ current_word = current_word * 16 + *p++ - '0';
+ else if (*p >= 'a' && *p <= 'f')
+ current_word = current_word * 16 + *p++ - 'a' + 10;
+ else if (*p >= 'A' && *p <= 'F')
+ current_word = current_word * 16 + *p++ - 'A' + 10;
+ else
+ {
+ if (num_front_bytes + num_back_bytes == 16)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return -1;
+ }
+
+ back_bytes[num_back_bytes++] = (current_word >> 8) & 0xFF;
+ back_bytes[num_back_bytes++] = current_word & 0xFF;
+ current_word = 0;
+
+ if (*p == ':')
+ state = bword, ++p;
+ else if (*p == '%')
+ state = scope, ++p;
+ else if (*p == 0)
+ state = done;
+ else
+ {
+ ec = boost::asio::error::invalid_argument;
+ return -1;
+ }
+ }
+ break;
+
+ case scope:
+ if (*p >= '0' && *p <= '9')
+ current_word = current_word * 10 + *p++ - '0';
+ else if (*p == 0)
+ *scope_id = current_word, state = done;
+ else
+ {
+ ec = boost::asio::error::invalid_argument;
+ return -1;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ for (int i = 0; i < num_back_bytes; ++i)
+ bytes[16 - num_back_bytes + i] = back_bytes[i];
+
+ ec = boost::system::error_code();
+ return 1;
+ }
+ else
+ {
+ ec = boost::asio::error::address_family_not_supported;
+ return -1;
+ }
+#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
   using namespace std; // For memcpy and strcmp.
 
- if (af != AF_INET && af != AF_INET6)
+ if (af != BOOST_ASIO_OS_DEF(AF_INET) && af != BOOST_ASIO_OS_DEF(AF_INET6))
   {
     ec = boost::asio::error::address_family_not_supported;
     return -1;
@@ -1966,7 +2160,7 @@
         const_cast<char*>(src), af, 0, &address.base, &address_length), ec);
 #endif
 
- if (af == AF_INET)
+ if (af == BOOST_ASIO_OS_DEF(AF_INET))
   {
     if (result != socket_error_retval)
     {
@@ -2002,7 +2196,7 @@
   int result = error_wrapper(::inet_pton(af, src, dest), ec);
   if (result <= 0 && !ec)
     ec = boost::asio::error::invalid_argument;
- if (result > 0 && af == AF_INET6 && scope_id)
+ if (result > 0 && af == BOOST_ASIO_OS_DEF(AF_INET6) && scope_id)
   {
     using namespace std; // For strchr and atoi.
     *scope_id = 0;
@@ -2024,14 +2218,47 @@
 int gethostname(char* name, int namelen, boost::system::error_code& ec)
 {
   clear_last_error();
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ try
+ {
+ using namespace Windows::Foundation::Collections;
+ using namespace Windows::Networking;
+ using namespace Windows::Networking::Connectivity;
+ IVectorView<HostName^>^ hostnames = NetworkInformation::GetHostNames();
+ for (unsigned i = 0; i < hostnames->Size; ++i)
+ {
+ HostName^ hostname = hostnames->GetAt(i);
+ if (hostname->Type == HostNameType::DomainName)
+ {
+ std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
+ std::string raw_name = converter.to_bytes(hostname->RawName->Data());
+ if (namelen > 0 && raw_name.size() < static_cast<std::size_t>(namelen))
+ {
+ strcpy_s(name, namelen, raw_name.c_str());
+ return 0;
+ }
+ }
+ }
+ return -1;
+ }
+ catch (Platform::Exception^ e)
+ {
+ ec = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ return -1;
+ }
+#else // defined(BOOST_ASIO_WINDOWS_RUNTIME)
   int result = error_wrapper(::gethostname(name, namelen), ec);
-#if defined(BOOST_ASIO_WINDOWS)
+# if defined(BOOST_ASIO_WINDOWS)
   if (result == 0)
     ec = boost::system::error_code();
-#endif
+# endif // defined(BOOST_ASIO_WINDOWS)
   return result;
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
 }
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) \
   || defined(__MACH__) && defined(__APPLE__)
 
@@ -2109,7 +2336,7 @@
   (void)(buffer);
   (void)(buflength);
   (void)(ai_flags);
- if (af != AF_INET)
+ if (af != BOOST_ASIO_OS_DEF(AF_INET))
   {
     ec = boost::asio::error::address_family_not_supported;
     return 0;
@@ -2122,7 +2349,7 @@
   return result;
 #elif defined(__sun) || defined(__QNX__)
   (void)(ai_flags);
- if (af != AF_INET)
+ if (af != BOOST_ASIO_OS_DEF(AF_INET))
   {
     ec = boost::asio::error::address_family_not_supported;
     return 0;
@@ -2147,7 +2374,7 @@
   return retval;
 #else
   (void)(ai_flags);
- if (af != AF_INET)
+ if (af != BOOST_ASIO_OS_DEF(AF_INET))
   {
     ec = boost::asio::error::address_family_not_supported;
     return 0;
@@ -2192,22 +2419,22 @@
       // No host and AI_PASSIVE implies wildcard bind.
       switch (hints->ai_family)
       {
- case AF_INET:
+ case BOOST_ASIO_OS_DEF(AF_INET):
         search[search_count].host = "0.0.0.0";
- search[search_count].family = AF_INET;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET);
         ++search_count;
         break;
- case AF_INET6:
+ case BOOST_ASIO_OS_DEF(AF_INET6):
         search[search_count].host = "0::0";
- search[search_count].family = AF_INET6;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET6);
         ++search_count;
         break;
- case AF_UNSPEC:
+ case BOOST_ASIO_OS_DEF(AF_UNSPEC):
         search[search_count].host = "0::0";
- search[search_count].family = AF_INET6;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET6);
         ++search_count;
         search[search_count].host = "0.0.0.0";
- search[search_count].family = AF_INET;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET);
         ++search_count;
         break;
       default:
@@ -2219,22 +2446,22 @@
       // No host and not AI_PASSIVE means connect to local host.
       switch (hints->ai_family)
       {
- case AF_INET:
+ case BOOST_ASIO_OS_DEF(AF_INET):
         search[search_count].host = "localhost";
- search[search_count].family = AF_INET;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET);
         ++search_count;
         break;
- case AF_INET6:
+ case BOOST_ASIO_OS_DEF(AF_INET6):
         search[search_count].host = "localhost";
- search[search_count].family = AF_INET6;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET6);
         ++search_count;
         break;
- case AF_UNSPEC:
+ case BOOST_ASIO_OS_DEF(AF_UNSPEC):
         search[search_count].host = "localhost";
- search[search_count].family = AF_INET6;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET6);
         ++search_count;
         search[search_count].host = "localhost";
- search[search_count].family = AF_INET;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET);
         ++search_count;
         break;
       default:
@@ -2247,22 +2474,22 @@
     // Host is specified.
     switch (hints->ai_family)
     {
- case AF_INET:
+ case BOOST_ASIO_OS_DEF(AF_INET):
       search[search_count].host = host;
- search[search_count].family = AF_INET;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET);
       ++search_count;
       break;
- case AF_INET6:
+ case BOOST_ASIO_OS_DEF(AF_INET6):
       search[search_count].host = host;
- search[search_count].family = AF_INET6;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET6);
       ++search_count;
       break;
- case AF_UNSPEC:
+ case BOOST_ASIO_OS_DEF(AF_UNSPEC):
       search[search_count].host = host;
- search[search_count].family = AF_INET6;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET6);
       ++search_count;
       search[search_count].host = host;
- search[search_count].family = AF_INET;
+ search[search_count].family = BOOST_ASIO_OS_DEF(AF_INET);
       ++search_count;
       break;
     default:
@@ -2322,23 +2549,23 @@
 
   switch (ai->ai_family)
   {
- case AF_INET:
+ case BOOST_ASIO_OS_DEF(AF_INET):
     {
       sockaddr_in4_type* sinptr = gai_alloc<sockaddr_in4_type>();
       if (sinptr == 0)
         return EAI_MEMORY;
- sinptr->sin_family = AF_INET;
+ sinptr->sin_family = BOOST_ASIO_OS_DEF(AF_INET);
       memcpy(&sinptr->sin_addr, addr, sizeof(in4_addr_type));
       ai->ai_addr = reinterpret_cast<sockaddr*>(sinptr);
       ai->ai_addrlen = sizeof(sockaddr_in4_type);
       break;
     }
- case AF_INET6:
+ case BOOST_ASIO_OS_DEF(AF_INET6):
     {
       sockaddr_in6_type* sin6ptr = gai_alloc<sockaddr_in6_type>();
       if (sin6ptr == 0)
         return EAI_MEMORY;
- sin6ptr->sin6_family = AF_INET6;
+ sin6ptr->sin6_family = BOOST_ASIO_OS_DEF(AF_INET6);
       memcpy(&sin6ptr->sin6_addr, addr, sizeof(in6_addr_type));
       ai->ai_addr = reinterpret_cast<sockaddr*>(sin6ptr);
       ai->ai_addrlen = sizeof(sockaddr_in6_type);
@@ -2400,7 +2627,7 @@
 
     switch (ai->ai_family)
     {
- case AF_INET:
+ case BOOST_ASIO_OS_DEF(AF_INET):
       {
         sockaddr_in4_type* sinptr =
           reinterpret_cast<sockaddr_in4_type*>(ai->ai_addr);
@@ -2408,7 +2635,7 @@
         ++num_found;
         break;
       }
- case AF_INET6:
+ case BOOST_ASIO_OS_DEF(AF_INET6):
       {
         sockaddr_in6_type* sin6ptr =
           reinterpret_cast<sockaddr_in6_type*>(ai->ai_addr);
@@ -2517,10 +2744,10 @@
   // Check combination of family and socket type.
   switch (family)
   {
- case AF_UNSPEC:
+ case BOOST_ASIO_OS_DEF(AF_UNSPEC):
     break;
- case AF_INET:
- case AF_INET6:
+ case BOOST_ASIO_OS_DEF(AF_INET):
+ case BOOST_ASIO_OS_DEF(AF_INET6):
     if (service != 0 && service[0] != '\0')
       if (socktype != 0 && socktype != SOCK_STREAM && socktype != SOCK_DGRAM)
         return EAI_SOCKTYPE;
@@ -2555,18 +2782,18 @@
 
   // Supply default hints if not specified by caller.
   addrinfo_type hints = addrinfo_type();
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = BOOST_ASIO_OS_DEF(AF_UNSPEC);
   if (hintsp)
     hints = *hintsp;
 
   // If the resolution is not specifically for AF_INET6, remove the AI_V4MAPPED
   // and AI_ALL flags.
 #if defined(AI_V4MAPPED)
- if (hints.ai_family != AF_INET6)
+ if (hints.ai_family != BOOST_ASIO_OS_DEF(AF_INET6))
     hints.ai_flags &= ~AI_V4MAPPED;
 #endif
 #if defined(AI_ALL)
- if (hints.ai_family != AF_INET6)
+ if (hints.ai_family != BOOST_ASIO_OS_DEF(AF_INET6))
     hints.ai_flags &= ~AI_ALL;
 #endif
 
@@ -2586,17 +2813,19 @@
     // Check for IPv4 dotted decimal string.
     in4_addr_type inaddr;
     boost::system::error_code ec;
- if (socket_ops::inet_pton(AF_INET, sptr->host, &inaddr, 0, ec) == 1)
+ if (socket_ops::inet_pton(BOOST_ASIO_OS_DEF(AF_INET),
+ sptr->host, &inaddr, 0, ec) == 1)
     {
- if (hints.ai_family != AF_UNSPEC && hints.ai_family != AF_INET)
+ if (hints.ai_family != BOOST_ASIO_OS_DEF(AF_UNSPEC)
+ && hints.ai_family != BOOST_ASIO_OS_DEF(AF_INET))
       {
         freeaddrinfo_emulation(aihead);
         gai_free(canon);
         return EAI_FAMILY;
       }
- if (sptr->family == AF_INET)
+ if (sptr->family == BOOST_ASIO_OS_DEF(AF_INET))
       {
- rc = gai_aistruct(&ainext, &hints, &inaddr, AF_INET);
+ rc = gai_aistruct(&ainext, &hints, &inaddr, BOOST_ASIO_OS_DEF(AF_INET));
         if (rc != 0)
         {
           freeaddrinfo_emulation(aihead);
@@ -2609,17 +2838,20 @@
 
     // Check for IPv6 hex string.
     in6_addr_type in6addr;
- if (socket_ops::inet_pton(AF_INET6, sptr->host, &in6addr, 0, ec) == 1)
+ if (socket_ops::inet_pton(BOOST_ASIO_OS_DEF(AF_INET6),
+ sptr->host, &in6addr, 0, ec) == 1)
     {
- if (hints.ai_family != AF_UNSPEC && hints.ai_family != AF_INET6)
+ if (hints.ai_family != BOOST_ASIO_OS_DEF(AF_UNSPEC)
+ && hints.ai_family != BOOST_ASIO_OS_DEF(AF_INET6))
       {
         freeaddrinfo_emulation(aihead);
         gai_free(canon);
         return EAI_FAMILY;
       }
- if (sptr->family == AF_INET6)
+ if (sptr->family == BOOST_ASIO_OS_DEF(AF_INET6))
       {
- rc = gai_aistruct(&ainext, &hints, &in6addr, AF_INET6);
+ rc = gai_aistruct(&ainext, &hints, &in6addr,
+ BOOST_ASIO_OS_DEF(AF_INET6));
         if (rc != 0)
         {
           freeaddrinfo_emulation(aihead);
@@ -2656,7 +2888,8 @@
     }
 
     // Check for address family mismatch if one was specified.
- if (hints.ai_family != AF_UNSPEC && hints.ai_family != hptr->h_addrtype)
+ if (hints.ai_family != BOOST_ASIO_OS_DEF(AF_UNSPEC)
+ && hints.ai_family != hptr->h_addrtype)
     {
       freeaddrinfo_emulation(aihead);
       gai_free(canon);
@@ -2752,7 +2985,7 @@
   unsigned short port;
   switch (sa->sa_family)
   {
- case AF_INET:
+ case BOOST_ASIO_OS_DEF(AF_INET):
     if (salen != sizeof(sockaddr_in4_type))
     {
       return ec = boost::asio::error::invalid_argument;
@@ -2762,7 +2995,7 @@
     addr_len = sizeof(in4_addr_type);
     port = reinterpret_cast<const sockaddr_in4_type*>(sa)->sin_port;
     break;
- case AF_INET6:
+ case BOOST_ASIO_OS_DEF(AF_INET6):
     if (salen != sizeof(sockaddr_in6_type))
     {
       return ec = boost::asio::error::invalid_argument;
@@ -3077,24 +3310,60 @@
   return ec;
 }
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 u_long_type network_to_host_long(u_long_type value)
 {
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ unsigned char* value_p = reinterpret_cast<unsigned char*>(&value);
+ u_long_type result = (static_cast<u_long_type>(value_p[0]) << 24)
+ | (static_cast<u_long_type>(value_p[1]) << 16)
+ | (static_cast<u_long_type>(value_p[2]) << 8)
+ | static_cast<u_long_type>(value_p[3]);
+ return result;
+#else // defined(BOOST_ASIO_WINDOWS_RUNTIME)
   return ntohl(value);
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
 }
 
 u_long_type host_to_network_long(u_long_type value)
 {
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ u_long_type result;
+ unsigned char* result_p = reinterpret_cast<unsigned char*>(&result);
+ result_p[0] = static_cast<unsigned char>((value >> 24) & 0xFF);
+ result_p[1] = static_cast<unsigned char>((value >> 16) & 0xFF);
+ result_p[2] = static_cast<unsigned char>((value >> 8) & 0xFF);
+ result_p[3] = static_cast<unsigned char>(value & 0xFF);
+ return result;
+#else // defined(BOOST_ASIO_WINDOWS_RUNTIME)
   return htonl(value);
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
 }
 
 u_short_type network_to_host_short(u_short_type value)
 {
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ unsigned char* value_p = reinterpret_cast<unsigned char*>(&value);
+ u_short_type result = (static_cast<u_long_type>(value_p[0]) << 8)
+ | static_cast<u_long_type>(value_p[1]);
+ return result;
+#else // defined(BOOST_ASIO_WINDOWS_RUNTIME)
   return ntohs(value);
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
 }
 
 u_short_type host_to_network_short(u_short_type value)
 {
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ u_long_type result;
+ unsigned char* result_p = reinterpret_cast<unsigned char*>(&result);
+ result_p[0] = static_cast<unsigned char>((value >> 8) & 0xFF);
+ result_p[1] = static_cast<unsigned char>(value & 0xFF);
+ return result;
+#else // defined(BOOST_ASIO_WINDOWS_RUNTIME)
   return htons(value);
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
 }
 
 } // namespace socket_ops

Modified: trunk/boost/asio/detail/impl/socket_select_interrupter.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/socket_select_interrupter.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/impl/socket_select_interrupter.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,6 +17,8 @@
 
 #include <boost/asio/detail/config.hpp>
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #if defined(BOOST_ASIO_WINDOWS) \
   || defined(__CYGWIN__) \
   || defined(__SYMBIAN32__)
@@ -170,4 +172,6 @@
        // || defined(__CYGWIN__)
        // || defined(__SYMBIAN32__)
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #endif // BOOST_ASIO_DETAIL_IMPL_SOCKET_SELECT_INTERRUPTER_IPP

Added: trunk/boost/asio/detail/impl/winrt_ssocket_service_base.ipp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/impl/winrt_ssocket_service_base.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,608 @@
+//
+// detail/impl/winrt_ssocket_service_base.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_IMPL_WINRT_SSOCKET_SERVICE_BASE_IPP
+#define BOOST_ASIO_DETAIL_IMPL_WINRT_SSOCKET_SERVICE_BASE_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <cstring>
+#include <boost/asio/detail/winrt_ssocket_service_base.hpp>
+#include <boost/asio/detail/winrt_async_op.hpp>
+#include <boost/asio/detail/winrt_utils.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+winrt_ssocket_service_base::winrt_ssocket_service_base(
+ boost::asio::io_service& io_service)
+ : io_service_(use_service<io_service_impl>(io_service)),
+ async_manager_(use_service<winrt_async_manager>(io_service)),
+ mutex_(),
+ impl_list_(0)
+{
+}
+
+void winrt_ssocket_service_base::shutdown_service()
+{
+ // Close all implementations, causing all operations to complete.
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ base_implementation_type* impl = impl_list_;
+ while (impl)
+ {
+ boost::system::error_code ignored_ec;
+ close(*impl, ignored_ec);
+ impl = impl->next_;
+ }
+}
+
+void winrt_ssocket_service_base::construct(
+ winrt_ssocket_service_base::base_implementation_type& impl)
+{
+ // Insert implementation into linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ impl.next_ = impl_list_;
+ impl.prev_ = 0;
+ if (impl_list_)
+ impl_list_->prev_ = &impl;
+ impl_list_ = &impl;
+}
+
+void winrt_ssocket_service_base::base_move_construct(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ winrt_ssocket_service_base::base_implementation_type& other_impl)
+{
+ impl.socket_ = other_impl.socket_;
+ other_impl.socket_ = nullptr;
+
+ // Insert implementation into linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ impl.next_ = impl_list_;
+ impl.prev_ = 0;
+ if (impl_list_)
+ impl_list_->prev_ = &impl;
+ impl_list_ = &impl;
+}
+
+void winrt_ssocket_service_base::base_move_assign(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ winrt_ssocket_service_base& other_service,
+ winrt_ssocket_service_base::base_implementation_type& other_impl)
+{
+ boost::system::error_code ignored_ec;
+ close(impl, ignored_ec);
+
+ if (this != &other_service)
+ {
+ // Remove implementation from linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ if (impl_list_ == &impl)
+ impl_list_ = impl.next_;
+ if (impl.prev_)
+ impl.prev_->next_ = impl.next_;
+ if (impl.next_)
+ impl.next_->prev_= impl.prev_;
+ impl.next_ = 0;
+ impl.prev_ = 0;
+ }
+
+ impl.socket_ = other_impl.socket_;
+ other_impl.socket_ = nullptr;
+
+ if (this != &other_service)
+ {
+ // Insert implementation into linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(other_service.mutex_);
+ impl.next_ = other_service.impl_list_;
+ impl.prev_ = 0;
+ if (other_service.impl_list_)
+ other_service.impl_list_->prev_ = &impl;
+ other_service.impl_list_ = &impl;
+ }
+}
+
+void winrt_ssocket_service_base::destroy(
+ winrt_ssocket_service_base::base_implementation_type& impl)
+{
+ boost::system::error_code ignored_ec;
+ close(impl, ignored_ec);
+
+ // Remove implementation from linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ if (impl_list_ == &impl)
+ impl_list_ = impl.next_;
+ if (impl.prev_)
+ impl.prev_->next_ = impl.next_;
+ if (impl.next_)
+ impl.next_->prev_= impl.prev_;
+ impl.next_ = 0;
+ impl.prev_ = 0;
+}
+
+boost::system::error_code winrt_ssocket_service_base::close(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ boost::system::error_code& ec)
+{
+ if (impl.socket_)
+ {
+ delete impl.socket_;
+ impl.socket_ = nullptr;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+std::size_t winrt_ssocket_service_base::do_get_endpoint(
+ const base_implementation_type& impl, bool local,
+ void* addr, std::size_t addr_len, boost::system::error_code& ec) const
+{
+ if (!is_open(impl))
+ {
+ ec = boost::asio::error::bad_descriptor;
+ return addr_len;
+ }
+
+ try
+ {
+ std::string addr_string = winrt_utils::string(local
+ ? impl.socket_->Information->LocalAddress->CanonicalName
+ : impl.socket_->Information->RemoteAddress->CanonicalName);
+ unsigned short port = winrt_utils::integer(local
+ ? impl.socket_->Information->LocalPort
+ : impl.socket_->Information->RemotePort);
+ unsigned long scope = 0;
+
+ switch (reinterpret_cast<const socket_addr_type*>(addr)->sa_family)
+ {
+ case BOOST_ASIO_OS_DEF(AF_INET):
+ if (addr_len < sizeof(sockaddr_in4_type))
+ {
+ ec = boost::asio::error::invalid_argument;
+ return addr_len;
+ }
+ else
+ {
+ socket_ops::inet_pton(BOOST_ASIO_OS_DEF(AF_INET), addr_string.c_str(),
+ &reinterpret_cast<sockaddr_in4_type*>(addr)->sin_addr, &scope, ec);
+ reinterpret_cast<sockaddr_in4_type*>(addr)->sin_port
+ = socket_ops::host_to_network_short(port);
+ ec = boost::system::error_code();
+ return sizeof(sockaddr_in4_type);
+ }
+ case BOOST_ASIO_OS_DEF(AF_INET6):
+ if (addr_len < sizeof(sockaddr_in6_type))
+ {
+ ec = boost::asio::error::invalid_argument;
+ return addr_len;
+ }
+ else
+ {
+ socket_ops::inet_pton(BOOST_ASIO_OS_DEF(AF_INET6), addr_string.c_str(),
+ &reinterpret_cast<sockaddr_in6_type*>(addr)->sin6_addr, &scope, ec);
+ reinterpret_cast<sockaddr_in6_type*>(addr)->sin6_port
+ = socket_ops::host_to_network_short(port);
+ ec = boost::system::error_code();
+ return sizeof(sockaddr_in6_type);
+ }
+ default:
+ ec = boost::asio::error::address_family_not_supported;
+ return addr_len;
+ }
+ }
+ catch (Platform::Exception^ e)
+ {
+ ec = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ return addr_len;
+ }
+}
+
+boost::system::error_code winrt_ssocket_service_base::do_set_option(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ int level, int optname, const void* optval,
+ std::size_t optlen, boost::system::error_code& ec)
+{
+ if (!is_open(impl))
+ {
+ ec = boost::asio::error::bad_descriptor;
+ return ec;
+ }
+
+ try
+ {
+ if (level == BOOST_ASIO_OS_DEF(SOL_SOCKET)
+ && optname == BOOST_ASIO_OS_DEF(SO_KEEPALIVE))
+ {
+ if (optlen == sizeof(int))
+ {
+ int value = 0;
+ std::memcpy(&value, optval, optlen);
+ impl.socket_->Control->KeepAlive = !!value;
+ ec = boost::system::error_code();
+ }
+ else
+ {
+ ec = boost::asio::error::invalid_argument;
+ }
+ }
+ else if (level == BOOST_ASIO_OS_DEF(IPPROTO_TCP)
+ && optname == BOOST_ASIO_OS_DEF(TCP_NODELAY))
+ {
+ if (optlen == sizeof(int))
+ {
+ int value = 0;
+ std::memcpy(&value, optval, optlen);
+ impl.socket_->Control->NoDelay = !!value;
+ ec = boost::system::error_code();
+ }
+ else
+ {
+ ec = boost::asio::error::invalid_argument;
+ }
+ }
+ else
+ {
+ ec = boost::asio::error::invalid_argument;
+ }
+ }
+ catch (Platform::Exception^ e)
+ {
+ ec = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ }
+
+ return ec;
+}
+
+void winrt_ssocket_service_base::do_get_option(
+ const winrt_ssocket_service_base::base_implementation_type& impl,
+ int level, int optname, void* optval,
+ std::size_t* optlen, boost::system::error_code& ec) const
+{
+ if (!is_open(impl))
+ {
+ ec = boost::asio::error::bad_descriptor;
+ return;
+ }
+
+ try
+ {
+ if (level == BOOST_ASIO_OS_DEF(SOL_SOCKET)
+ && optname == BOOST_ASIO_OS_DEF(SO_KEEPALIVE))
+ {
+ if (*optlen >= sizeof(int))
+ {
+ int value = impl.socket_->Control->KeepAlive ? 1 : 0;
+ std::memcpy(optval, &value, sizeof(int));
+ *optlen = sizeof(int);
+ ec = boost::system::error_code();
+ }
+ else
+ {
+ ec = boost::asio::error::invalid_argument;
+ }
+ }
+ else if (level == BOOST_ASIO_OS_DEF(IPPROTO_TCP)
+ && optname == BOOST_ASIO_OS_DEF(TCP_NODELAY))
+ {
+ if (*optlen >= sizeof(int))
+ {
+ int value = impl.socket_->Control->NoDelay ? 1 : 0;
+ std::memcpy(optval, &value, sizeof(int));
+ *optlen = sizeof(int);
+ ec = boost::system::error_code();
+ }
+ else
+ {
+ ec = boost::asio::error::invalid_argument;
+ }
+ }
+ else
+ {
+ ec = boost::asio::error::invalid_argument;
+ }
+ }
+ catch (Platform::Exception^ e)
+ {
+ ec = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ }
+}
+
+boost::system::error_code winrt_ssocket_service_base::do_connect(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ const void* addr, boost::system::error_code& ec)
+{
+ if (!is_open(impl))
+ {
+ ec = boost::asio::error::bad_descriptor;
+ return ec;
+ }
+
+ char addr_string[max_addr_v6_str_len];
+ unsigned short port;
+ switch (reinterpret_cast<const socket_addr_type*>(addr)->sa_family)
+ {
+ case BOOST_ASIO_OS_DEF(AF_INET):
+ socket_ops::inet_ntop(BOOST_ASIO_OS_DEF(AF_INET),
+ &reinterpret_cast<const sockaddr_in4_type*>(addr)->sin_addr,
+ addr_string, sizeof(addr_string), 0, ec);
+ port = socket_ops::network_to_host_short(
+ reinterpret_cast<const sockaddr_in4_type*>(addr)->sin_port);
+ break;
+ case BOOST_ASIO_OS_DEF(AF_INET6):
+ socket_ops::inet_ntop(BOOST_ASIO_OS_DEF(AF_INET6),
+ &reinterpret_cast<const sockaddr_in6_type*>(addr)->sin6_addr,
+ addr_string, sizeof(addr_string), 0, ec);
+ port = socket_ops::network_to_host_short(
+ reinterpret_cast<const sockaddr_in6_type*>(addr)->sin6_port);
+ break;
+ default:
+ ec = boost::asio::error::address_family_not_supported;
+ return ec;
+ }
+
+ if (!ec) try
+ {
+ async_manager_.sync(impl.socket_->ConnectAsync(
+ ref new Windows::Networking::HostName(
+ winrt_utils::string(addr_string)),
+ winrt_utils::string(port)), ec);
+ }
+ catch (Platform::Exception^ e)
+ {
+ ec = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ }
+
+ return ec;
+}
+
+void winrt_ssocket_service_base::start_connect_op(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ const void* addr, winrt_async_op<void>* op, bool is_continuation)
+{
+ if (!is_open(impl))
+ {
+ op->ec_ = boost::asio::error::bad_descriptor;
+ io_service_.post_immediate_completion(op, is_continuation);
+ return;
+ }
+
+ char addr_string[max_addr_v6_str_len];
+ unsigned short port = 0;
+ switch (reinterpret_cast<const socket_addr_type*>(addr)->sa_family)
+ {
+ case BOOST_ASIO_OS_DEF(AF_INET):
+ socket_ops::inet_ntop(BOOST_ASIO_OS_DEF(AF_INET),
+ &reinterpret_cast<const sockaddr_in4_type*>(addr)->sin_addr,
+ addr_string, sizeof(addr_string), 0, op->ec_);
+ port = socket_ops::network_to_host_short(
+ reinterpret_cast<const sockaddr_in4_type*>(addr)->sin_port);
+ break;
+ case BOOST_ASIO_OS_DEF(AF_INET6):
+ socket_ops::inet_ntop(BOOST_ASIO_OS_DEF(AF_INET6),
+ &reinterpret_cast<const sockaddr_in6_type*>(addr)->sin6_addr,
+ addr_string, sizeof(addr_string), 0, op->ec_);
+ port = socket_ops::network_to_host_short(
+ reinterpret_cast<const sockaddr_in6_type*>(addr)->sin6_port);
+ break;
+ default:
+ op->ec_ = boost::asio::error::address_family_not_supported;
+ break;
+ }
+
+ if (op->ec_)
+ {
+ io_service_.post_immediate_completion(op, is_continuation);
+ return;
+ }
+
+ try
+ {
+ async_manager_.async(impl.socket_->ConnectAsync(
+ ref new Windows::Networking::HostName(
+ winrt_utils::string(addr_string)),
+ winrt_utils::string(port)), op);
+ }
+ catch (Platform::Exception^ e)
+ {
+ op->ec_ = boost::system::error_code(
+ e->HResult, boost::system::system_category());
+ io_service_.post_immediate_completion(op, is_continuation);
+ }
+}
+
+std::size_t winrt_ssocket_service_base::do_send(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ const boost::asio::const_buffer& data,
+ socket_base::message_flags flags, boost::system::error_code& ec)
+{
+ if (flags)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ if (!is_open(impl))
+ {
+ ec = boost::asio::error::bad_descriptor;
+ return 0;
+ }
+
+ try
+ {
+ buffer_sequence_adapter<boost::asio::const_buffer,
+ boost::asio::const_buffers_1> bufs(boost::asio::buffer(data));
+
+ if (bufs.all_empty())
+ {
+ ec = boost::system::error_code();
+ return 0;
+ }
+
+ return async_manager_.sync(
+ impl.socket_->OutputStream->WriteAsync(bufs.buffers()[0]), ec);
+ }
+ catch (Platform::Exception^ e)
+ {
+ ec = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ return 0;
+ }
+}
+
+void winrt_ssocket_service_base::start_send_op(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ const boost::asio::const_buffer& data, socket_base::message_flags flags,
+ winrt_async_op<unsigned int>* op, bool is_continuation)
+{
+ if (flags)
+ {
+ op->ec_ = boost::asio::error::operation_not_supported;
+ io_service_.post_immediate_completion(op, is_continuation);
+ return;
+ }
+
+ if (!is_open(impl))
+ {
+ op->ec_ = boost::asio::error::bad_descriptor;
+ io_service_.post_immediate_completion(op, is_continuation);
+ return;
+ }
+
+ try
+ {
+ buffer_sequence_adapter<boost::asio::const_buffer,
+ boost::asio::const_buffers_1> bufs(boost::asio::buffer(data));
+
+ if (bufs.all_empty())
+ {
+ io_service_.post_immediate_completion(op, is_continuation);
+ return;
+ }
+
+ async_manager_.async(
+ impl.socket_->OutputStream->WriteAsync(bufs.buffers()[0]), op);
+ }
+ catch (Platform::Exception^ e)
+ {
+ op->ec_ = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ io_service_.post_immediate_completion(op, is_continuation);
+ }
+}
+
+std::size_t winrt_ssocket_service_base::do_receive(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ const boost::asio::mutable_buffer& data,
+ socket_base::message_flags flags, boost::system::error_code& ec)
+{
+ if (flags)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ if (!is_open(impl))
+ {
+ ec = boost::asio::error::bad_descriptor;
+ return 0;
+ }
+
+ try
+ {
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ boost::asio::mutable_buffers_1> bufs(boost::asio::buffer(data));
+
+ if (bufs.all_empty())
+ {
+ ec = boost::system::error_code();
+ return 0;
+ }
+
+ async_manager_.sync(
+ impl.socket_->InputStream->ReadAsync(
+ bufs.buffers()[0], bufs.buffers()[0]->Capacity,
+ Windows::Storage::Streams::InputStreamOptions::Partial), ec);
+
+ return bufs.buffers()[0]->Length;
+ }
+ catch (Platform::Exception^ e)
+ {
+ ec = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ return 0;
+ }
+}
+
+void winrt_ssocket_service_base::start_receive_op(
+ winrt_ssocket_service_base::base_implementation_type& impl,
+ const boost::asio::mutable_buffer& data, socket_base::message_flags flags,
+ winrt_async_op<Windows::Storage::Streams::IBuffer^>* op,
+ bool is_continuation)
+{
+ if (flags)
+ {
+ op->ec_ = boost::asio::error::operation_not_supported;
+ io_service_.post_immediate_completion(op, is_continuation);
+ return;
+ }
+
+ if (!is_open(impl))
+ {
+ op->ec_ = boost::asio::error::bad_descriptor;
+ io_service_.post_immediate_completion(op, is_continuation);
+ return;
+ }
+
+ try
+ {
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ boost::asio::mutable_buffers_1> bufs(boost::asio::buffer(data));
+
+ if (bufs.all_empty())
+ {
+ io_service_.post_immediate_completion(op, is_continuation);
+ return;
+ }
+
+ async_manager_.async(
+ impl.socket_->InputStream->ReadAsync(
+ bufs.buffers()[0], bufs.buffers()[0]->Capacity,
+ Windows::Storage::Streams::InputStreamOptions::Partial), op);
+ }
+ catch (Platform::Exception^ e)
+ {
+ op->ec_ = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ io_service_.post_immediate_completion(op, is_continuation);
+ }
+}
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_IMPL_WINRT_SSOCKET_SERVICE_BASE_IPP

Added: trunk/boost/asio/detail/impl/winrt_timer_scheduler.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/impl/winrt_timer_scheduler.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,81 @@
+//
+// detail/impl/winrt_timer_scheduler.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_HPP
+#define BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename Time_Traits>
+void winrt_timer_scheduler::add_timer_queue(timer_queue<Time_Traits>& queue)
+{
+ do_add_timer_queue(queue);
+}
+
+// Remove a timer queue from the reactor.
+template <typename Time_Traits>
+void winrt_timer_scheduler::remove_timer_queue(timer_queue<Time_Traits>& queue)
+{
+ do_remove_timer_queue(queue);
+}
+
+template <typename Time_Traits>
+void winrt_timer_scheduler::schedule_timer(timer_queue<Time_Traits>& queue,
+ const typename Time_Traits::time_type& time,
+ typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op)
+{
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+
+ if (shutdown_)
+ {
+ io_service_.post_immediate_completion(op, false);
+ return;
+ }
+
+ bool earliest = queue.enqueue_timer(time, timer, op);
+ io_service_.work_started();
+ if (earliest)
+ event_.signal(lock);
+}
+
+template <typename Time_Traits>
+std::size_t winrt_timer_scheduler::cancel_timer(timer_queue<Time_Traits>& queue,
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled)
+{
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ op_queue<operation> ops;
+ std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
+ lock.unlock();
+ io_service_.post_deferred_completions(ops);
+ return n;
+}
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_HPP

Added: trunk/boost/asio/detail/impl/winrt_timer_scheduler.ipp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/impl/winrt_timer_scheduler.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,124 @@
+//
+// detail/impl/winrt_timer_scheduler.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_IPP
+#define BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/winrt_timer_scheduler.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+winrt_timer_scheduler::winrt_timer_scheduler(
+ boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<winrt_timer_scheduler>(io_service),
+ io_service_(use_service<io_service_impl>(io_service)),
+ mutex_(),
+ event_(),
+ timer_queues_(),
+ thread_(0),
+ stop_thread_(false),
+ shutdown_(false)
+{
+ thread_ = new boost::asio::detail::thread(
+ bind_handler(&winrt_timer_scheduler::call_run_thread, this));
+}
+
+winrt_timer_scheduler::~winrt_timer_scheduler()
+{
+ shutdown_service();
+}
+
+void winrt_timer_scheduler::shutdown_service()
+{
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ shutdown_ = true;
+ stop_thread_ = true;
+ event_.signal(lock);
+ lock.unlock();
+
+ if (thread_)
+ {
+ thread_->join();
+ delete thread_;
+ thread_ = 0;
+ }
+
+ op_queue<operation> ops;
+ timer_queues_.get_all_timers(ops);
+ io_service_.abandon_operations(ops);
+}
+
+void winrt_timer_scheduler::fork_service(boost::asio::io_service::fork_event)
+{
+}
+
+void winrt_timer_scheduler::init_task()
+{
+}
+
+void winrt_timer_scheduler::run_thread()
+{
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ while (!stop_thread_)
+ {
+ const long max_wait_duration = 5 * 60 * 1000000;
+ long wait_duration = timer_queues_.wait_duration_usec(max_wait_duration);
+ event_.wait_for_usec(lock, wait_duration);
+ event_.clear(lock);
+ op_queue<operation> ops;
+ timer_queues_.get_ready_timers(ops);
+ if (!ops.empty())
+ {
+ lock.unlock();
+ io_service_.post_deferred_completions(ops);
+ lock.lock();
+ }
+ }
+}
+
+void winrt_timer_scheduler::call_run_thread(winrt_timer_scheduler* scheduler)
+{
+ scheduler->run_thread();
+}
+
+void winrt_timer_scheduler::do_add_timer_queue(timer_queue_base& queue)
+{
+ mutex::scoped_lock lock(mutex_);
+ timer_queues_.insert(&queue);
+}
+
+void winrt_timer_scheduler::do_remove_timer_queue(timer_queue_base& queue)
+{
+ mutex::scoped_lock lock(mutex_);
+ timer_queues_.erase(&queue);
+}
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_IPP

Modified: trunk/boost/asio/detail/io_control.hpp
==============================================================================
--- trunk/boost/asio/detail/io_control.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/io_control.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -45,7 +45,7 @@
   // Get the name of the IO control command.
   int name() const
   {
- return static_cast<int>(FIONBIO);
+ return static_cast<int>(BOOST_ASIO_OS_DEF(FIONBIO));
   }
 
   // Set the value of the I/O control command.
@@ -95,7 +95,7 @@
   // Get the name of the IO control command.
   int name() const
   {
- return static_cast<int>(FIONREAD);
+ return static_cast<int>(BOOST_ASIO_OS_DEF(FIONREAD));
   }
 
   // Set the value of the I/O control command.

Modified: trunk/boost/asio/detail/keyword_tss_ptr.hpp
==============================================================================
--- trunk/boost/asio/detail/keyword_tss_ptr.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/keyword_tss_ptr.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -55,11 +55,11 @@
   }
 
 private:
- static __thread T* value_;
+ static BOOST_ASIO_THREAD_KEYWORD T* value_;
 };
 
 template <typename T>
-__thread T* keyword_tss_ptr<T>::value_;
+BOOST_ASIO_THREAD_KEYWORD T* keyword_tss_ptr<T>::value_;
 
 } // namespace detail
 } // namespace asio

Modified: trunk/boost/asio/detail/mutex.hpp
==============================================================================
--- trunk/boost/asio/detail/mutex.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/mutex.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -23,8 +23,10 @@
 # include <boost/asio/detail/win_mutex.hpp>
 #elif defined(BOOST_ASIO_HAS_PTHREADS)
 # include <boost/asio/detail/posix_mutex.hpp>
+#elif defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+# include <boost/asio/detail/std_mutex.hpp>
 #else
-# error Only Windows and POSIX are supported!
+# error Only Windows, POSIX and std::mutex are supported!
 #endif
 
 namespace boost {
@@ -37,6 +39,8 @@
 typedef win_mutex mutex;
 #elif defined(BOOST_ASIO_HAS_PTHREADS)
 typedef posix_mutex mutex;
+#elif defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+typedef std_mutex mutex;
 #endif
 
 } // namespace detail

Added: trunk/boost/asio/detail/null_reactor.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/null_reactor.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,69 @@
+//
+// detail/null_reactor.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_NULL_REACTOR_HPP
+#define BOOST_ASIO_DETAIL_NULL_REACTOR_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/io_service.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class null_reactor
+ : public boost::asio::detail::service_base<null_reactor>
+{
+public:
+ // Constructor.
+ null_reactor(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<null_reactor>(io_service)
+ {
+ }
+
+ // Destructor.
+ ~null_reactor()
+ {
+ }
+
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ }
+
+ // No-op because should never be called.
+ void run(bool /*block*/, op_queue<operation>& /*ops*/)
+ {
+ }
+
+ // No-op.
+ void interrupt()
+ {
+ }
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_NULL_REACTOR_HPP

Modified: trunk/boost/asio/detail/null_signal_blocker.hpp
==============================================================================
--- trunk/boost/asio/detail/null_signal_blocker.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/null_signal_blocker.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -19,6 +19,7 @@
 
 #if !defined(BOOST_ASIO_HAS_THREADS) \
   || defined(BOOST_ASIO_WINDOWS) \
+ || defined(BOOST_ASIO_WINDOWS_RUNTIME) \
   || defined(__CYGWIN__) \
   || defined(__SYMBIAN32__)
 
@@ -63,6 +64,7 @@
 
 #endif // !defined(BOOST_ASIO_HAS_THREADS)
        // || defined(BOOST_ASIO_WINDOWS)
+ // || defined(BOOST_ASIO_WINDOWS_RUNTIME)
        // || defined(__CYGWIN__)
        // || defined(__SYMBIAN32__)
 

Added: trunk/boost/asio/detail/null_socket_service.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/null_socket_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,499 @@
+//
+// detail/null_socket_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_NULL_SOCKET_SERVICE_HPP
+#define BOOST_ASIO_DETAIL_NULL_SOCKET_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/buffer.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/socket_base.hpp>
+#include <boost/asio/detail/bind_handler.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename Protocol>
+class null_socket_service
+{
+public:
+ // The protocol type.
+ typedef Protocol protocol_type;
+
+ // The endpoint type.
+ typedef typename Protocol::endpoint endpoint_type;
+
+ // The native type of a socket.
+ typedef int native_handle_type;
+
+ // The implementation type of the socket.
+ struct implementation_type
+ {
+ };
+
+ // Constructor.
+ null_socket_service(boost::asio::io_service& io_service)
+ : io_service_(io_service)
+ {
+ }
+
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ }
+
+ // Construct a new socket implementation.
+ void construct(implementation_type&)
+ {
+ }
+
+ // Move-construct a new socket implementation.
+ void move_construct(implementation_type&, implementation_type&)
+ {
+ }
+
+ // Move-assign from another socket implementation.
+ void move_assign(implementation_type&,
+ null_socket_service&, implementation_type&)
+ {
+ }
+
+ // Move-construct a new socket implementation from another protocol type.
+ template <typename Protocol1>
+ void converting_move_construct(implementation_type&,
+ typename null_socket_service<Protocol1>::implementation_type&)
+ {
+ }
+
+ // Destroy a socket implementation.
+ void destroy(implementation_type&)
+ {
+ }
+
+ // Open a new socket implementation.
+ boost::system::error_code open(implementation_type&,
+ const protocol_type&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Assign a native socket to a socket implementation.
+ boost::system::error_code assign(implementation_type&, const protocol_type&,
+ const native_handle_type&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Determine whether the socket is open.
+ bool is_open(const implementation_type&) const
+ {
+ return false;
+ }
+
+ // Destroy a socket implementation.
+ boost::system::error_code close(implementation_type&,
+ boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Get the native socket representation.
+ native_handle_type native_handle(implementation_type&)
+ {
+ return 0;
+ }
+
+ // Cancel all operations associated with the socket.
+ boost::system::error_code cancel(implementation_type&,
+ boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Determine whether the socket is at the out-of-band data mark.
+ bool at_mark(const implementation_type&,
+ boost::system::error_code& ec) const
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return false;
+ }
+
+ // Determine the number of bytes available for reading.
+ std::size_t available(const implementation_type&,
+ boost::system::error_code& ec) const
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Place the socket into the state where it will listen for new connections.
+ boost::system::error_code listen(implementation_type&,
+ int, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Perform an IO control command on the socket.
+ template <typename IO_Control_Command>
+ boost::system::error_code io_control(implementation_type&,
+ IO_Control_Command&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Gets the non-blocking mode of the socket.
+ bool non_blocking(const implementation_type&) const
+ {
+ return false;
+ }
+
+ // Sets the non-blocking mode of the socket.
+ boost::system::error_code non_blocking(implementation_type&,
+ bool, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Gets the non-blocking mode of the native socket implementation.
+ bool native_non_blocking(const implementation_type&) const
+ {
+ return false;
+ }
+
+ // Sets the non-blocking mode of the native socket implementation.
+ boost::system::error_code native_non_blocking(implementation_type&,
+ bool, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Disable sends or receives on the socket.
+ boost::system::error_code shutdown(implementation_type&,
+ socket_base::shutdown_type, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Bind the socket to the specified local endpoint.
+ boost::system::error_code bind(implementation_type&,
+ const endpoint_type&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Set a socket option.
+ template <typename Option>
+ boost::system::error_code set_option(implementation_type&,
+ const Option&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Set a socket option.
+ template <typename Option>
+ boost::system::error_code get_option(const implementation_type&,
+ Option&, boost::system::error_code& ec) const
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Get the local endpoint.
+ endpoint_type local_endpoint(const implementation_type&,
+ boost::system::error_code& ec) const
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return endpoint_type();
+ }
+
+ // Get the remote endpoint.
+ endpoint_type remote_endpoint(const implementation_type&,
+ boost::system::error_code& ec) const
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return endpoint_type();
+ }
+
+ // Send the given data to the peer.
+ template <typename ConstBufferSequence>
+ std::size_t send(implementation_type&, const ConstBufferSequence&,
+ socket_base::message_flags, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Wait until data can be sent without blocking.
+ std::size_t send(implementation_type&, const null_buffers&,
+ socket_base::message_flags, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Start an asynchronous send. The data being sent must be valid for the
+ // lifetime of the asynchronous operation.
+ template <typename ConstBufferSequence, typename Handler>
+ void async_send(implementation_type&, const ConstBufferSequence&,
+ socket_base::message_flags, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Start an asynchronous wait until data can be sent without blocking.
+ template <typename Handler>
+ void async_send(implementation_type&, const null_buffers&,
+ socket_base::message_flags, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Receive some data from the peer. Returns the number of bytes received.
+ template <typename MutableBufferSequence>
+ std::size_t receive(implementation_type&, const MutableBufferSequence&,
+ socket_base::message_flags, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Wait until data can be received without blocking.
+ std::size_t receive(implementation_type&, const null_buffers&,
+ socket_base::message_flags, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Start an asynchronous receive. The buffer for the data being received
+ // must be valid for the lifetime of the asynchronous operation.
+ template <typename MutableBufferSequence, typename Handler>
+ void async_receive(implementation_type&, const MutableBufferSequence&,
+ socket_base::message_flags, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Wait until data can be received without blocking.
+ template <typename Handler>
+ void async_receive(implementation_type&, const null_buffers&,
+ socket_base::message_flags, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Receive some data with associated flags. Returns the number of bytes
+ // received.
+ template <typename MutableBufferSequence>
+ std::size_t receive_with_flags(implementation_type&,
+ const MutableBufferSequence&, socket_base::message_flags,
+ socket_base::message_flags&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Wait until data can be received without blocking.
+ std::size_t receive_with_flags(implementation_type&,
+ const null_buffers&, socket_base::message_flags,
+ socket_base::message_flags&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Start an asynchronous receive. The buffer for the data being received
+ // must be valid for the lifetime of the asynchronous operation.
+ template <typename MutableBufferSequence, typename Handler>
+ void async_receive_with_flags(implementation_type&,
+ const MutableBufferSequence&, socket_base::message_flags,
+ socket_base::message_flags&, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Wait until data can be received without blocking.
+ template <typename Handler>
+ void async_receive_with_flags(implementation_type&,
+ const null_buffers&, socket_base::message_flags,
+ socket_base::message_flags&, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Send a datagram to the specified endpoint. Returns the number of bytes
+ // sent.
+ template <typename ConstBufferSequence>
+ std::size_t send_to(implementation_type&, const ConstBufferSequence&,
+ const endpoint_type&, socket_base::message_flags,
+ boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Wait until data can be sent without blocking.
+ std::size_t send_to(implementation_type&, const null_buffers&,
+ const endpoint_type&, socket_base::message_flags,
+ boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Start an asynchronous send. The data being sent must be valid for the
+ // lifetime of the asynchronous operation.
+ template <typename ConstBufferSequence, typename Handler>
+ void async_send_to(implementation_type&, const ConstBufferSequence&,
+ const endpoint_type&, socket_base::message_flags,
+ Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Start an asynchronous wait until data can be sent without blocking.
+ template <typename Handler>
+ void async_send_to(implementation_type&, const null_buffers&,
+ const endpoint_type&, socket_base::message_flags, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Receive a datagram with the endpoint of the sender. Returns the number of
+ // bytes received.
+ template <typename MutableBufferSequence>
+ std::size_t receive_from(implementation_type&, const MutableBufferSequence&,
+ endpoint_type&, socket_base::message_flags,
+ boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Wait until data can be received without blocking.
+ std::size_t receive_from(implementation_type&, const null_buffers&,
+ endpoint_type&, socket_base::message_flags,
+ boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Start an asynchronous receive. The buffer for the data being received and
+ // the sender_endpoint object must both be valid for the lifetime of the
+ // asynchronous operation.
+ template <typename MutableBufferSequence, typename Handler>
+ void async_receive_from(implementation_type&,
+ const MutableBufferSequence&, endpoint_type&,
+ socket_base::message_flags, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Wait until data can be received without blocking.
+ template <typename Handler>
+ void async_receive_from(implementation_type&,
+ const null_buffers&, endpoint_type&,
+ socket_base::message_flags, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Accept a new connection.
+ template <typename Socket>
+ boost::system::error_code accept(implementation_type&,
+ Socket&, endpoint_type*, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Start an asynchronous accept. The peer and peer_endpoint objects
+ // must be valid until the accept's handler is invoked.
+ template <typename Socket, typename Handler>
+ void async_accept(implementation_type&, Socket&,
+ endpoint_type*, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ io_service_.post(detail::bind_handler(handler, ec));
+ }
+
+ // Connect the socket to the specified endpoint.
+ boost::system::error_code connect(implementation_type&,
+ const endpoint_type&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Start an asynchronous connect.
+ template <typename Handler>
+ void async_connect(implementation_type&,
+ const endpoint_type&, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ io_service_.post(detail::bind_handler(handler, ec));
+ }
+
+private:
+ boost::asio::io_service& io_service_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_NULL_SOCKET_SERVICE_HPP

Modified: trunk/boost/asio/detail/pipe_select_interrupter.hpp
==============================================================================
--- trunk/boost/asio/detail/pipe_select_interrupter.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/pipe_select_interrupter.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -18,6 +18,7 @@
 #include <boost/asio/detail/config.hpp>
 
 #if !defined(BOOST_ASIO_WINDOWS)
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 #if !defined(__CYGWIN__)
 #if !defined(__SYMBIAN32__)
 #if !defined(BOOST_ASIO_HAS_EVENTFD)
@@ -84,6 +85,7 @@
 #endif // !defined(BOOST_ASIO_HAS_EVENTFD)
 #endif // !defined(__SYMBIAN32__)
 #endif // !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 #endif // !defined(BOOST_ASIO_WINDOWS)
 
 #endif // BOOST_ASIO_DETAIL_PIPE_SELECT_INTERRUPTER_HPP

Modified: trunk/boost/asio/detail/posix_fd_set_adapter.hpp
==============================================================================
--- trunk/boost/asio/detail/posix_fd_set_adapter.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/posix_fd_set_adapter.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,7 +17,9 @@
 
 #include <boost/asio/detail/config.hpp>
 
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(__CYGWIN__) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #include <cstring>
 #include <boost/asio/detail/noncopyable.hpp>
@@ -84,6 +86,8 @@
 
 #include <boost/asio/detail/pop_options.hpp>
 
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(__CYGWIN__)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #endif // BOOST_ASIO_DETAIL_POSIX_FD_SET_ADAPTER_HPP

Modified: trunk/boost/asio/detail/push_options.hpp
==============================================================================
--- trunk/boost/asio/detail/push_options.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/push_options.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -103,7 +103,9 @@
 # pragma warning (disable:4180)
 # pragma warning (disable:4244)
 # pragma warning (disable:4355)
+# pragma warning (disable:4510)
 # pragma warning (disable:4512)
+# pragma warning (disable:4610)
 # pragma warning (disable:4675)
 # if defined(_M_IX86) && defined(_Wp64)
 // The /Wp64 option is broken. If you want to check 64 bit portability, use a

Modified: trunk/boost/asio/detail/reactive_descriptor_service.hpp
==============================================================================
--- trunk/boost/asio/detail/reactive_descriptor_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/reactive_descriptor_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,7 +17,9 @@
 
 #include <boost/asio/detail/config.hpp>
 
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
 
 #include <boost/asio/buffer.hpp>
 #include <boost/asio/io_service.hpp>
@@ -315,6 +317,8 @@
 # include <boost/asio/detail/impl/reactive_descriptor_service.ipp>
 #endif // defined(BOOST_ASIO_HEADER_ONLY)
 
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 
 #endif // BOOST_ASIO_DETAIL_REACTIVE_DESCRIPTOR_SERVICE_HPP

Modified: trunk/boost/asio/detail/reactive_socket_service_base.hpp
==============================================================================
--- trunk/boost/asio/detail/reactive_socket_service_base.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/reactive_socket_service_base.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,7 +17,8 @@
 
 #include <boost/asio/detail/config.hpp>
 
-#if !defined(BOOST_ASIO_HAS_IOCP)
+#if !defined(BOOST_ASIO_HAS_IOCP) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #include <boost/asio/buffer.hpp>
 #include <boost/asio/error.hpp>
@@ -446,5 +447,6 @@
 #endif // defined(BOOST_ASIO_HEADER_ONLY)
 
 #endif // !defined(BOOST_ASIO_HAS_IOCP)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_BASE_HPP

Modified: trunk/boost/asio/detail/reactor.hpp
==============================================================================
--- trunk/boost/asio/detail/reactor.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/reactor.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -23,6 +23,8 @@
 # include <boost/asio/detail/kqueue_reactor.hpp>
 #elif defined(BOOST_ASIO_HAS_DEV_POLL)
 # include <boost/asio/detail/dev_poll_reactor.hpp>
+#elif defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <boost/asio/detail/null_reactor.hpp>
 #else
 # include <boost/asio/detail/select_reactor.hpp>
 #endif

Modified: trunk/boost/asio/detail/reactor_fwd.hpp
==============================================================================
--- trunk/boost/asio/detail/reactor_fwd.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/reactor_fwd.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -21,7 +21,9 @@
 namespace asio {
 namespace detail {
 
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+typedef class null_reactor reactor;
+#elif defined(BOOST_ASIO_HAS_IOCP)
 typedef class select_reactor reactor;
 #elif defined(BOOST_ASIO_HAS_EPOLL)
 typedef class epoll_reactor reactor;

Modified: trunk/boost/asio/detail/resolver_service.hpp
==============================================================================
--- trunk/boost/asio/detail/resolver_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/resolver_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -16,6 +16,9 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #include <boost/asio/ip/basic_resolver_iterator.hpp>
 #include <boost/asio/ip/basic_resolver_query.hpp>
 #include <boost/asio/detail/addressof.hpp>
@@ -123,4 +126,6 @@
 
 #include <boost/asio/detail/pop_options.hpp>
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #endif // BOOST_ASIO_DETAIL_RESOLVER_SERVICE_HPP

Modified: trunk/boost/asio/detail/resolver_service_base.hpp
==============================================================================
--- trunk/boost/asio/detail/resolver_service_base.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/resolver_service_base.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -65,6 +65,7 @@
   // Helper function to start an asynchronous resolve operation.
   BOOST_ASIO_DECL void start_resolve_op(operation* op);
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
   // Helper class to perform exception-safe cleanup of addrinfo objects.
   class auto_addrinfo
     : private boost::asio::detail::noncopyable
@@ -89,6 +90,7 @@
   private:
     boost::asio::detail::addrinfo_type* ai_;
   };
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
   // Helper class to run the work io_service in a thread.
   class work_io_service_runner;

Modified: trunk/boost/asio/detail/select_interrupter.hpp
==============================================================================
--- trunk/boost/asio/detail/select_interrupter.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/select_interrupter.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,6 +17,8 @@
 
 #include <boost/asio/detail/config.hpp>
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) || defined(__SYMBIAN32__)
 # include <boost/asio/detail/socket_select_interrupter.hpp>
 #elif defined(BOOST_ASIO_HAS_EVENTFD)
@@ -41,4 +43,6 @@
 } // namespace asio
 } // namespace boost
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #endif // BOOST_ASIO_DETAIL_SELECT_INTERRUPTER_HPP

Modified: trunk/boost/asio/detail/select_reactor.hpp
==============================================================================
--- trunk/boost/asio/detail/select_reactor.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/select_reactor.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -20,7 +20,8 @@
 #if defined(BOOST_ASIO_HAS_IOCP) \
   || (!defined(BOOST_ASIO_HAS_DEV_POLL) \
       && !defined(BOOST_ASIO_HAS_EPOLL) \
- && !defined(BOOST_ASIO_HAS_KQUEUE))
+ && !defined(BOOST_ASIO_HAS_KQUEUE) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME))
 
 #include <cstddef>
 #include <boost/asio/detail/fd_set_adapter.hpp>
@@ -214,6 +215,7 @@
 #endif // defined(BOOST_ASIO_HAS_IOCP)
        // || (!defined(BOOST_ASIO_HAS_DEV_POLL)
        // && !defined(BOOST_ASIO_HAS_EPOLL)
- // && !defined(BOOST_ASIO_HAS_KQUEUE))
+ // && !defined(BOOST_ASIO_HAS_KQUEUE)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME))
 
 #endif // BOOST_ASIO_DETAIL_SELECT_REACTOR_HPP

Modified: trunk/boost/asio/detail/signal_blocker.hpp
==============================================================================
--- trunk/boost/asio/detail/signal_blocker.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/signal_blocker.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -18,6 +18,7 @@
 #include <boost/asio/detail/config.hpp>
 
 #if !defined(BOOST_ASIO_HAS_THREADS) || defined(BOOST_ASIO_WINDOWS) \
+ || defined(BOOST_ASIO_WINDOWS_RUNTIME) \
   || defined(__CYGWIN__) || defined(__SYMBIAN32__)
 # include <boost/asio/detail/null_signal_blocker.hpp>
 #elif defined(BOOST_ASIO_HAS_PTHREADS)
@@ -31,6 +32,7 @@
 namespace detail {
 
 #if !defined(BOOST_ASIO_HAS_THREADS) || defined(BOOST_ASIO_WINDOWS) \
+ || defined(BOOST_ASIO_WINDOWS_RUNTIME) \
   || defined(__CYGWIN__) || defined(__SYMBIAN32__)
 typedef null_signal_blocker signal_blocker;
 #elif defined(BOOST_ASIO_HAS_PTHREADS)

Modified: trunk/boost/asio/detail/signal_set_service.hpp
==============================================================================
--- trunk/boost/asio/detail/signal_set_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/signal_set_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -182,7 +182,9 @@
   // The io_service instance used for dispatching handlers.
   io_service_impl& io_service_;
 
-#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) \
+ && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
   // The type used for registering for pipe reactor notifications.
   class pipe_read_op;
 
@@ -191,7 +193,9 @@
 
   // The per-descriptor reactor data used for the pipe.
   reactor::per_descriptor_data reactor_data_;
-#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS)
+ // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
 
   // A mapping from signal number to the registered signal sets.
   registration* registrations_[max_signal_number];

Modified: trunk/boost/asio/detail/socket_ops.hpp
==============================================================================
--- trunk/boost/asio/detail/socket_ops.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/socket_ops.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -63,6 +63,8 @@
 typedef shared_ptr<void> shared_cancel_token_type;
 typedef weak_ptr<void> weak_cancel_token_type;
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 BOOST_ASIO_DECL socket_type accept(socket_type s, socket_addr_type* addr,
     std::size_t* addrlen, boost::system::error_code& ec);
 
@@ -263,6 +265,8 @@
 
 BOOST_ASIO_DECL int poll_connect(socket_type s, boost::system::error_code& ec);
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 BOOST_ASIO_DECL const char* inet_ntop(int af, const void* src, char* dest,
     size_t length, unsigned long scope_id, boost::system::error_code& ec);
 
@@ -272,6 +276,8 @@
 BOOST_ASIO_DECL int gethostname(char* name,
     int namelen, boost::system::error_code& ec);
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 BOOST_ASIO_DECL boost::system::error_code getaddrinfo(const char* host,
     const char* service, const addrinfo_type& hints,
     addrinfo_type** result, boost::system::error_code& ec);
@@ -299,6 +305,8 @@
     char* host, std::size_t hostlen, char* serv,
     std::size_t servlen, int sock_type, boost::system::error_code& ec);
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 BOOST_ASIO_DECL u_long_type network_to_host_long(u_long_type value);
 
 BOOST_ASIO_DECL u_long_type host_to_network_long(u_long_type value);

Modified: trunk/boost/asio/detail/socket_option.hpp
==============================================================================
--- trunk/boost/asio/detail/socket_option.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/socket_option.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -274,14 +274,14 @@
 
   // Get the address of the linger data.
   template <typename Protocol>
- ::linger* data(const Protocol&)
+ detail::linger_type* data(const Protocol&)
   {
     return &value_;
   }
 
   // Get the address of the linger data.
   template <typename Protocol>
- const ::linger* data(const Protocol&) const
+ const detail::linger_type* data(const Protocol&) const
   {
     return &value_;
   }
@@ -305,7 +305,7 @@
   }
 
 private:
- ::linger value_;
+ detail::linger_type value_;
 };
 
 } // namespace socket_option

Modified: trunk/boost/asio/detail/socket_select_interrupter.hpp
==============================================================================
--- trunk/boost/asio/detail/socket_select_interrupter.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/socket_select_interrupter.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,6 +17,8 @@
 
 #include <boost/asio/detail/config.hpp>
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #if defined(BOOST_ASIO_WINDOWS) \
   || defined(__CYGWIN__) \
   || defined(__SYMBIAN32__)
@@ -86,4 +88,6 @@
        // || defined(__CYGWIN__)
        // || defined(__SYMBIAN32__)
 
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
 #endif // BOOST_ASIO_DETAIL_SOCKET_SELECT_INTERRUPTER_HPP

Modified: trunk/boost/asio/detail/socket_types.hpp
==============================================================================
--- trunk/boost/asio/detail/socket_types.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/socket_types.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -17,7 +17,9 @@
 
 #include <boost/asio/detail/config.hpp>
 
-#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+// Empty.
+#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
 # if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
 # error WinSock.h has already been included
 # endif // defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
@@ -28,6 +30,11 @@
 # define BOOST_ASIO_WSPIAPI_H_DEFINED
 # endif // !defined(_WSPIAPI_H_)
 # endif // defined(__BORLANDC__)
+# if defined(WINAPI_FAMILY)
+# if ((WINAPI_FAMILY & WINAPI_PARTITION_DESKTOP) != 0)
+# include <windows.h>
+# endif // ((WINAPI_FAMILY & WINAPI_PARTITION_DESKTOP) != 0)
+# endif // defined(WINAPI_FAMILY)
 # include <winsock2.h>
 # include <ws2tcpip.h>
 # include <mswsock.h>
@@ -81,7 +88,88 @@
 namespace asio {
 namespace detail {
 
-#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+const int max_addr_v4_str_len = 256;
+const int max_addr_v6_str_len = 256;
+typedef unsigned __int32 u_long_type;
+typedef unsigned __int16 u_short_type;
+struct in4_addr_type { u_long_type s_addr; };
+struct in4_mreq_type { in4_addr_type imr_multiaddr, imr_interface; };
+struct in6_addr_type { unsigned char s6_addr[16]; };
+struct in6_mreq_type { in6_addr_type ipv6mr_multiaddr;
+ unsigned long ipv6mr_interface; };
+struct socket_addr_type { int sa_family; };
+struct sockaddr_in4_type { int sin_family;
+ in4_addr_type sin_addr; u_short_type sin_port; };
+struct sockaddr_in6_type { int sin6_family;
+ in6_addr_type sin6_addr; u_short_type sin6_port;
+ u_long_type sin6_flowinfo; u_long_type sin6_scope_id; };
+struct sockaddr_storage_type { int ss_family;
+ unsigned char ss_bytes[128 - sizeof(int)]; };
+struct addrinfo_type { int ai_flags;
+ int ai_family, ai_socktype, ai_protocol;
+ int ai_addrlen; const void* ai_addr;
+ const char* ai_canonname; addrinfo_type* ai_next; };
+struct linger_type { u_short_type l_onoff, l_linger; };
+typedef u_long_type ioctl_arg_type;
+typedef int signed_size_type;
+# define BOOST_ASIO_OS_DEF(c) BOOST_ASIO_OS_DEF_##c
+# define BOOST_ASIO_OS_DEF_AF_UNSPEC 0
+# define BOOST_ASIO_OS_DEF_AF_INET 2
+# define BOOST_ASIO_OS_DEF_AF_INET6 23
+# define BOOST_ASIO_OS_DEF_SOCK_STREAM 1
+# define BOOST_ASIO_OS_DEF_SOCK_DGRAM 2
+# define BOOST_ASIO_OS_DEF_SOCK_RAW 3
+# define BOOST_ASIO_OS_DEF_SOCK_SEQPACKET 5
+# define BOOST_ASIO_OS_DEF_IPPROTO_IP 0
+# define BOOST_ASIO_OS_DEF_IPPROTO_IPV6 41
+# define BOOST_ASIO_OS_DEF_IPPROTO_TCP 6
+# define BOOST_ASIO_OS_DEF_IPPROTO_UDP 17
+# define BOOST_ASIO_OS_DEF_IPPROTO_ICMP 1
+# define BOOST_ASIO_OS_DEF_IPPROTO_ICMPV6 58
+# define BOOST_ASIO_OS_DEF_FIONBIO 1
+# define BOOST_ASIO_OS_DEF_FIONREAD 2
+# define BOOST_ASIO_OS_DEF_INADDR_ANY 0
+# define BOOST_ASIO_OS_DEF_MSG_OOB 0x1
+# define BOOST_ASIO_OS_DEF_MSG_PEEK 0x2
+# define BOOST_ASIO_OS_DEF_MSG_DONTROUTE 0x4
+# define BOOST_ASIO_OS_DEF_MSG_EOR 0 // Not supported.
+# define BOOST_ASIO_OS_DEF_SHUT_RD 0x0
+# define BOOST_ASIO_OS_DEF_SHUT_WR 0x1
+# define BOOST_ASIO_OS_DEF_SHUT_RDWR 0x2
+# define BOOST_ASIO_OS_DEF_SOMAXCONN 0x7fffffff
+# define BOOST_ASIO_OS_DEF_SOL_SOCKET 0xffff
+# define BOOST_ASIO_OS_DEF_SO_BROADCAST 0x20
+# define BOOST_ASIO_OS_DEF_SO_DEBUG 0x1
+# define BOOST_ASIO_OS_DEF_SO_DONTROUTE 0x10
+# define BOOST_ASIO_OS_DEF_SO_KEEPALIVE 0x8
+# define BOOST_ASIO_OS_DEF_SO_LINGER 0x80
+# define BOOST_ASIO_OS_DEF_SO_SNDBUF 0x1001
+# define BOOST_ASIO_OS_DEF_SO_RCVBUF 0x1002
+# define BOOST_ASIO_OS_DEF_SO_SNDLOWAT 0x1003
+# define BOOST_ASIO_OS_DEF_SO_RCVLOWAT 0x1004
+# define BOOST_ASIO_OS_DEF_SO_REUSEADDR 0x4
+# define BOOST_ASIO_OS_DEF_TCP_NODELAY 0x1
+# define BOOST_ASIO_OS_DEF_IP_MULTICAST_IF 2
+# define BOOST_ASIO_OS_DEF_IP_MULTICAST_TTL 3
+# define BOOST_ASIO_OS_DEF_IP_MULTICAST_LOOP 4
+# define BOOST_ASIO_OS_DEF_IP_ADD_MEMBERSHIP 5
+# define BOOST_ASIO_OS_DEF_IP_DROP_MEMBERSHIP 6
+# define BOOST_ASIO_OS_DEF_IP_TTL 7
+# define BOOST_ASIO_OS_DEF_IPV6_UNICAST_HOPS 4
+# define BOOST_ASIO_OS_DEF_IPV6_MULTICAST_IF 9
+# define BOOST_ASIO_OS_DEF_IPV6_MULTICAST_HOPS 10
+# define BOOST_ASIO_OS_DEF_IPV6_MULTICAST_LOOP 11
+# define BOOST_ASIO_OS_DEF_IPV6_JOIN_GROUP 12
+# define BOOST_ASIO_OS_DEF_IPV6_LEAVE_GROUP 13
+# define BOOST_ASIO_OS_DEF_AI_CANONNAME 0x2
+# define BOOST_ASIO_OS_DEF_AI_PASSIVE 0x1
+# define BOOST_ASIO_OS_DEF_AI_NUMERICHOST 0x4
+# define BOOST_ASIO_OS_DEF_AI_NUMERICSERV 0x8
+# define BOOST_ASIO_OS_DEF_AI_V4MAPPED 0x800
+# define BOOST_ASIO_OS_DEF_AI_ALL 0x100
+# define BOOST_ASIO_OS_DEF_AI_ADDRCONFIG 0x400
+#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
 typedef SOCKET socket_type;
 const SOCKET invalid_socket = INVALID_SOCKET;
 const int socket_error_retval = SOCKET_ERROR;
@@ -104,17 +192,67 @@
 typedef sockaddr_storage sockaddr_storage_type;
 typedef addrinfo addrinfo_type;
 # endif
+typedef ::linger linger_type;
 typedef unsigned long ioctl_arg_type;
 typedef u_long u_long_type;
 typedef u_short u_short_type;
 typedef int signed_size_type;
-const int shutdown_receive = SD_RECEIVE;
-const int shutdown_send = SD_SEND;
-const int shutdown_both = SD_BOTH;
-const int message_peek = MSG_PEEK;
-const int message_out_of_band = MSG_OOB;
-const int message_do_not_route = MSG_DONTROUTE;
-const int message_end_of_record = 0; // Not supported on Windows.
+# define BOOST_ASIO_OS_DEF(c) BOOST_ASIO_OS_DEF_##c
+# define BOOST_ASIO_OS_DEF_AF_UNSPEC AF_UNSPEC
+# define BOOST_ASIO_OS_DEF_AF_INET AF_INET
+# define BOOST_ASIO_OS_DEF_AF_INET6 AF_INET6
+# define BOOST_ASIO_OS_DEF_SOCK_STREAM SOCK_STREAM
+# define BOOST_ASIO_OS_DEF_SOCK_DGRAM SOCK_DGRAM
+# define BOOST_ASIO_OS_DEF_SOCK_RAW SOCK_RAW
+# define BOOST_ASIO_OS_DEF_SOCK_SEQPACKET SOCK_SEQPACKET
+# define BOOST_ASIO_OS_DEF_IPPROTO_IP IPPROTO_IP
+# define BOOST_ASIO_OS_DEF_IPPROTO_IPV6 IPPROTO_IPV6
+# define BOOST_ASIO_OS_DEF_IPPROTO_TCP IPPROTO_TCP
+# define BOOST_ASIO_OS_DEF_IPPROTO_UDP IPPROTO_UDP
+# define BOOST_ASIO_OS_DEF_IPPROTO_ICMP IPPROTO_ICMP
+# define BOOST_ASIO_OS_DEF_IPPROTO_ICMPV6 IPPROTO_ICMPV6
+# define BOOST_ASIO_OS_DEF_FIONBIO FIONBIO
+# define BOOST_ASIO_OS_DEF_FIONREAD FIONREAD
+# define BOOST_ASIO_OS_DEF_INADDR_ANY INADDR_ANY
+# define BOOST_ASIO_OS_DEF_MSG_OOB MSG_OOB
+# define BOOST_ASIO_OS_DEF_MSG_PEEK MSG_PEEK
+# define BOOST_ASIO_OS_DEF_MSG_DONTROUTE MSG_DONTROUTE
+# define BOOST_ASIO_OS_DEF_MSG_EOR 0 // Not supported on Windows.
+# define BOOST_ASIO_OS_DEF_SHUT_RD SD_RECEIVE
+# define BOOST_ASIO_OS_DEF_SHUT_WR SD_SEND
+# define BOOST_ASIO_OS_DEF_SHUT_RDWR SD_BOTH
+# define BOOST_ASIO_OS_DEF_SOMAXCONN SOMAXCONN
+# define BOOST_ASIO_OS_DEF_SOL_SOCKET SOL_SOCKET
+# define BOOST_ASIO_OS_DEF_SO_BROADCAST SO_BROADCAST
+# define BOOST_ASIO_OS_DEF_SO_DEBUG SO_DEBUG
+# define BOOST_ASIO_OS_DEF_SO_DONTROUTE SO_DONTROUTE
+# define BOOST_ASIO_OS_DEF_SO_KEEPALIVE SO_KEEPALIVE
+# define BOOST_ASIO_OS_DEF_SO_LINGER SO_LINGER
+# define BOOST_ASIO_OS_DEF_SO_SNDBUF SO_SNDBUF
+# define BOOST_ASIO_OS_DEF_SO_RCVBUF SO_RCVBUF
+# define BOOST_ASIO_OS_DEF_SO_SNDLOWAT SO_SNDLOWAT
+# define BOOST_ASIO_OS_DEF_SO_RCVLOWAT SO_RCVLOWAT
+# define BOOST_ASIO_OS_DEF_SO_REUSEADDR SO_REUSEADDR
+# define BOOST_ASIO_OS_DEF_TCP_NODELAY TCP_NODELAY
+# define BOOST_ASIO_OS_DEF_IP_MULTICAST_IF IP_MULTICAST_IF
+# define BOOST_ASIO_OS_DEF_IP_MULTICAST_TTL IP_MULTICAST_TTL
+# define BOOST_ASIO_OS_DEF_IP_MULTICAST_LOOP IP_MULTICAST_LOOP
+# define BOOST_ASIO_OS_DEF_IP_ADD_MEMBERSHIP IP_ADD_MEMBERSHIP
+# define BOOST_ASIO_OS_DEF_IP_DROP_MEMBERSHIP IP_DROP_MEMBERSHIP
+# define BOOST_ASIO_OS_DEF_IP_TTL IP_TTL
+# define BOOST_ASIO_OS_DEF_IPV6_UNICAST_HOPS IPV6_UNICAST_HOPS
+# define BOOST_ASIO_OS_DEF_IPV6_MULTICAST_IF IPV6_MULTICAST_IF
+# define BOOST_ASIO_OS_DEF_IPV6_MULTICAST_HOPS IPV6_MULTICAST_HOPS
+# define BOOST_ASIO_OS_DEF_IPV6_MULTICAST_LOOP IPV6_MULTICAST_LOOP
+# define BOOST_ASIO_OS_DEF_IPV6_JOIN_GROUP IPV6_JOIN_GROUP
+# define BOOST_ASIO_OS_DEF_IPV6_LEAVE_GROUP IPV6_LEAVE_GROUP
+# define BOOST_ASIO_OS_DEF_AI_CANONNAME AI_CANONNAME
+# define BOOST_ASIO_OS_DEF_AI_PASSIVE AI_PASSIVE
+# define BOOST_ASIO_OS_DEF_AI_NUMERICHOST AI_NUMERICHOST
+# define BOOST_ASIO_OS_DEF_AI_NUMERICSERV AI_NUMERICSERV
+# define BOOST_ASIO_OS_DEF_AI_V4MAPPED AI_V4MAPPED
+# define BOOST_ASIO_OS_DEF_AI_ALL AI_ALL
+# define BOOST_ASIO_OS_DEF_AI_ADDRCONFIG AI_ADDRCONFIG
 # if defined (_WIN32_WINNT)
 const int max_iov_len = 64;
 # else
@@ -149,6 +287,7 @@
 typedef sockaddr_storage sockaddr_storage_type;
 typedef sockaddr_un sockaddr_un_type;
 typedef addrinfo addrinfo_type;
+typedef ::linger linger_type;
 typedef int ioctl_arg_type;
 typedef uint32_t u_long_type;
 typedef uint16_t u_short_type;
@@ -157,13 +296,80 @@
 #else // defined(BOOST_ASIO_HAS_SSIZE_T)
 typedef int signed_size_type;
 #endif // defined(BOOST_ASIO_HAS_SSIZE_T)
-const int shutdown_receive = SHUT_RD;
-const int shutdown_send = SHUT_WR;
-const int shutdown_both = SHUT_RDWR;
-const int message_peek = MSG_PEEK;
-const int message_out_of_band = MSG_OOB;
-const int message_do_not_route = MSG_DONTROUTE;
-const int message_end_of_record = MSG_EOR;
+# define BOOST_ASIO_OS_DEF(c) BOOST_ASIO_OS_DEF_##c
+# define BOOST_ASIO_OS_DEF_AF_UNSPEC AF_UNSPEC
+# define BOOST_ASIO_OS_DEF_AF_INET AF_INET
+# define BOOST_ASIO_OS_DEF_AF_INET6 AF_INET6
+# define BOOST_ASIO_OS_DEF_SOCK_STREAM SOCK_STREAM
+# define BOOST_ASIO_OS_DEF_SOCK_DGRAM SOCK_DGRAM
+# define BOOST_ASIO_OS_DEF_SOCK_RAW SOCK_RAW
+# define BOOST_ASIO_OS_DEF_SOCK_SEQPACKET SOCK_SEQPACKET
+# define BOOST_ASIO_OS_DEF_IPPROTO_IP IPPROTO_IP
+# define BOOST_ASIO_OS_DEF_IPPROTO_IPV6 IPPROTO_IPV6
+# define BOOST_ASIO_OS_DEF_IPPROTO_TCP IPPROTO_TCP
+# define BOOST_ASIO_OS_DEF_IPPROTO_UDP IPPROTO_UDP
+# define BOOST_ASIO_OS_DEF_IPPROTO_ICMP IPPROTO_ICMP
+# define BOOST_ASIO_OS_DEF_IPPROTO_ICMPV6 IPPROTO_ICMPV6
+# define BOOST_ASIO_OS_DEF_FIONBIO FIONBIO
+# define BOOST_ASIO_OS_DEF_FIONREAD FIONREAD
+# define BOOST_ASIO_OS_DEF_INADDR_ANY INADDR_ANY
+# define BOOST_ASIO_OS_DEF_MSG_OOB MSG_OOB
+# define BOOST_ASIO_OS_DEF_MSG_PEEK MSG_PEEK
+# define BOOST_ASIO_OS_DEF_MSG_DONTROUTE MSG_DONTROUTE
+# define BOOST_ASIO_OS_DEF_MSG_EOR MSG_EOR
+# define BOOST_ASIO_OS_DEF_SHUT_RD SHUT_RD
+# define BOOST_ASIO_OS_DEF_SHUT_WR SHUT_WR
+# define BOOST_ASIO_OS_DEF_SHUT_RDWR SHUT_RDWR
+# define BOOST_ASIO_OS_DEF_SOMAXCONN SOMAXCONN
+# define BOOST_ASIO_OS_DEF_SOL_SOCKET SOL_SOCKET
+# define BOOST_ASIO_OS_DEF_SO_BROADCAST SO_BROADCAST
+# define BOOST_ASIO_OS_DEF_SO_DEBUG SO_DEBUG
+# define BOOST_ASIO_OS_DEF_SO_DONTROUTE SO_DONTROUTE
+# define BOOST_ASIO_OS_DEF_SO_KEEPALIVE SO_KEEPALIVE
+# define BOOST_ASIO_OS_DEF_SO_LINGER SO_LINGER
+# define BOOST_ASIO_OS_DEF_SO_SNDBUF SO_SNDBUF
+# define BOOST_ASIO_OS_DEF_SO_RCVBUF SO_RCVBUF
+# define BOOST_ASIO_OS_DEF_SO_SNDLOWAT SO_SNDLOWAT
+# define BOOST_ASIO_OS_DEF_SO_RCVLOWAT SO_RCVLOWAT
+# define BOOST_ASIO_OS_DEF_SO_REUSEADDR SO_REUSEADDR
+# define BOOST_ASIO_OS_DEF_TCP_NODELAY TCP_NODELAY
+# define BOOST_ASIO_OS_DEF_IP_MULTICAST_IF IP_MULTICAST_IF
+# define BOOST_ASIO_OS_DEF_IP_MULTICAST_TTL IP_MULTICAST_TTL
+# define BOOST_ASIO_OS_DEF_IP_MULTICAST_LOOP IP_MULTICAST_LOOP
+# define BOOST_ASIO_OS_DEF_IP_ADD_MEMBERSHIP IP_ADD_MEMBERSHIP
+# define BOOST_ASIO_OS_DEF_IP_DROP_MEMBERSHIP IP_DROP_MEMBERSHIP
+# define BOOST_ASIO_OS_DEF_IP_TTL IP_TTL
+# define BOOST_ASIO_OS_DEF_IPV6_UNICAST_HOPS IPV6_UNICAST_HOPS
+# define BOOST_ASIO_OS_DEF_IPV6_MULTICAST_IF IPV6_MULTICAST_IF
+# define BOOST_ASIO_OS_DEF_IPV6_MULTICAST_HOPS IPV6_MULTICAST_HOPS
+# define BOOST_ASIO_OS_DEF_IPV6_MULTICAST_LOOP IPV6_MULTICAST_LOOP
+# define BOOST_ASIO_OS_DEF_IPV6_JOIN_GROUP IPV6_JOIN_GROUP
+# define BOOST_ASIO_OS_DEF_IPV6_LEAVE_GROUP IPV6_LEAVE_GROUP
+# define BOOST_ASIO_OS_DEF_AI_CANONNAME AI_CANONNAME
+# define BOOST_ASIO_OS_DEF_AI_PASSIVE AI_PASSIVE
+# define BOOST_ASIO_OS_DEF_AI_NUMERICHOST AI_NUMERICHOST
+# if defined(AI_NUMERICSERV)
+# define BOOST_ASIO_OS_DEF_AI_NUMERICSERV AI_NUMERICSERV
+# else
+# define BOOST_ASIO_OS_DEF_AI_NUMERICSERV 0
+# endif
+// Note: QNX Neutrino 6.3 defines AI_V4MAPPED, AI_ALL and AI_ADDRCONFIG but
+// does not implement them. Therefore they are specifically excluded here.
+# if defined(AI_V4MAPPED) && !defined(__QNXNTO__)
+# define BOOST_ASIO_OS_DEF_AI_V4MAPPED AI_V4MAPPED
+# else
+# define BOOST_ASIO_OS_DEF_AI_V4MAPPED 0
+# endif
+# if defined(AI_ALL) && !defined(__QNXNTO__)
+# define BOOST_ASIO_OS_DEF_AI_ALL AI_ALL
+# else
+# define BOOST_ASIO_OS_DEF_AI_ALL 0
+# endif
+# if defined(AI_ADDRCONFIG) && !defined(__QNXNTO__)
+# define BOOST_ASIO_OS_DEF_AI_ADDRCONFIG AI_ADDRCONFIG
+# else
+# define BOOST_ASIO_OS_DEF_AI_ADDRCONFIG 0
+# endif
 # if defined(IOV_MAX)
 const int max_iov_len = IOV_MAX;
 # else

Modified: trunk/boost/asio/detail/static_mutex.hpp
==============================================================================
--- trunk/boost/asio/detail/static_mutex.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/static_mutex.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -23,6 +23,8 @@
 # include <boost/asio/detail/win_static_mutex.hpp>
 #elif defined(BOOST_ASIO_HAS_PTHREADS)
 # include <boost/asio/detail/posix_static_mutex.hpp>
+#elif defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+# include <boost/asio/detail/std_static_mutex.hpp>
 #else
 # error Only Windows and POSIX are supported!
 #endif
@@ -40,6 +42,9 @@
 #elif defined(BOOST_ASIO_HAS_PTHREADS)
 typedef posix_static_mutex static_mutex;
 # define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_POSIX_STATIC_MUTEX_INIT
+#elif defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+typedef std_static_mutex static_mutex;
+# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_STD_STATIC_MUTEX_INIT
 #endif
 
 } // namespace detail

Added: trunk/boost/asio/detail/std_event.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/std_event.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,129 @@
+//
+// detail/std_event.hpp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_STD_EVENT_HPP
+#define BOOST_ASIO_DETAIL_STD_EVENT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+
+#include <chrono>
+#include <condition_variable>
+#include <boost/asio/detail/assert.hpp>
+#include <boost/asio/detail/noncopyable.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class std_event
+ : private noncopyable
+{
+public:
+ // Constructor.
+ std_event()
+ : signalled_(false)
+ {
+ }
+
+ // Destructor.
+ ~std_event()
+ {
+ }
+
+ // Signal the event.
+ template <typename Lock>
+ void signal(Lock& lock)
+ {
+ BOOST_ASIO_ASSERT(lock.locked());
+ (void)lock;
+ signalled_ = true;
+ cond_.notify_one();
+ }
+
+ // Signal the event and unlock the mutex.
+ template <typename Lock>
+ void signal_and_unlock(Lock& lock)
+ {
+ BOOST_ASIO_ASSERT(lock.locked());
+ signalled_ = true;
+ lock.unlock();
+ cond_.notify_one();
+ }
+
+ // Reset the event.
+ template <typename Lock>
+ void clear(Lock& lock)
+ {
+ BOOST_ASIO_ASSERT(lock.locked());
+ (void)lock;
+ signalled_ = false;
+ }
+
+ // Wait for the event to become signalled.
+ template <typename Lock>
+ void wait(Lock& lock)
+ {
+ BOOST_ASIO_ASSERT(lock.locked());
+ unique_lock_adapter u_lock(lock);
+ while (!signalled_)
+ cond_.wait(u_lock.unique_lock_);
+ }
+
+ // Timed wait for the event to become signalled.
+ template <typename Lock>
+ bool wait_for_usec(Lock& lock, long usec)
+ {
+ BOOST_ASIO_ASSERT(lock.locked());
+ unique_lock_adapter u_lock(lock);
+ if (!signalled_)
+ cond_.wait_for(u_lock.unique_lock_, std::chrono::microseconds(usec));
+ return signalled_;
+ }
+
+private:
+ // Helper class to temporarily adapt a scoped_lock into a unique_lock so that
+ // it can be passed to std::condition_variable::wait().
+ struct unique_lock_adapter
+ {
+ template <typename Lock>
+ explicit unique_lock_adapter(Lock& lock)
+ : unique_lock_(lock.mutex().mutex_, std::adopt_lock)
+ {
+ }
+
+ ~unique_lock_adapter()
+ {
+ unique_lock_.release();
+ }
+
+ std::unique_lock<std::mutex> unique_lock_;
+ };
+
+ std::condition_variable cond_;
+ bool signalled_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+
+#endif // BOOST_ASIO_DETAIL_STD_EVENT_HPP

Added: trunk/boost/asio/detail/std_mutex.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/std_mutex.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,75 @@
+//
+// detail/std_mutex.hpp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_STD_MUTEX_HPP
+#define BOOST_ASIO_DETAIL_STD_MUTEX_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+
+#include <mutex>
+#include <boost/asio/detail/noncopyable.hpp>
+#include <boost/asio/detail/scoped_lock.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class std_event;
+
+class std_mutex
+ : private noncopyable
+{
+public:
+ typedef boost::asio::detail::scoped_lock<std_mutex> scoped_lock;
+
+ // Constructor.
+ std_mutex()
+ {
+ }
+
+ // Destructor.
+ ~std_mutex()
+ {
+ }
+
+ // Lock the mutex.
+ void lock()
+ {
+ mutex_.lock();
+ }
+
+ // Unlock the mutex.
+ void unlock()
+ {
+ mutex_.unlock();
+ }
+
+private:
+ friend class std_event;
+ std::mutex mutex_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+
+#endif // BOOST_ASIO_DETAIL_STD_MUTEX_HPP

Added: trunk/boost/asio/detail/std_static_mutex.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/std_static_mutex.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,83 @@
+//
+// detail/std_static_mutex.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_STD_STATIC_MUTEX_HPP
+#define BOOST_ASIO_DETAIL_STD_STATIC_MUTEX_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+
+#include <mutex>
+#include <boost/asio/detail/noncopyable.hpp>
+#include <boost/asio/detail/scoped_lock.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class std_event;
+
+class std_static_mutex
+ : private noncopyable
+{
+public:
+ typedef boost::asio::detail::scoped_lock<std_static_mutex> scoped_lock;
+
+ // Constructor.
+ std_static_mutex(int)
+ {
+ }
+
+ // Destructor.
+ ~std_static_mutex()
+ {
+ }
+
+ // Initialise the mutex.
+ void init()
+ {
+ // Nothing to do.
+ }
+
+ // Lock the mutex.
+ void lock()
+ {
+ mutex_.lock();
+ }
+
+ // Unlock the mutex.
+ void unlock()
+ {
+ mutex_.unlock();
+ }
+
+private:
+ friend class std_event;
+ std::mutex mutex_;
+};
+
+#define BOOST_ASIO_STD_STATIC_MUTEX_INIT 0
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+
+#endif // BOOST_ASIO_DETAIL_STD_STATIC_MUTEX_HPP

Added: trunk/boost/asio/detail/std_thread.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/std_thread.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,67 @@
+//
+// detail/std_thread.hpp
+// ~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_STD_THREAD_HPP
+#define BOOST_ASIO_DETAIL_STD_THREAD_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_STD_THREAD)
+
+#include <thread>
+#include <boost/asio/detail/noncopyable.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class std_thread
+ : private noncopyable
+{
+public:
+ // Constructor.
+ template <typename Function>
+ std_thread(Function f, unsigned int = 0)
+ : thread_(f)
+ {
+ }
+
+ // Destructor.
+ ~std_thread()
+ {
+ join();
+ }
+
+ // Wait for the thread to exit.
+ void join()
+ {
+ if (thread_.joinable())
+ thread_.join();
+ }
+
+private:
+ std::thread thread_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_HAS_STD_THREAD)
+
+#endif // BOOST_ASIO_DETAIL_STD_THREAD_HPP

Modified: trunk/boost/asio/detail/thread.hpp
==============================================================================
--- trunk/boost/asio/detail/thread.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/thread.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -27,8 +27,10 @@
 # endif
 #elif defined(BOOST_ASIO_HAS_PTHREADS)
 # include <boost/asio/detail/posix_thread.hpp>
+#elif defined(BOOST_ASIO_HAS_STD_THREAD)
+# include <boost/asio/detail/std_thread.hpp>
 #else
-# error Only Windows and POSIX are supported!
+# error Only Windows, POSIX and std::thread are supported!
 #endif
 
 namespace boost {
@@ -45,6 +47,8 @@
 # endif
 #elif defined(BOOST_ASIO_HAS_PTHREADS)
 typedef posix_thread thread;
+#elif defined(BOOST_ASIO_HAS_STD_THREAD)
+typedef std_thread thread;
 #endif
 
 } // namespace detail

Modified: trunk/boost/asio/detail/timer_scheduler.hpp
==============================================================================
--- trunk/boost/asio/detail/timer_scheduler.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/timer_scheduler.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -18,7 +18,9 @@
 #include <boost/asio/detail/config.hpp>
 #include <boost/asio/detail/timer_scheduler_fwd.hpp>
 
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <boost/asio/detail/winrt_timer_scheduler.hpp>
+#elif defined(BOOST_ASIO_HAS_IOCP)
 # include <boost/asio/detail/win_iocp_io_service.hpp>
 #elif defined(BOOST_ASIO_HAS_EPOLL)
 # include <boost/asio/detail/epoll_reactor.hpp>

Modified: trunk/boost/asio/detail/timer_scheduler_fwd.hpp
==============================================================================
--- trunk/boost/asio/detail/timer_scheduler_fwd.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/detail/timer_scheduler_fwd.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -21,7 +21,9 @@
 namespace asio {
 namespace detail {
 
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+typedef class winrt_timer_scheduler timer_scheduler;
+#elif defined(BOOST_ASIO_HAS_IOCP)
 typedef class win_iocp_io_service timer_scheduler;
 #elif defined(BOOST_ASIO_HAS_EPOLL)
 typedef class epoll_reactor timer_scheduler;

Added: trunk/boost/asio/detail/winrt_async_manager.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_async_manager.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,296 @@
+//
+// detail/winrt_async_manager.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_ASYNC_MANAGER_HPP
+#define BOOST_ASIO_DETAIL_WINRT_ASYNC_MANAGER_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <future>
+#include <boost/asio/detail/atomic_count.hpp>
+#include <boost/asio/detail/winrt_async_op.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class winrt_async_manager
+ : public boost::asio::detail::service_base<winrt_async_manager>
+{
+public:
+ // Constructor.
+ winrt_async_manager(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<winrt_async_manager>(io_service),
+ io_service_(use_service<io_service_impl>(io_service)),
+ outstanding_ops_(1)
+ {
+ }
+
+ // Destructor.
+ ~winrt_async_manager()
+ {
+ }
+
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ if (--outstanding_ops_ > 0)
+ {
+ // Block until last operation is complete.
+ std::future<void> f = promise_.get_future();
+ f.wait();
+ }
+ }
+
+ void sync(Windows::Foundation::IAsyncAction^ action,
+ boost::system::error_code& ec)
+ {
+ using namespace Windows::Foundation;
+ using Windows::Foundation::AsyncStatus;
+
+ auto promise = std::make_shared<std::promise<boost::system::error_code>>();
+ auto future = promise->get_future();
+
+ action->Completed = ref new AsyncActionCompletedHandler(
+ [promise](IAsyncAction^ action, AsyncStatus status)
+ {
+ switch (status)
+ {
+ case AsyncStatus::Canceled:
+ promise->set_value(boost::asio::error::operation_aborted);
+ break;
+ case AsyncStatus::Error:
+ case AsyncStatus::Completed:
+ default:
+ boost::system::error_code ec(
+ action->ErrorCode.Value,
+ boost::system::system_category());
+ promise->set_value(ec);
+ break;
+ }
+ });
+
+ ec = future.get();
+ }
+
+ template <typename TResult>
+ TResult sync(Windows::Foundation::IAsyncOperation<TResult>^ operation,
+ boost::system::error_code& ec)
+ {
+ using namespace Windows::Foundation;
+ using Windows::Foundation::AsyncStatus;
+
+ auto promise = std::make_shared<std::promise<boost::system::error_code>>();
+ auto future = promise->get_future();
+
+ operation->Completed = ref new AsyncOperationCompletedHandler<TResult>(
+ [promise](IAsyncOperation<TResult>^ operation, AsyncStatus status)
+ {
+ switch (status)
+ {
+ case AsyncStatus::Canceled:
+ promise->set_value(boost::asio::error::operation_aborted);
+ break;
+ case AsyncStatus::Error:
+ case AsyncStatus::Completed:
+ default:
+ boost::system::error_code ec(
+ operation->ErrorCode.Value,
+ boost::system::system_category());
+ promise->set_value(ec);
+ break;
+ }
+ });
+
+ ec = future.get();
+ return operation->GetResults();
+ }
+
+ template <typename TResult, typename TProgress>
+ TResult sync(
+ Windows::Foundation::IAsyncOperationWithProgress<
+ TResult, TProgress>^ operation,
+ boost::system::error_code& ec)
+ {
+ using namespace Windows::Foundation;
+ using Windows::Foundation::AsyncStatus;
+
+ auto promise = std::make_shared<std::promise<boost::system::error_code>>();
+ auto future = promise->get_future();
+
+ operation->Completed
+ = ref new AsyncOperationWithProgressCompletedHandler<TResult, TProgress>(
+ [promise](IAsyncOperationWithProgress<TResult, TProgress>^ operation,
+ AsyncStatus status)
+ {
+ switch (status)
+ {
+ case AsyncStatus::Canceled:
+ promise->set_value(boost::asio::error::operation_aborted);
+ break;
+ case AsyncStatus::Started:
+ break;
+ case AsyncStatus::Error:
+ case AsyncStatus::Completed:
+ default:
+ boost::system::error_code ec(
+ operation->ErrorCode.Value,
+ boost::system::system_category());
+ promise->set_value(ec);
+ break;
+ }
+ });
+
+ ec = future.get();
+ return operation->GetResults();
+ }
+
+ void async(Windows::Foundation::IAsyncAction^ action,
+ winrt_async_op<void>* handler)
+ {
+ using namespace Windows::Foundation;
+ using Windows::Foundation::AsyncStatus;
+
+ auto on_completed = ref new AsyncActionCompletedHandler(
+ [this, handler](IAsyncAction^ action, AsyncStatus status)
+ {
+ switch (status)
+ {
+ case AsyncStatus::Canceled:
+ handler->ec_ = boost::asio::error::operation_aborted;
+ break;
+ case AsyncStatus::Started:
+ return;
+ case AsyncStatus::Completed:
+ case AsyncStatus::Error:
+ default:
+ handler->ec_ = boost::system::error_code(
+ action->ErrorCode.Value,
+ boost::system::system_category());
+ break;
+ }
+ io_service_.post_deferred_completion(handler);
+ if (--outstanding_ops_ == 0)
+ promise_.set_value();
+ });
+
+ io_service_.work_started();
+ ++outstanding_ops_;
+ action->Completed = on_completed;
+ }
+
+ template <typename TResult>
+ void async(Windows::Foundation::IAsyncOperation<TResult>^ operation,
+ winrt_async_op<TResult>* handler)
+ {
+ using namespace Windows::Foundation;
+ using Windows::Foundation::AsyncStatus;
+
+ auto on_completed = ref new AsyncOperationCompletedHandler<TResult>(
+ [this, handler](IAsyncOperation<TResult>^ operation, AsyncStatus status)
+ {
+ switch (status)
+ {
+ case AsyncStatus::Canceled:
+ handler->ec_ = boost::asio::error::operation_aborted;
+ break;
+ case AsyncStatus::Started:
+ return;
+ case AsyncStatus::Completed:
+ handler->result_ = operation->GetResults();
+ // Fall through.
+ case AsyncStatus::Error:
+ default:
+ handler->ec_ = boost::system::error_code(
+ operation->ErrorCode.Value,
+ boost::system::system_category());
+ break;
+ }
+ io_service_.post_deferred_completion(handler);
+ if (--outstanding_ops_ == 0)
+ promise_.set_value();
+ });
+
+ io_service_.work_started();
+ ++outstanding_ops_;
+ operation->Completed = on_completed;
+ }
+
+ template <typename TResult, typename TProgress>
+ void async(
+ Windows::Foundation::IAsyncOperationWithProgress<
+ TResult, TProgress>^ operation,
+ winrt_async_op<TResult>* handler)
+ {
+ using namespace Windows::Foundation;
+ using Windows::Foundation::AsyncStatus;
+
+ auto on_completed
+ = ref new AsyncOperationWithProgressCompletedHandler<TResult, TProgress>(
+ [this, handler](IAsyncOperationWithProgress<
+ TResult, TProgress>^ operation, AsyncStatus status)
+ {
+ switch (status)
+ {
+ case AsyncStatus::Canceled:
+ handler->ec_ = boost::asio::error::operation_aborted;
+ break;
+ case AsyncStatus::Started:
+ return;
+ case AsyncStatus::Completed:
+ handler->result_ = operation->GetResults();
+ // Fall through.
+ case AsyncStatus::Error:
+ default:
+ handler->ec_ = boost::system::error_code(
+ operation->ErrorCode.Value,
+ boost::system::system_category());
+ break;
+ }
+ io_service_.post_deferred_completion(handler);
+ if (--outstanding_ops_ == 0)
+ promise_.set_value();
+ });
+
+ io_service_.work_started();
+ ++outstanding_ops_;
+ operation->Completed = on_completed;
+ }
+
+private:
+ // The io_service implementation used to post completed handlers.
+ io_service_impl& io_service_;
+
+ // Count of outstanding operations.
+ atomic_count outstanding_ops_;
+
+ // Used to keep wait for outstanding operations to complete.
+ std::promise<void> promise_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_ASYNC_MANAGER_HPP

Added: trunk/boost/asio/detail/winrt_async_op.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_async_op.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,67 @@
+//
+// detail/winrt_async_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_ASYNC_OP_HPP
+#define BOOST_ASIO_DETAIL_WINRT_ASYNC_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/operation.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename TResult>
+class winrt_async_op
+ : public operation
+{
+public:
+ // The error code to be passed to the completion handler.
+ boost::system::error_code ec_;
+
+ // The result of the operation, to be passed to the completion handler.
+ TResult result_;
+
+protected:
+ winrt_async_op(func_type complete_func)
+ : operation(complete_func),
+ result_()
+ {
+ }
+};
+
+template <>
+class winrt_async_op<void>
+ : public operation
+{
+public:
+ // The error code to be passed to the completion handler.
+ boost::system::error_code ec_;
+
+protected:
+ winrt_async_op(func_type complete_func)
+ : operation(complete_func)
+ {
+ }
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_WINRT_ASYNC_OP_HPP

Added: trunk/boost/asio/detail/winrt_resolve_op.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_resolve_op.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,119 @@
+//
+// detail/winrt_resolve_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_RESOLVE_OP_HPP
+#define BOOST_ASIO_DETAIL_WINRT_RESOLVE_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/detail/addressof.hpp>
+#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/fenced_block.hpp>
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/winrt_async_op.hpp>
+#include <boost/asio/ip/basic_resolver_iterator.hpp>
+#include <boost/asio/error.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename Protocol, typename Handler>
+class winrt_resolve_op :
+ public winrt_async_op<
+ Windows::Foundation::Collections::IVectorView<
+ Windows::Networking::EndpointPair^>^>
+{
+public:
+ BOOST_ASIO_DEFINE_HANDLER_PTR(winrt_resolve_op);
+
+ typedef typename Protocol::endpoint endpoint_type;
+ typedef boost::asio::ip::basic_resolver_query<Protocol> query_type;
+ typedef boost::asio::ip::basic_resolver_iterator<Protocol> iterator_type;
+
+ winrt_resolve_op(const query_type& query, Handler& handler)
+ : winrt_async_op<
+ Windows::Foundation::Collections::IVectorView<
+ Windows::Networking::EndpointPair^>^>(
+ &winrt_resolve_op::do_complete),
+ query_(query),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ {
+ }
+
+ static void do_complete(io_service_impl* owner, operation* base,
+ const boost::system::error_code&, std::size_t)
+ {
+ // Take ownership of the operation object.
+ winrt_resolve_op* o(static_cast<winrt_resolve_op*>(base));
+ ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
+
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
+ iterator_type iterator = iterator_type();
+ if (!o->ec_)
+ {
+ try
+ {
+ iterator = iterator_type::create(
+ o->result_, o->query_.hints(),
+ o->query_.host_name(), o->query_.service_name());
+ }
+ catch (Platform::Exception^ e)
+ {
+ o->ec_ = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ }
+ }
+
+ // Make a copy of the handler so that the memory can be deallocated before
+ // the upcall is made. Even if we're not about to make an upcall, a
+ // sub-object of the handler may be the true owner of the memory associated
+ // with the handler. Consequently, a local copy of the handler is required
+ // to ensure that any owning sub-object remains valid until after we have
+ // deallocated the memory here.
+ detail::binder2<Handler, boost::system::error_code, iterator_type>
+ handler(o->handler_, o->ec_, iterator);
+ p.h = boost::asio::detail::addressof(handler.handler_);
+ p.reset();
+
+ // Make the upcall if required.
+ if (owner)
+ {
+ fenced_block b(fenced_block::half);
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
+ boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
+ }
+ }
+
+private:
+ query_type query_;
+ Handler handler_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_RESOLVE_OP_HPP

Added: trunk/boost/asio/detail/winrt_resolver_service.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_resolver_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,185 @@
+//
+// detail/winrt_resolver_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_RESOLVER_SERVICE_HPP
+#define BOOST_ASIO_DETAIL_WINRT_RESOLVER_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/ip/basic_resolver_iterator.hpp>
+#include <boost/asio/ip/basic_resolver_query.hpp>
+#include <boost/asio/detail/addressof.hpp>
+#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/socket_ops.hpp>
+#include <boost/asio/detail/winrt_async_manager.hpp>
+#include <boost/asio/detail/winrt_resolve_op.hpp>
+#include <boost/asio/detail/winrt_utils.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename Protocol>
+class winrt_resolver_service
+{
+public:
+ // The implementation type of the resolver. A cancellation token is used to
+ // indicate to the asynchronous operation that the operation has been
+ // cancelled.
+ typedef socket_ops::shared_cancel_token_type implementation_type;
+
+ // The endpoint type.
+ typedef typename Protocol::endpoint endpoint_type;
+
+ // The query type.
+ typedef boost::asio::ip::basic_resolver_query<Protocol> query_type;
+
+ // The iterator type.
+ typedef boost::asio::ip::basic_resolver_iterator<Protocol> iterator_type;
+
+ // Constructor.
+ winrt_resolver_service(boost::asio::io_service& io_service)
+ : io_service_(use_service<io_service_impl>(io_service)),
+ async_manager_(use_service<winrt_async_manager>(io_service))
+ {
+ }
+
+ // Destructor.
+ ~winrt_resolver_service()
+ {
+ }
+
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ }
+
+ // Perform any fork-related housekeeping.
+ void fork_service(boost::asio::io_service::fork_event)
+ {
+ }
+
+ // Construct a new resolver implementation.
+ void construct(implementation_type&)
+ {
+ }
+
+ // Destroy a resolver implementation.
+ void destroy(implementation_type&)
+ {
+ }
+
+ // Cancel pending asynchronous operations.
+ void cancel(implementation_type&)
+ {
+ }
+
+ // Resolve a query to a list of entries.
+ iterator_type resolve(implementation_type&,
+ const query_type& query, boost::system::error_code& ec)
+ {
+ try
+ {
+ using namespace Windows::Networking::Sockets;
+ auto endpoint_pairs = async_manager_.sync(
+ DatagramSocket::GetEndpointPairsAsync(
+ winrt_utils::host_name(query.host_name()),
+ winrt_utils::string(query.service_name())), ec);
+
+ if (ec)
+ return iterator_type();
+
+ return iterator_type::create(
+ endpoint_pairs, query.hints(),
+ query.host_name(), query.service_name());
+ }
+ catch (Platform::Exception^ e)
+ {
+ ec = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ return iterator_type();
+ }
+ }
+
+ // Asynchronously resolve a query to a list of entries.
+ template <typename Handler>
+ void async_resolve(implementation_type&,
+ const query_type& query, Handler& handler)
+ {
+ bool is_continuation =
+ boost_asio_handler_cont_helpers::is_continuation(handler);
+
+ // Allocate and construct an operation to wrap the handler.
+ typedef winrt_resolve_op<Protocol, Handler> op;
+ typename op::ptr p = { boost::asio::detail::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(query, handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "resolver", &impl, "async_resolve"));
+
+ try
+ {
+ using namespace Windows::Networking::Sockets;
+ async_manager_.async(DatagramSocket::GetEndpointPairsAsync(
+ winrt_utils::host_name(query.host_name()),
+ winrt_utils::string(query.service_name())), p.p);
+ p.v = p.p = 0;
+ }
+ catch (Platform::Exception^ e)
+ {
+ p.p->ec_ = boost::system::error_code(
+ e->HResult, boost::system::system_category());
+ io_service_.post_immediate_completion(p.p, is_continuation);
+ p.v = p.p = 0;
+ }
+ }
+
+ // Resolve an endpoint to a list of entries.
+ iterator_type resolve(implementation_type&,
+ const endpoint_type&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return iterator_type();
+ }
+
+ // Asynchronously resolve an endpoint to a list of entries.
+ template <typename Handler>
+ void async_resolve(implementation_type&,
+ const endpoint_type&, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const iterator_type iterator;
+ io_service_.get_io_service().post(
+ detail::bind_handler(handler, ec, iterator));
+ }
+
+private:
+ io_service_impl& io_service_;
+ winrt_async_manager& async_manager_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_RESOLVER_SERVICE_HPP

Added: trunk/boost/asio/detail/winrt_socket_connect_op.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_socket_connect_op.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,92 @@
+//
+// detail/winrt_socket_connect_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_SOCKET_CONNECT_OP_HPP
+#define BOOST_ASIO_DETAIL_WINRT_SOCKET_CONNECT_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/detail/addressof.hpp>
+#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/buffer_sequence_adapter.hpp>
+#include <boost/asio/detail/fenced_block.hpp>
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/winrt_async_op.hpp>
+#include <boost/asio/error.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename Handler>
+class winrt_socket_connect_op :
+ public winrt_async_op<void>
+{
+public:
+ BOOST_ASIO_DEFINE_HANDLER_PTR(winrt_socket_connect_op);
+
+ winrt_socket_connect_op(Handler& handler)
+ : winrt_async_op<void>(&winrt_socket_connect_op::do_complete),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ {
+ }
+
+ static void do_complete(io_service_impl* owner, operation* base,
+ const boost::system::error_code&, std::size_t)
+ {
+ // Take ownership of the operation object.
+ winrt_socket_connect_op* o(static_cast<winrt_socket_connect_op*>(base));
+ ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
+
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
+ // Make a copy of the handler so that the memory can be deallocated before
+ // the upcall is made. Even if we're not about to make an upcall, a
+ // sub-object of the handler may be the true owner of the memory associated
+ // with the handler. Consequently, a local copy of the handler is required
+ // to ensure that any owning sub-object remains valid until after we have
+ // deallocated the memory here.
+ detail::binder1<Handler, boost::system::error_code>
+ handler(o->handler_, o->ec_);
+ p.h = boost::asio::detail::addressof(handler.handler_);
+ p.reset();
+
+ // Make the upcall if required.
+ if (owner)
+ {
+ fenced_block b(fenced_block::half);
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
+ boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
+ }
+ }
+
+private:
+ Handler handler_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_SOCKET_CONNECT_OP_HPP

Added: trunk/boost/asio/detail/winrt_socket_recv_op.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_socket_recv_op.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,106 @@
+//
+// detail/winrt_socket_recv_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_SOCKET_RECV_OP_HPP
+#define BOOST_ASIO_DETAIL_WINRT_SOCKET_RECV_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/detail/addressof.hpp>
+#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/buffer_sequence_adapter.hpp>
+#include <boost/asio/detail/fenced_block.hpp>
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/winrt_async_op.hpp>
+#include <boost/asio/error.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename MutableBufferSequence, typename Handler>
+class winrt_socket_recv_op :
+ public winrt_async_op<Windows::Storage::Streams::IBuffer^>
+{
+public:
+ BOOST_ASIO_DEFINE_HANDLER_PTR(winrt_socket_recv_op);
+
+ winrt_socket_recv_op(const MutableBufferSequence& buffers, Handler& handler)
+ : winrt_async_op<Windows::Storage::Streams::IBuffer^>(
+ &winrt_socket_recv_op::do_complete),
+ buffers_(buffers),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ {
+ }
+
+ static void do_complete(io_service_impl* owner, operation* base,
+ const boost::system::error_code&, std::size_t)
+ {
+ // Take ownership of the operation object.
+ winrt_socket_recv_op* o(static_cast<winrt_socket_recv_op*>(base));
+ ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
+
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
+#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+ // Check whether buffers are still valid.
+ if (owner)
+ {
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence>::validate(o->buffers_);
+ }
+#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+
+ // TODO check for end-of-file.
+
+ // Make a copy of the handler so that the memory can be deallocated before
+ // the upcall is made. Even if we're not about to make an upcall, a
+ // sub-object of the handler may be the true owner of the memory associated
+ // with the handler. Consequently, a local copy of the handler is required
+ // to ensure that any owning sub-object remains valid until after we have
+ // deallocated the memory here.
+ detail::binder2<Handler, boost::system::error_code, std::size_t>
+ handler(o->handler_, o->ec_, o->result_ ? o->result_->Length : 0);
+ p.h = boost::asio::detail::addressof(handler.handler_);
+ p.reset();
+
+ // Make the upcall if required.
+ if (owner)
+ {
+ fenced_block b(fenced_block::half);
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
+ boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
+ }
+ }
+
+private:
+ MutableBufferSequence buffers_;
+ Handler handler_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_SOCKET_RECV_OP_HPP

Added: trunk/boost/asio/detail/winrt_socket_send_op.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_socket_send_op.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,103 @@
+//
+// detail/winrt_socket_send_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_SOCKET_SEND_OP_HPP
+#define BOOST_ASIO_DETAIL_WINRT_SOCKET_SEND_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/detail/addressof.hpp>
+#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/buffer_sequence_adapter.hpp>
+#include <boost/asio/detail/fenced_block.hpp>
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/winrt_async_op.hpp>
+#include <boost/asio/error.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename ConstBufferSequence, typename Handler>
+class winrt_socket_send_op :
+ public winrt_async_op<unsigned int>
+{
+public:
+ BOOST_ASIO_DEFINE_HANDLER_PTR(winrt_socket_send_op);
+
+ winrt_socket_send_op(const ConstBufferSequence& buffers, Handler& handler)
+ : winrt_async_op<unsigned int>(&winrt_socket_send_op::do_complete),
+ buffers_(buffers),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ {
+ }
+
+ static void do_complete(io_service_impl* owner, operation* base,
+ const boost::system::error_code&, std::size_t)
+ {
+ // Take ownership of the operation object.
+ winrt_socket_send_op* o(static_cast<winrt_socket_send_op*>(base));
+ ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
+
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
+#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+ // Check whether buffers are still valid.
+ if (owner)
+ {
+ buffer_sequence_adapter<boost::asio::const_buffer,
+ ConstBufferSequence>::validate(o->buffers_);
+ }
+#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+
+ // Make a copy of the handler so that the memory can be deallocated before
+ // the upcall is made. Even if we're not about to make an upcall, a
+ // sub-object of the handler may be the true owner of the memory associated
+ // with the handler. Consequently, a local copy of the handler is required
+ // to ensure that any owning sub-object remains valid until after we have
+ // deallocated the memory here.
+ detail::binder2<Handler, boost::system::error_code, std::size_t>
+ handler(o->handler_, o->ec_, o->result_);
+ p.h = boost::asio::detail::addressof(handler.handler_);
+ p.reset();
+
+ // Make the upcall if required.
+ if (owner)
+ {
+ fenced_block b(fenced_block::half);
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
+ boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
+ }
+ }
+
+private:
+ ConstBufferSequence buffers_;
+ Handler handler_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_SOCKET_SEND_OP_HPP

Added: trunk/boost/asio/detail/winrt_ssocket_service.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_ssocket_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,234 @@
+//
+// detail/winrt_ssocket_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_SSOCKET_SERVICE_HPP
+#define BOOST_ASIO_DETAIL_WINRT_SSOCKET_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/detail/addressof.hpp>
+#include <boost/asio/detail/winrt_socket_connect_op.hpp>
+#include <boost/asio/detail/winrt_ssocket_service_base.hpp>
+#include <boost/asio/detail/winrt_utils.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename Protocol>
+class winrt_ssocket_service :
+ public winrt_ssocket_service_base
+{
+public:
+ // The protocol type.
+ typedef Protocol protocol_type;
+
+ // The endpoint type.
+ typedef typename Protocol::endpoint endpoint_type;
+
+ // The native type of a socket.
+ typedef Windows::Networking::Sockets::StreamSocket^ native_handle_type;
+
+ // The implementation type of the socket.
+ struct implementation_type : base_implementation_type
+ {
+ // Default constructor.
+ implementation_type()
+ : base_implementation_type(),
+ protocol_(endpoint_type().protocol())
+ {
+ }
+
+ // The protocol associated with the socket.
+ protocol_type protocol_;
+ };
+
+ // Constructor.
+ winrt_ssocket_service(boost::asio::io_service& io_service)
+ : winrt_ssocket_service_base(io_service)
+ {
+ }
+
+ // Move-construct a new socket implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ this->base_move_construct(impl, other_impl);
+
+ impl.protocol_ = other_impl.protocol_;
+ other_impl.protocol_ = endpoint_type().protocol();
+ }
+
+ // Move-assign from another socket implementation.
+ void move_assign(implementation_type& impl,
+ winrt_ssocket_service& other_service,
+ implementation_type& other_impl)
+ {
+ this->base_move_assign(impl, other_service, other_impl);
+
+ impl.protocol_ = other_impl.protocol_;
+ other_impl.protocol_ = endpoint_type().protocol();
+ }
+
+ // Move-construct a new socket implementation from another protocol type.
+ template <typename Protocol1>
+ void converting_move_construct(implementation_type& impl,
+ typename winrt_ssocket_service<
+ Protocol1>::implementation_type& other_impl)
+ {
+ this->base_move_construct(impl, other_impl);
+
+ impl.protocol_ = protocol_type(other_impl.protocol_);
+ other_impl.protocol_ = typename Protocol1::endpoint().protocol();
+ }
+
+ // Open a new socket implementation.
+ boost::system::error_code open(implementation_type& impl,
+ const protocol_type& protocol, boost::system::error_code& ec)
+ {
+ if (is_open(impl))
+ {
+ ec = boost::asio::error::already_open;
+ return ec;
+ }
+
+ try
+ {
+ impl.socket_ = ref new Windows::Networking::Sockets::StreamSocket;
+ impl.protocol_ = protocol;
+ ec = boost::system::error_code();
+ }
+ catch (Platform::Exception^ e)
+ {
+ ec = boost::system::error_code(e->HResult,
+ boost::system::system_category());
+ }
+
+ return ec;
+ }
+
+ // Assign a native socket to a socket implementation.
+ boost::system::error_code assign(implementation_type& impl,
+ const protocol_type& protocol, const native_handle_type& native_socket,
+ boost::system::error_code& ec)
+ {
+ if (is_open(impl))
+ {
+ ec = boost::asio::error::already_open;
+ return ec;
+ }
+
+ impl.socket_ = native_socket;
+ impl.protocol_ = protocol;
+ ec = boost::system::error_code();
+
+ return ec;
+ }
+
+ // Bind the socket to the specified local endpoint.
+ boost::system::error_code bind(implementation_type&,
+ const endpoint_type&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Get the local endpoint.
+ endpoint_type local_endpoint(const implementation_type& impl,
+ boost::system::error_code& ec) const
+ {
+ endpoint_type endpoint;
+ endpoint.resize(do_get_endpoint(impl, true,
+ endpoint.data(), endpoint.size(), ec));
+ return endpoint;
+ }
+
+ // Get the remote endpoint.
+ endpoint_type remote_endpoint(const implementation_type& impl,
+ boost::system::error_code& ec) const
+ {
+ endpoint_type endpoint;
+ endpoint.resize(do_get_endpoint(impl, false,
+ endpoint.data(), endpoint.size(), ec));
+ return endpoint;
+ }
+
+ // Set a socket option.
+ template <typename Option>
+ boost::system::error_code set_option(implementation_type& impl,
+ const Option& option, boost::system::error_code& ec)
+ {
+ return do_set_option(impl, option.level(impl.protocol_),
+ option.name(impl.protocol_), option.data(impl.protocol_),
+ option.size(impl.protocol_), ec);
+ }
+
+ // Get a socket option.
+ template <typename Option>
+ boost::system::error_code get_option(const implementation_type& impl,
+ Option& option, boost::system::error_code& ec) const
+ {
+ std::size_t size = option.size(impl.protocol_);
+ do_get_option(impl, option.level(impl.protocol_),
+ option.name(impl.protocol_),
+ option.data(impl.protocol_), &size, ec);
+ if (!ec)
+ option.resize(impl.protocol_, size);
+ return ec;
+ }
+
+ // Connect the socket to the specified endpoint.
+ boost::system::error_code connect(implementation_type& impl,
+ const endpoint_type& peer_endpoint, boost::system::error_code& ec)
+ {
+ return do_connect(impl, peer_endpoint.data(), ec);
+ }
+
+ // Start an asynchronous connect.
+ template <typename Handler>
+ void async_connect(implementation_type& impl,
+ const endpoint_type& peer_endpoint, Handler& handler)
+ {
+ bool is_continuation =
+ boost_asio_handler_cont_helpers::is_continuation(handler);
+
+ // Allocate and construct an operation to wrap the handler.
+ typedef winrt_socket_connect_op<Handler> op;
+ typename op::ptr p = { boost::asio::detail::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect"));
+
+ start_connect_op(impl, peer_endpoint.data(), p.p, is_continuation);
+ p.v = p.p = 0;
+ }
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_SSOCKET_SERVICE_HPP

Added: trunk/boost/asio/detail/winrt_ssocket_service_base.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_ssocket_service_base.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,357 @@
+//
+// detail/winrt_ssocket_service_base.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_SSOCKET_SERVICE_BASE_HPP
+#define BOOST_ASIO_DETAIL_WINRT_SSOCKET_SERVICE_BASE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <boost/asio/buffer.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/socket_base.hpp>
+#include <boost/asio/detail/addressof.hpp>
+#include <boost/asio/detail/buffer_sequence_adapter.hpp>
+#include <boost/asio/detail/socket_types.hpp>
+#include <boost/asio/detail/winrt_async_manager.hpp>
+#include <boost/asio/detail/winrt_socket_recv_op.hpp>
+#include <boost/asio/detail/winrt_socket_send_op.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class winrt_ssocket_service_base
+{
+public:
+ // The native type of a socket.
+ typedef Windows::Networking::Sockets::StreamSocket^ native_handle_type;
+
+ // The implementation type of the socket.
+ struct base_implementation_type
+ {
+ // Default constructor.
+ base_implementation_type()
+ : socket_(nullptr),
+ next_(0),
+ prev_(0)
+ {
+ }
+
+ // The underlying native socket.
+ native_handle_type socket_;
+
+ // Pointers to adjacent socket implementations in linked list.
+ base_implementation_type* next_;
+ base_implementation_type* prev_;
+ };
+
+ // Constructor.
+ BOOST_ASIO_DECL winrt_ssocket_service_base(
+ boost::asio::io_service& io_service);
+
+ // Destroy all user-defined handler objects owned by the service.
+ BOOST_ASIO_DECL void shutdown_service();
+
+ // Construct a new socket implementation.
+ BOOST_ASIO_DECL void construct(base_implementation_type&);
+
+ // Move-construct a new socket implementation.
+ BOOST_ASIO_DECL void base_move_construct(base_implementation_type& impl,
+ base_implementation_type& other_impl);
+
+ // Move-assign from another socket implementation.
+ BOOST_ASIO_DECL void base_move_assign(base_implementation_type& impl,
+ winrt_ssocket_service_base& other_service,
+ base_implementation_type& other_impl);
+
+ // Destroy a socket implementation.
+ BOOST_ASIO_DECL void destroy(base_implementation_type& impl);
+
+ // Determine whether the socket is open.
+ bool is_open(const base_implementation_type& impl) const
+ {
+ return impl.socket_ != nullptr;
+ }
+
+ // Destroy a socket implementation.
+ BOOST_ASIO_DECL boost::system::error_code close(
+ base_implementation_type& impl, boost::system::error_code& ec);
+
+ // Get the native socket representation.
+ native_handle_type native_handle(base_implementation_type& impl)
+ {
+ return impl.socket_;
+ }
+
+ // Cancel all operations associated with the socket.
+ boost::system::error_code cancel(base_implementation_type&,
+ boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Determine whether the socket is at the out-of-band data mark.
+ bool at_mark(const base_implementation_type&,
+ boost::system::error_code& ec) const
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return false;
+ }
+
+ // Determine the number of bytes available for reading.
+ std::size_t available(const base_implementation_type&,
+ boost::system::error_code& ec) const
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Perform an IO control command on the socket.
+ template <typename IO_Control_Command>
+ boost::system::error_code io_control(base_implementation_type&,
+ IO_Control_Command&, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Gets the non-blocking mode of the socket.
+ bool non_blocking(const base_implementation_type&) const
+ {
+ return false;
+ }
+
+ // Sets the non-blocking mode of the socket.
+ boost::system::error_code non_blocking(base_implementation_type&,
+ bool, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Gets the non-blocking mode of the native socket implementation.
+ bool native_non_blocking(const base_implementation_type&) const
+ {
+ return false;
+ }
+
+ // Sets the non-blocking mode of the native socket implementation.
+ boost::system::error_code native_non_blocking(base_implementation_type&,
+ bool, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Disable sends or receives on the socket.
+ boost::system::error_code shutdown(base_implementation_type&,
+ socket_base::shutdown_type, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return ec;
+ }
+
+ // Send the given data to the peer.
+ template <typename ConstBufferSequence>
+ std::size_t send(base_implementation_type& impl,
+ const ConstBufferSequence& buffers,
+ socket_base::message_flags flags, boost::system::error_code& ec)
+ {
+ return do_send(impl,
+ buffer_sequence_adapter<boost::asio::const_buffer,
+ ConstBufferSequence>::first(buffers), flags, ec);
+ }
+
+ // Wait until data can be sent without blocking.
+ std::size_t send(base_implementation_type&, const null_buffers&,
+ socket_base::message_flags, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Start an asynchronous send. The data being sent must be valid for the
+ // lifetime of the asynchronous operation.
+ template <typename ConstBufferSequence, typename Handler>
+ void async_send(base_implementation_type& impl,
+ const ConstBufferSequence& buffers,
+ socket_base::message_flags flags, Handler& handler)
+ {
+ bool is_continuation =
+ boost_asio_handler_cont_helpers::is_continuation(handler);
+
+ // Allocate and construct an operation to wrap the handler.
+ typedef winrt_socket_send_op<ConstBufferSequence, Handler> op;
+ typename op::ptr p = { boost::asio::detail::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(buffers, handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send"));
+
+ start_send_op(impl,
+ buffer_sequence_adapter<boost::asio::const_buffer,
+ ConstBufferSequence>::first(buffers),
+ flags, p.p, is_continuation);
+ p.v = p.p = 0;
+ }
+
+ // Start an asynchronous wait until data can be sent without blocking.
+ template <typename Handler>
+ void async_send(base_implementation_type&, const null_buffers&,
+ socket_base::message_flags, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.get_io_service().post(
+ detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+ // Receive some data from the peer. Returns the number of bytes received.
+ template <typename MutableBufferSequence>
+ std::size_t receive(base_implementation_type& impl,
+ const MutableBufferSequence& buffers,
+ socket_base::message_flags flags, boost::system::error_code& ec)
+ {
+ return do_receive(impl,
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence>::first(buffers), flags, ec);
+ }
+
+ // Wait until data can be received without blocking.
+ std::size_t receive(base_implementation_type&, const null_buffers&,
+ socket_base::message_flags, boost::system::error_code& ec)
+ {
+ ec = boost::asio::error::operation_not_supported;
+ return 0;
+ }
+
+ // Start an asynchronous receive. The buffer for the data being received
+ // must be valid for the lifetime of the asynchronous operation.
+ template <typename MutableBufferSequence, typename Handler>
+ void async_receive(base_implementation_type& impl,
+ const MutableBufferSequence& buffers,
+ socket_base::message_flags flags, Handler& handler)
+ {
+ bool is_continuation =
+ boost_asio_handler_cont_helpers::is_continuation(handler);
+
+ // Allocate and construct an operation to wrap the handler.
+ typedef winrt_socket_recv_op<MutableBufferSequence, Handler> op;
+ typename op::ptr p = { boost::asio::detail::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(buffers, handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive"));
+
+ start_receive_op(impl,
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence>::first(buffers),
+ flags, p.p, is_continuation);
+ p.v = p.p = 0;
+ }
+
+ // Wait until data can be received without blocking.
+ template <typename Handler>
+ void async_receive(base_implementation_type&, const null_buffers&,
+ socket_base::message_flags, Handler& handler)
+ {
+ boost::system::error_code ec = boost::asio::error::operation_not_supported;
+ const std::size_t bytes_transferred = 0;
+ io_service_.get_io_service().post(
+ detail::bind_handler(handler, ec, bytes_transferred));
+ }
+
+protected:
+ // Helper function to obtain endpoints associated with the connection.
+ BOOST_ASIO_DECL std::size_t do_get_endpoint(
+ const base_implementation_type& impl, bool local,
+ void* addr, std::size_t addr_len, boost::system::error_code& ec) const;
+
+ // Helper function to set a socket option.
+ BOOST_ASIO_DECL boost::system::error_code do_set_option(
+ base_implementation_type& impl,
+ int level, int optname, const void* optval,
+ std::size_t optlen, boost::system::error_code& ec);
+
+ // Helper function to get a socket option.
+ BOOST_ASIO_DECL void do_get_option(
+ const base_implementation_type& impl,
+ int level, int optname, void* optval,
+ std::size_t* optlen, boost::system::error_code& ec) const;
+
+ // Helper function to perform a synchronous connect.
+ BOOST_ASIO_DECL boost::system::error_code do_connect(
+ base_implementation_type& impl,
+ const void* addr, boost::system::error_code& ec);
+
+ // Helper function to start an asynchronous connect.
+ BOOST_ASIO_DECL void start_connect_op(
+ base_implementation_type& impl, const void* addr,
+ winrt_async_op<void>* op, bool is_continuation);
+
+ // Helper function to perform a synchronous send.
+ BOOST_ASIO_DECL std::size_t do_send(
+ base_implementation_type& impl, const boost::asio::const_buffer& data,
+ socket_base::message_flags flags, boost::system::error_code& ec);
+
+ // Helper function to start an asynchronous send.
+ BOOST_ASIO_DECL void start_send_op(base_implementation_type& impl,
+ const boost::asio::const_buffer& data, socket_base::message_flags flags,
+ winrt_async_op<unsigned int>* op, bool is_continuation);
+
+ // Helper function to perform a synchronous receive.
+ BOOST_ASIO_DECL std::size_t do_receive(
+ base_implementation_type& impl, const boost::asio::mutable_buffer& data,
+ socket_base::message_flags flags, boost::system::error_code& ec);
+
+ // Helper function to start an asynchronous receive.
+ BOOST_ASIO_DECL void start_receive_op(base_implementation_type& impl,
+ const boost::asio::mutable_buffer& data, socket_base::message_flags flags,
+ winrt_async_op<Windows::Storage::Streams::IBuffer^>* op,
+ bool is_continuation);
+
+ // The io_service implementation used for delivering completions.
+ io_service_impl& io_service_;
+
+ // The manager that keeps track of outstanding operations.
+ winrt_async_manager& async_manager_;
+
+ // Mutex to protect access to the linked list of implementations.
+ boost::asio::detail::mutex mutex_;
+
+ // The head of a linked list of all implementations.
+ base_implementation_type* impl_list_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/detail/impl/winrt_ssocket_service_base.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_SSOCKET_SERVICE_BASE_HPP

Added: trunk/boost/asio/detail/winrt_timer_scheduler.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_timer_scheduler.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,133 @@
+//
+// detail/winrt_timer_scheduler.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_TIMER_SCHEDULER_HPP
+#define BOOST_ASIO_DETAIL_WINRT_TIMER_SCHEDULER_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <cstddef>
+#include <boost/asio/detail/event.hpp>
+#include <boost/asio/detail/limits.hpp>
+#include <boost/asio/detail/mutex.hpp>
+#include <boost/asio/detail/op_queue.hpp>
+#include <boost/asio/detail/thread.hpp>
+#include <boost/asio/detail/timer_queue_base.hpp>
+#include <boost/asio/detail/timer_queue_set.hpp>
+#include <boost/asio/detail/wait_op.hpp>
+#include <boost/asio/io_service.hpp>
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/thread.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class winrt_timer_scheduler
+ : public boost::asio::detail::service_base<winrt_timer_scheduler>
+{
+public:
+ // Constructor.
+ BOOST_ASIO_DECL winrt_timer_scheduler(boost::asio::io_service& io_service);
+
+ // Destructor.
+ BOOST_ASIO_DECL ~winrt_timer_scheduler();
+
+ // Destroy all user-defined handler objects owned by the service.
+ BOOST_ASIO_DECL void shutdown_service();
+
+ // Recreate internal descriptors following a fork.
+ BOOST_ASIO_DECL void fork_service(
+ boost::asio::io_service::fork_event fork_ev);
+
+ // Initialise the task. No effect as this class uses its own thread.
+ BOOST_ASIO_DECL void init_task();
+
+ // Add a new timer queue to the reactor.
+ template <typename Time_Traits>
+ void add_timer_queue(timer_queue<Time_Traits>& queue);
+
+ // Remove a timer queue from the reactor.
+ template <typename Time_Traits>
+ void remove_timer_queue(timer_queue<Time_Traits>& queue);
+
+ // Schedule a new operation in the given timer queue to expire at the
+ // specified absolute time.
+ template <typename Time_Traits>
+ void schedule_timer(timer_queue<Time_Traits>& queue,
+ const typename Time_Traits::time_type& time,
+ typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op);
+
+ // Cancel the timer operations associated with the given token. Returns the
+ // number of operations that have been posted or dispatched.
+ template <typename Time_Traits>
+ std::size_t cancel_timer(timer_queue<Time_Traits>& queue,
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
+
+private:
+ // Run the select loop in the thread.
+ BOOST_ASIO_DECL void run_thread();
+
+ // Entry point for the select loop thread.
+ BOOST_ASIO_DECL static void call_run_thread(winrt_timer_scheduler* reactor);
+
+ // Helper function to add a new timer queue.
+ BOOST_ASIO_DECL void do_add_timer_queue(timer_queue_base& queue);
+
+ // Helper function to remove a timer queue.
+ BOOST_ASIO_DECL void do_remove_timer_queue(timer_queue_base& queue);
+
+ // The io_service implementation used to post completions.
+ io_service_impl& io_service_;
+
+ // Mutex used to protect internal variables.
+ boost::asio::detail::mutex mutex_;
+
+ // Event used to wake up background thread.
+ boost::asio::detail::event event_;
+
+ // The timer queues.
+ timer_queue_set timer_queues_;
+
+ // The background thread that is waiting for timers to expire.
+ boost::asio::detail::thread* thread_;
+
+ // Does the background thread need to stop.
+ bool stop_thread_;
+
+ // Whether the service has been shut down.
+ bool shutdown_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#include <boost/asio/detail/impl/winrt_timer_scheduler.hpp>
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/detail/impl/winrt_timer_scheduler.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_TIMER_SCHEDULER_HPP

Added: trunk/boost/asio/detail/winrt_utils.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/asio/detail/winrt_utils.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -0,0 +1,108 @@
+//
+// detail/winrt_utils.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2013 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WINRT_UTILS_HPP
+#define BOOST_ASIO_DETAIL_WINRT_UTILS_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#include <codecvt>
+#include <cstdlib>
+#include <future>
+#include <locale>
+#include <memory>
+#include <robuffer.h>
+#include <windows.storage.streams.h>
+#include <wrl/implements.h>
+#include <boost/asio/buffer.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/asio/detail/addressof.hpp>
+#include <boost/asio/detail/socket_ops.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+namespace winrt_utils {
+
+inline Platform::String^ string(const char* from)
+{
+ std::wstring tmp(from, from + std::strlen(from));
+ return ref new Platform::String(tmp.c_str());
+}
+
+inline Platform::String^ string(const std::string& from)
+{
+ std::wstring tmp(from.begin(), from.end());
+ return ref new Platform::String(tmp.c_str());
+}
+
+inline std::string string(Platform::String^ from)
+{
+ std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
+ return converter.to_bytes(from->Data());
+}
+
+inline Platform::String^ string(unsigned short from)
+{
+ return string(std::to_string(from));
+}
+
+template <typename T>
+inline Platform::String^ string(const T& from)
+{
+ return string(from.to_string());
+}
+
+inline int integer(Platform::String^ from)
+{
+ return _wtoi(from->Data());
+}
+
+template <typename T>
+inline Windows::Networking::HostName^ host_name(const T& from)
+{
+ return ref new Windows::Networking::HostName((string)(from));
+}
+
+template <typename ConstBufferSequence>
+inline Windows::Storage::Streams::IBuffer^ buffer_dup(
+ const ConstBufferSequence& buffers)
+{
+ using Microsoft::WRL::ComPtr;
+ std::size_t size = boost::asio::buffer_size(buffers);
+ auto b = ref new Windows::Storage::Streams::Buffer(size);
+ ComPtr<IInspectable> insp = reinterpret_cast<IInspectable*>(b);
+ ComPtr<Windows::Storage::Streams::IBufferByteAccess> bacc;
+ insp.As(&bacc);
+ byte* bytes = nullptr;
+ bacc->Buffer(&bytes);
+ boost::asio::buffer_copy(boost::asio::buffer(bytes, size), buffers);
+ b->Length = size;
+ return b;
+}
+
+} // namespace winrt_utils
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+
+#endif // BOOST_ASIO_DETAIL_WINRT_UTILS_HPP

Modified: trunk/boost/asio/error.hpp
==============================================================================
--- trunk/boost/asio/error.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/error.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -18,7 +18,9 @@
 #include <boost/asio/detail/config.hpp>
 #include <boost/cerrno.hpp>
 #include <boost/system/error_code.hpp>
-#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) \
+ || defined(__CYGWIN__) \
+ || defined(BOOST_ASIO_WINDOWS_RUNTIME)
 # include <winerror.h>
 #else
 # include <cerrno>
@@ -36,6 +38,12 @@
 # define BOOST_ASIO_GETADDRINFO_ERROR(e) implementation_defined
 /// INTERNAL ONLY.
 # define BOOST_ASIO_WIN_OR_POSIX(e_win, e_posix) implementation_defined
+#elif defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# define BOOST_ASIO_NATIVE_ERROR(e) __HRESULT_FROM_WIN32(e)
+# define BOOST_ASIO_SOCKET_ERROR(e) __HRESULT_FROM_WIN32(WSA ## e)
+# define BOOST_ASIO_NETDB_ERROR(e) __HRESULT_FROM_WIN32(WSA ## e)
+# define BOOST_ASIO_GETADDRINFO_ERROR(e) __HRESULT_FROM_WIN32(WSA ## e)
+# define BOOST_ASIO_WIN_OR_POSIX(e_win, e_posix) e_win
 #elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
 # define BOOST_ASIO_NATIVE_ERROR(e) e
 # define BOOST_ASIO_SOCKET_ERROR(e) WSA ## e

Modified: trunk/boost/asio/generic/datagram_protocol.hpp
==============================================================================
--- trunk/boost/asio/generic/datagram_protocol.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/generic/datagram_protocol.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -76,7 +76,7 @@
   /// Obtain an identifier for the type of the protocol.
   int type() const
   {
- return SOCK_DGRAM;
+ return BOOST_ASIO_OS_DEF(SOCK_DGRAM);
   }
 
   /// Obtain an identifier for the protocol.

Modified: trunk/boost/asio/generic/raw_protocol.hpp
==============================================================================
--- trunk/boost/asio/generic/raw_protocol.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/generic/raw_protocol.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -76,7 +76,7 @@
   /// Obtain an identifier for the type of the protocol.
   int type() const
   {
- return SOCK_RAW;
+ return BOOST_ASIO_OS_DEF(SOCK_RAW);
   }
 
   /// Obtain an identifier for the protocol.

Modified: trunk/boost/asio/generic/seq_packet_protocol.hpp
==============================================================================
--- trunk/boost/asio/generic/seq_packet_protocol.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/generic/seq_packet_protocol.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -75,7 +75,7 @@
   /// Obtain an identifier for the type of the protocol.
   int type() const
   {
- return SOCK_SEQPACKET;
+ return BOOST_ASIO_OS_DEF(SOCK_SEQPACKET);
   }
 
   /// Obtain an identifier for the protocol.

Modified: trunk/boost/asio/generic/stream_protocol.hpp
==============================================================================
--- trunk/boost/asio/generic/stream_protocol.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/generic/stream_protocol.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -77,7 +77,7 @@
   /// Obtain an identifier for the type of the protocol.
   int type() const
   {
- return SOCK_STREAM;
+ return BOOST_ASIO_OS_DEF(SOCK_STREAM);
   }
 
   /// Obtain an identifier for the protocol.

Modified: trunk/boost/asio/impl/src.hpp
==============================================================================
--- trunk/boost/asio/impl/src.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/impl/src.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -23,6 +23,7 @@
 #include <boost/asio/impl/handler_alloc_hook.ipp>
 #include <boost/asio/impl/io_service.ipp>
 #include <boost/asio/impl/serial_port_base.ipp>
+#include <boost/asio/detail/impl/buffer_sequence_adapter.ipp>
 #include <boost/asio/detail/impl/descriptor_ops.ipp>
 #include <boost/asio/detail/impl/dev_poll_reactor.ipp>
 #include <boost/asio/detail/impl/epoll_reactor.ipp>
@@ -58,6 +59,8 @@
 #include <boost/asio/detail/impl/win_static_mutex.ipp>
 #include <boost/asio/detail/impl/win_thread.ipp>
 #include <boost/asio/detail/impl/win_tss_ptr.ipp>
+#include <boost/asio/detail/impl/winrt_ssocket_service_base.ipp>
+#include <boost/asio/detail/impl/winrt_timer_scheduler.ipp>
 #include <boost/asio/detail/impl/winsock_init.ipp>
 #include <boost/asio/generic/detail/impl/endpoint.ipp>
 #include <boost/asio/ip/impl/address.ipp>

Modified: trunk/boost/asio/ip/basic_resolver_iterator.hpp
==============================================================================
--- trunk/boost/asio/ip/basic_resolver_iterator.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/basic_resolver_iterator.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -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 @@
 
     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 @@
     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
   {

Modified: trunk/boost/asio/ip/basic_resolver_query.hpp
==============================================================================
--- trunk/boost/asio/ip/basic_resolver_query.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/basic_resolver_query.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -153,7 +153,7 @@
   {
     typename InternetProtocol::endpoint endpoint;
     hints_.ai_flags = static_cast<int>(resolve_flags);
- hints_.ai_family = PF_UNSPEC;
+ hints_.ai_family = BOOST_ASIO_OS_DEF(AF_UNSPEC);
     hints_.ai_socktype = endpoint.protocol().type();
     hints_.ai_protocol = endpoint.protocol().protocol();
     hints_.ai_addrlen = 0;

Modified: trunk/boost/asio/ip/detail/endpoint.hpp
==============================================================================
--- trunk/boost/asio/ip/detail/endpoint.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/detail/endpoint.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -109,7 +109,7 @@
   // Determine whether the endpoint is IPv4.
   bool is_v4() const
   {
- return data_.base.sa_family == AF_INET;
+ return data_.base.sa_family == BOOST_ASIO_OS_DEF(AF_INET);
   }
 
 #if !defined(BOOST_ASIO_NO_IOSTREAM)

Modified: trunk/boost/asio/ip/detail/impl/endpoint.ipp
==============================================================================
--- trunk/boost/asio/ip/detail/impl/endpoint.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/detail/impl/endpoint.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -35,25 +35,25 @@
 endpoint::endpoint()
   : data_()
 {
- data_.v4.sin_family = AF_INET;
+ data_.v4.sin_family = BOOST_ASIO_OS_DEF(AF_INET);
   data_.v4.sin_port = 0;
- data_.v4.sin_addr.s_addr = INADDR_ANY;
+ data_.v4.sin_addr.s_addr = BOOST_ASIO_OS_DEF(INADDR_ANY);
 }
 
 endpoint::endpoint(int family, unsigned short port_num)
   : data_()
 {
   using namespace std; // For memcpy.
- if (family == PF_INET)
+ if (family == BOOST_ASIO_OS_DEF(AF_INET))
   {
- data_.v4.sin_family = AF_INET;
+ data_.v4.sin_family = BOOST_ASIO_OS_DEF(AF_INET);
     data_.v4.sin_port =
       boost::asio::detail::socket_ops::host_to_network_short(port_num);
- data_.v4.sin_addr.s_addr = INADDR_ANY;
+ data_.v4.sin_addr.s_addr = BOOST_ASIO_OS_DEF(INADDR_ANY);
   }
   else
   {
- data_.v6.sin6_family = AF_INET6;
+ data_.v6.sin6_family = BOOST_ASIO_OS_DEF(AF_INET6);
     data_.v6.sin6_port =
       boost::asio::detail::socket_ops::host_to_network_short(port_num);
     data_.v6.sin6_flowinfo = 0;
@@ -76,7 +76,7 @@
   using namespace std; // For memcpy.
   if (addr.is_v4())
   {
- data_.v4.sin_family = AF_INET;
+ data_.v4.sin_family = BOOST_ASIO_OS_DEF(AF_INET);
     data_.v4.sin_port =
       boost::asio::detail::socket_ops::host_to_network_short(port_num);
     data_.v4.sin_addr.s_addr =
@@ -86,7 +86,7 @@
   }
   else
   {
- data_.v6.sin6_family = AF_INET6;
+ data_.v6.sin6_family = BOOST_ASIO_OS_DEF(AF_INET6);
     data_.v6.sin6_port =
       boost::asio::detail::socket_ops::host_to_network_short(port_num);
     data_.v6.sin6_flowinfo = 0;

Modified: trunk/boost/asio/ip/icmp.hpp
==============================================================================
--- trunk/boost/asio/ip/icmp.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/icmp.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -49,19 +49,21 @@
   /// Construct to represent the IPv4 ICMP protocol.
   static icmp v4()
   {
- return icmp(IPPROTO_ICMP, PF_INET);
+ return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMP),
+ BOOST_ASIO_OS_DEF(AF_INET));
   }
 
   /// Construct to represent the IPv6 ICMP protocol.
   static icmp v6()
   {
- return icmp(IPPROTO_ICMPV6, PF_INET6);
+ return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMPV6),
+ BOOST_ASIO_OS_DEF(AF_INET6));
   }
 
   /// Obtain an identifier for the type of the protocol.
   int type() const
   {
- return SOCK_RAW;
+ return BOOST_ASIO_OS_DEF(SOCK_RAW);
   }
 
   /// Obtain an identifier for the protocol.

Modified: trunk/boost/asio/ip/impl/address_v4.ipp
==============================================================================
--- trunk/boost/asio/ip/impl/address_v4.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/impl/address_v4.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -88,7 +88,8 @@
 {
   char addr_str[boost::asio::detail::max_addr_v4_str_len];
   const char* addr =
- boost::asio::detail::socket_ops::inet_ntop(AF_INET, &addr_, addr_str,
+ boost::asio::detail::socket_ops::inet_ntop(
+ BOOST_ASIO_OS_DEF(AF_INET), &addr_, addr_str,
         boost::asio::detail::max_addr_v4_str_len, 0, ec);
   if (addr == 0)
     return std::string();
@@ -108,7 +109,7 @@
 {
   address_v4 tmp;
   if (boost::asio::detail::socket_ops::inet_pton(
- AF_INET, str, &tmp.addr_, 0, ec) <= 0)
+ BOOST_ASIO_OS_DEF(AF_INET), str, &tmp.addr_, 0, ec) <= 0)
     return address_v4();
   return tmp;
 }

Modified: trunk/boost/asio/ip/impl/address_v6.ipp
==============================================================================
--- trunk/boost/asio/ip/impl/address_v6.ipp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/impl/address_v6.ipp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -110,7 +110,8 @@
 {
   char addr_str[boost::asio::detail::max_addr_v6_str_len];
   const char* addr =
- boost::asio::detail::socket_ops::inet_ntop(AF_INET6, &addr_, addr_str,
+ boost::asio::detail::socket_ops::inet_ntop(
+ BOOST_ASIO_OS_DEF(AF_INET6), &addr_, addr_str,
         boost::asio::detail::max_addr_v6_str_len, scope_id_, ec);
   if (addr == 0)
     return std::string();
@@ -130,7 +131,7 @@
 {
   address_v6 tmp;
   if (boost::asio::detail::socket_ops::inet_pton(
- AF_INET6, str, &tmp.addr_, &tmp.scope_id_, ec) <= 0)
+ BOOST_ASIO_OS_DEF(AF_INET6), str, &tmp.addr_, &tmp.scope_id_, ec) <= 0)
     return address_v6();
   return tmp;
 }

Modified: trunk/boost/asio/ip/multicast.hpp
==============================================================================
--- trunk/boost/asio/ip/multicast.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/multicast.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -48,7 +48,10 @@
 typedef implementation_defined join_group;
 #else
 typedef boost::asio::ip::detail::socket_option::multicast_request<
- IPPROTO_IP, IP_ADD_MEMBERSHIP, IPPROTO_IPV6, IPV6_JOIN_GROUP> join_group;
+ BOOST_ASIO_OS_DEF(IPPROTO_IP),
+ BOOST_ASIO_OS_DEF(IP_ADD_MEMBERSHIP),
+ BOOST_ASIO_OS_DEF(IPPROTO_IPV6),
+ BOOST_ASIO_OS_DEF(IPV6_JOIN_GROUP)> join_group;
 #endif
 
 /// Socket option to leave a multicast group on a specified interface.
@@ -73,7 +76,10 @@
 typedef implementation_defined leave_group;
 #else
 typedef boost::asio::ip::detail::socket_option::multicast_request<
- IPPROTO_IP, IP_DROP_MEMBERSHIP, IPPROTO_IPV6, IPV6_LEAVE_GROUP> leave_group;
+ BOOST_ASIO_OS_DEF(IPPROTO_IP),
+ BOOST_ASIO_OS_DEF(IP_DROP_MEMBERSHIP),
+ BOOST_ASIO_OS_DEF(IPPROTO_IPV6),
+ BOOST_ASIO_OS_DEF(IPV6_LEAVE_GROUP)> leave_group;
 #endif
 
 /// Socket option for local interface to use for outgoing multicast packets.
@@ -98,8 +104,10 @@
 typedef implementation_defined outbound_interface;
 #else
 typedef boost::asio::ip::detail::socket_option::network_interface<
- IPPROTO_IP, IP_MULTICAST_IF, IPPROTO_IPV6, IPV6_MULTICAST_IF>
- outbound_interface;
+ BOOST_ASIO_OS_DEF(IPPROTO_IP),
+ BOOST_ASIO_OS_DEF(IP_MULTICAST_IF),
+ BOOST_ASIO_OS_DEF(IPPROTO_IPV6),
+ BOOST_ASIO_OS_DEF(IPV6_MULTICAST_IF)> outbound_interface;
 #endif
 
 /// Socket option for time-to-live associated with outgoing multicast packets.
@@ -132,7 +140,10 @@
 typedef implementation_defined hops;
 #else
 typedef boost::asio::ip::detail::socket_option::multicast_hops<
- IPPROTO_IP, IP_MULTICAST_TTL, IPPROTO_IPV6, IPV6_MULTICAST_HOPS> hops;
+ BOOST_ASIO_OS_DEF(IPPROTO_IP),
+ BOOST_ASIO_OS_DEF(IP_MULTICAST_TTL),
+ BOOST_ASIO_OS_DEF(IPPROTO_IPV6),
+ BOOST_ASIO_OS_DEF(IPV6_MULTICAST_HOPS)> hops;
 #endif
 
 /// Socket option determining whether outgoing multicast packets will be
@@ -166,8 +177,10 @@
 typedef implementation_defined enable_loopback;
 #else
 typedef boost::asio::ip::detail::socket_option::multicast_enable_loopback<
- IPPROTO_IP, IP_MULTICAST_LOOP, IPPROTO_IPV6, IPV6_MULTICAST_LOOP>
- enable_loopback;
+ BOOST_ASIO_OS_DEF(IPPROTO_IP),
+ BOOST_ASIO_OS_DEF(IP_MULTICAST_LOOP),
+ BOOST_ASIO_OS_DEF(IPPROTO_IPV6),
+ BOOST_ASIO_OS_DEF(IPV6_MULTICAST_LOOP)> enable_loopback;
 #endif
 
 } // namespace multicast

Modified: trunk/boost/asio/ip/resolver_query_base.hpp
==============================================================================
--- trunk/boost/asio/ip/resolver_query_base.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/resolver_query_base.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -63,31 +63,13 @@
 #else
   enum flags
   {
- canonical_name = AI_CANONNAME,
- passive = AI_PASSIVE,
- numeric_host = AI_NUMERICHOST,
-# if defined(AI_NUMERICSERV)
- numeric_service = AI_NUMERICSERV,
-# else
- numeric_service = 0,
-# endif
- // Note: QNX Neutrino 6.3 defines AI_V4MAPPED, AI_ALL and AI_ADDRCONFIG but
- // does not implement them. Therefore they are specifically excluded here.
-# if defined(AI_V4MAPPED) && !defined(__QNXNTO__)
- v4_mapped = AI_V4MAPPED,
-# else
- v4_mapped = 0,
-# endif
-# if defined(AI_ALL) && !defined(__QNXNTO__)
- all_matching = AI_ALL,
-# else
- all_matching = 0,
-# endif
-# if defined(AI_ADDRCONFIG) && !defined(__QNXNTO__)
- address_configured = AI_ADDRCONFIG
-# else
- address_configured = 0
-# endif
+ canonical_name = BOOST_ASIO_OS_DEF(AI_CANONNAME),
+ passive = BOOST_ASIO_OS_DEF(AI_PASSIVE),
+ numeric_host = BOOST_ASIO_OS_DEF(AI_NUMERICHOST),
+ numeric_service = BOOST_ASIO_OS_DEF(AI_NUMERICSERV),
+ v4_mapped = BOOST_ASIO_OS_DEF(AI_V4MAPPED),
+ all_matching = BOOST_ASIO_OS_DEF(AI_ALL),
+ address_configured = BOOST_ASIO_OS_DEF(AI_ADDRCONFIG)
   };
 
   // Implement bitmask operations as shown in C++ Std [lib.bitmask.types].

Modified: trunk/boost/asio/ip/resolver_service.hpp
==============================================================================
--- trunk/boost/asio/ip/resolver_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/resolver_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -18,11 +18,16 @@
 #include <boost/asio/detail/config.hpp>
 #include <boost/asio/async_result.hpp>
 #include <boost/system/error_code.hpp>
-#include <boost/asio/detail/resolver_service.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/ip/basic_resolver_iterator.hpp>
 #include <boost/asio/ip/basic_resolver_query.hpp>
 
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <boost/asio/detail/winrt_resolver_service.hpp>
+#else
+# include <boost/asio/detail/resolver_service.hpp>
+#endif
+
 #include <boost/asio/detail/push_options.hpp>
 
 namespace boost {
@@ -59,8 +64,13 @@
 
 private:
   // The type of the platform-specific implementation.
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ typedef boost::asio::detail::winrt_resolver_service<InternetProtocol>
+ service_impl_type;
+#else
   typedef boost::asio::detail::resolver_service<InternetProtocol>
     service_impl_type;
+#endif
 
 public:
   /// The type of a resolver implementation.

Modified: trunk/boost/asio/ip/tcp.hpp
==============================================================================
--- trunk/boost/asio/ip/tcp.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/tcp.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -52,25 +52,25 @@
   /// Construct to represent the IPv4 TCP protocol.
   static tcp v4()
   {
- return tcp(PF_INET);
+ return tcp(BOOST_ASIO_OS_DEF(AF_INET));
   }
 
   /// Construct to represent the IPv6 TCP protocol.
   static tcp v6()
   {
- return tcp(PF_INET6);
+ return tcp(BOOST_ASIO_OS_DEF(AF_INET6));
   }
 
   /// Obtain an identifier for the type of the protocol.
   int type() const
   {
- return SOCK_STREAM;
+ return BOOST_ASIO_OS_DEF(SOCK_STREAM);
   }
 
   /// Obtain an identifier for the protocol.
   int protocol() const
   {
- return IPPROTO_TCP;
+ return BOOST_ASIO_OS_DEF(IPPROTO_TCP);
   }
 
   /// Obtain an identifier for the protocol family.
@@ -123,7 +123,7 @@
   typedef implementation_defined no_delay;
 #else
   typedef boost::asio::detail::socket_option::boolean<
- IPPROTO_TCP, TCP_NODELAY> no_delay;
+ BOOST_ASIO_OS_DEF(IPPROTO_TCP), BOOST_ASIO_OS_DEF(TCP_NODELAY)> no_delay;
 #endif
 
   /// Compare two protocols for equality.

Modified: trunk/boost/asio/ip/udp.hpp
==============================================================================
--- trunk/boost/asio/ip/udp.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/udp.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -49,25 +49,25 @@
   /// Construct to represent the IPv4 UDP protocol.
   static udp v4()
   {
- return udp(PF_INET);
+ return udp(BOOST_ASIO_OS_DEF(AF_INET));
   }
 
   /// Construct to represent the IPv6 UDP protocol.
   static udp v6()
   {
- return udp(PF_INET6);
+ return udp(BOOST_ASIO_OS_DEF(AF_INET6));
   }
 
   /// Obtain an identifier for the type of the protocol.
   int type() const
   {
- return SOCK_DGRAM;
+ return BOOST_ASIO_OS_DEF(SOCK_DGRAM);
   }
 
   /// Obtain an identifier for the protocol.
   int protocol() const
   {
- return IPPROTO_UDP;
+ return BOOST_ASIO_OS_DEF(IPPROTO_UDP);
   }
 
   /// Obtain an identifier for the protocol family.

Modified: trunk/boost/asio/ip/unicast.hpp
==============================================================================
--- trunk/boost/asio/ip/unicast.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/ip/unicast.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -56,7 +56,10 @@
 typedef implementation_defined hops;
 #else
 typedef boost::asio::ip::detail::socket_option::unicast_hops<
- IPPROTO_IP, IP_TTL, IPPROTO_IPV6, IPV6_UNICAST_HOPS> hops;
+ BOOST_ASIO_OS_DEF(IPPROTO_IP),
+ BOOST_ASIO_OS_DEF(IP_TTL),
+ BOOST_ASIO_OS_DEF(IPPROTO_IPV6),
+ BOOST_ASIO_OS_DEF(IPV6_UNICAST_HOPS)> hops;
 #endif
 
 } // namespace unicast

Modified: trunk/boost/asio/raw_socket_service.hpp
==============================================================================
--- trunk/boost/asio/raw_socket_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/raw_socket_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -22,7 +22,9 @@
 #include <boost/asio/error.hpp>
 #include <boost/asio/io_service.hpp>
 
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <boost/asio/detail/null_socket_service.hpp>
+#elif defined(BOOST_ASIO_HAS_IOCP)
 # include <boost/asio/detail/win_iocp_socket_service.hpp>
 #else
 # include <boost/asio/detail/reactive_socket_service.hpp>
@@ -56,7 +58,9 @@
 
 private:
   // The type of the platform-specific implementation.
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ typedef detail::null_socket_service<Protocol> service_impl_type;
+#elif defined(BOOST_ASIO_HAS_IOCP)
   typedef detail::win_iocp_socket_service<Protocol> service_impl_type;
 #else
   typedef detail::reactive_socket_service<Protocol> service_impl_type;
@@ -138,7 +142,7 @@
   boost::system::error_code open(implementation_type& impl,
       const protocol_type& protocol, boost::system::error_code& ec)
   {
- if (protocol.type() == SOCK_RAW)
+ if (protocol.type() == BOOST_ASIO_OS_DEF(SOCK_RAW))
       service_impl_.open(impl, protocol, ec);
     else
       ec = boost::asio::error::invalid_argument;

Modified: trunk/boost/asio/seq_packet_socket_service.hpp
==============================================================================
--- trunk/boost/asio/seq_packet_socket_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/seq_packet_socket_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -22,7 +22,9 @@
 #include <boost/asio/error.hpp>
 #include <boost/asio/io_service.hpp>
 
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <boost/asio/detail/null_socket_service.hpp>
+#elif defined(BOOST_ASIO_HAS_IOCP)
 # include <boost/asio/detail/win_iocp_socket_service.hpp>
 #else
 # include <boost/asio/detail/reactive_socket_service.hpp>
@@ -57,7 +59,9 @@
 
 private:
   // The type of the platform-specific implementation.
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ typedef detail::null_socket_service<Protocol> service_impl_type;
+#elif defined(BOOST_ASIO_HAS_IOCP)
   typedef detail::win_iocp_socket_service<Protocol> service_impl_type;
 #else
   typedef detail::reactive_socket_service<Protocol> service_impl_type;
@@ -140,7 +144,7 @@
   boost::system::error_code open(implementation_type& impl,
       const protocol_type& protocol, boost::system::error_code& ec)
   {
- if (protocol.type() == SOCK_SEQPACKET)
+ if (protocol.type() == BOOST_ASIO_OS_DEF(SOCK_SEQPACKET))
       service_impl_.open(impl, protocol, ec);
     else
       ec = boost::asio::error::invalid_argument;

Modified: trunk/boost/asio/socket_acceptor_service.hpp
==============================================================================
--- trunk/boost/asio/socket_acceptor_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/socket_acceptor_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -21,7 +21,9 @@
 #include <boost/asio/error.hpp>
 #include <boost/asio/io_service.hpp>
 
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <boost/asio/detail/null_socket_service.hpp>
+#elif defined(BOOST_ASIO_HAS_IOCP)
 # include <boost/asio/detail/win_iocp_socket_service.hpp>
 #else
 # include <boost/asio/detail/reactive_socket_service.hpp>
@@ -55,7 +57,9 @@
 
 private:
   // The type of the platform-specific implementation.
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ typedef detail::null_socket_service<Protocol> service_impl_type;
+#elif defined(BOOST_ASIO_HAS_IOCP)
   typedef detail::win_iocp_socket_service<Protocol> service_impl_type;
 #else
   typedef detail::reactive_socket_service<Protocol> service_impl_type;

Modified: trunk/boost/asio/socket_base.hpp
==============================================================================
--- trunk/boost/asio/socket_base.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/socket_base.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -44,9 +44,9 @@
     /// Shutdown both send and receive on the socket.
     shutdown_both = implementation_defined
 #else
- shutdown_receive = boost::asio::detail::shutdown_receive,
- shutdown_send = boost::asio::detail::shutdown_send,
- shutdown_both = boost::asio::detail::shutdown_both
+ shutdown_receive = BOOST_ASIO_OS_DEF(SHUT_RD),
+ shutdown_send = BOOST_ASIO_OS_DEF(SHUT_WR),
+ shutdown_both = BOOST_ASIO_OS_DEF(SHUT_RDWR)
 #endif
   };
 
@@ -67,13 +67,13 @@
   static const int message_end_of_record = implementation_defined;
 #else
   BOOST_ASIO_STATIC_CONSTANT(int,
- message_peek = boost::asio::detail::message_peek);
+ message_peek = BOOST_ASIO_OS_DEF(MSG_PEEK));
   BOOST_ASIO_STATIC_CONSTANT(int,
- message_out_of_band = boost::asio::detail::message_out_of_band);
+ message_out_of_band = BOOST_ASIO_OS_DEF(MSG_OOB));
   BOOST_ASIO_STATIC_CONSTANT(int,
- message_do_not_route = boost::asio::detail::message_do_not_route);
+ message_do_not_route = BOOST_ASIO_OS_DEF(MSG_DONTROUTE));
   BOOST_ASIO_STATIC_CONSTANT(int,
- message_end_of_record = boost::asio::detail::message_end_of_record);
+ message_end_of_record = BOOST_ASIO_OS_DEF(MSG_EOR));
 #endif
 
   /// Socket option to permit sending of broadcast messages.
@@ -106,7 +106,8 @@
   typedef implementation_defined broadcast;
 #else
   typedef boost::asio::detail::socket_option::boolean<
- SOL_SOCKET, SO_BROADCAST> broadcast;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_BROADCAST)>
+ broadcast;
 #endif
 
   /// Socket option to enable socket-level debugging.
@@ -139,7 +140,7 @@
   typedef implementation_defined debug;
 #else
   typedef boost::asio::detail::socket_option::boolean<
- SOL_SOCKET, SO_DEBUG> debug;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_DEBUG)> debug;
 #endif
 
   /// Socket option to prevent routing, use local interfaces only.
@@ -172,7 +173,8 @@
   typedef implementation_defined do_not_route;
 #else
   typedef boost::asio::detail::socket_option::boolean<
- SOL_SOCKET, SO_DONTROUTE> do_not_route;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_DONTROUTE)>
+ do_not_route;
 #endif
 
   /// Socket option to send keep-alives.
@@ -205,7 +207,7 @@
   typedef implementation_defined keep_alive;
 #else
   typedef boost::asio::detail::socket_option::boolean<
- SOL_SOCKET, SO_KEEPALIVE> keep_alive;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_KEEPALIVE)> keep_alive;
 #endif
 
   /// Socket option for the send buffer size of a socket.
@@ -238,7 +240,8 @@
   typedef implementation_defined send_buffer_size;
 #else
   typedef boost::asio::detail::socket_option::integer<
- SOL_SOCKET, SO_SNDBUF> send_buffer_size;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_SNDBUF)>
+ send_buffer_size;
 #endif
 
   /// Socket option for the send low watermark.
@@ -271,7 +274,8 @@
   typedef implementation_defined send_low_watermark;
 #else
   typedef boost::asio::detail::socket_option::integer<
- SOL_SOCKET, SO_SNDLOWAT> send_low_watermark;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_SNDLOWAT)>
+ send_low_watermark;
 #endif
 
   /// Socket option for the receive buffer size of a socket.
@@ -304,7 +308,8 @@
   typedef implementation_defined receive_buffer_size;
 #else
   typedef boost::asio::detail::socket_option::integer<
- SOL_SOCKET, SO_RCVBUF> receive_buffer_size;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_RCVBUF)>
+ receive_buffer_size;
 #endif
 
   /// Socket option for the receive low watermark.
@@ -337,7 +342,8 @@
   typedef implementation_defined receive_low_watermark;
 #else
   typedef boost::asio::detail::socket_option::integer<
- SOL_SOCKET, SO_RCVLOWAT> receive_low_watermark;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_RCVLOWAT)>
+ receive_low_watermark;
 #endif
 
   /// Socket option to allow the socket to be bound to an address that is
@@ -371,7 +377,8 @@
   typedef implementation_defined reuse_address;
 #else
   typedef boost::asio::detail::socket_option::boolean<
- SOL_SOCKET, SO_REUSEADDR> reuse_address;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_REUSEADDR)>
+ reuse_address;
 #endif
 
   /// Socket option to specify whether the socket lingers on close if unsent
@@ -406,7 +413,8 @@
   typedef implementation_defined linger;
 #else
   typedef boost::asio::detail::socket_option::linger<
- SOL_SOCKET, SO_LINGER> linger;
+ BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_LINGER)>
+ linger;
 #endif
 
   /// Socket option to report aborted connections on accept.
@@ -495,7 +503,8 @@
 #if defined(GENERATING_DOCUMENTATION)
   static const int max_connections = implementation_defined;
 #else
- BOOST_ASIO_STATIC_CONSTANT(int, max_connections = SOMAXCONN);
+ BOOST_ASIO_STATIC_CONSTANT(int, max_connections
+ = BOOST_ASIO_OS_DEF(SOMAXCONN));
 #endif
 
 protected:

Modified: trunk/boost/asio/stream_socket_service.hpp
==============================================================================
--- trunk/boost/asio/stream_socket_service.hpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/boost/asio/stream_socket_service.hpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -22,7 +22,9 @@
 #include <boost/asio/error.hpp>
 #include <boost/asio/io_service.hpp>
 
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# include <boost/asio/detail/winrt_ssocket_service.hpp>
+#elif defined(BOOST_ASIO_HAS_IOCP)
 # include <boost/asio/detail/win_iocp_socket_service.hpp>
 #else
 # include <boost/asio/detail/reactive_socket_service.hpp>
@@ -56,7 +58,9 @@
 
 private:
   // The type of the platform-specific implementation.
-#if defined(BOOST_ASIO_HAS_IOCP)
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ typedef detail::winrt_ssocket_service<Protocol> service_impl_type;
+#elif defined(BOOST_ASIO_HAS_IOCP)
   typedef detail::win_iocp_socket_service<Protocol> service_impl_type;
 #else
   typedef detail::reactive_socket_service<Protocol> service_impl_type;
@@ -138,7 +142,7 @@
   boost::system::error_code open(implementation_type& impl,
       const protocol_type& protocol, boost::system::error_code& ec)
   {
- if (protocol.type() == SOCK_STREAM)
+ if (protocol.type() == BOOST_ASIO_OS_DEF(SOCK_STREAM))
       service_impl_.open(impl, protocol, ec);
     else
       ec = boost::asio::error::invalid_argument;

Modified: trunk/libs/asio/test/generic/datagram_protocol.cpp
==============================================================================
--- trunk/libs/asio/test/generic/datagram_protocol.cpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/libs/asio/test/generic/datagram_protocol.cpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -21,6 +21,10 @@
 #include <boost/asio/ip/udp.hpp>
 #include "../unit_test.hpp"
 
+#if defined(__cplusplus_cli) || defined(__cplusplus_winrt)
+# define generic cpp_generic
+#endif
+
 //------------------------------------------------------------------------------
 
 // generic_datagram_protocol_socket_compile test
@@ -49,6 +53,10 @@
   namespace generic = boost::asio::generic;
   typedef generic::datagram_protocol dp;
 
+ const int af_inet = BOOST_ASIO_OS_DEF(AF_INET);
+ const int ipproto_udp = BOOST_ASIO_OS_DEF(IPPROTO_UDP);
+ const int sock_dgram = BOOST_ASIO_OS_DEF(SOCK_DGRAM);
+
   try
   {
     io_service ios;
@@ -62,10 +70,12 @@
     // basic_datagram_socket constructors.
 
     dp::socket socket1(ios);
- dp::socket socket2(ios, dp(AF_INET, IPPROTO_UDP));
+ dp::socket socket2(ios, dp(af_inet, ipproto_udp));
     dp::socket socket3(ios, dp::endpoint());
- int native_socket1 = ::socket(AF_INET, SOCK_DGRAM, 0);
- dp::socket socket4(ios, dp(AF_INET, IPPROTO_UDP), native_socket1);
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ int native_socket1 = ::socket(af_inet, sock_dgram, 0);
+ dp::socket socket4(ios, dp(af_inet, ipproto_udp), native_socket1);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #if defined(BOOST_ASIO_HAS_MOVE)
     dp::socket socket5(std::move(socket4));
@@ -90,13 +100,15 @@
     dp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
     (void)lowest_layer;
 
- socket1.open(dp(AF_INET, IPPROTO_UDP));
- socket1.open(dp(AF_INET, IPPROTO_UDP), ec);
+ socket1.open(dp(af_inet, ipproto_udp));
+ socket1.open(dp(af_inet, ipproto_udp), ec);
 
- int native_socket2 = ::socket(AF_INET, SOCK_DGRAM, 0);
- socket1.assign(dp(AF_INET, IPPROTO_UDP), native_socket2);
- int native_socket3 = ::socket(AF_INET, SOCK_DGRAM, 0);
- socket1.assign(dp(AF_INET, IPPROTO_UDP), native_socket3, ec);
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ int native_socket2 = ::socket(af_inet, sock_dgram, 0);
+ socket1.assign(dp(af_inet, ipproto_udp), native_socket2);
+ int native_socket3 = ::socket(af_inet, sock_dgram, 0);
+ socket1.assign(dp(af_inet, ipproto_udp), native_socket3, ec);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
     bool is_open = socket1.is_open();
     (void)is_open;

Modified: trunk/libs/asio/test/generic/raw_protocol.cpp
==============================================================================
--- trunk/libs/asio/test/generic/raw_protocol.cpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/libs/asio/test/generic/raw_protocol.cpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -21,6 +21,10 @@
 #include <boost/asio/ip/icmp.hpp>
 #include "../unit_test.hpp"
 
+#if defined(__cplusplus_cli) || defined(__cplusplus_winrt)
+# define generic cpp_generic
+#endif
+
 //------------------------------------------------------------------------------
 
 // generic_raw_protocol_socket_compile test
@@ -49,6 +53,10 @@
   namespace generic = boost::asio::generic;
   typedef generic::raw_protocol rp;
 
+ const int af_inet = BOOST_ASIO_OS_DEF(AF_INET);
+ const int ipproto_icmp = BOOST_ASIO_OS_DEF(IPPROTO_ICMP);
+ const int sock_raw = BOOST_ASIO_OS_DEF(SOCK_RAW);
+
   try
   {
     io_service ios;
@@ -62,10 +70,12 @@
     // basic_raw_socket constructors.
 
     rp::socket socket1(ios);
- rp::socket socket2(ios, rp(AF_INET, IPPROTO_ICMP));
+ rp::socket socket2(ios, rp(af_inet, ipproto_icmp));
     rp::socket socket3(ios, rp::endpoint());
- int native_socket1 = ::socket(AF_INET, SOCK_DGRAM, 0);
- rp::socket socket4(ios, rp(AF_INET, IPPROTO_ICMP), native_socket1);
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ int native_socket1 = ::socket(af_inet, sock_raw, 0);
+ rp::socket socket4(ios, rp(af_inet, ipproto_icmp), native_socket1);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #if defined(BOOST_ASIO_HAS_MOVE)
     rp::socket socket5(std::move(socket4));
@@ -90,13 +100,15 @@
     rp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
     (void)lowest_layer;
 
- socket1.open(rp(AF_INET, IPPROTO_ICMP));
- socket1.open(rp(AF_INET, IPPROTO_ICMP), ec);
+ socket1.open(rp(af_inet, ipproto_icmp));
+ socket1.open(rp(af_inet, ipproto_icmp), ec);
 
- int native_socket2 = ::socket(AF_INET, SOCK_DGRAM, 0);
- socket1.assign(rp(AF_INET, IPPROTO_ICMP), native_socket2);
- int native_socket3 = ::socket(AF_INET, SOCK_DGRAM, 0);
- socket1.assign(rp(AF_INET, IPPROTO_ICMP), native_socket3, ec);
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ int native_socket2 = ::socket(af_inet, sock_raw, 0);
+ socket1.assign(rp(af_inet, ipproto_icmp), native_socket2);
+ int native_socket3 = ::socket(af_inet, sock_raw, 0);
+ socket1.assign(rp(af_inet, ipproto_icmp), native_socket3, ec);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
     bool is_open = socket1.is_open();
     (void)is_open;

Modified: trunk/libs/asio/test/generic/seq_packet_protocol.cpp
==============================================================================
--- trunk/libs/asio/test/generic/seq_packet_protocol.cpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/libs/asio/test/generic/seq_packet_protocol.cpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -20,6 +20,10 @@
 #include <boost/asio/io_service.hpp>
 #include "../unit_test.hpp"
 
+#if defined(__cplusplus_cli) || defined(__cplusplus_winrt)
+# define generic cpp_generic
+#endif
+
 //------------------------------------------------------------------------------
 
 // generic_seq_packet_protocol_socket_compile test
@@ -48,6 +52,9 @@
   namespace generic = boost::asio::generic;
   typedef generic::seq_packet_protocol spp;
 
+ const int af_inet = BOOST_ASIO_OS_DEF(AF_INET);
+ const int sock_seqpacket = BOOST_ASIO_OS_DEF(SOCK_SEQPACKET);
+
   try
   {
     io_service ios;
@@ -62,10 +69,12 @@
     // basic_seq_packet_socket constructors.
 
     spp::socket socket1(ios);
- spp::socket socket2(ios, spp(AF_INET, 0));
+ spp::socket socket2(ios, spp(af_inet, 0));
     spp::socket socket3(ios, spp::endpoint());
- int native_socket1 = ::socket(AF_INET, SOCK_SEQPACKET, 0);
- spp::socket socket4(ios, spp(AF_INET, 0), native_socket1);
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ int native_socket1 = ::socket(af_inet, sock_seqpacket, 0);
+ spp::socket socket4(ios, spp(af_inet, 0), native_socket1);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #if defined(BOOST_ASIO_HAS_MOVE)
     spp::socket socket5(std::move(socket4));
@@ -88,13 +97,15 @@
     spp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
     (void)lowest_layer;
 
- socket1.open(spp(AF_INET, 0));
- socket1.open(spp(AF_INET, 0), ec);
+ socket1.open(spp(af_inet, 0));
+ socket1.open(spp(af_inet, 0), ec);
 
- int native_socket2 = ::socket(AF_INET, SOCK_SEQPACKET, 0);
- socket1.assign(spp(AF_INET, 0), native_socket2);
- int native_socket3 = ::socket(AF_INET, SOCK_SEQPACKET, 0);
- socket1.assign(spp(AF_INET, 0), native_socket3, ec);
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ int native_socket2 = ::socket(af_inet, sock_seqpacket, 0);
+ socket1.assign(spp(af_inet, 0), native_socket2);
+ int native_socket3 = ::socket(af_inet, sock_seqpacket, 0);
+ socket1.assign(spp(af_inet, 0), native_socket3, ec);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
     bool is_open = socket1.is_open();
     (void)is_open;

Modified: trunk/libs/asio/test/generic/stream_protocol.cpp
==============================================================================
--- trunk/libs/asio/test/generic/stream_protocol.cpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/libs/asio/test/generic/stream_protocol.cpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -21,6 +21,10 @@
 #include <boost/asio/ip/tcp.hpp>
 #include "../unit_test.hpp"
 
+#if defined(__cplusplus_cli) || defined(__cplusplus_winrt)
+# define generic cpp_generic
+#endif
+
 //------------------------------------------------------------------------------
 
 // generic_stream_protocol_socket_compile test
@@ -57,6 +61,10 @@
   namespace generic = boost::asio::generic;
   typedef generic::stream_protocol sp;
 
+ const int af_inet = BOOST_ASIO_OS_DEF(AF_INET);
+ const int ipproto_tcp = BOOST_ASIO_OS_DEF(IPPROTO_TCP);
+ const int sock_stream = BOOST_ASIO_OS_DEF(SOCK_STREAM);
+
   try
   {
     io_service ios;
@@ -70,10 +78,14 @@
     // basic_stream_socket constructors.
 
     sp::socket socket1(ios);
- sp::socket socket2(ios, sp(AF_INET, IPPROTO_TCP));
+ sp::socket socket2(ios, sp(af_inet, ipproto_tcp));
     sp::socket socket3(ios, sp::endpoint());
- int native_socket1 = ::socket(AF_INET, SOCK_STREAM, 0);
- sp::socket socket4(ios, sp(AF_INET, IPPROTO_TCP), native_socket1);
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ Windows::Networking::Sockets::StreamSocket^ native_socket1 = nullptr;
+#else // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ int native_socket1 = ::socket(af_inet, sock_stream, 0);
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ sp::socket socket4(ios, sp(af_inet, ipproto_tcp), native_socket1);
 
 #if defined(BOOST_ASIO_HAS_MOVE)
     sp::socket socket5(std::move(socket4));
@@ -98,13 +110,21 @@
     sp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
     (void)lowest_layer;
 
- socket1.open(sp(AF_INET, IPPROTO_TCP));
- socket1.open(sp(AF_INET, IPPROTO_TCP), ec);
+ socket1.open(sp(af_inet, ipproto_tcp));
+ socket1.open(sp(af_inet, ipproto_tcp), ec);
 
- int native_socket2 = ::socket(AF_INET, SOCK_STREAM, 0);
- socket1.assign(sp(AF_INET, IPPROTO_TCP), native_socket2);
- int native_socket3 = ::socket(AF_INET, SOCK_STREAM, 0);
- socket1.assign(sp(AF_INET, IPPROTO_TCP), native_socket3, ec);
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ Windows::Networking::Sockets::StreamSocket^ native_socket2 = nullptr;
+#else // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ int native_socket2 = ::socket(af_inet, sock_stream, 0);
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ socket1.assign(sp(af_inet, ipproto_tcp), native_socket2);
+#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ Windows::Networking::Sockets::StreamSocket^ native_socket3 = nullptr;
+#else // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ int native_socket3 = ::socket(af_inet, sock_stream, 0);
+#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
+ socket1.assign(sp(af_inet, ipproto_tcp), native_socket3, ec);
 
     bool is_open = socket1.is_open();
     (void)is_open;

Modified: trunk/libs/asio/test/ip/icmp.cpp
==============================================================================
--- trunk/libs/asio/test/ip/icmp.cpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/libs/asio/test/ip/icmp.cpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -74,8 +74,10 @@
     ip::icmp::socket socket3(ios, ip::icmp::v6());
     ip::icmp::socket socket4(ios, ip::icmp::endpoint(ip::icmp::v4(), 0));
     ip::icmp::socket socket5(ios, ip::icmp::endpoint(ip::icmp::v6(), 0));
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
     int native_socket1 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
     ip::icmp::socket socket6(ios, ip::icmp::v4(), native_socket1);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #if defined(BOOST_ASIO_HAS_MOVE)
     ip::icmp::socket socket7(std::move(socket6));
@@ -108,10 +110,12 @@
     socket1.open(ip::icmp::v4(), ec);
     socket1.open(ip::icmp::v6(), ec);
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
     int native_socket2 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
     socket1.assign(ip::icmp::v4(), native_socket2);
     int native_socket3 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
     socket1.assign(ip::icmp::v4(), native_socket3, ec);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
     bool is_open = socket1.is_open();
     (void)is_open;

Modified: trunk/libs/asio/test/ip/tcp.cpp
==============================================================================
--- trunk/libs/asio/test/ip/tcp.cpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/libs/asio/test/ip/tcp.cpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -197,8 +197,10 @@
     ip::tcp::socket socket3(ios, ip::tcp::v6());
     ip::tcp::socket socket4(ios, ip::tcp::endpoint(ip::tcp::v4(), 0));
     ip::tcp::socket socket5(ios, ip::tcp::endpoint(ip::tcp::v6(), 0));
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
     int native_socket1 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     ip::tcp::socket socket6(ios, ip::tcp::v4(), native_socket1);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #if defined(BOOST_ASIO_HAS_MOVE)
     ip::tcp::socket socket7(std::move(socket6));
@@ -231,10 +233,12 @@
     socket1.open(ip::tcp::v4(), ec);
     socket1.open(ip::tcp::v6(), ec);
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
     int native_socket2 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     socket1.assign(ip::tcp::v4(), native_socket2);
     int native_socket3 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     socket1.assign(ip::tcp::v4(), native_socket3, ec);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
     bool is_open = socket1.is_open();
     (void)is_open;
@@ -652,8 +656,10 @@
     ip::tcp::acceptor acceptor3(ios, ip::tcp::v6());
     ip::tcp::acceptor acceptor4(ios, ip::tcp::endpoint(ip::tcp::v4(), 0));
     ip::tcp::acceptor acceptor5(ios, ip::tcp::endpoint(ip::tcp::v6(), 0));
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
     int native_acceptor1 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     ip::tcp::acceptor acceptor6(ios, ip::tcp::v4(), native_acceptor1);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #if defined(BOOST_ASIO_HAS_MOVE)
     ip::tcp::acceptor acceptor7(std::move(acceptor6));
@@ -678,10 +684,12 @@
     acceptor1.open(ip::tcp::v4(), ec);
     acceptor1.open(ip::tcp::v6(), ec);
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
     int native_acceptor2 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     acceptor1.assign(ip::tcp::v4(), native_acceptor2);
     int native_acceptor3 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     acceptor1.assign(ip::tcp::v4(), native_acceptor3, ec);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
     bool is_open = acceptor1.is_open();
     (void)is_open;

Modified: trunk/libs/asio/test/ip/udp.cpp
==============================================================================
--- trunk/libs/asio/test/ip/udp.cpp Tue Sep 17 18:14:14 2013 (r85763)
+++ trunk/libs/asio/test/ip/udp.cpp 2013-09-17 18:24:19 EDT (Tue, 17 Sep 2013) (r85764)
@@ -79,8 +79,10 @@
     ip::udp::socket socket3(ios, ip::udp::v6());
     ip::udp::socket socket4(ios, ip::udp::endpoint(ip::udp::v4(), 0));
     ip::udp::socket socket5(ios, ip::udp::endpoint(ip::udp::v6(), 0));
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
     int native_socket1 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
     ip::udp::socket socket6(ios, ip::udp::v4(), native_socket1);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
 #if defined(BOOST_ASIO_HAS_MOVE)
     ip::udp::socket socket7(std::move(socket6));
@@ -113,10 +115,12 @@
     socket1.open(ip::udp::v4(), ec);
     socket1.open(ip::udp::v6(), ec);
 
+#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
     int native_socket2 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
     socket1.assign(ip::udp::v4(), native_socket2);
     int native_socket3 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
     socket1.assign(ip::udp::v4(), native_socket3, ec);
+#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
 
     bool is_open = socket1.is_open();
     (void)is_open;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk