Rename template parameters to match TR2 proposal.
This commit is contained in:
parent
9d286431e3
commit
5cfbfe8021
@ -37,18 +37,15 @@ namespace asio {
|
||||
* @par Thread Safety
|
||||
* @e Distinct @e objects: Safe.@n
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* Async_Object
|
||||
*/
|
||||
template <typename Protocol,
|
||||
typename Service = datagram_socket_service<Protocol> >
|
||||
typename DatagramSocketService = datagram_socket_service<Protocol> >
|
||||
class basic_datagram_socket
|
||||
: public basic_socket<Protocol, Service>
|
||||
: public basic_socket<Protocol, DatagramSocketService>
|
||||
{
|
||||
public:
|
||||
/// The native representation of a socket.
|
||||
typedef typename Service::native_type native_type;
|
||||
typedef typename DatagramSocketService::native_type native_type;
|
||||
|
||||
/// The protocol type.
|
||||
typedef Protocol protocol_type;
|
||||
@ -66,7 +63,7 @@ public:
|
||||
* socket.
|
||||
*/
|
||||
explicit basic_datagram_socket(asio::io_service& io_service)
|
||||
: basic_socket<Protocol, Service>(io_service)
|
||||
: basic_socket<Protocol, DatagramSocketService>(io_service)
|
||||
{
|
||||
}
|
||||
|
||||
@ -84,7 +81,7 @@ public:
|
||||
*/
|
||||
basic_datagram_socket(asio::io_service& io_service,
|
||||
const protocol_type& protocol)
|
||||
: basic_socket<Protocol, Service>(io_service, protocol)
|
||||
: basic_socket<Protocol, DatagramSocketService>(io_service, protocol)
|
||||
{
|
||||
}
|
||||
|
||||
@ -106,7 +103,7 @@ public:
|
||||
*/
|
||||
basic_datagram_socket(asio::io_service& io_service,
|
||||
const endpoint_type& endpoint)
|
||||
: basic_socket<Protocol, Service>(io_service, endpoint)
|
||||
: basic_socket<Protocol, DatagramSocketService>(io_service, endpoint)
|
||||
{
|
||||
}
|
||||
|
||||
@ -127,7 +124,8 @@ public:
|
||||
*/
|
||||
basic_datagram_socket(asio::io_service& io_service,
|
||||
const protocol_type& protocol, const native_type& native_socket)
|
||||
: basic_socket<Protocol, Service>(io_service, protocol, native_socket)
|
||||
: basic_socket<Protocol, DatagramSocketService>(
|
||||
io_service, protocol, native_socket)
|
||||
{
|
||||
}
|
||||
|
||||
@ -153,8 +151,8 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send(const Const_Buffers& buffers)
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send(const ConstBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = this->service.send(this->implementation, buffers, 0, ec);
|
||||
@ -179,8 +177,8 @@ public:
|
||||
* @note The send operation can only be used with a connected socket. Use
|
||||
* the send_to function to send data on an unconnected datagram socket.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -207,8 +205,8 @@ public:
|
||||
* @note The send operation can only be used with a connected socket. Use
|
||||
* the send_to function to send data on an unconnected datagram socket.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return this->service.send(this->implementation, buffers, flags, ec);
|
||||
@ -250,8 +248,8 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send(const Const_Buffers& buffers, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
|
||||
{
|
||||
this->service.async_send(this->implementation, buffers, 0, handler);
|
||||
}
|
||||
@ -285,9 +283,9 @@ public:
|
||||
* Use the async_send_to function to send data on an unconnected datagram
|
||||
* socket.
|
||||
*/
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send(const Const_Buffers& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, WriteHandler handler)
|
||||
{
|
||||
this->service.async_send(this->implementation, buffers, flags, handler);
|
||||
}
|
||||
@ -317,8 +315,8 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send_to(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send_to(const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -344,8 +342,8 @@ public:
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send_to(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send_to(const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -371,8 +369,8 @@ public:
|
||||
*
|
||||
* @returns The number of bytes sent.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send_to(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send_to(const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
@ -417,9 +415,9 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send_to(const Const_Buffers& buffers,
|
||||
const endpoint_type& destination, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_send_to(const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination, WriteHandler handler)
|
||||
{
|
||||
this->service.async_send_to(this->implementation, buffers, destination, 0,
|
||||
handler);
|
||||
@ -452,10 +450,10 @@ public:
|
||||
* of the handler will be performed in a manner equivalent to using
|
||||
* asio::io_service::post().
|
||||
*/
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send_to(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_send_to(const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
Handler handler)
|
||||
WriteHandler handler)
|
||||
{
|
||||
this->service.async_send_to(this->implementation, buffers, destination,
|
||||
flags, handler);
|
||||
@ -485,8 +483,8 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive(const MutableBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = this->service.receive(
|
||||
@ -513,8 +511,8 @@ public:
|
||||
* the receive_from function to receive data on an unconnected datagram
|
||||
* socket.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -542,8 +540,8 @@ public:
|
||||
* the receive_from function to receive data on an unconnected datagram
|
||||
* socket.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return this->service.receive(this->implementation, buffers, flags, ec);
|
||||
@ -585,8 +583,8 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive(const Mutable_Buffers& buffers, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
|
||||
{
|
||||
this->service.async_receive(this->implementation, buffers, 0, handler);
|
||||
}
|
||||
@ -619,9 +617,9 @@ public:
|
||||
* Use the async_receive_from function to receive data on an unconnected
|
||||
* datagram socket.
|
||||
*/
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive(const Mutable_Buffers& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, ReadHandler handler)
|
||||
{
|
||||
this->service.async_receive(this->implementation, buffers, flags, handler);
|
||||
}
|
||||
@ -652,8 +650,8 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive_from(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive_from(const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -679,8 +677,8 @@ public:
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive_from(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive_from(const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint, socket_base::message_flags flags)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -706,8 +704,8 @@ public:
|
||||
*
|
||||
* @returns The number of bytes received.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive_from(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive_from(const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint, socket_base::message_flags flags,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
@ -751,9 +749,9 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive_from(const Mutable_Buffers& buffers,
|
||||
endpoint_type& sender_endpoint, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_receive_from(const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint, ReadHandler handler)
|
||||
{
|
||||
this->service.async_receive_from(this->implementation, buffers,
|
||||
sender_endpoint, 0, handler);
|
||||
@ -788,10 +786,10 @@ public:
|
||||
* of the handler will be performed in a manner equivalent to using
|
||||
* asio::io_service::post().
|
||||
*/
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive_from(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_receive_from(const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint, socket_base::message_flags flags,
|
||||
Handler handler)
|
||||
ReadHandler handler)
|
||||
{
|
||||
this->service.async_receive_from(this->implementation, buffers,
|
||||
sender_endpoint, flags, handler);
|
||||
|
@ -75,15 +75,15 @@ namespace asio {
|
||||
* timer.async_wait(handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Time_Type,
|
||||
typename Time_Traits = asio::time_traits<Time_Type>,
|
||||
typename Service = deadline_timer_service<Time_Type, Time_Traits> >
|
||||
template <typename Time,
|
||||
typename TimeTraits = asio::time_traits<Time>,
|
||||
typename TimerService = deadline_timer_service<Time, TimeTraits> >
|
||||
class basic_deadline_timer
|
||||
: public basic_io_object<Service>
|
||||
: public basic_io_object<TimerService>
|
||||
{
|
||||
public:
|
||||
/// The time traits type.
|
||||
typedef Time_Traits traits_type;
|
||||
typedef TimeTraits traits_type;
|
||||
|
||||
/// The time type.
|
||||
typedef typename traits_type::time_type time_type;
|
||||
@ -101,7 +101,7 @@ public:
|
||||
* handlers for any asynchronous operations performed on the timer.
|
||||
*/
|
||||
explicit basic_deadline_timer(asio::io_service& io_service)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<TimerService>(io_service)
|
||||
{
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ public:
|
||||
*/
|
||||
basic_deadline_timer(asio::io_service& io_service,
|
||||
const time_type& expiry_time)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<TimerService>(io_service)
|
||||
{
|
||||
this->service.expires_at(this->implementation, expiry_time);
|
||||
}
|
||||
@ -134,7 +134,7 @@ public:
|
||||
*/
|
||||
basic_deadline_timer(asio::io_service& io_service,
|
||||
const duration_type& expiry_time)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<TimerService>(io_service)
|
||||
{
|
||||
this->service.expires_from_now(this->implementation, expiry_time);
|
||||
}
|
||||
@ -246,8 +246,8 @@ public:
|
||||
* of the handler will be performed in a manner equivalent to using
|
||||
* asio::io_service::post().
|
||||
*/
|
||||
template <typename Handler>
|
||||
void async_wait(Handler handler)
|
||||
template <typename WaitHandler>
|
||||
void async_wait(WaitHandler handler)
|
||||
{
|
||||
this->service.async_wait(this->implementation, handler);
|
||||
}
|
||||
|
@ -23,13 +23,13 @@
|
||||
namespace asio {
|
||||
|
||||
/// Base class for all I/O objects.
|
||||
template <typename Service>
|
||||
template <typename IoObjectService>
|
||||
class basic_io_object
|
||||
: private noncopyable
|
||||
{
|
||||
public:
|
||||
/// The type of the service that will be used to provide I/O operations.
|
||||
typedef Service service_type;
|
||||
typedef IoObjectService service_type;
|
||||
|
||||
/// The underlying implementation type of I/O object.
|
||||
typedef typename service_type::implementation_type implementation_type;
|
||||
@ -50,7 +50,7 @@ public:
|
||||
protected:
|
||||
/// Construct a basic_io_object.
|
||||
explicit basic_io_object(asio::io_service& io_service)
|
||||
: service(asio::use_service<Service>(io_service))
|
||||
: service(asio::use_service<IoObjectService>(io_service))
|
||||
{
|
||||
service.construct(implementation);
|
||||
}
|
||||
|
@ -32,18 +32,15 @@ namespace asio {
|
||||
* @par Thread Safety
|
||||
* @e Distinct @e objects: Safe.@n
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* IO_Object.
|
||||
*/
|
||||
template <typename Protocol, typename Service>
|
||||
template <typename Protocol, typename SocketService>
|
||||
class basic_socket
|
||||
: public basic_io_object<Service>,
|
||||
: public basic_io_object<SocketService>,
|
||||
public socket_base
|
||||
{
|
||||
public:
|
||||
/// The native representation of a socket.
|
||||
typedef typename Service::native_type native_type;
|
||||
typedef typename SocketService::native_type native_type;
|
||||
|
||||
/// The protocol type.
|
||||
typedef Protocol protocol_type;
|
||||
@ -52,7 +49,7 @@ public:
|
||||
typedef typename Protocol::endpoint endpoint_type;
|
||||
|
||||
/// A basic_socket is always the lowest layer.
|
||||
typedef basic_socket<Protocol, Service> lowest_layer_type;
|
||||
typedef basic_socket<Protocol, SocketService> lowest_layer_type;
|
||||
|
||||
/// Construct a basic_socket without opening it.
|
||||
/**
|
||||
@ -62,7 +59,7 @@ public:
|
||||
* dispatch handlers for any asynchronous operations performed on the socket.
|
||||
*/
|
||||
explicit basic_socket(asio::io_service& io_service)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<SocketService>(io_service)
|
||||
{
|
||||
}
|
||||
|
||||
@ -79,7 +76,7 @@ public:
|
||||
*/
|
||||
basic_socket(asio::io_service& io_service,
|
||||
const protocol_type& protocol)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<SocketService>(io_service)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.open(this->implementation, protocol, ec);
|
||||
@ -103,7 +100,7 @@ public:
|
||||
*/
|
||||
basic_socket(asio::io_service& io_service,
|
||||
const endpoint_type& endpoint)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<SocketService>(io_service)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.open(this->implementation, endpoint.protocol(), ec);
|
||||
@ -127,7 +124,7 @@ public:
|
||||
*/
|
||||
basic_socket(asio::io_service& io_service,
|
||||
const protocol_type& protocol, const native_type& native_socket)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<SocketService>(io_service)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.assign(this->implementation, protocol, native_socket, ec);
|
||||
@ -466,8 +463,8 @@ public:
|
||||
* socket.async_connect(endpoint, connect_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Handler>
|
||||
void async_connect(const endpoint_type& peer_endpoint, Handler handler)
|
||||
template <typename ConnectHandler>
|
||||
void async_connect(const endpoint_type& peer_endpoint, ConnectHandler handler)
|
||||
{
|
||||
this->service.async_connect(this->implementation, peer_endpoint, handler);
|
||||
}
|
||||
@ -480,7 +477,7 @@ public:
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*
|
||||
* @sa Socket_Option @n
|
||||
* @sa SettableSocketOption @n
|
||||
* asio::socket_base::broadcast @n
|
||||
* asio::socket_base::do_not_route @n
|
||||
* asio::socket_base::keep_alive @n
|
||||
@ -506,8 +503,8 @@ public:
|
||||
* socket.set_option(option);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Socket_Option>
|
||||
void set_option(const Socket_Option& option)
|
||||
template <typename SettableSocketOption>
|
||||
void set_option(const SettableSocketOption& option)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.set_option(this->implementation, option, ec);
|
||||
@ -522,7 +519,7 @@ public:
|
||||
*
|
||||
* @param ec Set to indicate what error occurred, if any.
|
||||
*
|
||||
* @sa Socket_Option @n
|
||||
* @sa SettableSocketOption @n
|
||||
* asio::socket_base::broadcast @n
|
||||
* asio::socket_base::do_not_route @n
|
||||
* asio::socket_base::keep_alive @n
|
||||
@ -553,8 +550,8 @@ public:
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Socket_Option>
|
||||
asio::error_code set_option(const Socket_Option& option,
|
||||
template <typename SettableSocketOption>
|
||||
asio::error_code set_option(const SettableSocketOption& option,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return this->service.set_option(this->implementation, option, ec);
|
||||
@ -568,7 +565,7 @@ public:
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*
|
||||
* @sa Socket_Option @n
|
||||
* @sa GettableSocketOption @n
|
||||
* asio::socket_base::broadcast @n
|
||||
* asio::socket_base::do_not_route @n
|
||||
* asio::socket_base::keep_alive @n
|
||||
@ -595,8 +592,8 @@ public:
|
||||
* bool is_set = option.get();
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Socket_Option>
|
||||
void get_option(Socket_Option& option) const
|
||||
template <typename GettableSocketOption>
|
||||
void get_option(GettableSocketOption& option) const
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.get_option(this->implementation, option, ec);
|
||||
@ -611,7 +608,7 @@ public:
|
||||
*
|
||||
* @param ec Set to indicate what error occurred, if any.
|
||||
*
|
||||
* @sa Socket_Option @n
|
||||
* @sa GettableSocketOption @n
|
||||
* asio::socket_base::broadcast @n
|
||||
* asio::socket_base::do_not_route @n
|
||||
* asio::socket_base::keep_alive @n
|
||||
@ -643,8 +640,8 @@ public:
|
||||
* bool is_set = option.get();
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Socket_Option>
|
||||
asio::error_code get_option(Socket_Option& option,
|
||||
template <typename GettableSocketOption>
|
||||
asio::error_code get_option(GettableSocketOption& option,
|
||||
asio::error_code& ec) const
|
||||
{
|
||||
return this->service.get_option(this->implementation, option, ec);
|
||||
@ -658,7 +655,7 @@ public:
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*
|
||||
* @sa IO_Control_Command @n
|
||||
* @sa IoControlCommand @n
|
||||
* asio::socket_base::bytes_readable @n
|
||||
* asio::socket_base::non_blocking_io
|
||||
*
|
||||
@ -672,8 +669,8 @@ public:
|
||||
* std::size_t bytes_readable = command.get();
|
||||
* @endcode
|
||||
*/
|
||||
template <typename IO_Control_Command>
|
||||
void io_control(IO_Control_Command& command)
|
||||
template <typename IoControlCommand>
|
||||
void io_control(IoControlCommand& command)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.io_control(this->implementation, command, ec);
|
||||
@ -688,7 +685,7 @@ public:
|
||||
*
|
||||
* @param ec Set to indicate what error occurred, if any.
|
||||
*
|
||||
* @sa IO_Control_Command @n
|
||||
* @sa IoControlCommand @n
|
||||
* asio::socket_base::bytes_readable @n
|
||||
* asio::socket_base::non_blocking_io
|
||||
*
|
||||
@ -707,8 +704,8 @@ public:
|
||||
* std::size_t bytes_readable = command.get();
|
||||
* @endcode
|
||||
*/
|
||||
template <typename IO_Control_Command>
|
||||
asio::error_code io_control(IO_Control_Command& command,
|
||||
template <typename IoControlCommand>
|
||||
asio::error_code io_control(IoControlCommand& command,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return this->service.io_control(this->implementation, command, ec);
|
||||
|
@ -47,14 +47,14 @@ namespace asio {
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Protocol,
|
||||
typename Service = socket_acceptor_service<Protocol> >
|
||||
typename SocketAcceptorService = socket_acceptor_service<Protocol> >
|
||||
class basic_socket_acceptor
|
||||
: public basic_io_object<Service>,
|
||||
: public basic_io_object<SocketAcceptorService>,
|
||||
public socket_base
|
||||
{
|
||||
public:
|
||||
/// The native representation of an acceptor.
|
||||
typedef typename Service::native_type native_type;
|
||||
typedef typename SocketAcceptorService::native_type native_type;
|
||||
|
||||
/// The protocol type.
|
||||
typedef Protocol protocol_type;
|
||||
@ -73,7 +73,7 @@ public:
|
||||
* acceptor.
|
||||
*/
|
||||
explicit basic_socket_acceptor(asio::io_service& io_service)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<SocketAcceptorService>(io_service)
|
||||
{
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
*/
|
||||
basic_socket_acceptor(asio::io_service& io_service,
|
||||
const protocol_type& protocol)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<SocketAcceptorService>(io_service)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.open(this->implementation, protocol, ec);
|
||||
@ -127,7 +127,7 @@ public:
|
||||
*/
|
||||
basic_socket_acceptor(asio::io_service& io_service,
|
||||
const endpoint_type& endpoint, bool reuse_addr = true)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<SocketAcceptorService>(io_service)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.open(this->implementation, endpoint.protocol(), ec);
|
||||
@ -162,7 +162,7 @@ public:
|
||||
*/
|
||||
basic_socket_acceptor(asio::io_service& io_service,
|
||||
const protocol_type& protocol, const native_type& native_acceptor)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<SocketAcceptorService>(io_service)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.assign(this->implementation, protocol, native_acceptor, ec);
|
||||
@ -438,7 +438,7 @@ public:
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*
|
||||
* @sa Socket_Option @n
|
||||
* @sa SettableSocketOption @n
|
||||
* asio::socket_base::reuse_address
|
||||
* asio::socket_base::enable_connection_aborted
|
||||
*
|
||||
@ -451,8 +451,8 @@ public:
|
||||
* acceptor.set_option(option);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Option>
|
||||
void set_option(const Option& option)
|
||||
template <typename SettableSocketOption>
|
||||
void set_option(const SettableSocketOption& option)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.set_option(this->implementation, option, ec);
|
||||
@ -467,7 +467,7 @@ public:
|
||||
*
|
||||
* @param ec Set to indicate what error occurred, if any.
|
||||
*
|
||||
* @sa Socket_Option @n
|
||||
* @sa SettableSocketOption @n
|
||||
* asio::socket_base::reuse_address
|
||||
* asio::socket_base::enable_connection_aborted
|
||||
*
|
||||
@ -485,8 +485,8 @@ public:
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Option>
|
||||
asio::error_code set_option(const Option& option,
|
||||
template <typename SettableSocketOption>
|
||||
asio::error_code set_option(const SettableSocketOption& option,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return this->service.set_option(this->implementation, option, ec);
|
||||
@ -501,7 +501,7 @@ public:
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*
|
||||
* @sa Socket_Option @n
|
||||
* @sa GettableSocketOption @n
|
||||
* asio::socket_base::reuse_address
|
||||
*
|
||||
* @par Example
|
||||
@ -514,8 +514,8 @@ public:
|
||||
* bool is_set = option.get();
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Option>
|
||||
void get_option(Option& option)
|
||||
template <typename GettableSocketOption>
|
||||
void get_option(GettableSocketOption& option)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.get_option(this->implementation, option, ec);
|
||||
@ -531,7 +531,7 @@ public:
|
||||
*
|
||||
* @param ec Set to indicate what error occurred, if any.
|
||||
*
|
||||
* @sa Socket_Option @n
|
||||
* @sa GettableSocketOption @n
|
||||
* asio::socket_base::reuse_address
|
||||
*
|
||||
* @par Example
|
||||
@ -549,8 +549,8 @@ public:
|
||||
* bool is_set = option.get();
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Option>
|
||||
asio::error_code get_option(Option& option,
|
||||
template <typename GettableSocketOption>
|
||||
asio::error_code get_option(GettableSocketOption& option,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return this->service.get_option(this->implementation, option, ec);
|
||||
@ -624,8 +624,8 @@ public:
|
||||
* acceptor.accept(socket);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Socket_Service>
|
||||
void accept(basic_socket<protocol_type, Socket_Service>& peer)
|
||||
template <typename SocketService>
|
||||
void accept(basic_socket<protocol_type, SocketService>& peer)
|
||||
{
|
||||
asio::error_code ec;
|
||||
this->service.accept(this->implementation, peer, ec);
|
||||
@ -655,9 +655,9 @@ public:
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Socket_Service>
|
||||
template <typename SocketService>
|
||||
asio::error_code accept(
|
||||
basic_socket<protocol_type, Socket_Service>& peer,
|
||||
basic_socket<protocol_type, SocketService>& peer,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return this->service.accept(this->implementation, peer, ec);
|
||||
@ -701,9 +701,9 @@ public:
|
||||
* acceptor.async_accept(socket, accept_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Socket_Service, typename Handler>
|
||||
void async_accept(basic_socket<protocol_type, Socket_Service>& peer,
|
||||
Handler handler)
|
||||
template <typename SocketService, typename AcceptHandler>
|
||||
void async_accept(basic_socket<protocol_type, SocketService>& peer,
|
||||
AcceptHandler handler)
|
||||
{
|
||||
this->service.async_accept(this->implementation, peer, handler);
|
||||
}
|
||||
@ -731,8 +731,8 @@ public:
|
||||
* acceptor.accept_endpoint(socket, endpoint);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Socket_Service>
|
||||
void accept_endpoint(basic_socket<protocol_type, Socket_Service>& peer,
|
||||
template <typename SocketService>
|
||||
void accept_endpoint(basic_socket<protocol_type, SocketService>& peer,
|
||||
endpoint_type& peer_endpoint)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -769,9 +769,9 @@ public:
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Socket_Service>
|
||||
template <typename SocketService>
|
||||
asio::error_code accept_endpoint(
|
||||
basic_socket<protocol_type, Socket_Service>& peer,
|
||||
basic_socket<protocol_type, SocketService>& peer,
|
||||
endpoint_type& peer_endpoint, asio::error_code& ec)
|
||||
{
|
||||
return this->service.accept_endpoint(
|
||||
@ -804,9 +804,9 @@ public:
|
||||
* of the handler will be performed in a manner equivalent to using
|
||||
* asio::io_service::post().
|
||||
*/
|
||||
template <typename Socket_Service, typename Handler>
|
||||
void async_accept_endpoint(basic_socket<protocol_type, Socket_Service>& peer,
|
||||
endpoint_type& peer_endpoint, Handler handler)
|
||||
template <typename SocketService, typename AcceptHandler>
|
||||
void async_accept_endpoint(basic_socket<protocol_type, SocketService>& peer,
|
||||
endpoint_type& peer_endpoint, AcceptHandler handler)
|
||||
{
|
||||
this->service.async_accept_endpoint(this->implementation, peer,
|
||||
peer_endpoint, handler);
|
||||
|
@ -36,7 +36,7 @@
|
||||
// template < typename T1, ..., typename Tn >
|
||||
// explicit basic_socket_iostream( T1 x1, ..., Tn xn )
|
||||
// : basic_iostream<char>(&this->boost::base_from_member<
|
||||
// basic_socket_streambuf<Protocol, Service> >::member)
|
||||
// basic_socket_streambuf<Protocol, StreamSocketService> >::member)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
@ -55,7 +55,7 @@
|
||||
template < BOOST_PP_ENUM_PARAMS(n, typename T) > \
|
||||
explicit basic_socket_iostream( BOOST_PP_ENUM_BINARY_PARAMS(n, T, x) ) \
|
||||
: std::basic_iostream<char>(&this->boost::base_from_member< \
|
||||
basic_socket_streambuf<Protocol, Service> >::member) \
|
||||
basic_socket_streambuf<Protocol, StreamSocketService> >::member) \
|
||||
{ \
|
||||
try \
|
||||
{ \
|
||||
@ -108,16 +108,17 @@ namespace asio {
|
||||
|
||||
/// Iostream interface for a socket.
|
||||
template <typename Protocol,
|
||||
typename Service = stream_socket_service<Protocol> >
|
||||
typename StreamSocketService = stream_socket_service<Protocol> >
|
||||
class basic_socket_iostream
|
||||
: public boost::base_from_member<basic_socket_streambuf<Protocol, Service> >,
|
||||
: public boost::base_from_member<
|
||||
basic_socket_streambuf<Protocol, StreamSocketService> >,
|
||||
public std::basic_iostream<char>
|
||||
{
|
||||
public:
|
||||
/// Construct a basic_socket_iostream without establishing a connection.
|
||||
basic_socket_iostream()
|
||||
: std::basic_iostream<char>(&this->boost::base_from_member<
|
||||
basic_socket_streambuf<Protocol, Service> >::member)
|
||||
basic_socket_streambuf<Protocol, StreamSocketService> >::member)
|
||||
{
|
||||
}
|
||||
|
||||
@ -158,11 +159,11 @@ public:
|
||||
}
|
||||
|
||||
/// Return a pointer to the underlying streambuf.
|
||||
basic_socket_streambuf<Protocol, Service>* rdbuf() const
|
||||
basic_socket_streambuf<Protocol, StreamSocketService>* rdbuf() const
|
||||
{
|
||||
return const_cast<basic_socket_streambuf<Protocol, Service>*>(
|
||||
return const_cast<basic_socket_streambuf<Protocol, StreamSocketService>*>(
|
||||
&this->boost::base_from_member<
|
||||
basic_socket_streambuf<Protocol, Service> >::member);
|
||||
basic_socket_streambuf<Protocol, StreamSocketService> >::member);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
// A macro that should expand to:
|
||||
// template < typename T1, ..., typename Tn >
|
||||
// explicit basic_socket_streambuf( T1 x1, ..., Tn xn )
|
||||
// : basic_socket<Protocol, Service>(
|
||||
// : basic_socket<Protocol, StreamSocketService>(
|
||||
// boost::base_from_member<io_service>::member)
|
||||
// {
|
||||
// init_buffers();
|
||||
@ -52,7 +52,7 @@
|
||||
#define ASIO_PRIVATE_CTR_DEF( z, n, data ) \
|
||||
template < BOOST_PP_ENUM_PARAMS(n, typename T) > \
|
||||
explicit basic_socket_streambuf( BOOST_PP_ENUM_BINARY_PARAMS(n, T, x) ) \
|
||||
: basic_socket<Protocol, Service>( \
|
||||
: basic_socket<Protocol, StreamSocketService>( \
|
||||
boost::base_from_member<io_service>::member) \
|
||||
{ \
|
||||
init_buffers(); \
|
||||
@ -66,7 +66,7 @@
|
||||
// template < typename T1, ..., typename Tn >
|
||||
// void connect( T1 x1, ..., Tn xn )
|
||||
// {
|
||||
// this->basic_socket<Protocol, Service>::close();
|
||||
// this->basic_socket<Protocol, StreamSocketService>::close();
|
||||
// init_buffers();
|
||||
// typedef typename Protocol::resolver_query resolver_query;
|
||||
// resolver_query query( x1, ..., xn );
|
||||
@ -78,7 +78,7 @@
|
||||
template < BOOST_PP_ENUM_PARAMS(n, typename T) > \
|
||||
void connect( BOOST_PP_ENUM_BINARY_PARAMS(n, T, x) ) \
|
||||
{ \
|
||||
this->basic_socket<Protocol, Service>::close(); \
|
||||
this->basic_socket<Protocol, StreamSocketService>::close(); \
|
||||
init_buffers(); \
|
||||
typedef typename Protocol::resolver_query resolver_query; \
|
||||
resolver_query query( BOOST_PP_ENUM_PARAMS(n, x) ); \
|
||||
@ -90,11 +90,11 @@ namespace asio {
|
||||
|
||||
/// Iostream streambuf for a socket.
|
||||
template <typename Protocol,
|
||||
typename Service = stream_socket_service<Protocol> >
|
||||
typename StreamSocketService = stream_socket_service<Protocol> >
|
||||
class basic_socket_streambuf
|
||||
: public std::streambuf,
|
||||
private boost::base_from_member<io_service>,
|
||||
public basic_socket<Protocol, Service>
|
||||
public basic_socket<Protocol, StreamSocketService>
|
||||
{
|
||||
public:
|
||||
/// The endpoint type.
|
||||
@ -102,7 +102,7 @@ public:
|
||||
|
||||
/// Construct a basic_socket_streambuf without establishing a connection.
|
||||
basic_socket_streambuf()
|
||||
: basic_socket<Protocol, Service>(
|
||||
: basic_socket<Protocol, StreamSocketService>(
|
||||
boost::base_from_member<asio::io_service>::member)
|
||||
{
|
||||
init_buffers();
|
||||
@ -110,11 +110,11 @@ public:
|
||||
|
||||
/// Establish a connection to the specified endpoint.
|
||||
explicit basic_socket_streambuf(const endpoint_type& endpoint)
|
||||
: basic_socket<Protocol, Service>(
|
||||
: basic_socket<Protocol, StreamSocketService>(
|
||||
boost::base_from_member<asio::io_service>::member)
|
||||
{
|
||||
init_buffers();
|
||||
this->basic_socket<Protocol, Service>::connect(endpoint);
|
||||
this->basic_socket<Protocol, StreamSocketService>::connect(endpoint);
|
||||
}
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
@ -141,9 +141,9 @@ public:
|
||||
/// Establish a connection to the specified endpoint.
|
||||
void connect(const endpoint_type& endpoint)
|
||||
{
|
||||
this->basic_socket<Protocol, Service>::close();
|
||||
this->basic_socket<Protocol, StreamSocketService>::close();
|
||||
init_buffers();
|
||||
this->basic_socket<Protocol, Service>::connect(endpoint);
|
||||
this->basic_socket<Protocol, StreamSocketService>::connect(endpoint);
|
||||
}
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
@ -165,7 +165,7 @@ public:
|
||||
void close()
|
||||
{
|
||||
sync();
|
||||
this->basic_socket<Protocol, Service>::close();
|
||||
this->basic_socket<Protocol, StreamSocketService>::close();
|
||||
init_buffers();
|
||||
}
|
||||
|
||||
@ -259,8 +259,8 @@ private:
|
||||
asio::error_code ec(asio::error::host_not_found);
|
||||
while (ec && iterator != iterator_type())
|
||||
{
|
||||
this->basic_socket<Protocol, Service>::close();
|
||||
this->basic_socket<Protocol, Service>::connect(*iterator, ec);
|
||||
this->basic_socket<Protocol, StreamSocketService>::close();
|
||||
this->basic_socket<Protocol, StreamSocketService>::connect(*iterator, ec);
|
||||
++iterator;
|
||||
}
|
||||
asio::detail::throw_error(ec);
|
||||
|
@ -39,17 +39,16 @@ namespace asio {
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* Async_Read_Stream, Async_Write_Stream, Stream, Sync_Read_Stream,
|
||||
* Sync_Write_Stream.
|
||||
* AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream.
|
||||
*/
|
||||
template <typename Protocol,
|
||||
typename Service = stream_socket_service<Protocol> >
|
||||
typename StreamSocketService = stream_socket_service<Protocol> >
|
||||
class basic_stream_socket
|
||||
: public basic_socket<Protocol, Service>
|
||||
: public basic_socket<Protocol, StreamSocketService>
|
||||
{
|
||||
public:
|
||||
/// The native representation of a socket.
|
||||
typedef typename Service::native_type native_type;
|
||||
typedef typename StreamSocketService::native_type native_type;
|
||||
|
||||
/// The protocol type.
|
||||
typedef Protocol protocol_type;
|
||||
@ -67,7 +66,7 @@ public:
|
||||
* dispatch handlers for any asynchronous operations performed on the socket.
|
||||
*/
|
||||
explicit basic_stream_socket(asio::io_service& io_service)
|
||||
: basic_socket<Protocol, Service>(io_service)
|
||||
: basic_socket<Protocol, StreamSocketService>(io_service)
|
||||
{
|
||||
}
|
||||
|
||||
@ -85,7 +84,7 @@ public:
|
||||
*/
|
||||
basic_stream_socket(asio::io_service& io_service,
|
||||
const protocol_type& protocol)
|
||||
: basic_socket<Protocol, Service>(io_service, protocol)
|
||||
: basic_socket<Protocol, StreamSocketService>(io_service, protocol)
|
||||
{
|
||||
}
|
||||
|
||||
@ -106,7 +105,7 @@ public:
|
||||
*/
|
||||
basic_stream_socket(asio::io_service& io_service,
|
||||
const endpoint_type& endpoint)
|
||||
: basic_socket<Protocol, Service>(io_service, endpoint)
|
||||
: basic_socket<Protocol, StreamSocketService>(io_service, endpoint)
|
||||
{
|
||||
}
|
||||
|
||||
@ -126,7 +125,8 @@ public:
|
||||
*/
|
||||
basic_stream_socket(asio::io_service& io_service,
|
||||
const protocol_type& protocol, const native_type& native_socket)
|
||||
: basic_socket<Protocol, Service>(io_service, protocol, native_socket)
|
||||
: basic_socket<Protocol, StreamSocketService>(
|
||||
io_service, protocol, native_socket)
|
||||
{
|
||||
}
|
||||
|
||||
@ -155,8 +155,8 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send(const Const_Buffers& buffers)
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send(const ConstBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = this->service.send(
|
||||
@ -192,8 +192,8 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -221,8 +221,8 @@ public:
|
||||
* Consider using the @ref write function if you need to ensure that all data
|
||||
* is written before the blocking operation completes.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return this->service.send(this->implementation, buffers, flags, ec);
|
||||
@ -263,8 +263,8 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send(const Const_Buffers& buffers, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
|
||||
{
|
||||
this->service.async_send(this->implementation, buffers, 0, handler);
|
||||
}
|
||||
@ -306,9 +306,9 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send(const Const_Buffers& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, WriteHandler handler)
|
||||
{
|
||||
this->service.async_send(this->implementation, buffers, flags, handler);
|
||||
}
|
||||
@ -341,8 +341,8 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive(const MutableBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = this->service.receive(this->implementation, buffers, 0, ec);
|
||||
@ -380,8 +380,8 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -409,8 +409,8 @@ public:
|
||||
* 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 Mutable_Buffers>
|
||||
std::size_t receive(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return this->service.receive(this->implementation, buffers, flags, ec);
|
||||
@ -453,8 +453,8 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive(const Mutable_Buffers& buffers, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
|
||||
{
|
||||
this->service.async_receive(this->implementation, buffers, 0, handler);
|
||||
}
|
||||
@ -498,9 +498,9 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive(const Mutable_Buffers& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, ReadHandler handler)
|
||||
{
|
||||
this->service.async_receive(this->implementation, buffers, flags, handler);
|
||||
}
|
||||
@ -532,8 +532,8 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers)
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = this->service.send(this->implementation, buffers, 0, ec);
|
||||
@ -557,8 +557,8 @@ public:
|
||||
* peer. Consider using the @ref write function if you need to ensure that
|
||||
* all data is written before the blocking operation completes.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return this->service.send(this->implementation, buffers, 0, ec);
|
||||
@ -599,8 +599,9 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_write_some(const Const_Buffers& buffers, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_write_some(const ConstBufferSequence& buffers,
|
||||
WriteHandler handler)
|
||||
{
|
||||
this->service.async_send(this->implementation, buffers, 0, handler);
|
||||
}
|
||||
@ -633,8 +634,8 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = this->service.receive(this->implementation, buffers, 0, ec);
|
||||
@ -659,8 +660,8 @@ public:
|
||||
* the requested amount of data is read before the blocking operation
|
||||
* completes.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return this->service.receive(this->implementation, buffers, 0, ec);
|
||||
@ -702,8 +703,9 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_read_some(const MutableBufferSequence& buffers,
|
||||
ReadHandler handler)
|
||||
{
|
||||
this->service.async_receive(this->implementation, buffers, 0, handler);
|
||||
}
|
||||
@ -728,8 +730,8 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = this->service.receive(this->implementation, buffers,
|
||||
@ -750,8 +752,8 @@ public:
|
||||
*
|
||||
* @returns The number of bytes read. Returns 0 if an error occurred.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return this->service.receive(this->implementation, buffers,
|
||||
|
@ -126,10 +126,10 @@ inline std::size_t buffer_size_helper(const mutable_buffer& b)
|
||||
/**
|
||||
* @relates mutable_buffer
|
||||
*/
|
||||
template <typename Pointer_To_Pod_Type>
|
||||
inline Pointer_To_Pod_Type buffer_cast(const mutable_buffer& b)
|
||||
template <typename PointerToPodType>
|
||||
inline PointerToPodType buffer_cast(const mutable_buffer& b)
|
||||
{
|
||||
return static_cast<Pointer_To_Pod_Type>(detail::buffer_cast_helper(b));
|
||||
return static_cast<PointerToPodType>(detail::buffer_cast_helper(b));
|
||||
}
|
||||
|
||||
/// Get the number of bytes in a non-modifiable buffer.
|
||||
@ -176,7 +176,7 @@ inline mutable_buffer operator+(std::size_t start, const mutable_buffer& b)
|
||||
}
|
||||
|
||||
/// Adapts a single modifiable buffer so that it meets the requirements of the
|
||||
/// Mutable_Buffers concept.
|
||||
/// MutableBufferSequence concept.
|
||||
class mutable_buffer_container_1
|
||||
: public mutable_buffer
|
||||
{
|
||||
@ -290,10 +290,10 @@ inline std::size_t buffer_size_helper(const const_buffer& b)
|
||||
/**
|
||||
* @relates const_buffer
|
||||
*/
|
||||
template <typename Pointer_To_Pod_Type>
|
||||
inline Pointer_To_Pod_Type buffer_cast(const const_buffer& b)
|
||||
template <typename PointerToPodType>
|
||||
inline PointerToPodType buffer_cast(const const_buffer& b)
|
||||
{
|
||||
return static_cast<Pointer_To_Pod_Type>(detail::buffer_cast_helper(b));
|
||||
return static_cast<PointerToPodType>(detail::buffer_cast_helper(b));
|
||||
}
|
||||
|
||||
/// Get the number of bytes in a non-modifiable buffer.
|
||||
@ -340,7 +340,7 @@ inline const_buffer operator+(std::size_t start, const const_buffer& b)
|
||||
}
|
||||
|
||||
/// Adapts a single non-modifiable buffer so that it meets the requirements of
|
||||
/// the Const_Buffers concept.
|
||||
/// the ConstBufferSequence concept.
|
||||
class const_buffer_container_1
|
||||
: public const_buffer
|
||||
{
|
||||
@ -405,9 +405,9 @@ private:
|
||||
* @code sock.write(asio::buffer(data, size)); @endcode
|
||||
*
|
||||
* In the above example, the return value of asio::buffer meets the
|
||||
* requirements of the Const_Buffers concept so that it may be directly passed
|
||||
* to the socket's write function. A buffer created for modifiable memory also
|
||||
* meets the requirements of the Mutable_Buffers concept.
|
||||
* requirements of the ConstBufferSequence concept so that it may be directly
|
||||
* passed to the socket's write function. A buffer created for modifiable
|
||||
* memory also meets the requirements of the MutableBufferSequence concept.
|
||||
*
|
||||
* An individual buffer may be created from a builtin array, std::vector or
|
||||
* boost::array of POD elements. This helps prevent buffer overruns by
|
||||
@ -424,7 +424,7 @@ private:
|
||||
*
|
||||
* To read or write using multiple buffers (i.e. scatter-gather I/O), multiple
|
||||
* buffer objects may be assigned into a container that supports the
|
||||
* Mutable_Buffers (for read) or Const_Buffers (for write) concepts:
|
||||
* MutableBufferSequence (for read) or ConstBufferSequence (for write) concepts:
|
||||
*
|
||||
* @code
|
||||
* char d1[128];
|
||||
@ -499,54 +499,54 @@ inline const_buffer_container_1 buffer(const void* data,
|
||||
}
|
||||
|
||||
/// Create a new modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline mutable_buffer_container_1 buffer(Pod_Type (&data)[N])
|
||||
template <typename PodType, std::size_t N>
|
||||
inline mutable_buffer_container_1 buffer(PodType (&data)[N])
|
||||
{
|
||||
return mutable_buffer_container_1(mutable_buffer(data, N * sizeof(Pod_Type)));
|
||||
return mutable_buffer_container_1(mutable_buffer(data, N * sizeof(PodType)));
|
||||
}
|
||||
|
||||
/// Create a new modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline mutable_buffer_container_1 buffer(Pod_Type (&data)[N],
|
||||
template <typename PodType, std::size_t N>
|
||||
inline mutable_buffer_container_1 buffer(PodType (&data)[N],
|
||||
std::size_t max_size_in_bytes)
|
||||
{
|
||||
return mutable_buffer_container_1(
|
||||
mutable_buffer(data,
|
||||
N * sizeof(Pod_Type) < max_size_in_bytes
|
||||
? N * sizeof(Pod_Type) : max_size_in_bytes));
|
||||
N * sizeof(PodType) < max_size_in_bytes
|
||||
? N * sizeof(PodType) : max_size_in_bytes));
|
||||
}
|
||||
|
||||
/// Create a new non-modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(const Pod_Type (&data)[N])
|
||||
template <typename PodType, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(const PodType (&data)[N])
|
||||
{
|
||||
return const_buffer_container_1(const_buffer(data, N * sizeof(Pod_Type)));
|
||||
return const_buffer_container_1(const_buffer(data, N * sizeof(PodType)));
|
||||
}
|
||||
|
||||
/// Create a new non-modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(const Pod_Type (&data)[N],
|
||||
template <typename PodType, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(const PodType (&data)[N],
|
||||
std::size_t max_size_in_bytes)
|
||||
{
|
||||
return const_buffer_container_1(
|
||||
const_buffer(data,
|
||||
N * sizeof(Pod_Type) < max_size_in_bytes
|
||||
? N * sizeof(Pod_Type) : max_size_in_bytes));
|
||||
N * sizeof(PodType) < max_size_in_bytes
|
||||
? N * sizeof(PodType) : max_size_in_bytes));
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
// Borland C++ thinks the overloads:
|
||||
//
|
||||
// unspecified buffer(boost::array<Pod_Type, N>& array ...);
|
||||
// unspecified buffer(boost::array<PodType, N>& array ...);
|
||||
//
|
||||
// and
|
||||
//
|
||||
// unspecified buffer(boost::array<const Pod_Type, N>& array ...);
|
||||
// unspecified buffer(boost::array<const PodType, N>& array ...);
|
||||
//
|
||||
// are ambiguous. This will be worked around by using a buffer_types traits
|
||||
// class that contains typedefs for the appropriate buffer and container
|
||||
// classes, based on whether Pod_Type is const or non-const.
|
||||
// classes, based on whether PodType is const or non-const.
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -567,99 +567,99 @@ struct buffer_types_base<true>
|
||||
typedef const_buffer_container_1 container_type;
|
||||
};
|
||||
|
||||
template <typename Pod_Type>
|
||||
template <typename PodType>
|
||||
struct buffer_types
|
||||
: public buffer_types_base<boost::is_const<Pod_Type>::value>
|
||||
: public buffer_types_base<boost::is_const<PodType>::value>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline typename detail::buffer_types<Pod_Type>::container_type
|
||||
buffer(boost::array<Pod_Type, N>& data)
|
||||
template <typename PodType, std::size_t N>
|
||||
inline typename detail::buffer_types<PodType>::container_type
|
||||
buffer(boost::array<PodType, N>& data)
|
||||
{
|
||||
typedef typename asio::detail::buffer_types<Pod_Type>::buffer_type
|
||||
typedef typename asio::detail::buffer_types<PodType>::buffer_type
|
||||
buffer_type;
|
||||
typedef typename asio::detail::buffer_types<Pod_Type>::container_type
|
||||
typedef typename asio::detail::buffer_types<PodType>::container_type
|
||||
container_type;
|
||||
return container_type(
|
||||
buffer_type(data.c_array(), data.size() * sizeof(Pod_Type)));
|
||||
buffer_type(data.c_array(), data.size() * sizeof(PodType)));
|
||||
}
|
||||
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline typename detail::buffer_types<Pod_Type>::container_type
|
||||
buffer(boost::array<Pod_Type, N>& data, std::size_t max_size_in_bytes)
|
||||
template <typename PodType, std::size_t N>
|
||||
inline typename detail::buffer_types<PodType>::container_type
|
||||
buffer(boost::array<PodType, N>& data, std::size_t max_size_in_bytes)
|
||||
{
|
||||
typedef typename asio::detail::buffer_types<Pod_Type>::buffer_type
|
||||
typedef typename asio::detail::buffer_types<PodType>::buffer_type
|
||||
buffer_type;
|
||||
typedef typename asio::detail::buffer_types<Pod_Type>::container_type
|
||||
typedef typename asio::detail::buffer_types<PodType>::container_type
|
||||
container_type;
|
||||
return container_type(
|
||||
buffer_type(data.c_array(),
|
||||
data.size() * sizeof(Pod_Type) < max_size_in_bytes
|
||||
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
|
||||
data.size() * sizeof(PodType) < max_size_in_bytes
|
||||
? data.size() * sizeof(PodType) : max_size_in_bytes));
|
||||
}
|
||||
|
||||
#else // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
/// Create a new modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline mutable_buffer_container_1 buffer(boost::array<Pod_Type, N>& data)
|
||||
template <typename PodType, std::size_t N>
|
||||
inline mutable_buffer_container_1 buffer(boost::array<PodType, N>& data)
|
||||
{
|
||||
return mutable_buffer_container_1(
|
||||
mutable_buffer(data.c_array(), data.size() * sizeof(Pod_Type)));
|
||||
mutable_buffer(data.c_array(), data.size() * sizeof(PodType)));
|
||||
}
|
||||
|
||||
/// Create a new modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline mutable_buffer_container_1 buffer(boost::array<Pod_Type, N>& data,
|
||||
template <typename PodType, std::size_t N>
|
||||
inline mutable_buffer_container_1 buffer(boost::array<PodType, N>& data,
|
||||
std::size_t max_size_in_bytes)
|
||||
{
|
||||
return mutable_buffer_container_1(
|
||||
mutable_buffer(data.c_array(),
|
||||
data.size() * sizeof(Pod_Type) < max_size_in_bytes
|
||||
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
|
||||
data.size() * sizeof(PodType) < max_size_in_bytes
|
||||
? data.size() * sizeof(PodType) : max_size_in_bytes));
|
||||
}
|
||||
|
||||
/// Create a new non-modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(boost::array<const Pod_Type, N>& data)
|
||||
template <typename PodType, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(boost::array<const PodType, N>& data)
|
||||
{
|
||||
return const_buffer_container_1(
|
||||
const_buffer(data.data(), data.size() * sizeof(Pod_Type)));
|
||||
const_buffer(data.data(), data.size() * sizeof(PodType)));
|
||||
}
|
||||
|
||||
/// Create a new non-modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(boost::array<const Pod_Type, N>& data,
|
||||
template <typename PodType, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(boost::array<const PodType, N>& data,
|
||||
std::size_t max_size_in_bytes)
|
||||
{
|
||||
return const_buffer_container_1(
|
||||
const_buffer(data.data(),
|
||||
data.size() * sizeof(Pod_Type) < max_size_in_bytes
|
||||
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
|
||||
data.size() * sizeof(PodType) < max_size_in_bytes
|
||||
? data.size() * sizeof(PodType) : max_size_in_bytes));
|
||||
}
|
||||
|
||||
#endif // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
/// Create a new non-modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(const boost::array<Pod_Type, N>& data)
|
||||
template <typename PodType, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(const boost::array<PodType, N>& data)
|
||||
{
|
||||
return const_buffer_container_1(
|
||||
const_buffer(data.data(), data.size() * sizeof(Pod_Type)));
|
||||
const_buffer(data.data(), data.size() * sizeof(PodType)));
|
||||
}
|
||||
|
||||
/// Create a new non-modifiable buffer that represents the given POD array.
|
||||
template <typename Pod_Type, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(const boost::array<Pod_Type, N>& data,
|
||||
template <typename PodType, std::size_t N>
|
||||
inline const_buffer_container_1 buffer(const boost::array<PodType, N>& data,
|
||||
std::size_t max_size_in_bytes)
|
||||
{
|
||||
return const_buffer_container_1(
|
||||
const_buffer(data.data(),
|
||||
data.size() * sizeof(Pod_Type) < max_size_in_bytes
|
||||
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
|
||||
data.size() * sizeof(PodType) < max_size_in_bytes
|
||||
? data.size() * sizeof(PodType) : max_size_in_bytes));
|
||||
}
|
||||
|
||||
/// Create a new modifiable buffer that represents the given POD vector.
|
||||
@ -667,14 +667,14 @@ inline const_buffer_container_1 buffer(const boost::array<Pod_Type, N>& data,
|
||||
* @note The buffer is invalidated by any vector operation that would also
|
||||
* invalidate iterators.
|
||||
*/
|
||||
template <typename Pod_Type, typename Allocator>
|
||||
inline mutable_buffer_container_1 buffer(std::vector<Pod_Type, Allocator>& data)
|
||||
template <typename PodType, typename Allocator>
|
||||
inline mutable_buffer_container_1 buffer(std::vector<PodType, Allocator>& data)
|
||||
{
|
||||
return mutable_buffer_container_1(
|
||||
mutable_buffer(&data[0], data.size() * sizeof(Pod_Type)
|
||||
mutable_buffer(&data[0], data.size() * sizeof(PodType)
|
||||
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
, detail::buffer_debug_check<
|
||||
typename std::vector<Pod_Type, Allocator>::iterator
|
||||
typename std::vector<PodType, Allocator>::iterator
|
||||
>(data.begin())
|
||||
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
|
||||
));
|
||||
@ -685,17 +685,17 @@ inline mutable_buffer_container_1 buffer(std::vector<Pod_Type, Allocator>& data)
|
||||
* @note The buffer is invalidated by any vector operation that would also
|
||||
* invalidate iterators.
|
||||
*/
|
||||
template <typename Pod_Type, typename Allocator>
|
||||
inline mutable_buffer_container_1 buffer(std::vector<Pod_Type, Allocator>& data,
|
||||
template <typename PodType, typename Allocator>
|
||||
inline mutable_buffer_container_1 buffer(std::vector<PodType, Allocator>& data,
|
||||
std::size_t max_size_in_bytes)
|
||||
{
|
||||
return mutable_buffer_container_1(
|
||||
mutable_buffer(&data[0],
|
||||
data.size() * sizeof(Pod_Type) < max_size_in_bytes
|
||||
? data.size() * sizeof(Pod_Type) : max_size_in_bytes
|
||||
data.size() * sizeof(PodType) < max_size_in_bytes
|
||||
? data.size() * sizeof(PodType) : max_size_in_bytes
|
||||
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
, detail::buffer_debug_check<
|
||||
typename std::vector<Pod_Type, Allocator>::iterator
|
||||
typename std::vector<PodType, Allocator>::iterator
|
||||
>(data.begin())
|
||||
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
|
||||
));
|
||||
@ -706,15 +706,15 @@ inline mutable_buffer_container_1 buffer(std::vector<Pod_Type, Allocator>& data,
|
||||
* @note The buffer is invalidated by any vector operation that would also
|
||||
* invalidate iterators.
|
||||
*/
|
||||
template <typename Pod_Type, typename Allocator>
|
||||
template <typename PodType, typename Allocator>
|
||||
inline const_buffer_container_1 buffer(
|
||||
const std::vector<Pod_Type, Allocator>& data)
|
||||
const std::vector<PodType, Allocator>& data)
|
||||
{
|
||||
return const_buffer_container_1(
|
||||
const_buffer(&data[0], data.size() * sizeof(Pod_Type)
|
||||
const_buffer(&data[0], data.size() * sizeof(PodType)
|
||||
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
, detail::buffer_debug_check<
|
||||
typename std::vector<Pod_Type, Allocator>::const_iterator
|
||||
typename std::vector<PodType, Allocator>::const_iterator
|
||||
>(data.begin())
|
||||
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
|
||||
));
|
||||
@ -725,17 +725,17 @@ inline const_buffer_container_1 buffer(
|
||||
* @note The buffer is invalidated by any vector operation that would also
|
||||
* invalidate iterators.
|
||||
*/
|
||||
template <typename Pod_Type, typename Allocator>
|
||||
template <typename PodType, typename Allocator>
|
||||
inline const_buffer_container_1 buffer(
|
||||
const std::vector<Pod_Type, Allocator>& data, std::size_t max_size_in_bytes)
|
||||
const std::vector<PodType, Allocator>& data, std::size_t max_size_in_bytes)
|
||||
{
|
||||
return const_buffer_container_1(
|
||||
const_buffer(&data[0],
|
||||
data.size() * sizeof(Pod_Type) < max_size_in_bytes
|
||||
? data.size() * sizeof(Pod_Type) : max_size_in_bytes
|
||||
data.size() * sizeof(PodType) < max_size_in_bytes
|
||||
? data.size() * sizeof(PodType) : max_size_in_bytes
|
||||
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
, detail::buffer_debug_check<
|
||||
typename std::vector<Pod_Type, Allocator>::const_iterator
|
||||
typename std::vector<PodType, Allocator>::const_iterator
|
||||
>(data.begin())
|
||||
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
|
||||
));
|
||||
|
@ -45,8 +45,7 @@ namespace asio {
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* Async_Object, Async_Read_Stream, Async_Write_Stream, Stream,
|
||||
* Sync_Read_Stream, Sync_Write_Stream.
|
||||
* AsyncReadStream, AsyncWriteStream, Stream, Sync_Read_Stream, SyncWriteStream.
|
||||
*/
|
||||
template <typename Stream>
|
||||
class buffered_read_stream
|
||||
@ -114,16 +113,16 @@ public:
|
||||
|
||||
/// Write the given data to the stream. Returns the number of bytes written.
|
||||
/// Throws an exception on failure.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers)
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers)
|
||||
{
|
||||
return next_layer_.write_some(buffers);
|
||||
}
|
||||
|
||||
/// Write the given data to the stream. Returns the number of bytes written,
|
||||
/// or 0 if an error occurred.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return next_layer_.write_some(buffers, ec);
|
||||
@ -131,8 +130,9 @@ public:
|
||||
|
||||
/// Start an asynchronous write. The data being written must be valid for the
|
||||
/// lifetime of the asynchronous operation.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_write_some(const Const_Buffers& buffers, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_write_some(const ConstBufferSequence& buffers,
|
||||
WriteHandler handler)
|
||||
{
|
||||
next_layer_.async_write_some(buffers, handler);
|
||||
}
|
||||
@ -168,13 +168,13 @@ public:
|
||||
return storage_.size() - previous_size;
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
template <typename ReadHandler>
|
||||
class fill_handler
|
||||
{
|
||||
public:
|
||||
fill_handler(asio::io_service& io_service,
|
||||
detail::buffered_stream_storage& storage,
|
||||
std::size_t previous_size, Handler handler)
|
||||
std::size_t previous_size, ReadHandler handler)
|
||||
: io_service_(io_service),
|
||||
storage_(storage),
|
||||
previous_size_(previous_size),
|
||||
@ -194,12 +194,12 @@ public:
|
||||
asio::io_service& io_service_;
|
||||
detail::buffered_stream_storage& storage_;
|
||||
std::size_t previous_size_;
|
||||
Handler handler_;
|
||||
ReadHandler handler_;
|
||||
};
|
||||
|
||||
/// Start an asynchronous fill.
|
||||
template <typename Handler>
|
||||
void async_fill(Handler handler)
|
||||
template <typename ReadHandler>
|
||||
void async_fill(ReadHandler handler)
|
||||
{
|
||||
std::size_t previous_size = storage_.size();
|
||||
storage_.resize(storage_.capacity());
|
||||
@ -207,13 +207,14 @@ public:
|
||||
buffer(
|
||||
storage_.data() + previous_size,
|
||||
storage_.size() - previous_size),
|
||||
fill_handler<Handler>(io_service(), storage_, previous_size, handler));
|
||||
fill_handler<ReadHandler>(io_service(),
|
||||
storage_, previous_size, handler));
|
||||
}
|
||||
|
||||
/// Read some data from the stream. Returns the number of bytes read. Throws
|
||||
/// an exception on failure.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers)
|
||||
{
|
||||
if (storage_.empty())
|
||||
fill();
|
||||
@ -222,8 +223,8 @@ public:
|
||||
|
||||
/// Read some data from the stream. Returns the number of bytes read or 0 if
|
||||
/// an error occurred.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
ec = asio::error_code();
|
||||
@ -232,13 +233,13 @@ public:
|
||||
return copy(buffers);
|
||||
}
|
||||
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
class read_some_handler
|
||||
{
|
||||
public:
|
||||
read_some_handler(asio::io_service& io_service,
|
||||
detail::buffered_stream_storage& storage,
|
||||
const Mutable_Buffers& buffers, Handler handler)
|
||||
const MutableBufferSequence& buffers, ReadHandler handler)
|
||||
: io_service_(io_service),
|
||||
storage_(storage),
|
||||
buffers_(buffers),
|
||||
@ -260,8 +261,8 @@ public:
|
||||
std::size_t bytes_avail = storage_.size();
|
||||
std::size_t bytes_copied = 0;
|
||||
|
||||
typename Mutable_Buffers::const_iterator iter = buffers_.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers_.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers_.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers_.end();
|
||||
for (; iter != end && bytes_avail > 0; ++iter)
|
||||
{
|
||||
std::size_t max_length = buffer_size(*iter);
|
||||
@ -281,18 +282,19 @@ public:
|
||||
private:
|
||||
asio::io_service& io_service_;
|
||||
detail::buffered_stream_storage& storage_;
|
||||
Mutable_Buffers buffers_;
|
||||
Handler handler_;
|
||||
MutableBufferSequence buffers_;
|
||||
ReadHandler handler_;
|
||||
};
|
||||
|
||||
/// Start an asynchronous read. The buffer into which the data will be read
|
||||
/// must be valid for the lifetime of the asynchronous operation.
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_read_some(const MutableBufferSequence& buffers,
|
||||
ReadHandler handler)
|
||||
{
|
||||
if (storage_.empty())
|
||||
{
|
||||
async_fill(read_some_handler<Mutable_Buffers, Handler>(
|
||||
async_fill(read_some_handler<MutableBufferSequence, ReadHandler>(
|
||||
io_service(), storage_, buffers, handler));
|
||||
}
|
||||
else
|
||||
@ -305,8 +307,8 @@ public:
|
||||
|
||||
/// Peek at the incoming data on the stream. Returns the number of bytes read.
|
||||
/// Throws an exception on failure.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers)
|
||||
{
|
||||
if (storage_.empty())
|
||||
fill();
|
||||
@ -315,8 +317,8 @@ public:
|
||||
|
||||
/// Peek at the incoming data on the stream. Returns the number of bytes read,
|
||||
/// or 0 if an error occurred.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
ec = asio::error_code();
|
||||
@ -341,16 +343,16 @@ public:
|
||||
private:
|
||||
/// Copy data out of the internal buffer to the specified target buffer.
|
||||
/// Returns the number of bytes copied.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t copy(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t copy(const MutableBufferSequence& buffers)
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
|
||||
std::size_t bytes_avail = storage_.size();
|
||||
std::size_t bytes_copied = 0;
|
||||
|
||||
typename Mutable_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers.end();
|
||||
for (; iter != end && bytes_avail > 0; ++iter)
|
||||
{
|
||||
std::size_t max_length = buffer_size(*iter);
|
||||
@ -368,16 +370,16 @@ private:
|
||||
/// Copy data from the internal buffer to the specified target buffer, without
|
||||
/// removing the data from the internal buffer. Returns the number of bytes
|
||||
/// copied.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek_copy(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek_copy(const MutableBufferSequence& buffers)
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
|
||||
std::size_t bytes_avail = storage_.size();
|
||||
std::size_t bytes_copied = 0;
|
||||
|
||||
typename Mutable_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers.end();
|
||||
for (; iter != end && bytes_avail > 0; ++iter)
|
||||
{
|
||||
std::size_t max_length = buffer_size(*iter);
|
||||
|
@ -41,8 +41,7 @@ namespace asio {
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* Async_Object, Async_Read_Stream, Async_Write_Stream, Stream,
|
||||
* Sync_Read_Stream, Sync_Write_Stream.
|
||||
* AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream.
|
||||
*/
|
||||
template <typename Stream>
|
||||
class buffered_stream
|
||||
@ -119,24 +118,24 @@ public:
|
||||
}
|
||||
|
||||
/// Start an asynchronous flush.
|
||||
template <typename Handler>
|
||||
void async_flush(Handler handler)
|
||||
template <typename WriteHandler>
|
||||
void async_flush(WriteHandler handler)
|
||||
{
|
||||
return stream_impl_.next_layer().async_flush(handler);
|
||||
}
|
||||
|
||||
/// Write the given data to the stream. Returns the number of bytes written.
|
||||
/// Throws an exception on failure.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers)
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers)
|
||||
{
|
||||
return stream_impl_.write_some(buffers);
|
||||
}
|
||||
|
||||
/// Write the given data to the stream. Returns the number of bytes written,
|
||||
/// or 0 if an error occurred.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return stream_impl_.write_some(buffers, ec);
|
||||
@ -144,8 +143,9 @@ public:
|
||||
|
||||
/// Start an asynchronous write. The data being written must be valid for the
|
||||
/// lifetime of the asynchronous operation.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_write_some(const Const_Buffers& buffers, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_write_some(const ConstBufferSequence& buffers,
|
||||
WriteHandler handler)
|
||||
{
|
||||
stream_impl_.async_write_some(buffers, handler);
|
||||
}
|
||||
@ -165,24 +165,24 @@ public:
|
||||
}
|
||||
|
||||
/// Start an asynchronous fill.
|
||||
template <typename Handler>
|
||||
void async_fill(Handler handler)
|
||||
template <typename ReadHandler>
|
||||
void async_fill(ReadHandler handler)
|
||||
{
|
||||
stream_impl_.async_fill(handler);
|
||||
}
|
||||
|
||||
/// Read some data from the stream. Returns the number of bytes read. Throws
|
||||
/// an exception on failure.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers)
|
||||
{
|
||||
return stream_impl_.read_some(buffers);
|
||||
}
|
||||
|
||||
/// Read some data from the stream. Returns the number of bytes read or 0 if
|
||||
/// an error occurred.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return stream_impl_.read_some(buffers, ec);
|
||||
@ -190,24 +190,25 @@ public:
|
||||
|
||||
/// Start an asynchronous read. The buffer into which the data will be read
|
||||
/// must be valid for the lifetime of the asynchronous operation.
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_read_some(const MutableBufferSequence& buffers,
|
||||
ReadHandler handler)
|
||||
{
|
||||
stream_impl_.async_read_some(buffers, handler);
|
||||
}
|
||||
|
||||
/// Peek at the incoming data on the stream. Returns the number of bytes read.
|
||||
/// Throws an exception on failure.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers)
|
||||
{
|
||||
return stream_impl_.peek(buffers);
|
||||
}
|
||||
|
||||
/// Peek at the incoming data on the stream. Returns the number of bytes read,
|
||||
/// or 0 if an error occurred.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return stream_impl_.peek(buffers, ec);
|
||||
|
@ -46,8 +46,7 @@ namespace asio {
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* Async_Read_Stream, Async_Write_Stream, Stream, Sync_Read_Stream,
|
||||
* Sync_Write_Stream.
|
||||
* AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream.
|
||||
*/
|
||||
template <typename Stream>
|
||||
class buffered_write_stream
|
||||
@ -136,12 +135,12 @@ public:
|
||||
return bytes_written;
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
template <typename WriteHandler>
|
||||
class flush_handler
|
||||
{
|
||||
public:
|
||||
flush_handler(asio::io_service& io_service,
|
||||
detail::buffered_stream_storage& storage, Handler handler)
|
||||
detail::buffered_stream_storage& storage, WriteHandler handler)
|
||||
: io_service_(io_service),
|
||||
storage_(storage),
|
||||
handler_(handler)
|
||||
@ -158,21 +157,21 @@ public:
|
||||
private:
|
||||
asio::io_service& io_service_;
|
||||
detail::buffered_stream_storage& storage_;
|
||||
Handler handler_;
|
||||
WriteHandler handler_;
|
||||
};
|
||||
|
||||
/// Start an asynchronous flush.
|
||||
template <typename Handler>
|
||||
void async_flush(Handler handler)
|
||||
template <typename WriteHandler>
|
||||
void async_flush(WriteHandler handler)
|
||||
{
|
||||
async_write(next_layer_, buffer(storage_.data(), storage_.size()),
|
||||
flush_handler<Handler>(io_service(), storage_, handler));
|
||||
flush_handler<WriteHandler>(io_service(), storage_, handler));
|
||||
}
|
||||
|
||||
/// Write the given data to the stream. Returns the number of bytes written.
|
||||
/// Throws an exception on failure.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers)
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers)
|
||||
{
|
||||
if (storage_.size() == storage_.capacity())
|
||||
flush();
|
||||
@ -181,8 +180,8 @@ public:
|
||||
|
||||
/// Write the given data to the stream. Returns the number of bytes written,
|
||||
/// or 0 if an error occurred and the error handler did not throw.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
ec = asio::error_code();
|
||||
@ -191,13 +190,13 @@ public:
|
||||
return copy(buffers);
|
||||
}
|
||||
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
class write_some_handler
|
||||
{
|
||||
public:
|
||||
write_some_handler(asio::io_service& io_service,
|
||||
detail::buffered_stream_storage& storage,
|
||||
const Const_Buffers& buffers, Handler handler)
|
||||
const ConstBufferSequence& buffers, WriteHandler handler)
|
||||
: io_service_(io_service),
|
||||
storage_(storage),
|
||||
buffers_(buffers),
|
||||
@ -220,8 +219,8 @@ public:
|
||||
std::size_t space_avail = storage_.capacity() - orig_size;
|
||||
std::size_t bytes_copied = 0;
|
||||
|
||||
typename Const_Buffers::const_iterator iter = buffers_.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers_.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers_.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers_.end();
|
||||
for (; iter != end && space_avail > 0; ++iter)
|
||||
{
|
||||
std::size_t bytes_avail = buffer_size(*iter);
|
||||
@ -241,18 +240,19 @@ public:
|
||||
private:
|
||||
asio::io_service& io_service_;
|
||||
detail::buffered_stream_storage& storage_;
|
||||
Const_Buffers buffers_;
|
||||
Handler handler_;
|
||||
ConstBufferSequence buffers_;
|
||||
WriteHandler handler_;
|
||||
};
|
||||
|
||||
/// Start an asynchronous write. The data being written must be valid for the
|
||||
/// lifetime of the asynchronous operation.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_write_some(const Const_Buffers& buffers, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_write_some(const ConstBufferSequence& buffers,
|
||||
WriteHandler handler)
|
||||
{
|
||||
if (storage_.size() == storage_.capacity())
|
||||
{
|
||||
async_flush(write_some_handler<Const_Buffers, Handler>(
|
||||
async_flush(write_some_handler<ConstBufferSequence, WriteHandler>(
|
||||
io_service(), storage_, buffers, handler));
|
||||
}
|
||||
else
|
||||
@ -265,16 +265,16 @@ public:
|
||||
|
||||
/// Read some data from the stream. Returns the number of bytes read. Throws
|
||||
/// an exception on failure.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers)
|
||||
{
|
||||
return next_layer_.read_some(buffers);
|
||||
}
|
||||
|
||||
/// Read some data from the stream. Returns the number of bytes read or 0 if
|
||||
/// an error occurred.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return next_layer_.read_some(buffers, ec);
|
||||
@ -282,24 +282,25 @@ public:
|
||||
|
||||
/// Start an asynchronous read. The buffer into which the data will be read
|
||||
/// must be valid for the lifetime of the asynchronous operation.
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_read_some(const MutableBufferSequence& buffers,
|
||||
ReadHandler handler)
|
||||
{
|
||||
next_layer_.async_read_some(buffers, handler);
|
||||
}
|
||||
|
||||
/// Peek at the incoming data on the stream. Returns the number of bytes read.
|
||||
/// Throws an exception on failure.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers)
|
||||
{
|
||||
return next_layer_.peek(buffers);
|
||||
}
|
||||
|
||||
/// Peek at the incoming data on the stream. Returns the number of bytes read,
|
||||
/// or 0 if an error occurred.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return next_layer_.peek(buffers, ec);
|
||||
@ -320,8 +321,8 @@ public:
|
||||
private:
|
||||
/// Copy data into the internal buffer from the specified source buffer.
|
||||
/// Returns the number of bytes copied.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t copy(const Const_Buffers& buffers)
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t copy(const ConstBufferSequence& buffers)
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
|
||||
@ -329,8 +330,8 @@ private:
|
||||
std::size_t space_avail = storage_.capacity() - orig_size;
|
||||
std::size_t bytes_copied = 0;
|
||||
|
||||
typename Const_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers.end();
|
||||
for (; iter != end && space_avail > 0; ++iter)
|
||||
{
|
||||
std::size_t bytes_avail = buffer_size(*iter);
|
||||
|
@ -152,33 +152,33 @@ public:
|
||||
}
|
||||
|
||||
/// Start an asynchronous connect.
|
||||
template <typename Handler>
|
||||
template <typename ConnectHandler>
|
||||
void async_connect(implementation_type& impl,
|
||||
const endpoint_type& peer_endpoint, Handler handler)
|
||||
const endpoint_type& peer_endpoint, ConnectHandler handler)
|
||||
{
|
||||
service_impl_.async_connect(impl, peer_endpoint, handler);
|
||||
}
|
||||
|
||||
/// Set a socket option.
|
||||
template <typename Option>
|
||||
template <typename SettableSocketOption>
|
||||
asio::error_code set_option(implementation_type& impl,
|
||||
const Option& option, asio::error_code& ec)
|
||||
const SettableSocketOption& option, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.set_option(impl, option, ec);
|
||||
}
|
||||
|
||||
/// Get a socket option.
|
||||
template <typename Option>
|
||||
template <typename GettableSocketOption>
|
||||
asio::error_code get_option(const implementation_type& impl,
|
||||
Option& option, asio::error_code& ec) const
|
||||
GettableSocketOption& option, asio::error_code& ec) const
|
||||
{
|
||||
return service_impl_.get_option(impl, option, ec);
|
||||
}
|
||||
|
||||
/// Perform an IO control command on the socket.
|
||||
template <typename IO_Control_Command>
|
||||
template <typename IoControlCommand>
|
||||
asio::error_code io_control(implementation_type& impl,
|
||||
IO_Control_Command& command, asio::error_code& ec)
|
||||
IoControlCommand& command, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.io_control(impl, command, ec);
|
||||
}
|
||||
@ -205,59 +205,62 @@ public:
|
||||
}
|
||||
|
||||
/// Send the given data to the peer.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send(implementation_type& impl, const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send(implementation_type& impl,
|
||||
const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.send(impl, buffers, flags, ec);
|
||||
}
|
||||
|
||||
/// Start an asynchronous send.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send(implementation_type& impl, const Const_Buffers& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_send(implementation_type& impl, const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, WriteHandler handler)
|
||||
{
|
||||
service_impl_.async_send(impl, buffers, flags, handler);
|
||||
}
|
||||
|
||||
/// Send a datagram to the specified endpoint.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send_to(implementation_type& impl, const Const_Buffers& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
asio::error_code& ec)
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send_to(implementation_type& impl,
|
||||
const ConstBufferSequence& buffers, const endpoint_type& destination,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.send_to(impl, buffers, destination, flags, ec);
|
||||
}
|
||||
|
||||
/// Start an asynchronous send.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send_to(implementation_type& impl, const Const_Buffers& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_send_to(implementation_type& impl,
|
||||
const ConstBufferSequence& buffers, const endpoint_type& destination,
|
||||
socket_base::message_flags flags, WriteHandler handler)
|
||||
{
|
||||
service_impl_.async_send_to(impl, buffers, destination, flags, handler);
|
||||
}
|
||||
|
||||
/// Receive some data from the peer.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.receive(impl, buffers, flags, ec);
|
||||
}
|
||||
|
||||
/// Start an asynchronous receive.
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_receive(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, ReadHandler handler)
|
||||
{
|
||||
service_impl_.async_receive(impl, buffers, flags, handler);
|
||||
}
|
||||
|
||||
/// Receive a datagram with the endpoint of the sender.
|
||||
template <typename Mutable_Buffers>
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive_from(implementation_type& impl,
|
||||
const Mutable_Buffers& buffers, endpoint_type& sender_endpoint,
|
||||
const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.receive_from(impl, buffers, sender_endpoint, flags,
|
||||
@ -265,10 +268,10 @@ public:
|
||||
}
|
||||
|
||||
/// Start an asynchronous receive that will get the endpoint of the sender.
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_receive_from(implementation_type& impl,
|
||||
const Mutable_Buffers& buffers, endpoint_type& sender_endpoint,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
|
||||
socket_base::message_flags flags, ReadHandler handler)
|
||||
{
|
||||
service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags,
|
||||
handler);
|
||||
|
@ -134,8 +134,8 @@ public:
|
||||
}
|
||||
|
||||
// Start an asynchronous wait on the timer.
|
||||
template <typename Handler>
|
||||
void async_wait(implementation_type& impl, Handler handler)
|
||||
template <typename WaitHandler>
|
||||
void async_wait(implementation_type& impl, WaitHandler handler)
|
||||
{
|
||||
service_impl_.async_wait(impl, handler);
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ namespace asio {
|
||||
namespace detail {
|
||||
|
||||
// A proxy iterator for a sub-range in a list of buffers.
|
||||
template <typename Const_Buffers>
|
||||
template <typename ConstBufferSequence>
|
||||
class const_buffers_iterator
|
||||
: public boost::iterator_facade<const_buffers_iterator<Const_Buffers>,
|
||||
: public boost::iterator_facade<const_buffers_iterator<ConstBufferSequence>,
|
||||
const char, boost::bidirectional_traversal_tag>
|
||||
{
|
||||
public:
|
||||
@ -41,7 +41,8 @@ public:
|
||||
}
|
||||
|
||||
// Create an iterator for the specified position.
|
||||
const_buffers_iterator(const Const_Buffers& buffers, std::size_t position)
|
||||
const_buffers_iterator(const ConstBufferSequence& buffers,
|
||||
std::size_t position)
|
||||
: begin_(buffers.begin()),
|
||||
current_(buffers.begin()),
|
||||
end_(buffers.end()),
|
||||
@ -107,7 +108,7 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
typename Const_Buffers::const_iterator iter = current_;
|
||||
typename ConstBufferSequence::const_iterator iter = current_;
|
||||
while (iter != begin_)
|
||||
{
|
||||
--iter;
|
||||
@ -136,9 +137,9 @@ private:
|
||||
|
||||
asio::const_buffer current_buffer_;
|
||||
std::size_t current_buffer_position_;
|
||||
typename Const_Buffers::const_iterator begin_;
|
||||
typename Const_Buffers::const_iterator current_;
|
||||
typename Const_Buffers::const_iterator end_;
|
||||
typename ConstBufferSequence::const_iterator begin_;
|
||||
typename ConstBufferSequence::const_iterator current_;
|
||||
typename ConstBufferSequence::const_iterator end_;
|
||||
std::size_t position_;
|
||||
};
|
||||
|
||||
|
@ -372,14 +372,14 @@ public:
|
||||
}
|
||||
|
||||
// Send the given data to the peer.
|
||||
template <typename Const_Buffers>
|
||||
size_t send(implementation_type& impl, const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
size_t send(implementation_type& impl, const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
// Copy buffers into array.
|
||||
socket_ops::buf bufs[max_buffers];
|
||||
typename Const_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers.end();
|
||||
size_t i = 0;
|
||||
size_t total_buffer_size = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
@ -420,12 +420,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
template <typename ConstBufferSequence, typename Handler>
|
||||
class send_handler
|
||||
{
|
||||
public:
|
||||
send_handler(socket_type socket, asio::io_service& io_service,
|
||||
const Const_Buffers& buffers, socket_base::message_flags flags,
|
||||
const ConstBufferSequence& buffers, socket_base::message_flags flags,
|
||||
Handler handler)
|
||||
: socket_(socket),
|
||||
io_service_(io_service),
|
||||
@ -447,8 +447,8 @@ public:
|
||||
|
||||
// Copy buffers into array.
|
||||
socket_ops::buf bufs[max_buffers];
|
||||
typename Const_Buffers::const_iterator iter = buffers_.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers_.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers_.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers_.end();
|
||||
size_t i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
@ -475,15 +475,15 @@ public:
|
||||
socket_type socket_;
|
||||
asio::io_service& io_service_;
|
||||
asio::io_service::work work_;
|
||||
Const_Buffers buffers_;
|
||||
ConstBufferSequence buffers_;
|
||||
socket_base::message_flags flags_;
|
||||
Handler handler_;
|
||||
};
|
||||
|
||||
// Start an asynchronous send. The data being sent must be valid for the
|
||||
// lifetime of the asynchronous operation.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send(implementation_type& impl, const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence, typename Handler>
|
||||
void async_send(implementation_type& impl, const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
{
|
||||
if (impl.socket_ == invalid_socket)
|
||||
@ -496,8 +496,8 @@ public:
|
||||
if (impl.protocol_.type() == SOCK_STREAM)
|
||||
{
|
||||
// Determine total size of buffers.
|
||||
typename Const_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers.end();
|
||||
size_t i = 0;
|
||||
size_t total_buffer_size = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
@ -529,22 +529,22 @@ public:
|
||||
}
|
||||
|
||||
reactor_.start_write_op(impl.socket_,
|
||||
send_handler<Const_Buffers, Handler>(
|
||||
send_handler<ConstBufferSequence, Handler>(
|
||||
impl.socket_, io_service(), buffers, flags, handler));
|
||||
}
|
||||
}
|
||||
|
||||
// Send a datagram to the specified endpoint. Returns the number of bytes
|
||||
// sent.
|
||||
template <typename Const_Buffers>
|
||||
size_t send_to(implementation_type& impl, const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
size_t send_to(implementation_type& impl, const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
// Copy buffers into array.
|
||||
socket_ops::buf bufs[max_buffers];
|
||||
typename Const_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers.end();
|
||||
size_t i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
@ -577,12 +577,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
template <typename ConstBufferSequence, typename Handler>
|
||||
class send_to_handler
|
||||
{
|
||||
public:
|
||||
send_to_handler(socket_type socket, asio::io_service& io_service,
|
||||
const Const_Buffers& buffers, const endpoint_type& endpoint,
|
||||
const ConstBufferSequence& buffers, const endpoint_type& endpoint,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
: socket_(socket),
|
||||
io_service_(io_service),
|
||||
@ -605,8 +605,8 @@ public:
|
||||
|
||||
// Copy buffers into array.
|
||||
socket_ops::buf bufs[max_buffers];
|
||||
typename Const_Buffers::const_iterator iter = buffers_.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers_.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers_.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers_.end();
|
||||
size_t i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
@ -634,7 +634,7 @@ public:
|
||||
socket_type socket_;
|
||||
asio::io_service& io_service_;
|
||||
asio::io_service::work work_;
|
||||
Const_Buffers buffers_;
|
||||
ConstBufferSequence buffers_;
|
||||
endpoint_type destination_;
|
||||
socket_base::message_flags flags_;
|
||||
Handler handler_;
|
||||
@ -642,8 +642,9 @@ public:
|
||||
|
||||
// Start an asynchronous send. The data being sent must be valid for the
|
||||
// lifetime of the asynchronous operation.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send_to(implementation_type& impl, const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence, typename Handler>
|
||||
void async_send_to(implementation_type& impl,
|
||||
const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
Handler handler)
|
||||
{
|
||||
@ -668,20 +669,21 @@ public:
|
||||
}
|
||||
|
||||
reactor_.start_write_op(impl.socket_,
|
||||
send_to_handler<Const_Buffers, Handler>(
|
||||
send_to_handler<ConstBufferSequence, Handler>(
|
||||
impl.socket_, io_service(), buffers, destination, flags, handler));
|
||||
}
|
||||
}
|
||||
|
||||
// Receive some data from the peer. Returns the number of bytes received.
|
||||
template <typename Mutable_Buffers>
|
||||
size_t receive(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
size_t receive(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
// Copy buffers into array.
|
||||
socket_ops::buf bufs[max_buffers];
|
||||
typename Mutable_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers.end();
|
||||
size_t i = 0;
|
||||
size_t total_buffer_size = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
@ -729,12 +731,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
template <typename MutableBufferSequence, typename Handler>
|
||||
class receive_handler
|
||||
{
|
||||
public:
|
||||
receive_handler(socket_type socket, asio::io_service& io_service,
|
||||
const Mutable_Buffers& buffers, socket_base::message_flags flags,
|
||||
const MutableBufferSequence& buffers, socket_base::message_flags flags,
|
||||
Handler handler)
|
||||
: socket_(socket),
|
||||
io_service_(io_service),
|
||||
@ -756,8 +758,8 @@ public:
|
||||
|
||||
// Copy buffers into array.
|
||||
socket_ops::buf bufs[max_buffers];
|
||||
typename Mutable_Buffers::const_iterator iter = buffers_.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers_.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers_.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers_.end();
|
||||
size_t i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
@ -786,15 +788,16 @@ public:
|
||||
socket_type socket_;
|
||||
asio::io_service& io_service_;
|
||||
asio::io_service::work work_;
|
||||
Mutable_Buffers buffers_;
|
||||
MutableBufferSequence buffers_;
|
||||
socket_base::message_flags flags_;
|
||||
Handler handler_;
|
||||
};
|
||||
|
||||
// Start an asynchronous receive. The buffer for the data being received
|
||||
// must be valid for the lifetime of the asynchronous operation.
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence, typename Handler>
|
||||
void async_receive(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
{
|
||||
if (impl.socket_ == invalid_socket)
|
||||
@ -807,8 +810,8 @@ public:
|
||||
if (impl.protocol_.type() == SOCK_STREAM)
|
||||
{
|
||||
// Determine total size of buffers.
|
||||
typename Mutable_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers.end();
|
||||
size_t i = 0;
|
||||
size_t total_buffer_size = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
@ -842,13 +845,13 @@ public:
|
||||
if (flags & socket_base::message_out_of_band)
|
||||
{
|
||||
reactor_.start_except_op(impl.socket_,
|
||||
receive_handler<Mutable_Buffers, Handler>(
|
||||
receive_handler<MutableBufferSequence, Handler>(
|
||||
impl.socket_, io_service(), buffers, flags, handler));
|
||||
}
|
||||
else
|
||||
{
|
||||
reactor_.start_read_op(impl.socket_,
|
||||
receive_handler<Mutable_Buffers, Handler>(
|
||||
receive_handler<MutableBufferSequence, Handler>(
|
||||
impl.socket_, io_service(), buffers, flags, handler));
|
||||
}
|
||||
}
|
||||
@ -856,15 +859,16 @@ public:
|
||||
|
||||
// Receive a datagram with the endpoint of the sender. Returns the number of
|
||||
// bytes received.
|
||||
template <typename Mutable_Buffers>
|
||||
size_t receive_from(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
size_t receive_from(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint, socket_base::message_flags flags,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
// Copy buffers into array.
|
||||
socket_ops::buf bufs[max_buffers];
|
||||
typename Mutable_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers.end();
|
||||
size_t i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
@ -908,14 +912,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
template <typename MutableBufferSequence, typename Handler>
|
||||
class receive_from_handler
|
||||
{
|
||||
public:
|
||||
receive_from_handler(socket_type socket,
|
||||
asio::io_service& io_service, const Mutable_Buffers& buffers,
|
||||
endpoint_type& endpoint, socket_base::message_flags flags,
|
||||
Handler handler)
|
||||
asio::io_service& io_service,
|
||||
const MutableBufferSequence& buffers, endpoint_type& endpoint,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
: socket_(socket),
|
||||
io_service_(io_service),
|
||||
work_(io_service),
|
||||
@ -937,8 +941,8 @@ public:
|
||||
|
||||
// Copy buffers into array.
|
||||
socket_ops::buf bufs[max_buffers];
|
||||
typename Mutable_Buffers::const_iterator iter = buffers_.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers_.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers_.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers_.end();
|
||||
size_t i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
@ -970,7 +974,7 @@ public:
|
||||
socket_type socket_;
|
||||
asio::io_service& io_service_;
|
||||
asio::io_service::work work_;
|
||||
Mutable_Buffers buffers_;
|
||||
MutableBufferSequence buffers_;
|
||||
endpoint_type& sender_endpoint_;
|
||||
socket_base::message_flags flags_;
|
||||
Handler handler_;
|
||||
@ -979,9 +983,9 @@ public:
|
||||
// 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 Mutable_Buffers, typename Handler>
|
||||
template <typename MutableBufferSequence, typename Handler>
|
||||
void async_receive_from(implementation_type& impl,
|
||||
const Mutable_Buffers& buffers, endpoint_type& sender_endpoint,
|
||||
const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
{
|
||||
if (impl.socket_ == invalid_socket)
|
||||
@ -1005,7 +1009,7 @@ public:
|
||||
}
|
||||
|
||||
reactor_.start_read_op(impl.socket_,
|
||||
receive_from_handler<Mutable_Buffers, Handler>(
|
||||
receive_from_handler<MutableBufferSequence, Handler>(
|
||||
impl.socket_, io_service(), buffers,
|
||||
sender_endpoint, flags, handler));
|
||||
}
|
||||
|
@ -516,14 +516,14 @@ public:
|
||||
}
|
||||
|
||||
// Send the given data to the peer. Returns the number of bytes sent.
|
||||
template <typename Const_Buffers>
|
||||
size_t send(implementation_type& impl, const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
size_t send(implementation_type& impl, const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
// Copy buffers into WSABUF array.
|
||||
::WSABUF bufs[max_buffers];
|
||||
typename Const_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers.end();
|
||||
DWORD i = 0;
|
||||
size_t total_buffer_size = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
@ -561,17 +561,17 @@ public:
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
template <typename ConstBufferSequence, typename Handler>
|
||||
class send_operation
|
||||
: public operation
|
||||
{
|
||||
public:
|
||||
send_operation(asio::io_service& io_service,
|
||||
weak_cancel_token_type cancel_token,
|
||||
const Const_Buffers& buffers, Handler handler)
|
||||
const ConstBufferSequence& buffers, Handler handler)
|
||||
: operation(
|
||||
&send_operation<Const_Buffers, Handler>::do_completion_impl,
|
||||
&send_operation<Const_Buffers, Handler>::destroy_impl),
|
||||
&send_operation<ConstBufferSequence, Handler>::do_completion_impl,
|
||||
&send_operation<ConstBufferSequence, Handler>::destroy_impl),
|
||||
work_(io_service),
|
||||
cancel_token_(cancel_token),
|
||||
buffers_(buffers),
|
||||
@ -584,16 +584,16 @@ public:
|
||||
DWORD last_error, size_t bytes_transferred)
|
||||
{
|
||||
// Take ownership of the operation object.
|
||||
typedef send_operation<Const_Buffers, Handler> op_type;
|
||||
typedef send_operation<ConstBufferSequence, Handler> op_type;
|
||||
op_type* handler_op(static_cast<op_type*>(op));
|
||||
typedef handler_alloc_traits<Handler, op_type> alloc_traits;
|
||||
handler_ptr<alloc_traits> ptr(handler_op->handler_, handler_op);
|
||||
|
||||
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
// Check whether buffers are still valid.
|
||||
typename Const_Buffers::const_iterator iter
|
||||
typename ConstBufferSequence::const_iterator iter
|
||||
= handler_op->buffers_.begin();
|
||||
typename Const_Buffers::const_iterator end
|
||||
typename ConstBufferSequence::const_iterator end
|
||||
= handler_op->buffers_.end();
|
||||
while (iter != end)
|
||||
{
|
||||
@ -632,7 +632,7 @@ public:
|
||||
static void destroy_impl(operation* op)
|
||||
{
|
||||
// Take ownership of the operation object.
|
||||
typedef send_operation<Const_Buffers, Handler> op_type;
|
||||
typedef send_operation<ConstBufferSequence, Handler> op_type;
|
||||
op_type* handler_op(static_cast<op_type*>(op));
|
||||
typedef handler_alloc_traits<Handler, op_type> alloc_traits;
|
||||
handler_ptr<alloc_traits> ptr(handler_op->handler_, handler_op);
|
||||
@ -640,14 +640,14 @@ public:
|
||||
|
||||
asio::io_service::work work_;
|
||||
weak_cancel_token_type cancel_token_;
|
||||
Const_Buffers buffers_;
|
||||
ConstBufferSequence buffers_;
|
||||
Handler handler_;
|
||||
};
|
||||
|
||||
// Start an asynchronous send. The data being sent must be valid for the
|
||||
// lifetime of the asynchronous operation.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send(implementation_type& impl, const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence, typename Handler>
|
||||
void async_send(implementation_type& impl, const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
{
|
||||
// Update the ID of the thread from which cancellation is safe.
|
||||
@ -657,7 +657,7 @@ public:
|
||||
impl.safe_cancellation_thread_id_ = ~DWORD(0);
|
||||
|
||||
// Allocate and construct an operation to wrap the handler.
|
||||
typedef send_operation<Const_Buffers, Handler> value_type;
|
||||
typedef send_operation<ConstBufferSequence, Handler> value_type;
|
||||
typedef handler_alloc_traits<Handler, value_type> alloc_traits;
|
||||
raw_handler_ptr<alloc_traits> raw_ptr(handler);
|
||||
handler_ptr<alloc_traits> ptr(raw_ptr,
|
||||
@ -665,8 +665,8 @@ public:
|
||||
|
||||
// Copy buffers into WSABUF array.
|
||||
::WSABUF bufs[max_buffers];
|
||||
typename Const_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers.end();
|
||||
DWORD i = 0;
|
||||
size_t total_buffer_size = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
@ -708,15 +708,15 @@ public:
|
||||
|
||||
// Send a datagram to the specified endpoint. Returns the number of bytes
|
||||
// sent.
|
||||
template <typename Const_Buffers>
|
||||
size_t send_to(implementation_type& impl, const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
size_t send_to(implementation_type& impl, const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
// Copy buffers into WSABUF array.
|
||||
::WSABUF bufs[max_buffers];
|
||||
typename Const_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers.end();
|
||||
DWORD i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
@ -743,16 +743,16 @@ public:
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
template <typename ConstBufferSequence, typename Handler>
|
||||
class send_to_operation
|
||||
: public operation
|
||||
{
|
||||
public:
|
||||
send_to_operation(asio::io_service& io_service,
|
||||
const Const_Buffers& buffers, Handler handler)
|
||||
const ConstBufferSequence& buffers, Handler handler)
|
||||
: operation(
|
||||
&send_to_operation<Const_Buffers, Handler>::do_completion_impl,
|
||||
&send_to_operation<Const_Buffers, Handler>::destroy_impl),
|
||||
&send_to_operation<ConstBufferSequence, Handler>::do_completion_impl,
|
||||
&send_to_operation<ConstBufferSequence, Handler>::destroy_impl),
|
||||
work_(io_service),
|
||||
buffers_(buffers),
|
||||
handler_(handler)
|
||||
@ -764,16 +764,16 @@ public:
|
||||
DWORD last_error, size_t bytes_transferred)
|
||||
{
|
||||
// Take ownership of the operation object.
|
||||
typedef send_to_operation<Const_Buffers, Handler> op_type;
|
||||
typedef send_to_operation<ConstBufferSequence, Handler> op_type;
|
||||
op_type* handler_op(static_cast<op_type*>(op));
|
||||
typedef handler_alloc_traits<Handler, op_type> alloc_traits;
|
||||
handler_ptr<alloc_traits> ptr(handler_op->handler_, handler_op);
|
||||
|
||||
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
// Check whether buffers are still valid.
|
||||
typename Const_Buffers::const_iterator iter
|
||||
typename ConstBufferSequence::const_iterator iter
|
||||
= handler_op->buffers_.begin();
|
||||
typename Const_Buffers::const_iterator end
|
||||
typename ConstBufferSequence::const_iterator end
|
||||
= handler_op->buffers_.end();
|
||||
while (iter != end)
|
||||
{
|
||||
@ -805,23 +805,23 @@ public:
|
||||
static void destroy_impl(operation* op)
|
||||
{
|
||||
// Take ownership of the operation object.
|
||||
typedef send_to_operation<Const_Buffers, Handler> op_type;
|
||||
typedef send_to_operation<ConstBufferSequence, Handler> op_type;
|
||||
op_type* handler_op(static_cast<op_type*>(op));
|
||||
typedef handler_alloc_traits<Handler, op_type> alloc_traits;
|
||||
handler_ptr<alloc_traits> ptr(handler_op->handler_, handler_op);
|
||||
}
|
||||
|
||||
asio::io_service::work work_;
|
||||
Const_Buffers buffers_;
|
||||
ConstBufferSequence buffers_;
|
||||
Handler handler_;
|
||||
};
|
||||
|
||||
// Start an asynchronous send. The data being sent must be valid for the
|
||||
// lifetime of the asynchronous operation.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send_to(implementation_type& impl, const Const_Buffers& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
Handler handler)
|
||||
template <typename ConstBufferSequence, typename Handler>
|
||||
void async_send_to(implementation_type& impl,
|
||||
const ConstBufferSequence& buffers, const endpoint_type& destination,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
{
|
||||
// Update the ID of the thread from which cancellation is safe.
|
||||
if (impl.safe_cancellation_thread_id_ == 0)
|
||||
@ -830,15 +830,15 @@ public:
|
||||
impl.safe_cancellation_thread_id_ = ~DWORD(0);
|
||||
|
||||
// Allocate and construct an operation to wrap the handler.
|
||||
typedef send_to_operation<Const_Buffers, Handler> value_type;
|
||||
typedef send_to_operation<ConstBufferSequence, Handler> value_type;
|
||||
typedef handler_alloc_traits<Handler, value_type> alloc_traits;
|
||||
raw_handler_ptr<alloc_traits> raw_ptr(handler);
|
||||
handler_ptr<alloc_traits> ptr(raw_ptr, io_service(), buffers, handler);
|
||||
|
||||
// Copy buffers into WSABUF array.
|
||||
::WSABUF bufs[max_buffers];
|
||||
typename Const_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Const_Buffers::const_iterator end = buffers.end();
|
||||
typename ConstBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename ConstBufferSequence::const_iterator end = buffers.end();
|
||||
DWORD i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
@ -868,14 +868,15 @@ public:
|
||||
}
|
||||
|
||||
// Receive some data from the peer. Returns the number of bytes received.
|
||||
template <typename Mutable_Buffers>
|
||||
size_t receive(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
size_t receive(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
// Copy buffers into WSABUF array.
|
||||
::WSABUF bufs[max_buffers];
|
||||
typename Mutable_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers.end();
|
||||
DWORD i = 0;
|
||||
size_t total_buffer_size = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
@ -918,17 +919,19 @@ public:
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
template <typename MutableBufferSequence, typename Handler>
|
||||
class receive_operation
|
||||
: public operation
|
||||
{
|
||||
public:
|
||||
receive_operation(asio::io_service& io_service,
|
||||
weak_cancel_token_type cancel_token,
|
||||
const Mutable_Buffers& buffers, Handler handler)
|
||||
const MutableBufferSequence& buffers, Handler handler)
|
||||
: operation(
|
||||
&receive_operation<Mutable_Buffers, Handler>::do_completion_impl,
|
||||
&receive_operation<Mutable_Buffers, Handler>::destroy_impl),
|
||||
&receive_operation<
|
||||
MutableBufferSequence, Handler>::do_completion_impl,
|
||||
&receive_operation<
|
||||
MutableBufferSequence, Handler>::destroy_impl),
|
||||
work_(io_service),
|
||||
cancel_token_(cancel_token),
|
||||
buffers_(buffers),
|
||||
@ -941,16 +944,16 @@ public:
|
||||
DWORD last_error, size_t bytes_transferred)
|
||||
{
|
||||
// Take ownership of the operation object.
|
||||
typedef receive_operation<Mutable_Buffers, Handler> op_type;
|
||||
typedef receive_operation<MutableBufferSequence, Handler> op_type;
|
||||
op_type* handler_op(static_cast<op_type*>(op));
|
||||
typedef handler_alloc_traits<Handler, op_type> alloc_traits;
|
||||
handler_ptr<alloc_traits> ptr(handler_op->handler_, handler_op);
|
||||
|
||||
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
// Check whether buffers are still valid.
|
||||
typename Mutable_Buffers::const_iterator iter
|
||||
typename MutableBufferSequence::const_iterator iter
|
||||
= handler_op->buffers_.begin();
|
||||
typename Mutable_Buffers::const_iterator end
|
||||
typename MutableBufferSequence::const_iterator end
|
||||
= handler_op->buffers_.end();
|
||||
while (iter != end)
|
||||
{
|
||||
@ -995,7 +998,7 @@ public:
|
||||
static void destroy_impl(operation* op)
|
||||
{
|
||||
// Take ownership of the operation object.
|
||||
typedef receive_operation<Mutable_Buffers, Handler> op_type;
|
||||
typedef receive_operation<MutableBufferSequence, Handler> op_type;
|
||||
op_type* handler_op(static_cast<op_type*>(op));
|
||||
typedef handler_alloc_traits<Handler, op_type> alloc_traits;
|
||||
handler_ptr<alloc_traits> ptr(handler_op->handler_, handler_op);
|
||||
@ -1003,14 +1006,15 @@ public:
|
||||
|
||||
asio::io_service::work work_;
|
||||
weak_cancel_token_type cancel_token_;
|
||||
Mutable_Buffers buffers_;
|
||||
MutableBufferSequence buffers_;
|
||||
Handler handler_;
|
||||
};
|
||||
|
||||
// Start an asynchronous receive. The buffer for the data being received
|
||||
// must be valid for the lifetime of the asynchronous operation.
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence, typename Handler>
|
||||
void async_receive(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
{
|
||||
// Update the ID of the thread from which cancellation is safe.
|
||||
@ -1020,7 +1024,7 @@ public:
|
||||
impl.safe_cancellation_thread_id_ = ~DWORD(0);
|
||||
|
||||
// Allocate and construct an operation to wrap the handler.
|
||||
typedef receive_operation<Mutable_Buffers, Handler> value_type;
|
||||
typedef receive_operation<MutableBufferSequence, Handler> value_type;
|
||||
typedef handler_alloc_traits<Handler, value_type> alloc_traits;
|
||||
raw_handler_ptr<alloc_traits> raw_ptr(handler);
|
||||
handler_ptr<alloc_traits> ptr(raw_ptr,
|
||||
@ -1028,8 +1032,8 @@ public:
|
||||
|
||||
// Copy buffers into WSABUF array.
|
||||
::WSABUF bufs[max_buffers];
|
||||
typename Mutable_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers.end();
|
||||
DWORD i = 0;
|
||||
size_t total_buffer_size = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
@ -1069,15 +1073,16 @@ public:
|
||||
|
||||
// Receive a datagram with the endpoint of the sender. Returns the number of
|
||||
// bytes received.
|
||||
template <typename Mutable_Buffers>
|
||||
size_t receive_from(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
size_t receive_from(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint, socket_base::message_flags flags,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
// Copy buffers into WSABUF array.
|
||||
::WSABUF bufs[max_buffers];
|
||||
typename Mutable_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers.end();
|
||||
DWORD i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
@ -1112,17 +1117,19 @@ public:
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
template <typename MutableBufferSequence, typename Handler>
|
||||
class receive_from_operation
|
||||
: public operation
|
||||
{
|
||||
public:
|
||||
receive_from_operation(asio::io_service& io_service,
|
||||
endpoint_type& endpoint, const Mutable_Buffers& buffers,
|
||||
endpoint_type& endpoint, const MutableBufferSequence& buffers,
|
||||
Handler handler)
|
||||
: operation(
|
||||
&receive_from_operation<Mutable_Buffers, Handler>::do_completion_impl,
|
||||
&receive_from_operation<Mutable_Buffers, Handler>::destroy_impl),
|
||||
&receive_from_operation<
|
||||
MutableBufferSequence, Handler>::do_completion_impl,
|
||||
&receive_from_operation<
|
||||
MutableBufferSequence, Handler>::destroy_impl),
|
||||
endpoint_(endpoint),
|
||||
endpoint_size_(endpoint.capacity()),
|
||||
work_(io_service),
|
||||
@ -1141,16 +1148,16 @@ public:
|
||||
DWORD last_error, size_t bytes_transferred)
|
||||
{
|
||||
// Take ownership of the operation object.
|
||||
typedef receive_from_operation<Mutable_Buffers, Handler> op_type;
|
||||
typedef receive_from_operation<MutableBufferSequence, Handler> op_type;
|
||||
op_type* handler_op(static_cast<op_type*>(op));
|
||||
typedef handler_alloc_traits<Handler, op_type> alloc_traits;
|
||||
handler_ptr<alloc_traits> ptr(handler_op->handler_, handler_op);
|
||||
|
||||
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
|
||||
// Check whether buffers are still valid.
|
||||
typename Mutable_Buffers::const_iterator iter
|
||||
typename MutableBufferSequence::const_iterator iter
|
||||
= handler_op->buffers_.begin();
|
||||
typename Mutable_Buffers::const_iterator end
|
||||
typename MutableBufferSequence::const_iterator end
|
||||
= handler_op->buffers_.end();
|
||||
while (iter != end)
|
||||
{
|
||||
@ -1191,7 +1198,7 @@ public:
|
||||
static void destroy_impl(operation* op)
|
||||
{
|
||||
// Take ownership of the operation object.
|
||||
typedef receive_from_operation<Mutable_Buffers, Handler> op_type;
|
||||
typedef receive_from_operation<MutableBufferSequence, Handler> op_type;
|
||||
op_type* handler_op(static_cast<op_type*>(op));
|
||||
typedef handler_alloc_traits<Handler, op_type> alloc_traits;
|
||||
handler_ptr<alloc_traits> ptr(handler_op->handler_, handler_op);
|
||||
@ -1200,16 +1207,16 @@ public:
|
||||
endpoint_type& endpoint_;
|
||||
int endpoint_size_;
|
||||
asio::io_service::work work_;
|
||||
Mutable_Buffers buffers_;
|
||||
MutableBufferSequence buffers_;
|
||||
Handler handler_;
|
||||
};
|
||||
|
||||
// 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 Mutable_Buffers, typename Handler>
|
||||
template <typename MutableBufferSequence, typename Handler>
|
||||
void async_receive_from(implementation_type& impl,
|
||||
const Mutable_Buffers& buffers, endpoint_type& sender_endp,
|
||||
const MutableBufferSequence& buffers, endpoint_type& sender_endp,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
{
|
||||
// Update the ID of the thread from which cancellation is safe.
|
||||
@ -1219,7 +1226,7 @@ public:
|
||||
impl.safe_cancellation_thread_id_ = ~DWORD(0);
|
||||
|
||||
// Allocate and construct an operation to wrap the handler.
|
||||
typedef receive_from_operation<Mutable_Buffers, Handler> value_type;
|
||||
typedef receive_from_operation<MutableBufferSequence, Handler> value_type;
|
||||
typedef handler_alloc_traits<Handler, value_type> alloc_traits;
|
||||
raw_handler_ptr<alloc_traits> raw_ptr(handler);
|
||||
handler_ptr<alloc_traits> ptr(raw_ptr,
|
||||
@ -1227,8 +1234,8 @@ public:
|
||||
|
||||
// Copy buffers into WSABUF array.
|
||||
::WSABUF bufs[max_buffers];
|
||||
typename Mutable_Buffers::const_iterator iter = buffers.begin();
|
||||
typename Mutable_Buffers::const_iterator end = buffers.end();
|
||||
typename MutableBufferSequence::const_iterator iter = buffers.begin();
|
||||
typename MutableBufferSequence::const_iterator end = buffers.end();
|
||||
DWORD i = 0;
|
||||
for (; iter != end && i < max_buffers; ++iter, ++i)
|
||||
{
|
||||
|
@ -28,13 +28,13 @@
|
||||
|
||||
namespace asio {
|
||||
|
||||
template <typename Sync_Read_Stream, typename Mutable_Buffers,
|
||||
typename Completion_Condition>
|
||||
std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
Completion_Condition completion_condition, asio::error_code& ec)
|
||||
template <typename SyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition>
|
||||
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, asio::error_code& ec)
|
||||
{
|
||||
asio::detail::consuming_buffers<
|
||||
mutable_buffer, Mutable_Buffers> tmp(buffers);
|
||||
mutable_buffer, MutableBufferSequence> tmp(buffers);
|
||||
std::size_t total_transferred = 0;
|
||||
while (tmp.begin() != tmp.end())
|
||||
{
|
||||
@ -48,8 +48,8 @@ std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
return total_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Read_Stream, typename Mutable_Buffers>
|
||||
inline std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers)
|
||||
template <typename SyncReadStream, typename MutableBufferSequence>
|
||||
inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t bytes_transferred = read(s, buffers, transfer_all(), ec);
|
||||
@ -57,10 +57,10 @@ inline std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers)
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Read_Stream, typename Mutable_Buffers,
|
||||
typename Completion_Condition>
|
||||
inline std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
Completion_Condition completion_condition)
|
||||
template <typename SyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition>
|
||||
inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t bytes_transferred = read(s, buffers, completion_condition, ec);
|
||||
@ -68,11 +68,11 @@ inline std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Read_Stream, typename Allocator,
|
||||
typename Completion_Condition>
|
||||
std::size_t read(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator,
|
||||
typename CompletionCondition>
|
||||
std::size_t read(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition, asio::error_code& ec)
|
||||
CompletionCondition completion_condition, asio::error_code& ec)
|
||||
{
|
||||
std::size_t total_transferred = 0;
|
||||
for (;;)
|
||||
@ -85,8 +85,8 @@ std::size_t read(Sync_Read_Stream& s,
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
inline std::size_t read(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
inline std::size_t read(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -95,11 +95,11 @@ inline std::size_t read(Sync_Read_Stream& s,
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Read_Stream, typename Allocator,
|
||||
typename Completion_Condition>
|
||||
inline std::size_t read(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator,
|
||||
typename CompletionCondition>
|
||||
inline std::size_t read(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition)
|
||||
CompletionCondition completion_condition)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t bytes_transferred = read(s, b, completion_condition, ec);
|
||||
@ -109,13 +109,13 @@ inline std::size_t read(Sync_Read_Stream& s,
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Async_Read_Stream, typename Mutable_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
class read_handler
|
||||
{
|
||||
public:
|
||||
read_handler(Async_Read_Stream& stream, const Mutable_Buffers& buffers,
|
||||
Completion_Condition completion_condition, Handler handler)
|
||||
read_handler(AsyncReadStream& stream, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, ReadHandler handler)
|
||||
: stream_(stream),
|
||||
buffers_(buffers),
|
||||
total_transferred_(0),
|
||||
@ -141,74 +141,75 @@ namespace detail
|
||||
}
|
||||
|
||||
//private:
|
||||
Async_Read_Stream& stream_;
|
||||
AsyncReadStream& stream_;
|
||||
asio::detail::consuming_buffers<
|
||||
mutable_buffer, Mutable_Buffers> buffers_;
|
||||
mutable_buffer, MutableBufferSequence> buffers_;
|
||||
std::size_t total_transferred_;
|
||||
Completion_Condition completion_condition_;
|
||||
Handler handler_;
|
||||
CompletionCondition completion_condition_;
|
||||
ReadHandler handler_;
|
||||
};
|
||||
|
||||
template <typename Async_Read_Stream, typename Mutable_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline void* asio_handler_allocate(std::size_t size,
|
||||
read_handler<Async_Read_Stream, Mutable_Buffers,
|
||||
Completion_Condition, Handler>* this_handler)
|
||||
read_handler<AsyncReadStream, MutableBufferSequence,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
return asio_handler_alloc_helpers::allocate(
|
||||
size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Async_Read_Stream, typename Mutable_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
read_handler<Async_Read_Stream, Mutable_Buffers,
|
||||
Completion_Condition, Handler>* this_handler)
|
||||
read_handler<AsyncReadStream, MutableBufferSequence,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_alloc_helpers::deallocate(
|
||||
pointer, size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Async_Read_Stream,
|
||||
typename Mutable_Buffers, typename Completion_Condition, typename Handler>
|
||||
template <typename Function, typename AsyncReadStream,
|
||||
typename MutableBufferSequence, typename CompletionCondition,
|
||||
typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
read_handler<Async_Read_Stream, Mutable_Buffers,
|
||||
Completion_Condition, Handler>* this_handler)
|
||||
read_handler<AsyncReadStream, MutableBufferSequence,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, &this_handler->handler_);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename Async_Read_Stream, typename Mutable_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
inline void async_read(Async_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
Completion_Condition completion_condition, Handler handler)
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, ReadHandler handler)
|
||||
{
|
||||
s.async_read_some(buffers,
|
||||
detail::read_handler<Async_Read_Stream, Mutable_Buffers,
|
||||
Completion_Condition, Handler>(
|
||||
detail::read_handler<AsyncReadStream, MutableBufferSequence,
|
||||
CompletionCondition, ReadHandler>(
|
||||
s, buffers, completion_condition, handler));
|
||||
}
|
||||
|
||||
template <typename Async_Read_Stream, typename Mutable_Buffers,
|
||||
typename Handler>
|
||||
inline void async_read(Async_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
Handler handler)
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename ReadHandler>
|
||||
inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
ReadHandler handler)
|
||||
{
|
||||
async_read(s, buffers, transfer_all(), handler);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Async_Read_Stream, typename Allocator,
|
||||
typename Completion_Condition, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
class read_streambuf_handler
|
||||
{
|
||||
public:
|
||||
read_streambuf_handler(Async_Read_Stream& stream,
|
||||
read_streambuf_handler(AsyncReadStream& stream,
|
||||
basic_streambuf<Allocator>& streambuf,
|
||||
Completion_Condition completion_condition, Handler handler)
|
||||
CompletionCondition completion_condition, ReadHandler handler)
|
||||
: stream_(stream),
|
||||
streambuf_(streambuf),
|
||||
total_transferred_(0),
|
||||
@ -233,59 +234,59 @@ namespace detail
|
||||
}
|
||||
|
||||
//private:
|
||||
Async_Read_Stream& stream_;
|
||||
AsyncReadStream& stream_;
|
||||
asio::basic_streambuf<Allocator>& streambuf_;
|
||||
std::size_t total_transferred_;
|
||||
Completion_Condition completion_condition_;
|
||||
Handler handler_;
|
||||
CompletionCondition completion_condition_;
|
||||
ReadHandler handler_;
|
||||
};
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator,
|
||||
typename Completion_Condition, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline void* asio_handler_allocate(std::size_t size,
|
||||
read_streambuf_handler<Async_Read_Stream, Allocator,
|
||||
Completion_Condition, Handler>* this_handler)
|
||||
read_streambuf_handler<AsyncReadStream, Allocator,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
return asio_handler_alloc_helpers::allocate(
|
||||
size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator,
|
||||
typename Completion_Condition, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
read_streambuf_handler<Async_Read_Stream, Allocator,
|
||||
Completion_Condition, Handler>* this_handler)
|
||||
read_streambuf_handler<AsyncReadStream, Allocator,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_alloc_helpers::deallocate(
|
||||
pointer, size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Async_Read_Stream,
|
||||
typename Allocator, typename Completion_Condition, typename Handler>
|
||||
template <typename Function, typename AsyncReadStream,
|
||||
typename Allocator, typename CompletionCondition, typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
read_streambuf_handler<Async_Read_Stream, Allocator,
|
||||
Completion_Condition, Handler>* this_handler)
|
||||
read_streambuf_handler<AsyncReadStream, Allocator,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, &this_handler->handler_);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator,
|
||||
typename Completion_Condition, typename Handler>
|
||||
inline void async_read(Async_Read_Stream& s,
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline void async_read(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition, Handler handler)
|
||||
CompletionCondition completion_condition, ReadHandler handler)
|
||||
{
|
||||
s.async_read_some(b.prepare(512),
|
||||
detail::read_streambuf_handler<Async_Read_Stream, Allocator,
|
||||
Completion_Condition, Handler>(
|
||||
detail::read_streambuf_handler<AsyncReadStream, Allocator,
|
||||
CompletionCondition, ReadHandler>(
|
||||
s, b, completion_condition, handler));
|
||||
}
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
inline void async_read(Async_Read_Stream& s,
|
||||
asio::basic_streambuf<Allocator>& b, Handler handler)
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline void async_read(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, ReadHandler handler)
|
||||
{
|
||||
async_read(s, b, transfer_all(), handler);
|
||||
}
|
||||
|
@ -33,8 +33,8 @@
|
||||
|
||||
namespace asio {
|
||||
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
inline std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
inline std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, char delim)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -43,8 +43,8 @@ inline std::size_t read_until(Sync_Read_Stream& s,
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, char delim,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
@ -81,8 +81,8 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
inline std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
inline std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const std::string& delim)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -126,8 +126,8 @@ namespace detail
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const std::string& delim,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
@ -173,8 +173,8 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
inline std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
inline std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const boost::regex& expr)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -183,8 +183,8 @@ inline std::size_t read_until(Sync_Read_Stream& s,
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
@ -232,13 +232,13 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
class read_until_delim_handler
|
||||
{
|
||||
public:
|
||||
read_until_delim_handler(Async_Read_Stream& stream,
|
||||
read_until_delim_handler(AsyncReadStream& stream,
|
||||
asio::basic_streambuf<Allocator>& streambuf, char delim,
|
||||
std::size_t next_search_start, Handler handler)
|
||||
std::size_t next_search_start, ReadHandler handler)
|
||||
: stream_(stream),
|
||||
streambuf_(streambuf),
|
||||
delim_(delim),
|
||||
@ -286,45 +286,45 @@ namespace detail
|
||||
}
|
||||
|
||||
//private:
|
||||
Async_Read_Stream& stream_;
|
||||
AsyncReadStream& stream_;
|
||||
asio::basic_streambuf<Allocator>& streambuf_;
|
||||
char delim_;
|
||||
std::size_t next_search_start_;
|
||||
Handler handler_;
|
||||
ReadHandler handler_;
|
||||
};
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline void* asio_handler_allocate(std::size_t size,
|
||||
read_until_delim_handler<Async_Read_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
read_until_delim_handler<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
return asio_handler_alloc_helpers::allocate(
|
||||
size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
read_until_delim_handler<Async_Read_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
read_until_delim_handler<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_alloc_helpers::deallocate(
|
||||
pointer, size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Async_Read_Stream, typename Allocator,
|
||||
typename Handler>
|
||||
template <typename Function, typename AsyncReadStream, typename Allocator,
|
||||
typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
read_until_delim_handler<Async_Read_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
read_until_delim_handler<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, &this_handler->handler_);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
void async_read_until(Async_Read_Stream& s,
|
||||
asio::basic_streambuf<Allocator>& b, char delim, Handler handler)
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
void async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, char delim, ReadHandler handler)
|
||||
{
|
||||
// Determine the range of the data to be searched.
|
||||
typedef typename asio::basic_streambuf<
|
||||
@ -348,20 +348,20 @@ void async_read_until(Async_Read_Stream& s,
|
||||
|
||||
// No match. Start a new asynchronous read operation to obtain more data.
|
||||
s.async_read_some(b.prepare(512),
|
||||
detail::read_until_delim_handler<Async_Read_Stream, Allocator, Handler>(
|
||||
detail::read_until_delim_handler<AsyncReadStream, Allocator, ReadHandler>(
|
||||
s, b, delim, end.position(), handler));
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
class read_until_delim_string_handler
|
||||
{
|
||||
public:
|
||||
read_until_delim_string_handler(Async_Read_Stream& stream,
|
||||
read_until_delim_string_handler(AsyncReadStream& stream,
|
||||
asio::basic_streambuf<Allocator>& streambuf,
|
||||
const std::string& delim, std::size_t next_search_start,
|
||||
Handler handler)
|
||||
ReadHandler handler)
|
||||
: stream_(stream),
|
||||
streambuf_(streambuf),
|
||||
delim_(delim),
|
||||
@ -422,46 +422,46 @@ namespace detail
|
||||
}
|
||||
|
||||
//private:
|
||||
Async_Read_Stream& stream_;
|
||||
AsyncReadStream& stream_;
|
||||
asio::basic_streambuf<Allocator>& streambuf_;
|
||||
std::string delim_;
|
||||
std::size_t next_search_start_;
|
||||
Handler handler_;
|
||||
ReadHandler handler_;
|
||||
};
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline void* asio_handler_allocate(std::size_t size,
|
||||
read_until_delim_string_handler<Async_Read_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
read_until_delim_string_handler<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
return asio_handler_alloc_helpers::allocate(
|
||||
size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
read_until_delim_string_handler<Async_Read_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
read_until_delim_string_handler<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_alloc_helpers::deallocate(
|
||||
pointer, size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Async_Read_Stream,
|
||||
typename Allocator, typename Handler>
|
||||
template <typename Function, typename AsyncReadStream,
|
||||
typename Allocator, typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
read_until_delim_string_handler<Async_Read_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
read_until_delim_string_handler<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, &this_handler->handler_);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
void async_read_until(Async_Read_Stream& s,
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
void async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const std::string& delim,
|
||||
Handler handler)
|
||||
ReadHandler handler)
|
||||
{
|
||||
// Determine the range of the data to be searched.
|
||||
typedef typename asio::basic_streambuf<
|
||||
@ -501,20 +501,20 @@ void async_read_until(Async_Read_Stream& s,
|
||||
// No match. Start a new asynchronous read operation to obtain more data.
|
||||
s.async_read_some(b.prepare(512),
|
||||
detail::read_until_delim_string_handler<
|
||||
Async_Read_Stream, Allocator, Handler>(
|
||||
AsyncReadStream, Allocator, ReadHandler>(
|
||||
s, b, delim, next_search_start, handler));
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
class read_until_expr_handler
|
||||
{
|
||||
public:
|
||||
read_until_expr_handler(Async_Read_Stream& stream,
|
||||
read_until_expr_handler(AsyncReadStream& stream,
|
||||
asio::basic_streambuf<Allocator>& streambuf,
|
||||
const boost::regex& expr, std::size_t next_search_start,
|
||||
Handler handler)
|
||||
ReadHandler handler)
|
||||
: stream_(stream),
|
||||
streambuf_(streambuf),
|
||||
expr_(expr),
|
||||
@ -575,46 +575,46 @@ namespace detail
|
||||
}
|
||||
|
||||
//private:
|
||||
Async_Read_Stream& stream_;
|
||||
AsyncReadStream& stream_;
|
||||
asio::basic_streambuf<Allocator>& streambuf_;
|
||||
boost::regex expr_;
|
||||
std::size_t next_search_start_;
|
||||
Handler handler_;
|
||||
ReadHandler handler_;
|
||||
};
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline void* asio_handler_allocate(std::size_t size,
|
||||
read_until_expr_handler<Async_Read_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
read_until_expr_handler<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
return asio_handler_alloc_helpers::allocate(
|
||||
size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
read_until_expr_handler<Async_Read_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
read_until_expr_handler<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_alloc_helpers::deallocate(
|
||||
pointer, size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Async_Read_Stream, typename Allocator,
|
||||
typename Handler>
|
||||
template <typename Function, typename AsyncReadStream, typename Allocator,
|
||||
typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
read_until_expr_handler<Async_Read_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
read_until_expr_handler<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, &this_handler->handler_);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
void async_read_until(Async_Read_Stream& s,
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
void async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
|
||||
Handler handler)
|
||||
ReadHandler handler)
|
||||
{
|
||||
// Determine the range of the data to be searched.
|
||||
typedef typename asio::basic_streambuf<
|
||||
@ -653,7 +653,7 @@ void async_read_until(Async_Read_Stream& s,
|
||||
|
||||
// No match. Start a new asynchronous read operation to obtain more data.
|
||||
s.async_read_some(b.prepare(512),
|
||||
detail::read_until_expr_handler<Async_Read_Stream, Allocator, Handler>(
|
||||
detail::read_until_expr_handler<AsyncReadStream, Allocator, ReadHandler>(
|
||||
s, b, expr, next_search_start, handler));
|
||||
}
|
||||
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace asio {
|
||||
|
||||
template <typename Sync_Write_Stream, typename Const_Buffers,
|
||||
typename Completion_Condition>
|
||||
std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
Completion_Condition completion_condition, asio::error_code& ec)
|
||||
template <typename SyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition>
|
||||
std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, asio::error_code& ec)
|
||||
{
|
||||
asio::detail::consuming_buffers<
|
||||
const_buffer, Const_Buffers> tmp(buffers);
|
||||
const_buffer, ConstBufferSequence> tmp(buffers);
|
||||
std::size_t total_transferred = 0;
|
||||
while (tmp.begin() != tmp.end())
|
||||
{
|
||||
@ -47,8 +47,8 @@ std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
return total_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Write_Stream, typename Const_Buffers>
|
||||
inline std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers)
|
||||
template <typename SyncWriteStream, typename ConstBufferSequence>
|
||||
inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t bytes_transferred = write(s, buffers, transfer_all(), ec);
|
||||
@ -56,10 +56,10 @@ inline std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers)
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Write_Stream, typename Const_Buffers,
|
||||
typename Completion_Condition>
|
||||
inline std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
Completion_Condition completion_condition)
|
||||
template <typename SyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition>
|
||||
inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t bytes_transferred = write(s, buffers, completion_condition, ec);
|
||||
@ -67,19 +67,19 @@ inline std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Write_Stream, typename Allocator,
|
||||
typename Completion_Condition>
|
||||
std::size_t write(Sync_Write_Stream& s,
|
||||
template <typename SyncWriteStream, typename Allocator,
|
||||
typename CompletionCondition>
|
||||
std::size_t write(SyncWriteStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition, asio::error_code& ec)
|
||||
CompletionCondition completion_condition, asio::error_code& ec)
|
||||
{
|
||||
std::size_t bytes_transferred = write(s, b.data(), completion_condition, ec);
|
||||
b.consume(bytes_transferred);
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Write_Stream, typename Allocator>
|
||||
inline std::size_t write(Sync_Write_Stream& s,
|
||||
template <typename SyncWriteStream, typename Allocator>
|
||||
inline std::size_t write(SyncWriteStream& s,
|
||||
asio::basic_streambuf<Allocator>& b)
|
||||
{
|
||||
asio::error_code ec;
|
||||
@ -88,11 +88,11 @@ inline std::size_t write(Sync_Write_Stream& s,
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
template <typename Sync_Write_Stream, typename Allocator,
|
||||
typename Completion_Condition>
|
||||
inline std::size_t write(Sync_Write_Stream& s,
|
||||
template <typename SyncWriteStream, typename Allocator,
|
||||
typename CompletionCondition>
|
||||
inline std::size_t write(SyncWriteStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition)
|
||||
CompletionCondition completion_condition)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t bytes_transferred = write(s, b, completion_condition, ec);
|
||||
@ -102,13 +102,13 @@ inline std::size_t write(Sync_Write_Stream& s,
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Async_Write_Stream, typename Const_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
class write_handler
|
||||
{
|
||||
public:
|
||||
write_handler(Async_Write_Stream& stream, const Const_Buffers& buffers,
|
||||
Completion_Condition completion_condition, Handler handler)
|
||||
write_handler(AsyncWriteStream& stream, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, WriteHandler handler)
|
||||
: stream_(stream),
|
||||
buffers_(buffers),
|
||||
total_transferred_(0),
|
||||
@ -134,71 +134,74 @@ namespace detail
|
||||
}
|
||||
|
||||
//private:
|
||||
Async_Write_Stream& stream_;
|
||||
AsyncWriteStream& stream_;
|
||||
asio::detail::consuming_buffers<
|
||||
const_buffer, Const_Buffers> buffers_;
|
||||
const_buffer, ConstBufferSequence> buffers_;
|
||||
std::size_t total_transferred_;
|
||||
Completion_Condition completion_condition_;
|
||||
Handler handler_;
|
||||
CompletionCondition completion_condition_;
|
||||
WriteHandler handler_;
|
||||
};
|
||||
|
||||
template <typename Async_Write_Stream, typename Const_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline void* asio_handler_allocate(std::size_t size,
|
||||
write_handler<Async_Write_Stream, Const_Buffers,
|
||||
Completion_Condition, Handler>* this_handler)
|
||||
write_handler<AsyncWriteStream, ConstBufferSequence,
|
||||
CompletionCondition, WriteHandler>* this_handler)
|
||||
{
|
||||
return asio_handler_alloc_helpers::allocate(
|
||||
size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Async_Write_Stream, typename Const_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
write_handler<Async_Write_Stream, Const_Buffers,
|
||||
Completion_Condition, Handler>* this_handler)
|
||||
write_handler<AsyncWriteStream, ConstBufferSequence,
|
||||
CompletionCondition, WriteHandler>* this_handler)
|
||||
{
|
||||
asio_handler_alloc_helpers::deallocate(
|
||||
pointer, size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Async_Write_Stream,
|
||||
typename Const_Buffers, typename Completion_Condition, typename Handler>
|
||||
template <typename Function, typename AsyncWriteStream,
|
||||
typename ConstBufferSequence, typename CompletionCondition,
|
||||
typename WriteHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
write_handler<Async_Write_Stream, Const_Buffers,
|
||||
Completion_Condition, Handler>* this_handler)
|
||||
write_handler<AsyncWriteStream, ConstBufferSequence,
|
||||
CompletionCondition, WriteHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, &this_handler->handler_);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename Async_Write_Stream, typename Const_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
inline void async_write(Async_Write_Stream& s, const Const_Buffers& buffers,
|
||||
Completion_Condition completion_condition, Handler handler)
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, WriteHandler handler)
|
||||
{
|
||||
s.async_write_some(buffers,
|
||||
detail::write_handler<Async_Write_Stream, Const_Buffers,
|
||||
Completion_Condition, Handler>(
|
||||
detail::write_handler<AsyncWriteStream, ConstBufferSequence,
|
||||
CompletionCondition, WriteHandler>(
|
||||
s, buffers, completion_condition, handler));
|
||||
}
|
||||
|
||||
template <typename Async_Write_Stream, typename Const_Buffers, typename Handler>
|
||||
inline void async_write(Async_Write_Stream& s, const Const_Buffers& buffers,
|
||||
Handler handler)
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename WriteHandler>
|
||||
inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
WriteHandler handler)
|
||||
{
|
||||
async_write(s, buffers, transfer_all(), handler);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Async_Write_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncWriteStream, typename Allocator,
|
||||
typename WriteHandler>
|
||||
class write_streambuf_handler
|
||||
{
|
||||
public:
|
||||
write_streambuf_handler(asio::basic_streambuf<Allocator>& streambuf,
|
||||
Handler handler)
|
||||
WriteHandler handler)
|
||||
: streambuf_(streambuf),
|
||||
handler_(handler)
|
||||
{
|
||||
@ -213,52 +216,54 @@ namespace detail
|
||||
|
||||
//private:
|
||||
asio::basic_streambuf<Allocator>& streambuf_;
|
||||
Handler handler_;
|
||||
WriteHandler handler_;
|
||||
};
|
||||
|
||||
template <typename Async_Write_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncWriteStream, typename Allocator,
|
||||
typename WriteHandler>
|
||||
inline void* asio_handler_allocate(std::size_t size,
|
||||
write_streambuf_handler<Async_Write_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
write_streambuf_handler<AsyncWriteStream,
|
||||
Allocator, WriteHandler>* this_handler)
|
||||
{
|
||||
return asio_handler_alloc_helpers::allocate(
|
||||
size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Async_Write_Stream, typename Allocator, typename Handler>
|
||||
template <typename AsyncWriteStream, typename Allocator,
|
||||
typename WriteHandler>
|
||||
inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
write_streambuf_handler<Async_Write_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
write_streambuf_handler<AsyncWriteStream,
|
||||
Allocator, WriteHandler>* this_handler)
|
||||
{
|
||||
asio_handler_alloc_helpers::deallocate(
|
||||
pointer, size, &this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Async_Write_Stream, typename Allocator,
|
||||
typename Handler>
|
||||
template <typename Function, typename AsyncWriteStream, typename Allocator,
|
||||
typename WriteHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
write_streambuf_handler<Async_Write_Stream,
|
||||
Allocator, Handler>* this_handler)
|
||||
write_streambuf_handler<AsyncWriteStream,
|
||||
Allocator, WriteHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, &this_handler->handler_);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename Async_Write_Stream, typename Allocator,
|
||||
typename Completion_Condition, typename Handler>
|
||||
inline void async_write(Async_Write_Stream& s,
|
||||
template <typename AsyncWriteStream, typename Allocator,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline void async_write(AsyncWriteStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition, Handler handler)
|
||||
CompletionCondition completion_condition, WriteHandler handler)
|
||||
{
|
||||
async_write(s, b.data(), completion_condition,
|
||||
detail::write_streambuf_handler<Async_Write_Stream, Allocator, Handler>(
|
||||
b, handler));
|
||||
detail::write_streambuf_handler<
|
||||
AsyncWriteStream, Allocator, WriteHandler>(b, handler));
|
||||
}
|
||||
|
||||
template <typename Async_Write_Stream, typename Allocator, typename Handler>
|
||||
inline void async_write(Async_Write_Stream& s,
|
||||
asio::basic_streambuf<Allocator>& b, Handler handler)
|
||||
template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
|
||||
inline void async_write(AsyncWriteStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, WriteHandler handler)
|
||||
{
|
||||
async_write(s, b, transfer_all(), handler);
|
||||
}
|
||||
|
@ -173,8 +173,8 @@ public:
|
||||
* a copy of the handler object as required. The function signature of the
|
||||
* handler must be: @code void handler(); @endcode
|
||||
*/
|
||||
template <typename Handler>
|
||||
void dispatch(Handler handler);
|
||||
template <typename CompletionHandler>
|
||||
void dispatch(CompletionHandler handler);
|
||||
|
||||
/// Request the io_service to invoke the given handler and return immediately.
|
||||
/**
|
||||
@ -190,8 +190,8 @@ public:
|
||||
* a copy of the handler object as required. The function signature of the
|
||||
* handler must be: @code void handler(); @endcode
|
||||
*/
|
||||
template <typename Handler>
|
||||
void post(Handler handler);
|
||||
template <typename CompletionHandler>
|
||||
void post(CompletionHandler handler);
|
||||
|
||||
/// Create a new handler that automatically dispatches the wrapped handler
|
||||
/// on the io_service.
|
||||
|
@ -46,12 +46,12 @@ namespace ip {
|
||||
* @par Concepts:
|
||||
* Endpoint.
|
||||
*/
|
||||
template <typename Protocol>
|
||||
template <typename InternetProtocol>
|
||||
class basic_endpoint
|
||||
{
|
||||
public:
|
||||
/// The protocol type associated with the endpoint.
|
||||
typedef Protocol protocol_type;
|
||||
typedef InternetProtocol protocol_type;
|
||||
|
||||
/// The type of the endpoint structure. This type is dependent on the
|
||||
/// underlying implementation of the socket layer.
|
||||
@ -96,7 +96,7 @@ public:
|
||||
* asio::ip::udp::endpoint ep(asio::ip::udp::v6(), 9876);
|
||||
* @endcode
|
||||
*/
|
||||
basic_endpoint(const Protocol& protocol, unsigned short port_num)
|
||||
basic_endpoint(const InternetProtocol& protocol, unsigned short port_num)
|
||||
: data_()
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
@ -173,8 +173,8 @@ public:
|
||||
protocol_type protocol() const
|
||||
{
|
||||
if (data_.ss_family == AF_INET)
|
||||
return Protocol::v4();
|
||||
return Protocol::v6();
|
||||
return InternetProtocol::v4();
|
||||
return InternetProtocol::v6();
|
||||
}
|
||||
|
||||
/// Get the underlying endpoint in the native type.
|
||||
@ -275,27 +275,27 @@ public:
|
||||
/// Set the IP address associated with the endpoint.
|
||||
void address(const asio::ip::address& addr)
|
||||
{
|
||||
basic_endpoint<Protocol> tmp_endpoint(addr, port());
|
||||
basic_endpoint<InternetProtocol> tmp_endpoint(addr, port());
|
||||
data_ = tmp_endpoint.data_;
|
||||
}
|
||||
|
||||
/// Compare two endpoints for equality.
|
||||
friend bool operator==(const basic_endpoint<Protocol>& e1,
|
||||
const basic_endpoint<Protocol>& e2)
|
||||
friend bool operator==(const basic_endpoint<InternetProtocol>& e1,
|
||||
const basic_endpoint<InternetProtocol>& e2)
|
||||
{
|
||||
return e1.address() == e2.address() && e1.port() == e2.port();
|
||||
}
|
||||
|
||||
/// Compare two endpoints for inequality.
|
||||
friend bool operator!=(const basic_endpoint<Protocol>& e1,
|
||||
const basic_endpoint<Protocol>& e2)
|
||||
friend bool operator!=(const basic_endpoint<InternetProtocol>& e1,
|
||||
const basic_endpoint<InternetProtocol>& e2)
|
||||
{
|
||||
return e1.address() != e2.address() || e1.port() != e2.port();
|
||||
}
|
||||
|
||||
/// Compare endpoints for ordering.
|
||||
friend bool operator<(const basic_endpoint<Protocol>& e1,
|
||||
const basic_endpoint<Protocol>& e2)
|
||||
friend bool operator<(const basic_endpoint<InternetProtocol>& e1,
|
||||
const basic_endpoint<InternetProtocol>& e2)
|
||||
{
|
||||
if (e1.address() < e2.address())
|
||||
return true;
|
||||
@ -322,9 +322,9 @@ private:
|
||||
* @relates asio::ip::basic_endpoint
|
||||
*/
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template <typename Protocol>
|
||||
template <typename InternetProtocol>
|
||||
std::ostream& operator<<(std::ostream& os,
|
||||
const basic_endpoint<Protocol>& endpoint)
|
||||
const basic_endpoint<InternetProtocol>& endpoint)
|
||||
{
|
||||
const address& addr = endpoint.address();
|
||||
if (addr.is_v4())
|
||||
@ -335,10 +335,10 @@ std::ostream& operator<<(std::ostream& os,
|
||||
return os;
|
||||
}
|
||||
#else // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template <typename Elem, typename Traits, typename Protocol>
|
||||
template <typename Elem, typename Traits, typename InternetProtocol>
|
||||
std::basic_ostream<Elem, Traits>& operator<<(
|
||||
std::basic_ostream<Elem, Traits>& os,
|
||||
const basic_endpoint<Protocol>& endpoint)
|
||||
const basic_endpoint<InternetProtocol>& endpoint)
|
||||
{
|
||||
const address& addr = endpoint.address();
|
||||
if (addr.is_v4())
|
||||
|
@ -34,22 +34,23 @@ namespace ip {
|
||||
* @e Distinct @e objects: Safe.@n
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*/
|
||||
template <typename Protocol, typename Service = resolver_service<Protocol> >
|
||||
template <typename InternetProtocol,
|
||||
typename ResolverService = resolver_service<InternetProtocol> >
|
||||
class basic_resolver
|
||||
: public basic_io_object<Service>
|
||||
: public basic_io_object<ResolverService>
|
||||
{
|
||||
public:
|
||||
/// The protocol type.
|
||||
typedef Protocol protocol_type;
|
||||
typedef InternetProtocol protocol_type;
|
||||
|
||||
/// The endpoint type.
|
||||
typedef typename Protocol::endpoint endpoint_type;
|
||||
typedef typename InternetProtocol::endpoint endpoint_type;
|
||||
|
||||
/// The query type.
|
||||
typedef typename Protocol::resolver_query query;
|
||||
typedef typename InternetProtocol::resolver_query query;
|
||||
|
||||
/// The iterator type.
|
||||
typedef typename Protocol::resolver_iterator iterator;
|
||||
typedef typename InternetProtocol::resolver_iterator iterator;
|
||||
|
||||
/// Constructor.
|
||||
/**
|
||||
@ -59,7 +60,7 @@ public:
|
||||
* dispatch handlers for any asynchronous operations performed on the timer.
|
||||
*/
|
||||
explicit basic_resolver(asio::io_service& io_service)
|
||||
: basic_io_object<Service>(io_service)
|
||||
: basic_io_object<ResolverService>(io_service)
|
||||
{
|
||||
}
|
||||
|
||||
@ -146,8 +147,8 @@ public:
|
||||
* A successful resolve operation is guaranteed to pass at least one entry to
|
||||
* the handler.
|
||||
*/
|
||||
template <typename Handler>
|
||||
void async_resolve(const query& q, Handler handler)
|
||||
template <typename ResolveHandler>
|
||||
void async_resolve(const query& q, ResolveHandler handler)
|
||||
{
|
||||
return this->service.async_resolve(this->implementation, q, handler);
|
||||
}
|
||||
@ -229,8 +230,8 @@ public:
|
||||
* A successful resolve operation is guaranteed to pass at least one entry to
|
||||
* the handler.
|
||||
*/
|
||||
template <typename Handler>
|
||||
void async_resolve(const endpoint_type& e, Handler handler)
|
||||
template <typename ResolveHandler>
|
||||
void async_resolve(const endpoint_type& e, ResolveHandler handler)
|
||||
{
|
||||
return this->service.async_resolve(this->implementation, e, handler);
|
||||
}
|
||||
|
@ -32,19 +32,16 @@ namespace ip {
|
||||
* @par Thread Safety
|
||||
* @e Distinct @e objects: Safe.@n
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* Endpoint.
|
||||
*/
|
||||
template <typename Protocol>
|
||||
template <typename InternetProtocol>
|
||||
class basic_resolver_entry
|
||||
{
|
||||
public:
|
||||
/// The protocol type associated with the endpoint entry.
|
||||
typedef Protocol protocol_type;
|
||||
typedef InternetProtocol protocol_type;
|
||||
|
||||
/// The endpoint type associated with the endpoint entry.
|
||||
typedef typename Protocol::endpoint endpoint_type;
|
||||
typedef typename InternetProtocol::endpoint endpoint_type;
|
||||
|
||||
/// Default constructor.
|
||||
basic_resolver_entry()
|
||||
|
@ -38,17 +38,17 @@ namespace ip {
|
||||
* iterators over the results returned by a resolver.
|
||||
*
|
||||
* The iterator's value_type, obtained when the iterator is dereferenced, is:
|
||||
* @code const basic_resolver_entry<Protocol> @endcode
|
||||
* @code const basic_resolver_entry<InternetProtocol> @endcode
|
||||
*
|
||||
* @par Thread Safety
|
||||
* @e Distinct @e objects: Safe.@n
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*/
|
||||
template <typename Protocol>
|
||||
template <typename InternetProtocol>
|
||||
class basic_resolver_iterator
|
||||
: public boost::iterator_facade<
|
||||
basic_resolver_iterator<Protocol>,
|
||||
const basic_resolver_entry<Protocol>,
|
||||
basic_resolver_iterator<InternetProtocol>,
|
||||
const basic_resolver_entry<InternetProtocol>,
|
||||
boost::forward_traversal_tag>
|
||||
{
|
||||
public:
|
||||
@ -78,14 +78,14 @@ public:
|
||||
|| address_info->ai_family == PF_INET6)
|
||||
{
|
||||
using namespace std; // For memcpy.
|
||||
typename Protocol::endpoint endpoint;
|
||||
typename InternetProtocol::endpoint endpoint;
|
||||
endpoint.resize(
|
||||
static_cast<asio::detail::socket_addr_len_type>(
|
||||
address_info->ai_addrlen));
|
||||
memcpy(endpoint.data(), address_info->ai_addr,
|
||||
address_info->ai_addrlen);
|
||||
iter.values_->push_back(
|
||||
basic_resolver_entry<Protocol>(endpoint,
|
||||
basic_resolver_entry<InternetProtocol>(endpoint,
|
||||
actual_host_name, service_name));
|
||||
}
|
||||
address_info = address_info->ai_next;
|
||||
@ -101,13 +101,14 @@ public:
|
||||
|
||||
/// Create an iterator from an endpoint, host name and service name.
|
||||
static basic_resolver_iterator create(
|
||||
const typename Protocol::endpoint& endpoint,
|
||||
const typename InternetProtocol::endpoint& endpoint,
|
||||
const std::string& host_name, const std::string& service_name)
|
||||
{
|
||||
basic_resolver_iterator iter;
|
||||
iter.values_.reset(new values_type);
|
||||
iter.values_->push_back(
|
||||
basic_resolver_entry<Protocol>(endpoint, host_name, service_name));
|
||||
basic_resolver_entry<InternetProtocol>(
|
||||
endpoint, host_name, service_name));
|
||||
iter.iter_ = iter.values_->begin();
|
||||
return iter;
|
||||
}
|
||||
@ -135,12 +136,12 @@ private:
|
||||
return iter_ == other.iter_;
|
||||
}
|
||||
|
||||
const basic_resolver_entry<Protocol>& dereference() const
|
||||
const basic_resolver_entry<InternetProtocol>& dereference() const
|
||||
{
|
||||
return *iter_;
|
||||
}
|
||||
|
||||
typedef std::vector<basic_resolver_entry<Protocol> > values_type;
|
||||
typedef std::vector<basic_resolver_entry<InternetProtocol> > values_type;
|
||||
boost::shared_ptr<values_type> values_;
|
||||
typename values_type::const_iterator iter_;
|
||||
};
|
||||
|
@ -36,17 +36,14 @@ namespace ip {
|
||||
* @par Thread Safety
|
||||
* @e Distinct @e objects: Safe.@n
|
||||
* @e Shared @e objects: Unsafe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* Endpoint.
|
||||
*/
|
||||
template <typename Protocol>
|
||||
template <typename InternetProtocol>
|
||||
class basic_resolver_query
|
||||
: public resolver_query_base
|
||||
{
|
||||
public:
|
||||
/// The protocol type associated with the endpoint query.
|
||||
typedef Protocol protocol_type;
|
||||
typedef InternetProtocol protocol_type;
|
||||
|
||||
/// Construct with specified service name for any protocol.
|
||||
basic_resolver_query(const std::string& service_name,
|
||||
@ -55,7 +52,7 @@ public:
|
||||
host_name_(),
|
||||
service_name_(service_name)
|
||||
{
|
||||
typename Protocol::endpoint endpoint;
|
||||
typename InternetProtocol::endpoint endpoint;
|
||||
hints_.ai_flags = flags;
|
||||
hints_.ai_family = PF_UNSPEC;
|
||||
hints_.ai_socktype = endpoint.protocol().type();
|
||||
@ -91,7 +88,7 @@ public:
|
||||
host_name_(host_name),
|
||||
service_name_(service_name)
|
||||
{
|
||||
typename Protocol::endpoint endpoint;
|
||||
typename InternetProtocol::endpoint endpoint;
|
||||
hints_.ai_flags = flags;
|
||||
hints_.ai_family = PF_UNSPEC;
|
||||
hints_.ai_socktype = endpoint.protocol().type();
|
||||
|
@ -44,7 +44,7 @@ namespace multicast {
|
||||
* @endcode
|
||||
*
|
||||
* @par Concepts:
|
||||
* Socket_Option, IP_MReq_Socket_Option.
|
||||
* SettableSocketOption.
|
||||
*/
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined join_group;
|
||||
@ -69,7 +69,7 @@ typedef asio::ip::detail::socket_option::multicast_request<
|
||||
* @endcode
|
||||
*
|
||||
* @par Concepts:
|
||||
* Socket_Option, IP_MReq_Socket_Option.
|
||||
* SettableSocketOption.
|
||||
*/
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined leave_group;
|
||||
@ -94,7 +94,7 @@ typedef asio::ip::detail::socket_option::multicast_request<
|
||||
* @endcode
|
||||
*
|
||||
* @par Concepts:
|
||||
* Socket_Option, IP_Network_Interface_Socket_Option.
|
||||
* SettableSocketOption.
|
||||
*/
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined outbound_interface;
|
||||
@ -128,7 +128,7 @@ typedef asio::ip::detail::socket_option::network_interface<
|
||||
* @endcode
|
||||
*
|
||||
* @par Concepts:
|
||||
* Socket_Option, Integer_Socket_Option.
|
||||
* GettableSocketOption, SettableSocketOption.
|
||||
*/
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined hops;
|
||||
@ -162,7 +162,7 @@ typedef asio::ip::detail::socket_option::integer<
|
||||
* @endcode
|
||||
*
|
||||
* @par Concepts:
|
||||
* Socket_Option, Boolean_Socket_Option.
|
||||
* GettableSocketOption, SettableSocketOption.
|
||||
*/
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined enable_loopback;
|
||||
|
@ -25,26 +25,27 @@ namespace asio {
|
||||
namespace ip {
|
||||
|
||||
/// Default service implementation for a resolver.
|
||||
template <typename Protocol>
|
||||
template <typename InternetProtocol>
|
||||
class resolver_service
|
||||
: public asio::io_service::service
|
||||
{
|
||||
public:
|
||||
/// The protocol type.
|
||||
typedef Protocol protocol_type;
|
||||
typedef InternetProtocol protocol_type;
|
||||
|
||||
/// The endpoint type.
|
||||
typedef typename Protocol::endpoint endpoint_type;
|
||||
typedef typename InternetProtocol::endpoint endpoint_type;
|
||||
|
||||
/// The query type.
|
||||
typedef typename Protocol::resolver_query query_type;
|
||||
typedef typename InternetProtocol::resolver_query query_type;
|
||||
|
||||
/// The iterator type.
|
||||
typedef typename Protocol::resolver_iterator iterator_type;
|
||||
typedef typename InternetProtocol::resolver_iterator iterator_type;
|
||||
|
||||
private:
|
||||
// The type of the platform-specific implementation.
|
||||
typedef asio::detail::resolver_service<Protocol> service_impl_type;
|
||||
typedef asio::detail::resolver_service<InternetProtocol>
|
||||
service_impl_type;
|
||||
|
||||
public:
|
||||
/// The type of a resolver implementation.
|
||||
@ -107,9 +108,9 @@ public:
|
||||
}
|
||||
|
||||
/// Asynchronously resolve an endpoint to a list of entries.
|
||||
template <typename Handler>
|
||||
template <typename ResolveHandler>
|
||||
void async_resolve(implementation_type& impl, const endpoint_type& endpoint,
|
||||
Handler handler)
|
||||
ResolveHandler handler)
|
||||
{
|
||||
return service_impl_.async_resolve(impl, endpoint, handler);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ namespace ip {
|
||||
* @e Shared @e objects: Safe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* Protocol.
|
||||
* Protocol, InternetProtocol.
|
||||
*/
|
||||
class tcp
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ namespace ip {
|
||||
* @e Shared @e objects: Safe.
|
||||
*
|
||||
* @par Concepts:
|
||||
* Protocol.
|
||||
* Protocol, InternetProtocol.
|
||||
*/
|
||||
class udp
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ namespace asio {
|
||||
* read_some function.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers into which the data will be read. The sum
|
||||
* of the buffer sizes indicates the maximum number of bytes to read from the
|
||||
@ -68,8 +68,8 @@ namespace asio {
|
||||
* s, buffers,
|
||||
* asio::transfer_all()); @endcode
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Mutable_Buffers>
|
||||
std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers);
|
||||
template <typename SyncReadStream, typename MutableBufferSequence>
|
||||
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers);
|
||||
|
||||
/// Attempt to read a certain amount of data from a stream before returning.
|
||||
/**
|
||||
@ -85,7 +85,7 @@ std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers);
|
||||
* read_some function.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers into which the data will be read. The sum
|
||||
* of the buffer sizes indicates the maximum number of bytes to read from the
|
||||
@ -116,10 +116,10 @@ std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers);
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Mutable_Buffers,
|
||||
typename Completion_Condition>
|
||||
std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
Completion_Condition completion_condition);
|
||||
template <typename SyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition>
|
||||
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition);
|
||||
|
||||
/// Attempt to read a certain amount of data from a stream before returning.
|
||||
/**
|
||||
@ -135,7 +135,7 @@ std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
* read_some function.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers into which the data will be read. The sum
|
||||
* of the buffer sizes indicates the maximum number of bytes to read from the
|
||||
@ -159,10 +159,10 @@ std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
* @returns The number of bytes read. If an error occurs, returns the total
|
||||
* number of bytes successfully transferred prior to the error.
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Mutable_Buffers,
|
||||
typename Completion_Condition>
|
||||
std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
Completion_Condition completion_condition, asio::error_code& ec);
|
||||
template <typename SyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition>
|
||||
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, asio::error_code& ec);
|
||||
|
||||
/// Attempt to read a certain amount of data from a stream before returning.
|
||||
/**
|
||||
@ -175,7 +175,7 @@ std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
* read_some function.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param b The basic_streambuf object into which the data will be read.
|
||||
*
|
||||
@ -188,8 +188,8 @@ std::size_t read(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
* s, b,
|
||||
* asio::transfer_all()); @endcode
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read(Sync_Read_Stream& s, basic_streambuf<Allocator>& b);
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b);
|
||||
|
||||
/// Attempt to read a certain amount of data from a stream before returning.
|
||||
/**
|
||||
@ -202,7 +202,7 @@ std::size_t read(Sync_Read_Stream& s, basic_streambuf<Allocator>& b);
|
||||
* read_some function.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param b The basic_streambuf object into which the data will be read.
|
||||
*
|
||||
@ -223,10 +223,10 @@ std::size_t read(Sync_Read_Stream& s, basic_streambuf<Allocator>& b);
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Allocator,
|
||||
typename Completion_Condition>
|
||||
std::size_t read(Sync_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition);
|
||||
template <typename SyncReadStream, typename Allocator,
|
||||
typename CompletionCondition>
|
||||
std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition);
|
||||
|
||||
/// Attempt to read a certain amount of data from a stream before returning.
|
||||
/**
|
||||
@ -239,7 +239,7 @@ std::size_t read(Sync_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* read_some function.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param b The basic_streambuf object into which the data will be read.
|
||||
*
|
||||
@ -261,10 +261,10 @@ std::size_t read(Sync_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* @returns The number of bytes read. If an error occurs, returns the total
|
||||
* number of bytes successfully transferred prior to the error.
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Allocator,
|
||||
typename Completion_Condition>
|
||||
std::size_t read(Sync_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition, asio::error_code& ec);
|
||||
template <typename SyncReadStream, typename Allocator,
|
||||
typename CompletionCondition>
|
||||
std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition, asio::error_code& ec);
|
||||
|
||||
/*@}*/
|
||||
/**
|
||||
@ -289,7 +289,7 @@ std::size_t read(Sync_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* async_read_some function.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Async_Read_Stream concept.
|
||||
* the AsyncReadStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers into which the data will be read. The sum
|
||||
* of the buffer sizes indicates the maximum number of bytes to read from the
|
||||
@ -329,10 +329,10 @@ std::size_t read(Sync_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* asio::transfer_all(),
|
||||
* handler); @endcode
|
||||
*/
|
||||
template <typename Async_Read_Stream, typename Mutable_Buffers,
|
||||
typename Handler>
|
||||
void async_read(Async_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
Handler handler);
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename ReadHandler>
|
||||
void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
ReadHandler handler);
|
||||
|
||||
/// Start an asynchronous operation to read a certain amount of data from a
|
||||
/// stream.
|
||||
@ -348,7 +348,7 @@ void async_read(Async_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
* @li The completion_condition function object returns true.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Async_Read_Stream concept.
|
||||
* the AsyncReadStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers into which the data will be read. The sum
|
||||
* of the buffer sizes indicates the maximum number of bytes to read from the
|
||||
@ -397,10 +397,10 @@ void async_read(Async_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Async_Read_Stream, typename Mutable_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
void async_read(Async_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
Completion_Condition completion_condition, Handler handler);
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, ReadHandler handler);
|
||||
|
||||
/// Start an asynchronous operation to read a certain amount of data from a
|
||||
/// stream.
|
||||
@ -416,7 +416,7 @@ void async_read(Async_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
* async_read_some function.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Async_Read_Stream concept.
|
||||
* the AsyncReadStream concept.
|
||||
*
|
||||
* @param b A basic_streambuf object into which the data will be read. Ownership
|
||||
* of the streambuf is retained by the caller, which must guarantee that it
|
||||
@ -445,9 +445,9 @@ void async_read(Async_Read_Stream& s, const Mutable_Buffers& buffers,
|
||||
* asio::transfer_all(),
|
||||
* handler); @endcode
|
||||
*/
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
void async_read(Async_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
Handler handler);
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
ReadHandler handler);
|
||||
|
||||
/// Start an asynchronous operation to read a certain amount of data from a
|
||||
/// stream.
|
||||
@ -463,7 +463,7 @@ void async_read(Async_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* async_read_some function.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Async_Read_Stream concept.
|
||||
* the AsyncReadStream concept.
|
||||
*
|
||||
* @param b A basic_streambuf object into which the data will be read. Ownership
|
||||
* of the streambuf is retained by the caller, which must guarantee that it
|
||||
@ -500,10 +500,10 @@ void async_read(Async_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* the handler will be performed in a manner equivalent to using
|
||||
* asio::io_service::post().
|
||||
*/
|
||||
template <typename Async_Read_Stream, typename Allocator,
|
||||
typename Completion_Condition, typename Handler>
|
||||
void async_read(Async_Read_Stream& s, basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition, Handler handler);
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition, ReadHandler handler);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace asio {
|
||||
* delimiter, the function returns immediately.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param b A streambuf object into which the data will be read.
|
||||
*
|
||||
@ -68,8 +68,8 @@ namespace asio {
|
||||
* std::string line;
|
||||
* std::getline(is, line); @endcode
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, char delim);
|
||||
|
||||
/// Read data into a streambuf until a delimiter is encountered.
|
||||
@ -87,7 +87,7 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* delimiter, the function returns immediately.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param b A streambuf object into which the data will be read.
|
||||
*
|
||||
@ -98,8 +98,8 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* @returns The number of bytes in the streambuf's get area up to and including
|
||||
* the delimiter. Returns 0 if an error occurred.
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, char delim,
|
||||
asio::error_code& ec);
|
||||
|
||||
@ -118,7 +118,7 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* delimiter, the function returns immediately.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param b A streambuf object into which the data will be read.
|
||||
*
|
||||
@ -137,8 +137,8 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* std::string line;
|
||||
* std::getline(is, line); @endcode
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const std::string& delim);
|
||||
|
||||
/// Read data into a streambuf until a delimiter is encountered.
|
||||
@ -156,7 +156,7 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* delimiter, the function returns immediately.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param b A streambuf object into which the data will be read.
|
||||
*
|
||||
@ -167,8 +167,8 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* @returns The number of bytes in the streambuf's get area up to and including
|
||||
* the delimiter. Returns 0 if an error occurred.
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const std::string& delim,
|
||||
asio::error_code& ec);
|
||||
|
||||
@ -187,7 +187,7 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* matches the regular expression, the function returns immediately.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param b A streambuf object into which the data will be read.
|
||||
*
|
||||
@ -206,8 +206,8 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* std::string line;
|
||||
* std::getline(is, line); @endcode
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read_until(Sync_Read_Stream& s,
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const boost::regex& expr);
|
||||
|
||||
/// Read data into a streambuf until a regular expression is located.
|
||||
@ -225,7 +225,7 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* matches the regular expression, the function returns immediately.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Sync_Read_Stream concept.
|
||||
* the SyncReadStream concept.
|
||||
*
|
||||
* @param b A streambuf object into which the data will be read.
|
||||
*
|
||||
@ -237,10 +237,10 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* the substring that matches the regular expression. Returns 0 if an error
|
||||
* occurred.
|
||||
*/
|
||||
template <typename Sync_Read_Stream, typename Allocator>
|
||||
std::size_t read_until(Sync_Read_Stream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
|
||||
asio::error_code& ec);
|
||||
template <typename SyncReadStream, typename Allocator>
|
||||
std::size_t read_until(SyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
|
||||
asio::error_code& ec);
|
||||
|
||||
/*@}*/
|
||||
/**
|
||||
@ -265,7 +265,7 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* delimiter, the asynchronous operation completes immediately.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Async_Read_Stream concept.
|
||||
* the AsyncReadStream concept.
|
||||
*
|
||||
* @param b A streambuf object into which the data will be read. Ownership of
|
||||
* the streambuf is retained by the caller, which must guarantee that it remains
|
||||
@ -306,9 +306,10 @@ std::size_t read_until(Sync_Read_Stream& s,
|
||||
* ...
|
||||
* asio::async_read_until(s, b, '\n', handler); @endcode
|
||||
*/
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
void async_read_until(Async_Read_Stream& s,
|
||||
asio::basic_streambuf<Allocator>& b, char delim, Handler handler);
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
void async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
char delim, ReadHandler handler);
|
||||
|
||||
/// Start an asynchronous operation to read data into a streambuf until a
|
||||
/// delimiter is encountered.
|
||||
@ -327,7 +328,7 @@ void async_read_until(Async_Read_Stream& s,
|
||||
* delimiter, the asynchronous operation completes immediately.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Async_Read_Stream concept.
|
||||
* the AsyncReadStream concept.
|
||||
*
|
||||
* @param b A streambuf object into which the data will be read. Ownership of
|
||||
* the streambuf is retained by the caller, which must guarantee that it remains
|
||||
@ -368,10 +369,10 @@ void async_read_until(Async_Read_Stream& s,
|
||||
* ...
|
||||
* asio::async_read_until(s, b, "\r\n", handler); @endcode
|
||||
*/
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
void async_read_until(Async_Read_Stream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const std::string& delim,
|
||||
Handler handler);
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
void async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const std::string& delim,
|
||||
ReadHandler handler);
|
||||
|
||||
/// Start an asynchronous operation to read data into a streambuf until a
|
||||
/// regular expression is located.
|
||||
@ -391,7 +392,7 @@ void async_read_until(Async_Read_Stream& s,
|
||||
* that matches the regular expression, the function returns immediately.
|
||||
*
|
||||
* @param s The stream from which the data is to be read. The type must support
|
||||
* the Async_Read_Stream concept.
|
||||
* the AsyncReadStream concept.
|
||||
*
|
||||
* @param b A streambuf object into which the data will be read. Ownership of
|
||||
* the streambuf is retained by the caller, which must guarantee that it remains
|
||||
@ -435,10 +436,10 @@ void async_read_until(Async_Read_Stream& s,
|
||||
* ...
|
||||
* asio::async_read_until(s, b, boost::regex("\r\n"), handler); @endcode
|
||||
*/
|
||||
template <typename Async_Read_Stream, typename Allocator, typename Handler>
|
||||
void async_read_until(Async_Read_Stream& s,
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
void async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
|
||||
Handler handler);
|
||||
ReadHandler handler);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
@ -145,25 +145,25 @@ public:
|
||||
}
|
||||
|
||||
/// Set a socket option.
|
||||
template <typename Option>
|
||||
template <typename SettableSocketOption>
|
||||
asio::error_code set_option(implementation_type& impl,
|
||||
const Option& option, asio::error_code& ec)
|
||||
const SettableSocketOption& option, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.set_option(impl, option, ec);
|
||||
}
|
||||
|
||||
/// Get a socket option.
|
||||
template <typename Option>
|
||||
template <typename GettableSocketOption>
|
||||
asio::error_code get_option(const implementation_type& impl,
|
||||
Option& option, asio::error_code& ec) const
|
||||
GettableSocketOption& option, asio::error_code& ec) const
|
||||
{
|
||||
return service_impl_.get_option(impl, option, ec);
|
||||
}
|
||||
|
||||
/// Perform an IO control command on the socket.
|
||||
template <typename IO_Control_Command>
|
||||
template <typename IoControlCommand>
|
||||
asio::error_code io_control(implementation_type& impl,
|
||||
IO_Control_Command& command, asio::error_code& ec)
|
||||
IoControlCommand& command, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.io_control(impl, command, ec);
|
||||
}
|
||||
@ -176,36 +176,36 @@ public:
|
||||
}
|
||||
|
||||
/// Accept a new connection.
|
||||
template <typename Socket_Service>
|
||||
template <typename SocketService>
|
||||
asio::error_code accept(implementation_type& impl,
|
||||
basic_socket<protocol_type, Socket_Service>& peer,
|
||||
basic_socket<protocol_type, SocketService>& peer,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.accept(impl, peer, ec);
|
||||
}
|
||||
|
||||
/// Accept a new connection.
|
||||
template <typename Socket_Service>
|
||||
template <typename SocketService>
|
||||
asio::error_code accept_endpoint(implementation_type& impl,
|
||||
basic_socket<protocol_type, Socket_Service>& peer,
|
||||
basic_socket<protocol_type, SocketService>& peer,
|
||||
endpoint_type& peer_endpoint, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.accept_endpoint(impl, peer, peer_endpoint, ec);
|
||||
}
|
||||
|
||||
/// Start an asynchronous accept.
|
||||
template <typename Socket_Service, typename Handler>
|
||||
template <typename SocketService, typename AcceptHandler>
|
||||
void async_accept(implementation_type& impl,
|
||||
basic_socket<protocol_type, Socket_Service>& peer, Handler handler)
|
||||
basic_socket<protocol_type, SocketService>& peer, AcceptHandler handler)
|
||||
{
|
||||
service_impl_.async_accept(impl, peer, handler);
|
||||
}
|
||||
|
||||
/// Start an asynchronous accept.
|
||||
template <typename Socket_Service, typename Handler>
|
||||
template <typename SocketService, typename AcceptHandler>
|
||||
void async_accept_endpoint(implementation_type& impl,
|
||||
basic_socket<protocol_type, Socket_Service>& peer,
|
||||
endpoint_type& peer_endpoint, Handler handler)
|
||||
basic_socket<protocol_type, SocketService>& peer,
|
||||
endpoint_type& peer_endpoint, AcceptHandler handler)
|
||||
{
|
||||
service_impl_.async_accept_endpoint(impl, peer, peer_endpoint, handler);
|
||||
}
|
||||
|
@ -388,8 +388,8 @@ public:
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*/
|
||||
template <typename Password_Callback>
|
||||
void set_password_callback(Password_Callback callback)
|
||||
template <typename PasswordCallback>
|
||||
void set_password_callback(PasswordCallback callback)
|
||||
{
|
||||
asio::error_code ec;
|
||||
service_.set_password_callback(impl_, callback, ec);
|
||||
@ -411,8 +411,8 @@ public:
|
||||
*
|
||||
* @param ec Set to indicate what error occurred, if any.
|
||||
*/
|
||||
template <typename Password_Callback>
|
||||
asio::error_code set_password_callback(Password_Callback callback,
|
||||
template <typename PasswordCallback>
|
||||
asio::error_code set_password_callback(PasswordCallback callback,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return service_.set_password_callback(impl_, callback, ec);
|
||||
|
@ -145,9 +145,9 @@ public:
|
||||
}
|
||||
|
||||
/// Set the password callback.
|
||||
template <typename Password_Callback>
|
||||
template <typename PasswordCallback>
|
||||
asio::error_code set_password_callback(impl_type& impl,
|
||||
Password_Callback callback, asio::error_code& ec)
|
||||
PasswordCallback callback, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.set_password_callback(impl, callback, ec);
|
||||
}
|
||||
|
@ -195,8 +195,8 @@ public:
|
||||
* const asio::error_code& error // Result of operation.
|
||||
* ); @endcode
|
||||
*/
|
||||
template <typename Handler>
|
||||
void async_handshake(handshake_type type, Handler handler)
|
||||
template <typename HandshakeHandler>
|
||||
void async_handshake(handshake_type type, HandshakeHandler handler)
|
||||
{
|
||||
service_.async_handshake(impl_, next_layer_, type, handler);
|
||||
}
|
||||
@ -239,8 +239,8 @@ public:
|
||||
* const asio::error_code& error // Result of operation.
|
||||
* ); @endcode
|
||||
*/
|
||||
template <typename Handler>
|
||||
void async_shutdown(Handler handler)
|
||||
template <typename ShutdownHandler>
|
||||
void async_shutdown(ShutdownHandler handler)
|
||||
{
|
||||
service_.async_shutdown(impl_, next_layer_, handler);
|
||||
}
|
||||
@ -261,8 +261,8 @@ public:
|
||||
* peer. Consider using the @ref write function if you need to ensure that all
|
||||
* data is written before the blocking operation completes.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers)
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = service_.write_some(impl_, next_layer_, buffers, ec);
|
||||
@ -286,8 +286,8 @@ public:
|
||||
* peer. Consider using the @ref write function if you need to ensure that all
|
||||
* data is written before the blocking operation completes.
|
||||
*/
|
||||
template <typename Const_Buffers>
|
||||
std::size_t write_some(const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some(const ConstBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return service_.write_some(impl_, next_layer_, buffers, ec);
|
||||
@ -315,8 +315,9 @@ public:
|
||||
* the peer. Consider using the @ref async_write function if you need to
|
||||
* ensure that all data is written before the blocking operation completes.
|
||||
*/
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_write_some(const Const_Buffers& buffers, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_write_some(const ConstBufferSequence& buffers,
|
||||
WriteHandler handler)
|
||||
{
|
||||
service_.async_write_some(impl_, next_layer_, buffers, handler);
|
||||
}
|
||||
@ -337,8 +338,8 @@ public:
|
||||
* 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 Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = service_.read_some(impl_, next_layer_, buffers, ec);
|
||||
@ -362,8 +363,8 @@ public:
|
||||
* 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 Mutable_Buffers>
|
||||
std::size_t read_some(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return service_.read_some(impl_, next_layer_, buffers, ec);
|
||||
@ -392,8 +393,9 @@ public:
|
||||
* ensure that the requested amount of data is read before the asynchronous
|
||||
* operation completes.
|
||||
*/
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_read_some(const MutableBufferSequence& buffers,
|
||||
ReadHandler handler)
|
||||
{
|
||||
service_.async_read_some(impl_, next_layer_, buffers, handler);
|
||||
}
|
||||
@ -410,8 +412,8 @@ public:
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers)
|
||||
{
|
||||
asio::error_code ec;
|
||||
std::size_t s = service_.peek(impl_, next_layer_, buffers, ec);
|
||||
@ -431,8 +433,8 @@ public:
|
||||
*
|
||||
* @returns The number of bytes read. Returns 0 if an error occurred.
|
||||
*/
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t peek(const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t peek(const MutableBufferSequence& buffers,
|
||||
asio::error_code& ec)
|
||||
{
|
||||
return service_.peek(impl_, next_layer_, buffers, ec);
|
||||
|
@ -90,9 +90,9 @@ public:
|
||||
}
|
||||
|
||||
/// Start an asynchronous SSL handshake.
|
||||
template <typename Stream, typename Handler>
|
||||
template <typename Stream, typename HandshakeHandler>
|
||||
void async_handshake(impl_type& impl, Stream& next_layer,
|
||||
stream_base::handshake_type type, Handler handler)
|
||||
stream_base::handshake_type type, HandshakeHandler handler)
|
||||
{
|
||||
service_impl_.async_handshake(impl, next_layer, type, handler);
|
||||
}
|
||||
@ -106,48 +106,51 @@ public:
|
||||
}
|
||||
|
||||
/// Asynchronously shut down SSL on the stream.
|
||||
template <typename Stream, typename Handler>
|
||||
void async_shutdown(impl_type& impl, Stream& next_layer, Handler handler)
|
||||
template <typename Stream, typename ShutdownHandler>
|
||||
void async_shutdown(impl_type& impl, Stream& next_layer,
|
||||
ShutdownHandler handler)
|
||||
{
|
||||
service_impl_.async_shutdown(impl, next_layer, handler);
|
||||
}
|
||||
|
||||
/// Write some data to the stream.
|
||||
template <typename Stream, typename Const_Buffers>
|
||||
template <typename Stream, typename ConstBufferSequence>
|
||||
std::size_t write_some(impl_type& impl, Stream& next_layer,
|
||||
const Const_Buffers& buffers, asio::error_code& ec)
|
||||
const ConstBufferSequence& buffers, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.write_some(impl, next_layer, buffers, ec);
|
||||
}
|
||||
|
||||
/// Start an asynchronous write.
|
||||
template <typename Stream, typename Const_Buffers, typename Handler>
|
||||
template <typename Stream, typename ConstBufferSequence,
|
||||
typename WriteHandler>
|
||||
void async_write_some(impl_type& impl, Stream& next_layer,
|
||||
const Const_Buffers& buffers, Handler handler)
|
||||
const ConstBufferSequence& buffers, WriteHandler handler)
|
||||
{
|
||||
service_impl_.async_write_some(impl, next_layer, buffers, handler);
|
||||
}
|
||||
|
||||
/// Read some data from the stream.
|
||||
template <typename Stream, typename Mutable_Buffers>
|
||||
template <typename Stream, typename MutableBufferSequence>
|
||||
std::size_t read_some(impl_type& impl, Stream& next_layer,
|
||||
const Mutable_Buffers& buffers, asio::error_code& ec)
|
||||
const MutableBufferSequence& buffers, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.read_some(impl, next_layer, buffers, ec);
|
||||
}
|
||||
|
||||
/// Start an asynchronous read.
|
||||
template <typename Stream, typename Mutable_Buffers, typename Handler>
|
||||
template <typename Stream, typename MutableBufferSequence,
|
||||
typename ReadHandler>
|
||||
void async_read_some(impl_type& impl, Stream& next_layer,
|
||||
const Mutable_Buffers& buffers, Handler handler)
|
||||
const MutableBufferSequence& buffers, ReadHandler handler)
|
||||
{
|
||||
service_impl_.async_read_some(impl, next_layer, buffers, handler);
|
||||
}
|
||||
|
||||
/// Peek at the incoming data on the stream.
|
||||
template <typename Stream, typename Mutable_Buffers>
|
||||
template <typename Stream, typename MutableBufferSequence>
|
||||
std::size_t peek(impl_type& impl, Stream& next_layer,
|
||||
const Mutable_Buffers& buffers, asio::error_code& ec)
|
||||
const MutableBufferSequence& buffers, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.peek(impl, next_layer, buffers, ec);
|
||||
}
|
||||
|
@ -152,33 +152,33 @@ public:
|
||||
}
|
||||
|
||||
/// Start an asynchronous connect.
|
||||
template <typename Handler>
|
||||
template <typename ConnectHandler>
|
||||
void async_connect(implementation_type& impl,
|
||||
const endpoint_type& peer_endpoint, Handler handler)
|
||||
const endpoint_type& peer_endpoint, ConnectHandler handler)
|
||||
{
|
||||
service_impl_.async_connect(impl, peer_endpoint, handler);
|
||||
}
|
||||
|
||||
/// Set a socket option.
|
||||
template <typename Option>
|
||||
template <typename SettableSocketOption>
|
||||
asio::error_code set_option(implementation_type& impl,
|
||||
const Option& option, asio::error_code& ec)
|
||||
const SettableSocketOption& option, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.set_option(impl, option, ec);
|
||||
}
|
||||
|
||||
/// Get a socket option.
|
||||
template <typename Option>
|
||||
template <typename GettableSocketOption>
|
||||
asio::error_code get_option(const implementation_type& impl,
|
||||
Option& option, asio::error_code& ec) const
|
||||
GettableSocketOption& option, asio::error_code& ec) const
|
||||
{
|
||||
return service_impl_.get_option(impl, option, ec);
|
||||
}
|
||||
|
||||
/// Perform an IO control command on the socket.
|
||||
template <typename IO_Control_Command>
|
||||
template <typename IoControlCommand>
|
||||
asio::error_code io_control(implementation_type& impl,
|
||||
IO_Control_Command& command, asio::error_code& ec)
|
||||
IoControlCommand& command, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.io_control(impl, command, ec);
|
||||
}
|
||||
@ -205,33 +205,37 @@ public:
|
||||
}
|
||||
|
||||
/// Send the given data to the peer.
|
||||
template <typename Const_Buffers>
|
||||
std::size_t send(implementation_type& impl, const Const_Buffers& buffers,
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send(implementation_type& impl,
|
||||
const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.send(impl, buffers, flags, ec);
|
||||
}
|
||||
|
||||
/// Start an asynchronous send.
|
||||
template <typename Const_Buffers, typename Handler>
|
||||
void async_send(implementation_type& impl, const Const_Buffers& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
void async_send(implementation_type& impl,
|
||||
const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags, WriteHandler handler)
|
||||
{
|
||||
service_impl_.async_send(impl, buffers, flags, handler);
|
||||
}
|
||||
|
||||
/// Receive some data from the peer.
|
||||
template <typename Mutable_Buffers>
|
||||
std::size_t receive(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t receive(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, asio::error_code& ec)
|
||||
{
|
||||
return service_impl_.receive(impl, buffers, flags, ec);
|
||||
}
|
||||
|
||||
/// Start an asynchronous receive.
|
||||
template <typename Mutable_Buffers, typename Handler>
|
||||
void async_receive(implementation_type& impl, const Mutable_Buffers& buffers,
|
||||
socket_base::message_flags flags, Handler handler)
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
void async_receive(implementation_type& impl,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags, ReadHandler handler)
|
||||
{
|
||||
service_impl_.async_receive(impl, buffers, flags, handler);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace asio {
|
||||
* write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Sync_Write_Stream concept.
|
||||
* the SyncWriteStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers containing the data to be written. The sum
|
||||
* of the buffer sizes indicates the maximum number of bytes to write to the
|
||||
@ -68,8 +68,8 @@ namespace asio {
|
||||
* s, buffers,
|
||||
* asio::transfer_all()); @endcode
|
||||
*/
|
||||
template <typename Sync_Write_Stream, typename Const_Buffers>
|
||||
std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers);
|
||||
template <typename SyncWriteStream, typename ConstBufferSequence>
|
||||
std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers);
|
||||
|
||||
/// Write a certain amount of data to a stream before returning.
|
||||
/**
|
||||
@ -85,7 +85,7 @@ std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers);
|
||||
* write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Sync_Write_Stream concept.
|
||||
* the SyncWriteStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers containing the data to be written. The sum
|
||||
* of the buffer sizes indicates the maximum number of bytes to write to the
|
||||
@ -117,10 +117,10 @@ std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers);
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Sync_Write_Stream, typename Const_Buffers,
|
||||
typename Completion_Condition>
|
||||
std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
Completion_Condition completion_condition);
|
||||
template <typename SyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition>
|
||||
std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition);
|
||||
|
||||
/// Write a certain amount of data to a stream before returning.
|
||||
/**
|
||||
@ -136,7 +136,7 @@ std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
* write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Sync_Write_Stream concept.
|
||||
* the SyncWriteStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers containing the data to be written. The sum
|
||||
* of the buffer sizes indicates the maximum number of bytes to write to the
|
||||
@ -161,10 +161,10 @@ std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
* @returns The number of bytes written. If an error occurs, returns the total
|
||||
* number of bytes successfully transferred prior to the error.
|
||||
*/
|
||||
template <typename Sync_Write_Stream, typename Const_Buffers,
|
||||
typename Completion_Condition>
|
||||
std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
Completion_Condition completion_condition, asio::error_code& ec);
|
||||
template <typename SyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition>
|
||||
std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, asio::error_code& ec);
|
||||
|
||||
/// Write a certain amount of data to a stream before returning.
|
||||
/**
|
||||
@ -179,7 +179,7 @@ std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
* write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Sync_Write_Stream concept.
|
||||
* the SyncWriteStream concept.
|
||||
*
|
||||
* @param b The basic_streambuf object from which data will be written.
|
||||
*
|
||||
@ -192,8 +192,8 @@ std::size_t write(Sync_Write_Stream& s, const Const_Buffers& buffers,
|
||||
* s, b,
|
||||
* asio::transfer_all()); @endcode
|
||||
*/
|
||||
template <typename Sync_Write_Stream, typename Allocator>
|
||||
std::size_t write(Sync_Write_Stream& s, basic_streambuf<Allocator>& b);
|
||||
template <typename SyncWriteStream, typename Allocator>
|
||||
std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b);
|
||||
|
||||
/// Write a certain amount of data to a stream before returning.
|
||||
/**
|
||||
@ -208,7 +208,7 @@ std::size_t write(Sync_Write_Stream& s, basic_streambuf<Allocator>& b);
|
||||
* write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Sync_Write_Stream concept.
|
||||
* the SyncWriteStream concept.
|
||||
*
|
||||
* @param b The basic_streambuf object from which data will be written.
|
||||
*
|
||||
@ -230,10 +230,10 @@ std::size_t write(Sync_Write_Stream& s, basic_streambuf<Allocator>& b);
|
||||
*
|
||||
* @throws asio::system_error Thrown on failure.
|
||||
*/
|
||||
template <typename Sync_Write_Stream, typename Allocator,
|
||||
typename Completion_Condition>
|
||||
std::size_t write(Sync_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition);
|
||||
template <typename SyncWriteStream, typename Allocator,
|
||||
typename CompletionCondition>
|
||||
std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition);
|
||||
|
||||
/// Write a certain amount of data to a stream before returning.
|
||||
/**
|
||||
@ -248,7 +248,7 @@ std::size_t write(Sync_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Sync_Write_Stream concept.
|
||||
* the SyncWriteStream concept.
|
||||
*
|
||||
* @param b The basic_streambuf object from which data will be written.
|
||||
*
|
||||
@ -271,10 +271,10 @@ std::size_t write(Sync_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* @returns The number of bytes written. If an error occurs, returns the total
|
||||
* number of bytes successfully transferred prior to the error.
|
||||
*/
|
||||
template <typename Sync_Write_Stream, typename Allocator,
|
||||
typename Completion_Condition>
|
||||
std::size_t write(Sync_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition, asio::error_code& ec);
|
||||
template <typename SyncWriteStream, typename Allocator,
|
||||
typename CompletionCondition>
|
||||
std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition, asio::error_code& ec);
|
||||
|
||||
/*@}*/
|
||||
/**
|
||||
@ -299,7 +299,7 @@ std::size_t write(Sync_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* async_write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Async_Write_Stream concept.
|
||||
* the AsyncWriteStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers containing the data to be written.
|
||||
* Although the buffers object may be copied as necessary, ownership of the
|
||||
@ -331,9 +331,10 @@ std::size_t write(Sync_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Async_Write_Stream, typename Const_Buffers, typename Handler>
|
||||
void async_write(Async_Write_Stream& s, const Const_Buffers& buffers,
|
||||
Handler handler);
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename WriteHandler>
|
||||
void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
WriteHandler handler);
|
||||
|
||||
/// Start an asynchronous operation to write a certain amount of data to a
|
||||
/// stream.
|
||||
@ -352,7 +353,7 @@ void async_write(Async_Write_Stream& s, const Const_Buffers& buffers,
|
||||
* async_write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Async_Write_Stream concept.
|
||||
* the AsyncWriteStream concept.
|
||||
*
|
||||
* @param buffers One or more buffers containing the data to be written.
|
||||
* Although the buffers object may be copied as necessary, ownership of the
|
||||
@ -399,10 +400,10 @@ void async_write(Async_Write_Stream& s, const Const_Buffers& buffers,
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename Async_Write_Stream, typename Const_Buffers,
|
||||
typename Completion_Condition, typename Handler>
|
||||
void async_write(Async_Write_Stream& s, const Const_Buffers& buffers,
|
||||
Completion_Condition completion_condition, Handler handler);
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition, WriteHandler handler);
|
||||
|
||||
/// Start an asynchronous operation to write a certain amount of data to a
|
||||
/// stream.
|
||||
@ -420,7 +421,7 @@ void async_write(Async_Write_Stream& s, const Const_Buffers& buffers,
|
||||
* async_write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Async_Write_Stream concept.
|
||||
* the AsyncWriteStream concept.
|
||||
*
|
||||
* @param b A basic_streambuf object from which data will be written. Ownership
|
||||
* of the streambuf is retained by the caller, which must guarantee that it
|
||||
@ -442,9 +443,9 @@ void async_write(Async_Write_Stream& s, const Const_Buffers& buffers,
|
||||
* the handler will be performed in a manner equivalent to using
|
||||
* asio::io_service::post().
|
||||
*/
|
||||
template <typename Async_Write_Stream, typename Allocator, typename Handler>
|
||||
void async_write(Async_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
Handler handler);
|
||||
template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
|
||||
void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
|
||||
WriteHandler handler);
|
||||
|
||||
/// Start an asynchronous operation to write a certain amount of data to a
|
||||
/// stream.
|
||||
@ -462,7 +463,7 @@ void async_write(Async_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* async_write_some function.
|
||||
*
|
||||
* @param s The stream to which the data is to be written. The type must support
|
||||
* the Async_Write_Stream concept.
|
||||
* the AsyncWriteStream concept.
|
||||
*
|
||||
* @param b A basic_streambuf object from which data will be written. Ownership
|
||||
* of the streambuf is retained by the caller, which must guarantee that it
|
||||
@ -498,10 +499,10 @@ void async_write(Async_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
* the handler will be performed in a manner equivalent to using
|
||||
* asio::io_service::post().
|
||||
*/
|
||||
template <typename Async_Write_Stream, typename Allocator,
|
||||
typename Completion_Condition, typename Handler>
|
||||
void async_write(Async_Write_Stream& s, basic_streambuf<Allocator>& b,
|
||||
Completion_Condition completion_condition, Handler handler);
|
||||
template <typename AsyncWriteStream, typename Allocator,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition, WriteHandler handler);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user