summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-06-01 08:48:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-06-01 09:24:28 (GMT)
commit2812bddd81f8a1b804c7460f4e14cd0aa393d129 (patch)
treed46294f35150c4f0f43deaf2d31fceaf945ae715 /3rdParty/Boost/boost/asio/windows
downloadswift-contrib-2812bddd81f8a1b804c7460f4e14cd0aa393d129.zip
swift-contrib-2812bddd81f8a1b804c7460f4e14cd0aa393d129.tar.bz2
Import.
Diffstat (limited to '3rdParty/Boost/boost/asio/windows')
-rw-r--r--3rdParty/Boost/boost/asio/windows/basic_handle.hpp227
-rw-r--r--3rdParty/Boost/boost/asio/windows/basic_random_access_handle.hpp322
-rw-r--r--3rdParty/Boost/boost/asio/windows/basic_stream_handle.hpp304
-rw-r--r--3rdParty/Boost/boost/asio/windows/overlapped_ptr.hpp120
-rw-r--r--3rdParty/Boost/boost/asio/windows/random_access_handle.hpp41
-rw-r--r--3rdParty/Boost/boost/asio/windows/random_access_handle_service.hpp181
-rw-r--r--3rdParty/Boost/boost/asio/windows/stream_handle.hpp41
-rw-r--r--3rdParty/Boost/boost/asio/windows/stream_handle_service.hpp179
8 files changed, 1415 insertions, 0 deletions
diff --git a/3rdParty/Boost/boost/asio/windows/basic_handle.hpp b/3rdParty/Boost/boost/asio/windows/basic_handle.hpp
new file mode 100644
index 0000000..96a7b90
--- /dev/null
+++ b/3rdParty/Boost/boost/asio/windows/basic_handle.hpp
@@ -0,0 +1,227 @@
+//
+// basic_handle.hpp
+// ~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 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_WINDOWS_BASIC_HANDLE_HPP
+#define BOOST_ASIO_WINDOWS_BASIC_HANDLE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/push_options.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+#include <boost/config.hpp>
+#include <boost/asio/detail/pop_options.hpp>
+
+#include <boost/asio/basic_io_object.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+
+namespace boost {
+namespace asio {
+namespace windows {
+
+/// Provides Windows handle functionality.
+/**
+ * The windows::basic_handle class template provides the ability to wrap a
+ * Windows handle.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Unsafe.
+ */
+template <typename HandleService>
+class basic_handle
+ : public basic_io_object<HandleService>
+{
+public:
+ /// The native representation of a handle.
+ typedef typename HandleService::native_type native_type;
+
+ /// A basic_handle is always the lowest layer.
+ typedef basic_handle<HandleService> lowest_layer_type;
+
+ /// Construct a basic_handle without opening it.
+ /**
+ * This constructor creates a handle without opening it.
+ *
+ * @param io_service The io_service object that the handle will use to
+ * dispatch handlers for any asynchronous operations performed on the handle.
+ */
+ explicit basic_handle(boost::asio::io_service& io_service)
+ : basic_io_object<HandleService>(io_service)
+ {
+ }
+
+ /// Construct a basic_handle on an existing native handle.
+ /**
+ * This constructor creates a handle object to hold an existing native handle.
+ *
+ * @param io_service The io_service object that the handle will use to
+ * dispatch handlers for any asynchronous operations performed on the handle.
+ *
+ * @param native_handle A native handle.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ basic_handle(boost::asio::io_service& io_service,
+ const native_type& native_handle)
+ : basic_io_object<HandleService>(io_service)
+ {
+ boost::system::error_code ec;
+ this->service.assign(this->implementation, native_handle, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Get a reference to the lowest layer.
+ /**
+ * This function returns a reference to the lowest layer in a stack of
+ * layers. Since a basic_handle cannot contain any further layers, it simply
+ * returns a reference to itself.
+ *
+ * @return A reference to the lowest layer in the stack of layers. Ownership
+ * is not transferred to the caller.
+ */
+ lowest_layer_type& lowest_layer()
+ {
+ return *this;
+ }
+
+ /// Get a const reference to the lowest layer.
+ /**
+ * This function returns a const reference to the lowest layer in a stack of
+ * layers. Since a basic_handle cannot contain any further layers, it simply
+ * returns a reference to itself.
+ *
+ * @return A const reference to the lowest layer in the stack of layers.
+ * Ownership is not transferred to the caller.
+ */
+ const lowest_layer_type& lowest_layer() const
+ {
+ return *this;
+ }
+
+ /// Assign an existing native handle to the handle.
+ /*
+ * This function opens the handle to hold an existing native handle.
+ *
+ * @param native_handle A native handle.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void assign(const native_type& native_handle)
+ {
+ boost::system::error_code ec;
+ this->service.assign(this->implementation, native_handle, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Assign an existing native handle to the handle.
+ /*
+ * This function opens the handle to hold an existing native handle.
+ *
+ * @param native_handle A native handle.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code assign(const native_type& native_handle,
+ boost::system::error_code& ec)
+ {
+ return this->service.assign(this->implementation, native_handle, ec);
+ }
+
+ /// Determine whether the handle is open.
+ bool is_open() const
+ {
+ return this->service.is_open(this->implementation);
+ }
+
+ /// Close the handle.
+ /**
+ * This function is used to close the handle. Any asynchronous read or write
+ * operations will be cancelled immediately, and will complete with the
+ * boost::asio::error::operation_aborted error.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void close()
+ {
+ boost::system::error_code ec;
+ this->service.close(this->implementation, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Close the handle.
+ /**
+ * This function is used to close the handle. Any asynchronous read or write
+ * operations will be cancelled immediately, and will complete with the
+ * boost::asio::error::operation_aborted error.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code close(boost::system::error_code& ec)
+ {
+ return this->service.close(this->implementation, ec);
+ }
+
+ /// Get the native handle representation.
+ /**
+ * This function may be used to obtain the underlying representation of the
+ * handle. This is intended to allow access to native handle functionality
+ * that is not otherwise provided.
+ */
+ native_type native()
+ {
+ return this->service.native(this->implementation);
+ }
+
+ /// Cancel all asynchronous operations associated with the handle.
+ /**
+ * This function causes all outstanding asynchronous read or write operations
+ * to finish immediately, and the handlers for cancelled operations will be
+ * passed the boost::asio::error::operation_aborted error.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void cancel()
+ {
+ boost::system::error_code ec;
+ this->service.cancel(this->implementation, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Cancel all asynchronous operations associated with the handle.
+ /**
+ * This function causes all outstanding asynchronous read or write operations
+ * to finish immediately, and the handlers for cancelled operations will be
+ * passed the boost::asio::error::operation_aborted error.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code cancel(boost::system::error_code& ec)
+ {
+ return this->service.cancel(this->implementation, ec);
+ }
+
+protected:
+ /// Protected destructor to prevent deletion through this type.
+ ~basic_handle()
+ {
+ }
+};
+
+} // namespace windows
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WINDOWS_BASIC_HANDLE_HPP
diff --git a/3rdParty/Boost/boost/asio/windows/basic_random_access_handle.hpp b/3rdParty/Boost/boost/asio/windows/basic_random_access_handle.hpp
new file mode 100644
index 0000000..d6b63b1
--- /dev/null
+++ b/3rdParty/Boost/boost/asio/windows/basic_random_access_handle.hpp
@@ -0,0 +1,322 @@
+//
+// basic_random_access_handle.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 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_WINDOWS_BASIC_RANDOM_ACCESS_HANDLE_HPP
+#define BOOST_ASIO_WINDOWS_BASIC_RANDOM_ACCESS_HANDLE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/push_options.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+#include <cstddef>
+#include <boost/config.hpp>
+#include <boost/asio/detail/pop_options.hpp>
+
+#include <boost/asio/error.hpp>
+#include <boost/asio/windows/basic_handle.hpp>
+#include <boost/asio/windows/random_access_handle_service.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+
+#if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \
+ || defined(GENERATING_DOCUMENTATION)
+
+namespace boost {
+namespace asio {
+namespace windows {
+
+/// Provides random-access handle functionality.
+/**
+ * The windows::basic_random_access_handle class template provides asynchronous
+ * and blocking random-access handle functionality.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Unsafe.
+ */
+template <typename RandomAccessHandleService = random_access_handle_service>
+class basic_random_access_handle
+ : public basic_handle<RandomAccessHandleService>
+{
+public:
+ /// The native representation of a handle.
+ typedef typename RandomAccessHandleService::native_type native_type;
+
+ /// Construct a basic_random_access_handle without opening it.
+ /**
+ * This constructor creates a random-access handle without opening it. The
+ * handle needs to be opened before data can be written to or or read from it.
+ *
+ * @param io_service The io_service object that the random-access handle will
+ * use to dispatch handlers for any asynchronous operations performed on the
+ * handle.
+ */
+ explicit basic_random_access_handle(boost::asio::io_service& io_service)
+ : basic_handle<RandomAccessHandleService>(io_service)
+ {
+ }
+
+ /// Construct a basic_random_access_handle on an existing native handle.
+ /**
+ * This constructor creates a random-access handle object to hold an existing
+ * native handle.
+ *
+ * @param io_service The io_service object that the random-access handle will
+ * use to dispatch handlers for any asynchronous operations performed on the
+ * handle.
+ *
+ * @param native_handle The new underlying handle implementation.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ basic_random_access_handle(boost::asio::io_service& io_service,
+ const native_type& native_handle)
+ : basic_handle<RandomAccessHandleService>(io_service, native_handle)
+ {
+ }
+
+ /// Write some data to the handle at the specified offset.
+ /**
+ * This function is used to write data to the random-access handle. The
+ * function call will block until one or more bytes of the data has been
+ * written successfully, or until an error occurs.
+ *
+ * @param offset The offset at which the data will be written.
+ *
+ * @param buffers One or more data buffers to be written to the handle.
+ *
+ * @returns The number of bytes written.
+ *
+ * @throws boost::system::system_error Thrown on failure. An error code of
+ * boost::asio::error::eof indicates that the connection was closed by the
+ * peer.
+ *
+ * @note The write_some_at operation may not write all of the data. Consider
+ * using the @ref write_at function if you need to ensure that all data is
+ * written before the blocking operation completes.
+ *
+ * @par Example
+ * To write a single data buffer use the @ref buffer function as follows:
+ * @code
+ * handle.write_some_at(42, boost::asio::buffer(data, size));
+ * @endcode
+ * See the @ref buffer documentation for information on writing multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t write_some_at(boost::uint64_t offset,
+ const ConstBufferSequence& buffers)
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->service.write_some_at(
+ this->implementation, offset, buffers, ec);
+ boost::asio::detail::throw_error(ec);
+ return s;
+ }
+
+ /// Write some data to the handle at the specified offset.
+ /**
+ * This function is used to write data to the random-access handle. The
+ * function call will block until one or more bytes of the data has been
+ * written successfully, or until an error occurs.
+ *
+ * @param offset The offset at which the data will be written.
+ *
+ * @param buffers One or more data buffers to be written to the handle.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes written. Returns 0 if an error occurred.
+ *
+ * @note The write_some operation may not transmit all of the data to the
+ * peer. Consider using the @ref write_at function if you need to ensure that
+ * all data is written before the blocking operation completes.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t write_some_at(boost::uint64_t offset,
+ const ConstBufferSequence& buffers, boost::system::error_code& ec)
+ {
+ return this->service.write_some_at(
+ this->implementation, offset, buffers, ec);
+ }
+
+ /// Start an asynchronous write at the specified offset.
+ /**
+ * This function is used to asynchronously write data to the random-access
+ * handle. The function call always returns immediately.
+ *
+ * @param offset The offset at which the data will be written.
+ *
+ * @param buffers One or more data buffers to be written to the handle.
+ * Although the buffers object may be copied as necessary, ownership of the
+ * underlying memory blocks is retained by the caller, which must guarantee
+ * that they remain valid until the handler is called.
+ *
+ * @param handler The handler to be called when the write operation completes.
+ * Copies will be made of the handler as required. The function signature of
+ * the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes written.
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @note The write operation may not transmit all of the data to the peer.
+ * Consider using the @ref async_write_at function if you need to ensure that
+ * all data is written before the asynchronous operation completes.
+ *
+ * @par Example
+ * To write a single data buffer use the @ref buffer function as follows:
+ * @code
+ * handle.async_write_some_at(42, boost::asio::buffer(data, size), handler);
+ * @endcode
+ * See the @ref buffer documentation for information on writing multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename ConstBufferSequence, typename WriteHandler>
+ void async_write_some_at(boost::uint64_t offset,
+ const ConstBufferSequence& buffers, WriteHandler handler)
+ {
+ this->service.async_write_some_at(
+ this->implementation, offset, buffers, handler);
+ }
+
+ /// Read some data from the handle at the specified offset.
+ /**
+ * This function is used to read data from the random-access handle. The
+ * function call will block until one or more bytes of data has been read
+ * successfully, or until an error occurs.
+ *
+ * @param offset The offset at which the data will be read.
+ *
+ * @param buffers One or more buffers into which the data will be read.
+ *
+ * @returns The number of bytes read.
+ *
+ * @throws boost::system::system_error Thrown on failure. An error code of
+ * boost::asio::error::eof indicates that the connection was closed by the
+ * peer.
+ *
+ * @note The read_some operation may not read all of the requested number of
+ * bytes. Consider using the @ref read_at function if you need to ensure that
+ * the requested amount of data is read before the blocking operation
+ * completes.
+ *
+ * @par Example
+ * To read into a single data buffer use the @ref buffer function as follows:
+ * @code
+ * handle.read_some_at(42, boost::asio::buffer(data, size));
+ * @endcode
+ * See the @ref buffer documentation for information on reading into multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t read_some_at(boost::uint64_t offset,
+ const MutableBufferSequence& buffers)
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->service.read_some_at(
+ this->implementation, offset, buffers, ec);
+ boost::asio::detail::throw_error(ec);
+ return s;
+ }
+
+ /// Read some data from the handle at the specified offset.
+ /**
+ * This function is used to read data from the random-access handle. The
+ * function call will block until one or more bytes of data has been read
+ * successfully, or until an error occurs.
+ *
+ * @param offset The offset at which the data will be read.
+ *
+ * @param buffers One or more buffers into which the data will be read.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes read. Returns 0 if an error occurred.
+ *
+ * @note The read_some operation may not read all of the requested number of
+ * bytes. Consider using the @ref read_at function if you need to ensure that
+ * the requested amount of data is read before the blocking operation
+ * completes.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t read_some_at(boost::uint64_t offset,
+ const MutableBufferSequence& buffers, boost::system::error_code& ec)
+ {
+ return this->service.read_some_at(
+ this->implementation, offset, buffers, ec);
+ }
+
+ /// Start an asynchronous read at the specified offset.
+ /**
+ * This function is used to asynchronously read data from the random-access
+ * handle. The function call always returns immediately.
+ *
+ * @param offset The offset at which the data will be read.
+ *
+ * @param buffers One or more buffers into which the data will be read.
+ * Although the buffers object may be copied as necessary, ownership of the
+ * underlying memory blocks is retained by the caller, which must guarantee
+ * that they remain valid until the handler is called.
+ *
+ * @param handler The handler to be called when the read operation completes.
+ * Copies will be made of the handler as required. The function signature of
+ * the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes read.
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @note The read operation may not read all of the requested number of bytes.
+ * Consider using the @ref async_read_at function if you need to ensure that
+ * the requested amount of data is read before the asynchronous operation
+ * completes.
+ *
+ * @par Example
+ * To read into a single data buffer use the @ref buffer function as follows:
+ * @code
+ * handle.async_read_some_at(42, boost::asio::buffer(data, size), handler);
+ * @endcode
+ * See the @ref buffer documentation for information on reading into multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence, typename ReadHandler>
+ void async_read_some_at(boost::uint64_t offset,
+ const MutableBufferSequence& buffers, ReadHandler handler)
+ {
+ this->service.async_read_some_at(
+ this->implementation, offset, buffers, handler);
+ }
+};
+
+} // namespace windows
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WINDOWS_BASIC_RANDOM_ACCESS_HANDLE_HPP
diff --git a/3rdParty/Boost/boost/asio/windows/basic_stream_handle.hpp b/3rdParty/Boost/boost/asio/windows/basic_stream_handle.hpp
new file mode 100644
index 0000000..aaa8448
--- /dev/null
+++ b/3rdParty/Boost/boost/asio/windows/basic_stream_handle.hpp
@@ -0,0 +1,304 @@
+//
+// basic_stream_handle.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 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_WINDOWS_BASIC_STREAM_HANDLE_HPP
+#define BOOST_ASIO_WINDOWS_BASIC_STREAM_HANDLE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/push_options.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+#include <cstddef>
+#include <boost/config.hpp>
+#include <boost/asio/detail/pop_options.hpp>
+
+#include <boost/asio/error.hpp>
+#include <boost/asio/windows/basic_handle.hpp>
+#include <boost/asio/windows/stream_handle_service.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+
+#if defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \
+ || defined(GENERATING_DOCUMENTATION)
+
+namespace boost {
+namespace asio {
+namespace windows {
+
+/// Provides stream-oriented handle functionality.
+/**
+ * The windows::basic_stream_handle class template provides asynchronous and
+ * blocking stream-oriented handle functionality.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Unsafe.
+ *
+ * @par Concepts:
+ * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream.
+ */
+template <typename StreamHandleService = stream_handle_service>
+class basic_stream_handle
+ : public basic_handle<StreamHandleService>
+{
+public:
+ /// The native representation of a handle.
+ typedef typename StreamHandleService::native_type native_type;
+
+ /// Construct a basic_stream_handle without opening it.
+ /**
+ * This constructor creates a stream handle without opening it. The handle
+ * needs to be opened and then connected or accepted before data can be sent
+ * or received on it.
+ *
+ * @param io_service The io_service object that the stream handle will use to
+ * dispatch handlers for any asynchronous operations performed on the handle.
+ */
+ explicit basic_stream_handle(boost::asio::io_service& io_service)
+ : basic_handle<StreamHandleService>(io_service)
+ {
+ }
+
+ /// Construct a basic_stream_handle on an existing native handle.
+ /**
+ * This constructor creates a stream handle object to hold an existing native
+ * handle.
+ *
+ * @param io_service The io_service object that the stream handle will use to
+ * dispatch handlers for any asynchronous operations performed on the handle.
+ *
+ * @param native_handle The new underlying handle implementation.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ basic_stream_handle(boost::asio::io_service& io_service,
+ const native_type& native_handle)
+ : basic_handle<StreamHandleService>(io_service, native_handle)
+ {
+ }
+
+ /// Write some data to the handle.
+ /**
+ * This function is used to write data to the stream handle. The function call
+ * will block until one or more bytes of the data has been written
+ * successfully, or until an error occurs.
+ *
+ * @param buffers One or more data buffers to be written to the handle.
+ *
+ * @returns The number of bytes written.
+ *
+ * @throws boost::system::system_error Thrown on failure. An error code of
+ * boost::asio::error::eof indicates that the connection was closed by the
+ * peer.
+ *
+ * @note The write_some operation may not transmit all of the data to the
+ * peer. Consider using the @ref write function if you need to ensure that
+ * all data is written before the blocking operation completes.
+ *
+ * @par Example
+ * To write a single data buffer use the @ref buffer function as follows:
+ * @code
+ * handle.write_some(boost::asio::buffer(data, size));
+ * @endcode
+ * See the @ref buffer documentation for information on writing multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t write_some(const ConstBufferSequence& buffers)
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->service.write_some(this->implementation, buffers, ec);
+ boost::asio::detail::throw_error(ec);
+ return s;
+ }
+
+ /// Write some data to the handle.
+ /**
+ * This function is used to write data to the stream handle. The function call
+ * will block until one or more bytes of the data has been written
+ * successfully, or until an error occurs.
+ *
+ * @param buffers One or more data buffers to be written to the handle.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes written. Returns 0 if an error occurred.
+ *
+ * @note The write_some operation may not transmit all of the data to the
+ * peer. Consider using the @ref write function if you need to ensure that
+ * all data is written before the blocking operation completes.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t write_some(const ConstBufferSequence& buffers,
+ boost::system::error_code& ec)
+ {
+ return this->service.write_some(this->implementation, buffers, ec);
+ }
+
+ /// Start an asynchronous write.
+ /**
+ * This function is used to asynchronously write data to the stream handle.
+ * The function call always returns immediately.
+ *
+ * @param buffers One or more data buffers to be written to the handle.
+ * Although the buffers object may be copied as necessary, ownership of the
+ * underlying memory blocks is retained by the caller, which must guarantee
+ * that they remain valid until the handler is called.
+ *
+ * @param handler The handler to be called when the write operation completes.
+ * Copies will be made of the handler as required. The function signature of
+ * the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes written.
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @note The write operation may not transmit all of the data to the peer.
+ * Consider using the @ref async_write function if you need to ensure that all
+ * data is written before the asynchronous operation completes.
+ *
+ * @par Example
+ * To write a single data buffer use the @ref buffer function as follows:
+ * @code
+ * handle.async_write_some(boost::asio::buffer(data, size), handler);
+ * @endcode
+ * See the @ref buffer documentation for information on writing multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename ConstBufferSequence, typename WriteHandler>
+ void async_write_some(const ConstBufferSequence& buffers,
+ WriteHandler handler)
+ {
+ this->service.async_write_some(this->implementation, buffers, handler);
+ }
+
+ /// Read some data from the handle.
+ /**
+ * This function is used to read data from the stream handle. The function
+ * call will block until one or more bytes of data has been read successfully,
+ * or until an error occurs.
+ *
+ * @param buffers One or more buffers into which the data will be read.
+ *
+ * @returns The number of bytes read.
+ *
+ * @throws boost::system::system_error Thrown on failure. An error code of
+ * boost::asio::error::eof indicates that the connection was closed by the
+ * peer.
+ *
+ * @note The read_some operation may not read all of the requested number of
+ * bytes. Consider using the @ref read function if you need to ensure that
+ * the requested amount of data is read before the blocking operation
+ * completes.
+ *
+ * @par Example
+ * To read into a single data buffer use the @ref buffer function as follows:
+ * @code
+ * handle.read_some(boost::asio::buffer(data, size));
+ * @endcode
+ * See the @ref buffer documentation for information on reading into multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t read_some(const MutableBufferSequence& buffers)
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->service.read_some(this->implementation, buffers, ec);
+ boost::asio::detail::throw_error(ec);
+ return s;
+ }
+
+ /// Read some data from the handle.
+ /**
+ * This function is used to read data from the stream handle. The function
+ * call will block until one or more bytes of data has been read successfully,
+ * or until an error occurs.
+ *
+ * @param buffers One or more buffers into which the data will be read.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes read. Returns 0 if an error occurred.
+ *
+ * @note The read_some operation may not read all of the requested number of
+ * bytes. Consider using the @ref read function if you need to ensure that
+ * the requested amount of data is read before the blocking operation
+ * completes.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t read_some(const MutableBufferSequence& buffers,
+ boost::system::error_code& ec)
+ {
+ return this->service.read_some(this->implementation, buffers, ec);
+ }
+
+ /// Start an asynchronous read.
+ /**
+ * This function is used to asynchronously read data from the stream handle.
+ * The function call always returns immediately.
+ *
+ * @param buffers One or more buffers into which the data will be read.
+ * Although the buffers object may be copied as necessary, ownership of the
+ * underlying memory blocks is retained by the caller, which must guarantee
+ * that they remain valid until the handler is called.
+ *
+ * @param handler The handler to be called when the read operation completes.
+ * Copies will be made of the handler as required. The function signature of
+ * the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes read.
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @note The read operation may not read all of the requested number of bytes.
+ * Consider using the @ref async_read function if you need to ensure that the
+ * requested amount of data is read before the asynchronous operation
+ * completes.
+ *
+ * @par Example
+ * To read into a single data buffer use the @ref buffer function as follows:
+ * @code
+ * handle.async_read_some(boost::asio::buffer(data, size), handler);
+ * @endcode
+ * See the @ref buffer documentation for information on reading into multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence, typename ReadHandler>
+ void async_read_some(const MutableBufferSequence& buffers,
+ ReadHandler handler)
+ {
+ this->service.async_read_some(this->implementation, buffers, handler);
+ }
+};
+
+} // namespace windows
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WINDOWS_BASIC_STREAM_HANDLE_HPP
diff --git a/3rdParty/Boost/boost/asio/windows/overlapped_ptr.hpp b/3rdParty/Boost/boost/asio/windows/overlapped_ptr.hpp
new file mode 100644
index 0000000..e97c16e
--- /dev/null
+++ b/3rdParty/Boost/boost/asio/windows/overlapped_ptr.hpp
@@ -0,0 +1,120 @@
+//
+// overlapped_ptr.hpp
+// ~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 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_WINDOWS_OVERLAPPED_PTR_HPP
+#define BOOST_ASIO_WINDOWS_OVERLAPPED_PTR_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/push_options.hpp>
+
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/detail/noncopyable.hpp>
+#include <boost/asio/detail/win_iocp_overlapped_ptr.hpp>
+
+#if !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
+# if defined(BOOST_ASIO_HAS_IOCP)
+# define BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
+# endif // defined(BOOST_ASIO_HAS_IOCP)
+#endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
+
+#if defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR) \
+ || defined(GENERATING_DOCUMENTATION)
+
+namespace boost {
+namespace asio {
+namespace windows {
+
+/// Wraps a handler to create an OVERLAPPED object for use with overlapped I/O.
+/**
+ * A special-purpose smart pointer used to wrap an application handler so that
+ * it can be passed as the LPOVERLAPPED argument to overlapped I/O functions.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Unsafe.
+ */
+class overlapped_ptr
+ : private noncopyable
+{
+public:
+ /// Construct an empty overlapped_ptr.
+ overlapped_ptr()
+ : impl_()
+ {
+ }
+
+ /// Construct an overlapped_ptr to contain the specified handler.
+ template <typename Handler>
+ explicit overlapped_ptr(boost::asio::io_service& io_service, Handler handler)
+ : impl_(io_service, handler)
+ {
+ }
+
+ /// Destructor automatically frees the OVERLAPPED object unless released.
+ ~overlapped_ptr()
+ {
+ }
+
+ /// Reset to empty.
+ void reset()
+ {
+ impl_.reset();
+ }
+
+ /// Reset to contain the specified handler, freeing any current OVERLAPPED
+ /// object.
+ template <typename Handler>
+ void reset(boost::asio::io_service& io_service, Handler handler)
+ {
+ impl_.reset(io_service, handler);
+ }
+
+ /// Get the contained OVERLAPPED object.
+ OVERLAPPED* get()
+ {
+ return impl_.get();
+ }
+
+ /// Get the contained OVERLAPPED object.
+ const OVERLAPPED* get() const
+ {
+ return impl_.get();
+ }
+
+ /// Release ownership of the OVERLAPPED object.
+ OVERLAPPED* release()
+ {
+ return impl_.release();
+ }
+
+ /// Post completion notification for overlapped operation. Releases ownership.
+ void complete(const boost::system::error_code& ec,
+ std::size_t bytes_transferred)
+ {
+ impl_.complete(ec, bytes_transferred);
+ }
+
+private:
+ detail::win_iocp_overlapped_ptr impl_;
+};
+
+} // namespace windows
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WINDOWS_OVERLAPPED_PTR_HPP
diff --git a/3rdParty/Boost/boost/asio/windows/random_access_handle.hpp b/3rdParty/Boost/boost/asio/windows/random_access_handle.hpp
new file mode 100644
index 0000000..38e79e9
--- /dev/null
+++ b/3rdParty/Boost/boost/asio/windows/random_access_handle.hpp
@@ -0,0 +1,41 @@
+//
+// random_access_handle.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 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_WINDOWS_RANDOM_ACCESS_HANDLE_HPP
+#define BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/push_options.hpp>
+
+#include <boost/asio/windows/basic_random_access_handle.hpp>
+
+#if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \
+ || defined(GENERATING_DOCUMENTATION)
+
+namespace boost {
+namespace asio {
+namespace windows {
+
+/// Typedef for the typical usage of a random-access handle.
+typedef basic_random_access_handle<> random_access_handle;
+
+} // namespace windows
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_HPP
diff --git a/3rdParty/Boost/boost/asio/windows/random_access_handle_service.hpp b/3rdParty/Boost/boost/asio/windows/random_access_handle_service.hpp
new file mode 100644
index 0000000..3b11223
--- /dev/null
+++ b/3rdParty/Boost/boost/asio/windows/random_access_handle_service.hpp
@@ -0,0 +1,181 @@
+//
+// random_access_handle_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 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_WINDOWS_RANDOM_ACCESS_HANDLE_SERVICE_HPP
+#define BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/push_options.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+#include <cstddef>
+#include <boost/config.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/asio/detail/pop_options.hpp>
+
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/detail/service_base.hpp>
+#include <boost/asio/detail/win_iocp_handle_service.hpp>
+
+#if !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
+# if defined(BOOST_ASIO_HAS_IOCP)
+# define BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
+# endif // defined(BOOST_ASIO_HAS_IOCP)
+#endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
+
+#if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \
+ || defined(GENERATING_DOCUMENTATION)
+
+namespace boost {
+namespace asio {
+namespace windows {
+
+/// Default service implementation for a random-access handle.
+class random_access_handle_service
+#if defined(GENERATING_DOCUMENTATION)
+ : public boost::asio::io_service::service
+#else
+ : public boost::asio::detail::service_base<random_access_handle_service>
+#endif
+{
+public:
+#if defined(GENERATING_DOCUMENTATION)
+ /// The unique service identifier.
+ static boost::asio::io_service::id id;
+#endif
+
+private:
+ // The type of the platform-specific implementation.
+ typedef detail::win_iocp_handle_service service_impl_type;
+
+public:
+ /// The type of a random-access handle implementation.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined implementation_type;
+#else
+ typedef service_impl_type::implementation_type implementation_type;
+#endif
+
+ /// The native handle type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_type;
+#else
+ typedef service_impl_type::native_type native_type;
+#endif
+
+ /// Construct a new random-access handle service for the specified io_service.
+ explicit random_access_handle_service(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<
+ random_access_handle_service>(io_service),
+ service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+ {
+ }
+
+ /// Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ }
+
+ /// Construct a new random-access handle implementation.
+ void construct(implementation_type& impl)
+ {
+ service_impl_.construct(impl);
+ }
+
+ /// Destroy a random-access handle implementation.
+ void destroy(implementation_type& impl)
+ {
+ service_impl_.destroy(impl);
+ }
+
+ /// Assign an existing native handle to a random-access handle.
+ boost::system::error_code assign(implementation_type& impl,
+ const native_type& native_handle, boost::system::error_code& ec)
+ {
+ return service_impl_.assign(impl, native_handle, ec);
+ }
+
+ /// Determine whether the handle is open.
+ bool is_open(const implementation_type& impl) const
+ {
+ return service_impl_.is_open(impl);
+ }
+
+ /// Close a random-access handle implementation.
+ boost::system::error_code close(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.close(impl, ec);
+ }
+
+ /// Get the native handle implementation.
+ native_type native(implementation_type& impl)
+ {
+ return service_impl_.native(impl);
+ }
+
+ /// Cancel all asynchronous operations associated with the handle.
+ boost::system::error_code cancel(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.cancel(impl, ec);
+ }
+
+ /// Write the given data at the specified offset.
+ template <typename ConstBufferSequence>
+ std::size_t write_some_at(implementation_type& impl, boost::uint64_t offset,
+ const ConstBufferSequence& buffers, boost::system::error_code& ec)
+ {
+ return service_impl_.write_some_at(impl, offset, buffers, ec);
+ }
+
+ /// Start an asynchronous write at the specified offset.
+ template <typename ConstBufferSequence, typename WriteHandler>
+ void async_write_some_at(implementation_type& impl, boost::uint64_t offset,
+ const ConstBufferSequence& buffers, WriteHandler handler)
+ {
+ service_impl_.async_write_some_at(impl, offset, buffers, handler);
+ }
+
+ /// Read some data from the specified offset.
+ template <typename MutableBufferSequence>
+ std::size_t read_some_at(implementation_type& impl, boost::uint64_t offset,
+ const MutableBufferSequence& buffers, boost::system::error_code& ec)
+ {
+ return service_impl_.read_some_at(impl, offset, buffers, ec);
+ }
+
+ /// Start an asynchronous read at the specified offset.
+ template <typename MutableBufferSequence, typename ReadHandler>
+ void async_read_some_at(implementation_type& impl, boost::uint64_t offset,
+ const MutableBufferSequence& buffers, ReadHandler handler)
+ {
+ service_impl_.async_read_some_at(impl, offset, buffers, handler);
+ }
+
+private:
+ // The service that provides the platform-specific implementation.
+ service_impl_type& service_impl_;
+};
+
+} // namespace windows
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_SERVICE_HPP
diff --git a/3rdParty/Boost/boost/asio/windows/stream_handle.hpp b/3rdParty/Boost/boost/asio/windows/stream_handle.hpp
new file mode 100644
index 0000000..b247197
--- /dev/null
+++ b/3rdParty/Boost/boost/asio/windows/stream_handle.hpp
@@ -0,0 +1,41 @@
+//
+// stream_handle.hpp
+// ~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 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_WINDOWS_STREAM_HANDLE_HPP
+#define BOOST_ASIO_WINDOWS_STREAM_HANDLE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/push_options.hpp>
+
+#include <boost/asio/windows/basic_stream_handle.hpp>
+
+#if defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \
+ || defined(GENERATING_DOCUMENTATION)
+
+namespace boost {
+namespace asio {
+namespace windows {
+
+/// Typedef for the typical usage of a stream-oriented handle.
+typedef basic_stream_handle<> stream_handle;
+
+} // namespace windows
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WINDOWS_STREAM_HANDLE_HPP
diff --git a/3rdParty/Boost/boost/asio/windows/stream_handle_service.hpp b/3rdParty/Boost/boost/asio/windows/stream_handle_service.hpp
new file mode 100644
index 0000000..29cdc95
--- /dev/null
+++ b/3rdParty/Boost/boost/asio/windows/stream_handle_service.hpp
@@ -0,0 +1,179 @@
+//
+// stream_handle_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 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_WINDOWS_STREAM_HANDLE_SERVICE_HPP
+#define BOOST_ASIO_WINDOWS_STREAM_HANDLE_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/push_options.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+#include <cstddef>
+#include <boost/config.hpp>
+#include <boost/asio/detail/pop_options.hpp>
+
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/detail/service_base.hpp>
+#include <boost/asio/detail/win_iocp_handle_service.hpp>
+
+#if !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
+# if defined(BOOST_ASIO_HAS_IOCP)
+# define BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE 1
+# endif // defined(BOOST_ASIO_HAS_IOCP)
+#endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
+
+#if defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \
+ || defined(GENERATING_DOCUMENTATION)
+
+namespace boost {
+namespace asio {
+namespace windows {
+
+/// Default service implementation for a stream handle.
+class stream_handle_service
+#if defined(GENERATING_DOCUMENTATION)
+ : public boost::asio::io_service::service
+#else
+ : public boost::asio::detail::service_base<stream_handle_service>
+#endif
+{
+public:
+#if defined(GENERATING_DOCUMENTATION)
+ /// The unique service identifier.
+ static boost::asio::io_service::id id;
+#endif
+
+private:
+ // The type of the platform-specific implementation.
+ typedef detail::win_iocp_handle_service service_impl_type;
+
+public:
+ /// The type of a stream handle implementation.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined implementation_type;
+#else
+ typedef service_impl_type::implementation_type implementation_type;
+#endif
+
+ /// The native handle type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_type;
+#else
+ typedef service_impl_type::native_type native_type;
+#endif
+
+ /// Construct a new stream handle service for the specified io_service.
+ explicit stream_handle_service(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<stream_handle_service>(io_service),
+ service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+ {
+ }
+
+ /// Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ }
+
+ /// Construct a new stream handle implementation.
+ void construct(implementation_type& impl)
+ {
+ service_impl_.construct(impl);
+ }
+
+ /// Destroy a stream handle implementation.
+ void destroy(implementation_type& impl)
+ {
+ service_impl_.destroy(impl);
+ }
+
+ /// Assign an existing native handle to a stream handle.
+ boost::system::error_code assign(implementation_type& impl,
+ const native_type& native_handle, boost::system::error_code& ec)
+ {
+ return service_impl_.assign(impl, native_handle, ec);
+ }
+
+ /// Determine whether the handle is open.
+ bool is_open(const implementation_type& impl) const
+ {
+ return service_impl_.is_open(impl);
+ }
+
+ /// Close a stream handle implementation.
+ boost::system::error_code close(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.close(impl, ec);
+ }
+
+ /// Get the native handle implementation.
+ native_type native(implementation_type& impl)
+ {
+ return service_impl_.native(impl);
+ }
+
+ /// Cancel all asynchronous operations associated with the handle.
+ boost::system::error_code cancel(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.cancel(impl, ec);
+ }
+
+ /// Write the given data to the stream.
+ template <typename ConstBufferSequence>
+ std::size_t write_some(implementation_type& impl,
+ const ConstBufferSequence& buffers, boost::system::error_code& ec)
+ {
+ return service_impl_.write_some(impl, buffers, ec);
+ }
+
+ /// Start an asynchronous write.
+ template <typename ConstBufferSequence, typename WriteHandler>
+ void async_write_some(implementation_type& impl,
+ const ConstBufferSequence& buffers, WriteHandler handler)
+ {
+ service_impl_.async_write_some(impl, buffers, handler);
+ }
+
+ /// Read some data from the stream.
+ template <typename MutableBufferSequence>
+ std::size_t read_some(implementation_type& impl,
+ const MutableBufferSequence& buffers, boost::system::error_code& ec)
+ {
+ return service_impl_.read_some(impl, buffers, ec);
+ }
+
+ /// Start an asynchronous read.
+ template <typename MutableBufferSequence, typename ReadHandler>
+ void async_read_some(implementation_type& impl,
+ const MutableBufferSequence& buffers, ReadHandler handler)
+ {
+ service_impl_.async_read_some(impl, buffers, handler);
+ }
+
+private:
+ // The service that provides the platform-specific implementation.
+ service_impl_type& service_impl_;
+};
+
+} // namespace windows
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WINDOWS_STREAM_HANDLE_SERVICE_HPP