11 #ifndef ASIO_DATAGRAM_SOCKET_SERVICE_HPP 12 #define ASIO_DATAGRAM_SOCKET_SERVICE_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 25 #if defined(ASIO_WINDOWS_RUNTIME) 27 #elif defined(ASIO_HAS_IOCP) 38 template <
typename Protocol>
40 #if defined(GENERATING_DOCUMENTATION)
47 #if defined(GENERATING_DOCUMENTATION) 60 #if defined(ASIO_WINDOWS_RUNTIME) 62 #elif defined(ASIO_HAS_IOCP) 63 typedef detail::win_iocp_socket_service<Protocol> service_impl_type;
70 #if defined(GENERATING_DOCUMENTATION) 77 #if defined(GENERATING_DOCUMENTATION) 84 #if defined(GENERATING_DOCUMENTATION) 94 service_impl_(io_service)
104 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 105 void move_construct(implementation_type& impl,
107 implementation_type& other_impl)
113 void move_assign(implementation_type& impl,
115 implementation_type& other_impl)
117 service_impl_.
move_assign(impl, other_service.service_impl_, other_impl);
122 template <
typename Protocol1>
123 void converting_move_construct(implementation_type& impl,
125 Protocol1>::implementation_type& other_impl,
127 Protocol1, Protocol>::value>::type* = 0)
129 service_impl_.template converting_move_construct<Protocol1>(
132 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 145 service_impl_.
open(impl, protocol, ec);
153 const protocol_type& protocol,
const native_handle_type& native_socket,
156 return service_impl_.
assign(impl, protocol, native_socket, ec);
160 bool is_open(
const implementation_type& impl)
const 162 return service_impl_.
is_open(impl);
169 return service_impl_.
close(impl, ec);
173 native_type
native(implementation_type& impl)
188 return service_impl_.
cancel(impl, ec);
195 return service_impl_.
at_mark(impl, ec);
202 return service_impl_.
available(impl, ec);
209 return service_impl_.
bind(impl, endpoint, ec);
216 return service_impl_.
connect(impl, peer_endpoint, ec);
220 template <
typename ConnectHandler>
223 async_connect(implementation_type& impl,
237 template <
typename SettableSocketOption>
241 return service_impl_.
set_option(impl, option, ec);
245 template <
typename GettableSocketOption>
249 return service_impl_.
get_option(impl, option, ec);
253 template <
typename IoControlCommand>
257 return service_impl_.
io_control(impl, command, ec);
304 return service_impl_.
shutdown(impl, what, ec);
308 template <
typename ConstBufferSequence>
309 std::size_t
send(implementation_type& impl,
310 const ConstBufferSequence&
buffers,
313 return service_impl_.
send(impl, buffers, flags, ec);
317 template <
typename ConstBufferSequence,
typename WriteHandler>
320 async_send(implementation_type& impl, const ConstBufferSequence&
buffers,
334 template <
typename ConstBufferSequence>
339 return service_impl_.
send_to(impl, buffers, destination, flags, ec);
343 template <
typename ConstBufferSequence,
typename WriteHandler>
356 destination, flags, init.
handler);
362 template <
typename MutableBufferSequence>
364 const MutableBufferSequence& buffers,
367 return service_impl_.
receive(impl, buffers, flags, ec);
371 template <
typename MutableBufferSequence,
typename ReadHandler>
375 const MutableBufferSequence& buffers,
389 template <
typename MutableBufferSequence>
394 return service_impl_.
receive_from(impl, buffers, sender_endpoint, flags,
399 template <
typename MutableBufferSequence,
typename ReadHandler>
412 sender_endpoint, flags, init.
handler);
419 void shutdown_service()
432 #endif // ASIO_DATAGRAM_SOCKET_SERVICE_HPP bool is_open(const implementation_type &impl) const
Determine whether the socket is open.
int message_flags
Bitmask type for flags that can be passed to send and receive operations.
asio::error_code assign(implementation_type &impl, const protocol_type &protocol, const native_handle_type &native_socket, asio::error_code &ec)
asio::error_code cancel(implementation_type &impl, asio::error_code &ec)
Cancel all asynchronous operations associated with the socket.
asio::error_code bind(implementation_type &impl, const endpoint_type &endpoint, asio::error_code &ec)
asio::error_code non_blocking(implementation_type &impl, bool mode, asio::error_code &ec)
Sets the non-blocking mode of the socket.
bool at_mark(const base_implementation_type &impl, asio::error_code &ec) const
asio::error_code shutdown(implementation_type &impl, socket_base::shutdown_type what, asio::error_code &ec)
Disable sends or receives on the socket.
Class used to uniquely identify a service.
asio::error_code connect(implementation_type &impl, const endpoint_type &peer_endpoint, asio::error_code &ec)
Provides core I/O functionality.
asio::error_code native_non_blocking(implementation_type &impl, bool mode, asio::error_code &ec)
Sets the non-blocking mode of the native socket implementation.
endpoint_type remote_endpoint(const implementation_type &impl, asio::error_code &ec) const
Get the remote endpoint.
void construct(implementation_type &impl)
Construct a new datagram socket implementation.
const ConstBufferSequence socket_base::message_flags flags
const MutableBufferSequence endpoint_type socket_base::message_flags ASIO_MOVE_ARG(ReadHandler) handler)
ASIO_DECL void shutdown_service()
service_impl_type::native_handle_type native_handle_type
The native socket type.
const endpoint_type ASIO_MOVE_ARG(ConnectHandler) handler)
asio::error_code get_option(const implementation_type &impl, Option &option, asio::error_code &ec) const
ASIO_DECL void destroy(base_implementation_type &impl)
asio::basic_streambuf< Allocator > MatchCondition enable_if< is_match_condition< MatchCondition >::value >::type *detail::async_result_init< ReadHandler, void(asio::error_code, std::size_t)> init(ASIO_MOVE_CAST(ReadHandler)(handler))
void async_send_to(implementation_type &impl, const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags, Handler &handler)
Protocol protocol_type
The protocol type.
size_t receive(base_implementation_type &impl, const MutableBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)
size_t send(base_implementation_type &impl, const ConstBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)
void async_connect(implementation_type &impl, const endpoint_type &peer_endpoint, Handler &handler)
native_handle_type native_handle(implementation_type &impl)
Get the native socket implementation.
datagram_socket_service(asio::io_service &io_service)
Construct a new datagram socket service for the specified io_service.
asio::error_code io_control(implementation_type &impl, IoControlCommand &command, asio::error_code &ec)
Perform an IO control command on the socket.
ASIO_INITFN_RESULT_TYPE(ConnectHandler, void(asio::error_code)) async_connect(implementation_type &impl
Start an asynchronous connect.
const endpoint_type & peer_endpoint
asio::error_code io_control(base_implementation_type &impl, IO_Control_Command &command, asio::error_code &ec)
std::size_t receive(implementation_type &impl, const MutableBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)
Receive some data from the peer.
size_t send_to(implementation_type &impl, const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags, asio::error_code &ec)
void move_assign(implementation_type &impl, reactive_socket_service_base &other_service, implementation_type &other_impl)
asio::error_code close(implementation_type &impl, asio::error_code &ec)
Close a datagram socket implementation.
asio::error_code get_option(const implementation_type &impl, GettableSocketOption &option, asio::error_code &ec) const
Get a socket option.
endpoint_type local_endpoint(const implementation_type &impl, asio::error_code &ec) const
ASIO_DECL void construct(base_implementation_type &impl)
std::size_t send_to(implementation_type &impl, const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags, asio::error_code &ec)
Send a datagram to the specified endpoint.
std::size_t receive_from(implementation_type &impl, const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags, asio::error_code &ec)
Receive a datagram with the endpoint of the sender.
Default service implementation for a datagram socket.
const MutableBufferSequence endpoint_type & sender_endpoint
bool non_blocking(const implementation_type &impl) const
Gets the non-blocking mode of the socket.
asio::error_code set_option(implementation_type &impl, const Option &option, asio::error_code &ec)
bool native_non_blocking(const implementation_type &impl) const
Gets the non-blocking mode of the native socket implementation.
socket_type native_handle_type
asio::error_code assign(implementation_type &impl, const protocol_type &protocol, const native_handle_type &native_socket, asio::error_code &ec)
Assign an existing native socket to a datagram socket.
const ConstBufferSequence & buffers
service_impl_type::implementation_type implementation_type
The type of a datagram socket.
native_type native(implementation_type &impl)
(Deprecated: Use native_handle().) Get the native socket implementation.
shutdown_type
Different ways a socket may be shutdown.
asio::error_code open(implementation_type &impl, const protocol_type &protocol, asio::error_code &ec)
void async_receive_from(implementation_type &impl, const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags, Handler &handler)
void move_construct(implementation_type &impl, implementation_type &other_impl)
service_impl_type::native_handle_type native_type
(Deprecated: Use native_handle_type.) The native socket type.
bool is_open(const base_implementation_type &impl) const
Class to represent an error code value.
const ConstBufferSequence const endpoint_type socket_base::message_flags ASIO_MOVE_ARG(WriteHandler) handler)
const ConstBufferSequence const endpoint_type & destination
void async_send(base_implementation_type &impl, const ConstBufferSequence &buffers, socket_base::message_flags flags, Handler &handler)
ASIO_DECL asio::error_code close(base_implementation_type &impl, asio::error_code &ec)
endpoint_type local_endpoint(const implementation_type &impl, asio::error_code &ec) const
Get the local endpoint.
bool native_non_blocking(const base_implementation_type &impl) const
static asio::detail::service_id< datagram_socket_service< Protocol > > id
void async_receive(base_implementation_type &impl, const MutableBufferSequence &buffers, socket_base::message_flags flags, Handler &handler)
asio::error_code connect(implementation_type &impl, const endpoint_type &peer_endpoint, asio::error_code &ec)
Connect the datagram socket to the specified endpoint.
void destroy(implementation_type &impl)
Destroy a datagram socket implementation.
asio::error_code bind(implementation_type &impl, const endpoint_type &endpoint, asio::error_code &ec)
ASIO_DECL asio::error_code cancel(base_implementation_type &impl, asio::error_code &ec)
handler_type< Handler, Signature >::type handler
const MutableBufferSequence socket_base::message_flags ASIO_MOVE_ARG(ReadHandler) handler)
#define ASIO_MOVE_CAST(type)
bool non_blocking(const base_implementation_type &impl) const
async_result< typename handler_type< Handler, Signature >::type > result
native_handle_type native_handle(implementation_type &impl)
service_base(asio::io_service &io_service)
Base class for all io_service services.
asio::error_code open(implementation_type &impl, const protocol_type &protocol, asio::error_code &ec)
std::size_t available(const implementation_type &impl, asio::error_code &ec) const
Determine the number of bytes available for reading.
asio::error_code set_option(implementation_type &impl, const SettableSocketOption &option, asio::error_code &ec)
Set a socket option.
Protocol::endpoint endpoint_type
The endpoint type.
bool at_mark(const implementation_type &impl, asio::error_code &ec) const
Determine whether the socket is at the out-of-band data mark.
std::size_t send(implementation_type &impl, const ConstBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)
Send the given data to the peer.
std::size_t available(const base_implementation_type &impl, asio::error_code &ec) const
asio::error_code shutdown(base_implementation_type &impl, socket_base::shutdown_type what, asio::error_code &ec)
endpoint_type remote_endpoint(const implementation_type &impl, asio::error_code &ec) const
size_t receive_from(implementation_type &impl, const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags, asio::error_code &ec)