11 #ifndef ASIO_DETAIL_WINRT_SSOCKET_SERVICE_BASE_HPP 12 #define ASIO_DETAIL_WINRT_SSOCKET_SERVICE_BASE_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 20 #if defined(ASIO_WINDOWS_RUNTIME) 38 class winrt_ssocket_service_base
42 typedef Windows::Networking::Sockets::StreamSocket^ native_handle_type;
45 struct base_implementation_type
48 base_implementation_type()
56 native_handle_type socket_;
59 base_implementation_type* next_;
60 base_implementation_type* prev_;
71 ASIO_DECL void construct(base_implementation_type&);
74 ASIO_DECL void base_move_construct(base_implementation_type& impl,
75 base_implementation_type& other_impl);
78 ASIO_DECL void base_move_assign(base_implementation_type& impl,
79 winrt_ssocket_service_base& other_service,
80 base_implementation_type& other_impl);
83 ASIO_DECL void destroy(base_implementation_type& impl);
86 bool is_open(
const base_implementation_type& impl)
const 88 return impl.socket_ !=
nullptr;
96 native_handle_type native_handle(base_implementation_type& impl)
110 bool at_mark(
const base_implementation_type&,
118 std::size_t
available(
const base_implementation_type&,
126 template <
typename IO_Control_Command>
135 bool non_blocking(
const base_implementation_type&)
const 149 bool native_non_blocking(
const base_implementation_type&)
const 171 template <
typename ConstBufferSequence>
172 std::size_t
send(base_implementation_type& impl,
173 const ConstBufferSequence&
buffers,
178 ConstBufferSequence>::first(buffers), flags, ec);
182 std::size_t
send(base_implementation_type&,
const null_buffers&,
191 template <
typename ConstBufferSequence,
typename Handler>
192 void async_send(base_implementation_type& impl,
193 const ConstBufferSequence& buffers,
200 typedef winrt_socket_send_op<ConstBufferSequence, Handler> op;
201 typename op::ptr p = { asio::detail::addressof(handler),
203 sizeof(op), handler), 0 };
204 p.p =
new (p.v) op(buffers, handler);
210 ConstBufferSequence>::first(buffers),
211 flags, p.p, is_continuation);
216 template <
typename Handler>
217 void async_send(base_implementation_type&,
const null_buffers&,
221 const std::size_t bytes_transferred = 0;
222 io_service_.get_io_service().post(
227 template <
typename MutableBufferSequence>
228 std::size_t receive(base_implementation_type& impl,
229 const MutableBufferSequence& buffers,
232 return do_receive(impl,
234 MutableBufferSequence>::first(buffers), flags, ec);
238 std::size_t receive(base_implementation_type&,
const null_buffers&,
247 template <
typename MutableBufferSequence,
typename Handler>
248 void async_receive(base_implementation_type& impl,
249 const MutableBufferSequence& buffers,
252 bool is_continuation =
256 typedef winrt_socket_recv_op<MutableBufferSequence, Handler> op;
257 typename op::ptr p = { asio::detail::addressof(handler),
259 sizeof(op), handler), 0 };
260 p.p =
new (p.v) op(buffers, handler);
264 start_receive_op(impl,
266 MutableBufferSequence>::first(buffers),
267 flags, p.p, is_continuation);
272 template <
typename Handler>
273 void async_receive(base_implementation_type&,
const null_buffers&,
277 const std::size_t bytes_transferred = 0;
278 io_service_.get_io_service().post(
285 const base_implementation_type& impl,
bool local,
290 base_implementation_type& impl,
291 int level,
int optname,
const void* optval,
296 const base_implementation_type& impl,
297 int level,
int optname,
void* optval,
302 base_implementation_type& impl,
307 base_implementation_type& impl,
const void* addr,
308 winrt_async_op<void>* op,
bool is_continuation);
316 ASIO_DECL void start_send_op(base_implementation_type& impl,
318 winrt_async_op<unsigned int>* op,
bool is_continuation);
326 ASIO_DECL void start_receive_op(base_implementation_type& impl,
328 winrt_async_op<Windows::Storage::Streams::IBuffer^>* op,
329 bool is_continuation);
335 winrt_async_manager& async_manager_;
341 base_implementation_type* impl_list_;
349 #if defined(ASIO_HEADER_ONLY) 351 #endif // defined(ASIO_HEADER_ONLY) 353 #endif // defined(ASIO_WINDOWS_RUNTIME) 355 #endif // ASIO_DETAIL_WINRT_SSOCKET_SERVICE_BASE_HPP
int message_flags
Bitmask type for flags that can be passed to send and receive operations.
Provides core I/O functionality.
Holds a buffer that cannot be modified.
class task_io_service io_service_impl
const MutableBufferSequence & buffers
signed_size_type send(socket_type s, const buf *bufs, size_t count, int flags, asio::error_code &ec)
Holds a buffer that can be modified.
shutdown_type
Different ways a socket may be shutdown.
size_t available(socket_type s, asio::error_code &ec)
bool is_continuation(Context &context)
Class to represent an error code value.
ASIO_DECL int close(int d, state_type &state, asio::error_code &ec)
void * allocate(std::size_t s, Handler &h)
int shutdown(socket_type s, int what, asio::error_code &ec)
binder1< Handler, Arg1 > bind_handler(Handler handler, const Arg1 &arg1)
#define ASIO_HANDLER_CREATION(args)