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.hpp188
1 files changed, 137 insertions, 51 deletions
diff --git a/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp
index a79967f..a773315 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-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2012 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)
@@ -19,6 +19,7 @@
#include <cstddef>
#include <boost/asio/basic_socket.hpp>
#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/error.hpp>
@@ -42,8 +43,12 @@ class basic_datagram_socket
: public basic_socket<Protocol, DatagramSocketService>
{
public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// socket.
+ typedef typename DatagramSocketService::native_handle_type native_type;
+
/// The native representation of a socket.
- typedef typename DatagramSocketService::native_type native_type;
+ typedef typename DatagramSocketService::native_handle_type native_handle_type;
/// The protocol type.
typedef Protocol protocol_type;
@@ -121,12 +126,48 @@ public:
* @throws boost::system::system_error Thrown on failure.
*/
basic_datagram_socket(boost::asio::io_service& io_service,
- const protocol_type& protocol, const native_type& native_socket)
+ const protocol_type& protocol, const native_handle_type& native_socket)
: basic_socket<Protocol, DatagramSocketService>(
io_service, protocol, native_socket)
{
}
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_datagram_socket from another.
+ /**
+ * 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.
+ */
+ basic_datagram_socket(basic_datagram_socket&& other)
+ : basic_socket<Protocol, DatagramSocketService>(
+ BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other))
+ {
+ }
+
+ /// Move-assign a basic_datagram_socket from another.
+ /**
+ * 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.
+ */
+ basic_datagram_socket& operator=(basic_datagram_socket&& other)
+ {
+ basic_socket<Protocol, DatagramSocketService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
/// Send some data on a connected socket.
/**
* This function is used to send data on the datagram socket. The function
@@ -153,8 +194,9 @@ public:
std::size_t send(const ConstBufferSequence& buffers)
{
boost::system::error_code ec;
- std::size_t s = this->service.send(this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "send");
return s;
}
@@ -180,9 +222,9 @@ public:
socket_base::message_flags flags)
{
boost::system::error_code ec;
- std::size_t s = this->service.send(
- this->implementation, buffers, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
+ boost::asio::detail::throw_error(ec, "send");
return s;
}
@@ -207,7 +249,8 @@ public:
std::size_t send(const ConstBufferSequence& buffers,
socket_base::message_flags flags, boost::system::error_code& ec)
{
- return this->service.send(this->implementation, buffers, flags, ec);
+ return this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
}
/// Start an asynchronous send on a connected socket.
@@ -247,9 +290,15 @@ public:
* std::vector.
*/
template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
+ void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
- this->service.async_send(this->implementation, buffers, 0, 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(),
+ buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
/// Start an asynchronous send on a connected socket.
@@ -283,9 +332,15 @@ public:
*/
template <typename ConstBufferSequence, typename WriteHandler>
void async_send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
- this->service.async_send(this->implementation, buffers, flags, 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(),
+ buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
/// Send a datagram to the specified endpoint.
@@ -318,9 +373,9 @@ public:
const endpoint_type& destination)
{
boost::system::error_code ec;
- std::size_t s = this->service.send_to(
- this->implementation, buffers, destination, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send_to(
+ this->get_implementation(), buffers, destination, 0, ec);
+ boost::asio::detail::throw_error(ec, "send_to");
return s;
}
@@ -345,9 +400,9 @@ public:
const endpoint_type& destination, socket_base::message_flags flags)
{
boost::system::error_code ec;
- std::size_t s = this->service.send_to(
- this->implementation, buffers, destination, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send_to(
+ this->get_implementation(), buffers, destination, flags, ec);
+ boost::asio::detail::throw_error(ec, "send_to");
return s;
}
@@ -372,7 +427,7 @@ public:
const endpoint_type& destination, socket_base::message_flags flags,
boost::system::error_code& ec)
{
- return this->service.send_to(this->implementation,
+ return this->get_service().send_to(this->get_implementation(),
buffers, destination, flags, ec);
}
@@ -415,10 +470,15 @@ public:
*/
template <typename ConstBufferSequence, typename WriteHandler>
void async_send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination, WriteHandler handler)
+ const endpoint_type& destination,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
- this->service.async_send_to(this->implementation, buffers, destination, 0,
- 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_to(this->get_implementation(), buffers,
+ destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
/// Start an asynchronous send.
@@ -451,10 +511,14 @@ public:
template <typename ConstBufferSequence, typename WriteHandler>
void async_send_to(const ConstBufferSequence& buffers,
const endpoint_type& destination, socket_base::message_flags flags,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
- this->service.async_send_to(this->implementation, buffers, destination,
- flags, 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_to(this->get_implementation(), buffers,
+ destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
/// Receive some data on a connected socket.
@@ -485,9 +549,9 @@ public:
std::size_t receive(const MutableBufferSequence& buffers)
{
boost::system::error_code ec;
- std::size_t s = this->service.receive(
- this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "receive");
return s;
}
@@ -514,9 +578,9 @@ public:
socket_base::message_flags flags)
{
boost::system::error_code ec;
- std::size_t s = this->service.receive(
- this->implementation, buffers, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, flags, ec);
+ boost::asio::detail::throw_error(ec, "receive");
return s;
}
@@ -542,7 +606,8 @@ public:
std::size_t receive(const MutableBufferSequence& buffers,
socket_base::message_flags flags, boost::system::error_code& ec)
{
- return this->service.receive(this->implementation, buffers, flags, ec);
+ return this->get_service().receive(
+ this->get_implementation(), buffers, flags, ec);
}
/// Start an asynchronous receive on a connected socket.
@@ -582,9 +647,15 @@ public:
* std::vector.
*/
template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
+ void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
- this->service.async_receive(this->implementation, buffers, 0, 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(),
+ buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
/// Start an asynchronous receive on a connected socket.
@@ -617,9 +688,15 @@ public:
*/
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
- this->service.async_receive(this->implementation, buffers, flags, 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(),
+ buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
/// Receive a datagram with the endpoint of the sender.
@@ -653,9 +730,9 @@ public:
endpoint_type& sender_endpoint)
{
boost::system::error_code ec;
- std::size_t s = this->service.receive_from(
- this->implementation, buffers, sender_endpoint, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive_from(
+ this->get_implementation(), buffers, sender_endpoint, 0, ec);
+ boost::asio::detail::throw_error(ec, "receive_from");
return s;
}
@@ -680,9 +757,9 @@ public:
endpoint_type& sender_endpoint, socket_base::message_flags flags)
{
boost::system::error_code ec;
- std::size_t s = this->service.receive_from(
- this->implementation, buffers, sender_endpoint, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive_from(
+ this->get_implementation(), buffers, sender_endpoint, flags, ec);
+ boost::asio::detail::throw_error(ec, "receive_from");
return s;
}
@@ -707,8 +784,8 @@ public:
endpoint_type& sender_endpoint, socket_base::message_flags flags,
boost::system::error_code& ec)
{
- return this->service.receive_from(this->implementation, buffers,
- sender_endpoint, flags, ec);
+ return this->get_service().receive_from(this->get_implementation(),
+ buffers, sender_endpoint, flags, ec);
}
/// Start an asynchronous receive.
@@ -749,10 +826,15 @@ public:
*/
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, ReadHandler handler)
+ endpoint_type& sender_endpoint,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
- this->service.async_receive_from(this->implementation, buffers,
- sender_endpoint, 0, 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_from(this->get_implementation(), buffers,
+ sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
/// Start an asynchronous receive.
@@ -787,10 +869,14 @@ public:
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive_from(const MutableBufferSequence& buffers,
endpoint_type& sender_endpoint, socket_base::message_flags flags,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
- this->service.async_receive_from(this->implementation, buffers,
- sender_endpoint, flags, 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_from(this->get_implementation(), buffers,
+ sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
};