summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp')
-rw-r--r--3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp119
1 files changed, 91 insertions, 28 deletions
diff --git a/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp
index a773315..1be3c78 100644
--- a/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp
+++ b/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp
@@ -2,7 +2,7 @@
// basic_datagram_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -21,6 +21,7 @@
#include <boost/asio/datagram_socket_service.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/detail/push_options.hpp>
@@ -166,6 +167,50 @@ public:
BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other));
return *this;
}
+
+ /// Move-construct a basic_datagram_socket from a socket of another protocol
+ /// type.
+ /**
+ * This constructor moves a datagram socket from one object to another.
+ *
+ * @param other The other basic_datagram_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_datagram_socket(io_service&) constructor.
+ */
+ template <typename Protocol1, typename DatagramSocketService1>
+ basic_datagram_socket(
+ basic_datagram_socket<Protocol1, DatagramSocketService1>&& other,
+ typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0)
+ : basic_socket<Protocol, DatagramSocketService>(
+ BOOST_ASIO_MOVE_CAST2(basic_datagram_socket<
+ Protocol1, DatagramSocketService1>)(other))
+ {
+ }
+
+ /// Move-assign a basic_datagram_socket from a socket of another protocol
+ /// type.
+ /**
+ * This assignment operator moves a datagram socket from one object to
+ * another.
+ *
+ * @param other The other basic_datagram_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_datagram_socket(io_service&) constructor.
+ */
+ template <typename Protocol1, typename DatagramSocketService1>
+ typename enable_if<is_convertible<Protocol1, Protocol>::value,
+ basic_datagram_socket>::type& operator=(
+ basic_datagram_socket<Protocol1, DatagramSocketService1>&& other)
+ {
+ basic_socket<Protocol, DatagramSocketService>::operator=(
+ BOOST_ASIO_MOVE_CAST2(basic_datagram_socket<
+ Protocol1, DatagramSocketService1>)(other));
+ return *this;
+ }
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Send some data on a connected socket.
@@ -255,9 +300,8 @@ public:
/// Start an asynchronous send on a connected socket.
/**
- * This function is used to send data on the datagram socket. The function
- * call will block until the data has been sent successfully or an error
- * occurs.
+ * This function is used to asynchronously send data on the datagram socket.
+ * The function call always returns immediately.
*
* @param buffers One or more data buffers to be sent on the socket. Although
* the buffers object may be copied as necessary, ownership of the underlying
@@ -290,22 +334,23 @@ public:
* std::vector.
*/
template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+ async_send(const ConstBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
// If you get an error on the following line it means that your handler does
// not meet the documented type requirements for a WriteHandler.
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
- this->get_service().async_send(this->get_implementation(),
+ return this->get_service().async_send(this->get_implementation(),
buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
/// Start an asynchronous send on a connected socket.
/**
- * This function is used to send data on the datagram socket. The function
- * call will block until the data has been sent successfully or an error
- * occurs.
+ * This function is used to asynchronously send data on the datagram socket.
+ * The function call always returns immediately.
*
* @param buffers One or more data buffers to be sent on the socket. Although
* the buffers object may be copied as necessary, ownership of the underlying
@@ -331,7 +376,9 @@ public:
* socket.
*/
template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+ async_send(const ConstBufferSequence& buffers,
socket_base::message_flags flags,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
@@ -339,7 +386,7 @@ public:
// not meet the documented type requirements for a WriteHandler.
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
- this->get_service().async_send(this->get_implementation(),
+ return this->get_service().async_send(this->get_implementation(),
buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
@@ -469,7 +516,9 @@ public:
* std::vector.
*/
template <typename ConstBufferSequence, typename WriteHandler>
- void async_send_to(const ConstBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+ async_send_to(const ConstBufferSequence& buffers,
const endpoint_type& destination,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
@@ -477,8 +526,9 @@ public:
// not meet the documented type requirements for a WriteHandler.
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
- this->get_service().async_send_to(this->get_implementation(), buffers,
- destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+ return this->get_service().async_send_to(
+ this->get_implementation(), buffers, destination, 0,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
/// Start an asynchronous send.
@@ -509,7 +559,9 @@ public:
* boost::asio::io_service::post().
*/
template <typename ConstBufferSequence, typename WriteHandler>
- void async_send_to(const ConstBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+ async_send_to(const ConstBufferSequence& buffers,
const endpoint_type& destination, socket_base::message_flags flags,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
@@ -517,8 +569,9 @@ public:
// not meet the documented type requirements for a WriteHandler.
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
- this->get_service().async_send_to(this->get_implementation(), buffers,
- destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+ return this->get_service().async_send_to(
+ this->get_implementation(), buffers, destination, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
/// Receive some data on a connected socket.
@@ -647,14 +700,16 @@ public:
* std::vector.
*/
template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+ async_receive(const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
// If you get an error on the following line it means that your handler does
// not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- this->get_service().async_receive(this->get_implementation(),
+ return this->get_service().async_receive(this->get_implementation(),
buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
@@ -687,7 +742,9 @@ public:
* datagram socket.
*/
template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+ async_receive(const MutableBufferSequence& buffers,
socket_base::message_flags flags,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
@@ -695,7 +752,7 @@ public:
// not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- this->get_service().async_receive(this->get_implementation(),
+ return this->get_service().async_receive(this->get_implementation(),
buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
@@ -819,13 +876,15 @@ public:
* To receive into a single data buffer use the @ref buffer function as
* follows:
* @code socket.async_receive_from(
- * boost::asio::buffer(data, size), 0, sender_endpoint, handler); @endcode
+ * boost::asio::buffer(data, size), sender_endpoint, handler); @endcode
* See the @ref buffer documentation for information on receiving 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_receive_from(const MutableBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+ async_receive_from(const MutableBufferSequence& buffers,
endpoint_type& sender_endpoint,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
@@ -833,8 +892,9 @@ public:
// not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- this->get_service().async_receive_from(this->get_implementation(), buffers,
- sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+ return this->get_service().async_receive_from(
+ this->get_implementation(), buffers, sender_endpoint, 0,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
/// Start an asynchronous receive.
@@ -867,7 +927,9 @@ public:
* boost::asio::io_service::post().
*/
template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive_from(const MutableBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+ async_receive_from(const MutableBufferSequence& buffers,
endpoint_type& sender_endpoint, socket_base::message_flags flags,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
@@ -875,8 +937,9 @@ public:
// not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- this->get_service().async_receive_from(this->get_implementation(), buffers,
- sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+ return this->get_service().async_receive_from(
+ this->get_implementation(), buffers, sender_endpoint, flags,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
};