11 #ifndef ASIO_SOCKET_ACCEPTOR_SERVICE_HPP 12 #define ASIO_SOCKET_ACCEPTOR_SERVICE_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 24 #if defined(ASIO_WINDOWS_RUNTIME) 26 #elif defined(ASIO_HAS_IOCP) 37 template <
typename Protocol>
39 #if defined(GENERATING_DOCUMENTATION)
46 #if defined(GENERATING_DOCUMENTATION) 59 #if defined(ASIO_WINDOWS_RUNTIME) 61 #elif defined(ASIO_HAS_IOCP) 62 typedef detail::win_iocp_socket_service<Protocol> service_impl_type;
69 #if defined(GENERATING_DOCUMENTATION) 76 #if defined(GENERATING_DOCUMENTATION) 83 #if defined(GENERATING_DOCUMENTATION) 93 service_impl_(io_service)
100 service_impl_.construct(impl);
103 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 104 void move_construct(implementation_type& impl,
106 implementation_type& other_impl)
108 service_impl_.move_construct(impl, other_impl);
112 void move_assign(implementation_type& impl,
114 implementation_type& other_impl)
116 service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
121 template <
typename Protocol1>
122 void converting_move_construct(implementation_type& impl,
124 Protocol1>::implementation_type& other_impl,
126 Protocol1, Protocol>::value>::type* = 0)
128 service_impl_.template converting_move_construct<Protocol1>(
131 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 136 service_impl_.destroy(impl);
143 return service_impl_.open(impl, protocol, ec);
148 const protocol_type& protocol,
const native_handle_type& native_acceptor,
151 return service_impl_.assign(impl, protocol, native_acceptor, ec);
155 bool is_open(
const implementation_type& impl)
const 157 return service_impl_.is_open(impl);
164 return service_impl_.cancel(impl, ec);
171 return service_impl_.bind(impl, endpoint, ec);
179 return service_impl_.listen(impl, backlog, ec);
186 return service_impl_.close(impl, ec);
190 native_type
native(implementation_type& impl)
192 return service_impl_.native_handle(impl);
198 return service_impl_.native_handle(impl);
202 template <
typename SettableSocketOption>
206 return service_impl_.set_option(impl, option, ec);
210 template <
typename GettableSocketOption>
214 return service_impl_.get_option(impl, option, ec);
218 template <
typename IoControlCommand>
222 return service_impl_.io_control(impl, command, ec);
228 return service_impl_.non_blocking(impl);
235 return service_impl_.non_blocking(impl, mode, ec);
241 return service_impl_.native_non_blocking(impl);
248 return service_impl_.native_non_blocking(impl, mode, ec);
255 return service_impl_.local_endpoint(impl, ec);
259 template <
typename Protocol1,
typename SocketService>
263 typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0)
265 return service_impl_.accept(impl, peer, peer_endpoint, ec);
269 template <
typename Protocol1,
typename SocketService,
typename AcceptHandler>
272 async_accept(implementation_type& impl,
276 typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0)
282 service_impl_.async_accept(impl, peer, peer_endpoint, init.
handler);
289 void shutdown_service()
291 service_impl_.shutdown_service();
295 service_impl_type service_impl_;
302 #endif // ASIO_SOCKET_ACCEPTOR_SERVICE_HPP asio::error_code io_control(implementation_type &impl, IoControlCommand &command, asio::error_code &ec)
Perform an IO control command on the socket.
bool is_open(const implementation_type &impl) const
Determine whether the acceptor is open.
void construct(implementation_type &impl)
Construct a new socket acceptor implementation.
asio::error_code native_non_blocking(implementation_type &impl, bool mode, asio::error_code &ec)
Sets the non-blocking mode of the native acceptor implementation.
Class used to uniquely identify a service.
Provides core I/O functionality.
endpoint_type local_endpoint(const implementation_type &impl, asio::error_code &ec) const
Get the local endpoint.
bool native_non_blocking(const implementation_type &impl) const
Gets the non-blocking mode of the native acceptor implementation.
asio::error_code cancel(implementation_type &impl, asio::error_code &ec)
Cancel all asynchronous operations associated with the acceptor.
service_impl_type::native_handle_type native_type
(Deprecated: Use native_handle_type.) The native acceptor type.
basic_socket< Protocol1, SocketService > endpoint_type * peer_endpoint
asio::error_code non_blocking(implementation_type &impl, bool mode, asio::error_code &ec)
Sets the non-blocking mode of the acceptor.
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))
asio::error_code assign(implementation_type &impl, const protocol_type &protocol, const native_handle_type &native_acceptor, asio::error_code &ec)
Assign an existing native acceptor to a socket acceptor.
asio::error_code bind(implementation_type &impl, const endpoint_type &endpoint, asio::error_code &ec)
Bind the socket acceptor to the specified local endpoint.
asio::error_code close(implementation_type &impl, asio::error_code &ec)
Close a socket acceptor implementation.
Default service implementation for a socket acceptor.
ASIO_INITFN_RESULT_TYPE(AcceptHandler, void(asio::error_code)) async_accept(implementation_type &impl
Start an asynchronous accept.
void destroy(implementation_type &impl)
Destroy a socket acceptor implementation.
asio::error_code set_option(implementation_type &impl, const SettableSocketOption &option, asio::error_code &ec)
Set a socket option.
socket_type native_handle_type
basic_socket< Protocol1, SocketService > endpoint_type ASIO_MOVE_ARG(AcceptHandler) handler
basic_socket< Protocol1, SocketService > & peer
asio::error_code listen(implementation_type &impl, int backlog, asio::error_code &ec)
asio::error_code get_option(const implementation_type &impl, GettableSocketOption &option, asio::error_code &ec) const
Get a socket option.
Protocol protocol_type
The protocol type.
socket_acceptor_service(asio::io_service &io_service)
Construct a new socket acceptor service for the specified io_service.
Class to represent an error code value.
asio::error_code open(implementation_type &impl, const protocol_type &protocol, asio::error_code &ec)
Open a new socket acceptor implementation.
native_type native(implementation_type &impl)
(Deprecated: Use native_handle().) Get the native acceptor implementation.
protocol_type::endpoint endpoint_type
The endpoint type.
static asio::detail::service_id< socket_acceptor_service< Protocol > > id
handler_type< Handler, Signature >::type handler
#define ASIO_MOVE_CAST(type)
service_impl_type::native_handle_type native_handle_type
The native acceptor type.
async_result< typename handler_type< Handler, Signature >::type > result
service_base(asio::io_service &io_service)
native_handle_type native_handle(implementation_type &impl)
Get the native acceptor implementation.
Base class for all io_service services.
asio::error_code accept(implementation_type &impl, basic_socket< Protocol1, SocketService > &peer, endpoint_type *peer_endpoint, asio::error_code &ec, typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *=0)
Accept a new connection.
bool non_blocking(const implementation_type &impl) const
Gets the non-blocking mode of the acceptor.
service_impl_type::implementation_type implementation_type
The native type of the socket acceptor.