annotate DEPENDENCIES/generic/include/boost/asio/detail/null_socket_service.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //
Chris@16 2 // detail/null_socket_service.hpp
Chris@16 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris@16 4 //
Chris@101 5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Chris@16 6 //
Chris@16 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 //
Chris@16 10
Chris@16 11 #ifndef BOOST_ASIO_DETAIL_NULL_SOCKET_SERVICE_HPP
Chris@16 12 #define BOOST_ASIO_DETAIL_NULL_SOCKET_SERVICE_HPP
Chris@16 13
Chris@16 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 15 # pragma once
Chris@16 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 17
Chris@16 18 #include <boost/asio/detail/config.hpp>
Chris@16 19
Chris@16 20 #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
Chris@16 21
Chris@16 22 #include <boost/asio/buffer.hpp>
Chris@16 23 #include <boost/asio/error.hpp>
Chris@16 24 #include <boost/asio/io_service.hpp>
Chris@16 25 #include <boost/asio/socket_base.hpp>
Chris@16 26 #include <boost/asio/detail/bind_handler.hpp>
Chris@16 27
Chris@16 28 #include <boost/asio/detail/push_options.hpp>
Chris@16 29
Chris@16 30 namespace boost {
Chris@16 31 namespace asio {
Chris@16 32 namespace detail {
Chris@16 33
Chris@16 34 template <typename Protocol>
Chris@16 35 class null_socket_service
Chris@16 36 {
Chris@16 37 public:
Chris@16 38 // The protocol type.
Chris@16 39 typedef Protocol protocol_type;
Chris@16 40
Chris@16 41 // The endpoint type.
Chris@16 42 typedef typename Protocol::endpoint endpoint_type;
Chris@16 43
Chris@16 44 // The native type of a socket.
Chris@16 45 typedef int native_handle_type;
Chris@16 46
Chris@16 47 // The implementation type of the socket.
Chris@16 48 struct implementation_type
Chris@16 49 {
Chris@16 50 };
Chris@16 51
Chris@16 52 // Constructor.
Chris@16 53 null_socket_service(boost::asio::io_service& io_service)
Chris@16 54 : io_service_(io_service)
Chris@16 55 {
Chris@16 56 }
Chris@16 57
Chris@16 58 // Destroy all user-defined handler objects owned by the service.
Chris@16 59 void shutdown_service()
Chris@16 60 {
Chris@16 61 }
Chris@16 62
Chris@16 63 // Construct a new socket implementation.
Chris@16 64 void construct(implementation_type&)
Chris@16 65 {
Chris@16 66 }
Chris@16 67
Chris@16 68 // Move-construct a new socket implementation.
Chris@16 69 void move_construct(implementation_type&, implementation_type&)
Chris@16 70 {
Chris@16 71 }
Chris@16 72
Chris@16 73 // Move-assign from another socket implementation.
Chris@16 74 void move_assign(implementation_type&,
Chris@16 75 null_socket_service&, implementation_type&)
Chris@16 76 {
Chris@16 77 }
Chris@16 78
Chris@16 79 // Move-construct a new socket implementation from another protocol type.
Chris@16 80 template <typename Protocol1>
Chris@16 81 void converting_move_construct(implementation_type&,
Chris@16 82 typename null_socket_service<Protocol1>::implementation_type&)
Chris@16 83 {
Chris@16 84 }
Chris@16 85
Chris@16 86 // Destroy a socket implementation.
Chris@16 87 void destroy(implementation_type&)
Chris@16 88 {
Chris@16 89 }
Chris@16 90
Chris@16 91 // Open a new socket implementation.
Chris@16 92 boost::system::error_code open(implementation_type&,
Chris@16 93 const protocol_type&, boost::system::error_code& ec)
Chris@16 94 {
Chris@16 95 ec = boost::asio::error::operation_not_supported;
Chris@16 96 return ec;
Chris@16 97 }
Chris@16 98
Chris@16 99 // Assign a native socket to a socket implementation.
Chris@16 100 boost::system::error_code assign(implementation_type&, const protocol_type&,
Chris@16 101 const native_handle_type&, boost::system::error_code& ec)
Chris@16 102 {
Chris@16 103 ec = boost::asio::error::operation_not_supported;
Chris@16 104 return ec;
Chris@16 105 }
Chris@16 106
Chris@16 107 // Determine whether the socket is open.
Chris@16 108 bool is_open(const implementation_type&) const
Chris@16 109 {
Chris@16 110 return false;
Chris@16 111 }
Chris@16 112
Chris@16 113 // Destroy a socket implementation.
Chris@16 114 boost::system::error_code close(implementation_type&,
Chris@16 115 boost::system::error_code& ec)
Chris@16 116 {
Chris@16 117 ec = boost::asio::error::operation_not_supported;
Chris@16 118 return ec;
Chris@16 119 }
Chris@16 120
Chris@16 121 // Get the native socket representation.
Chris@16 122 native_handle_type native_handle(implementation_type&)
Chris@16 123 {
Chris@16 124 return 0;
Chris@16 125 }
Chris@16 126
Chris@16 127 // Cancel all operations associated with the socket.
Chris@16 128 boost::system::error_code cancel(implementation_type&,
Chris@16 129 boost::system::error_code& ec)
Chris@16 130 {
Chris@16 131 ec = boost::asio::error::operation_not_supported;
Chris@16 132 return ec;
Chris@16 133 }
Chris@16 134
Chris@16 135 // Determine whether the socket is at the out-of-band data mark.
Chris@16 136 bool at_mark(const implementation_type&,
Chris@16 137 boost::system::error_code& ec) const
Chris@16 138 {
Chris@16 139 ec = boost::asio::error::operation_not_supported;
Chris@16 140 return false;
Chris@16 141 }
Chris@16 142
Chris@16 143 // Determine the number of bytes available for reading.
Chris@16 144 std::size_t available(const implementation_type&,
Chris@16 145 boost::system::error_code& ec) const
Chris@16 146 {
Chris@16 147 ec = boost::asio::error::operation_not_supported;
Chris@16 148 return 0;
Chris@16 149 }
Chris@16 150
Chris@16 151 // Place the socket into the state where it will listen for new connections.
Chris@16 152 boost::system::error_code listen(implementation_type&,
Chris@16 153 int, boost::system::error_code& ec)
Chris@16 154 {
Chris@16 155 ec = boost::asio::error::operation_not_supported;
Chris@16 156 return ec;
Chris@16 157 }
Chris@16 158
Chris@16 159 // Perform an IO control command on the socket.
Chris@16 160 template <typename IO_Control_Command>
Chris@16 161 boost::system::error_code io_control(implementation_type&,
Chris@16 162 IO_Control_Command&, boost::system::error_code& ec)
Chris@16 163 {
Chris@16 164 ec = boost::asio::error::operation_not_supported;
Chris@16 165 return ec;
Chris@16 166 }
Chris@16 167
Chris@16 168 // Gets the non-blocking mode of the socket.
Chris@16 169 bool non_blocking(const implementation_type&) const
Chris@16 170 {
Chris@16 171 return false;
Chris@16 172 }
Chris@16 173
Chris@16 174 // Sets the non-blocking mode of the socket.
Chris@16 175 boost::system::error_code non_blocking(implementation_type&,
Chris@16 176 bool, boost::system::error_code& ec)
Chris@16 177 {
Chris@16 178 ec = boost::asio::error::operation_not_supported;
Chris@16 179 return ec;
Chris@16 180 }
Chris@16 181
Chris@16 182 // Gets the non-blocking mode of the native socket implementation.
Chris@16 183 bool native_non_blocking(const implementation_type&) const
Chris@16 184 {
Chris@16 185 return false;
Chris@16 186 }
Chris@16 187
Chris@16 188 // Sets the non-blocking mode of the native socket implementation.
Chris@16 189 boost::system::error_code native_non_blocking(implementation_type&,
Chris@16 190 bool, boost::system::error_code& ec)
Chris@16 191 {
Chris@16 192 ec = boost::asio::error::operation_not_supported;
Chris@16 193 return ec;
Chris@16 194 }
Chris@16 195
Chris@16 196 // Disable sends or receives on the socket.
Chris@16 197 boost::system::error_code shutdown(implementation_type&,
Chris@16 198 socket_base::shutdown_type, boost::system::error_code& ec)
Chris@16 199 {
Chris@16 200 ec = boost::asio::error::operation_not_supported;
Chris@16 201 return ec;
Chris@16 202 }
Chris@16 203
Chris@16 204 // Bind the socket to the specified local endpoint.
Chris@16 205 boost::system::error_code bind(implementation_type&,
Chris@16 206 const endpoint_type&, boost::system::error_code& ec)
Chris@16 207 {
Chris@16 208 ec = boost::asio::error::operation_not_supported;
Chris@16 209 return ec;
Chris@16 210 }
Chris@16 211
Chris@16 212 // Set a socket option.
Chris@16 213 template <typename Option>
Chris@16 214 boost::system::error_code set_option(implementation_type&,
Chris@16 215 const Option&, boost::system::error_code& ec)
Chris@16 216 {
Chris@16 217 ec = boost::asio::error::operation_not_supported;
Chris@16 218 return ec;
Chris@16 219 }
Chris@16 220
Chris@16 221 // Set a socket option.
Chris@16 222 template <typename Option>
Chris@16 223 boost::system::error_code get_option(const implementation_type&,
Chris@16 224 Option&, boost::system::error_code& ec) const
Chris@16 225 {
Chris@16 226 ec = boost::asio::error::operation_not_supported;
Chris@16 227 return ec;
Chris@16 228 }
Chris@16 229
Chris@16 230 // Get the local endpoint.
Chris@16 231 endpoint_type local_endpoint(const implementation_type&,
Chris@16 232 boost::system::error_code& ec) const
Chris@16 233 {
Chris@16 234 ec = boost::asio::error::operation_not_supported;
Chris@16 235 return endpoint_type();
Chris@16 236 }
Chris@16 237
Chris@16 238 // Get the remote endpoint.
Chris@16 239 endpoint_type remote_endpoint(const implementation_type&,
Chris@16 240 boost::system::error_code& ec) const
Chris@16 241 {
Chris@16 242 ec = boost::asio::error::operation_not_supported;
Chris@16 243 return endpoint_type();
Chris@16 244 }
Chris@16 245
Chris@16 246 // Send the given data to the peer.
Chris@16 247 template <typename ConstBufferSequence>
Chris@16 248 std::size_t send(implementation_type&, const ConstBufferSequence&,
Chris@16 249 socket_base::message_flags, boost::system::error_code& ec)
Chris@16 250 {
Chris@16 251 ec = boost::asio::error::operation_not_supported;
Chris@16 252 return 0;
Chris@16 253 }
Chris@16 254
Chris@16 255 // Wait until data can be sent without blocking.
Chris@16 256 std::size_t send(implementation_type&, const null_buffers&,
Chris@16 257 socket_base::message_flags, boost::system::error_code& ec)
Chris@16 258 {
Chris@16 259 ec = boost::asio::error::operation_not_supported;
Chris@16 260 return 0;
Chris@16 261 }
Chris@16 262
Chris@16 263 // Start an asynchronous send. The data being sent must be valid for the
Chris@16 264 // lifetime of the asynchronous operation.
Chris@16 265 template <typename ConstBufferSequence, typename Handler>
Chris@16 266 void async_send(implementation_type&, const ConstBufferSequence&,
Chris@16 267 socket_base::message_flags, Handler& handler)
Chris@16 268 {
Chris@16 269 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 270 const std::size_t bytes_transferred = 0;
Chris@16 271 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 272 }
Chris@16 273
Chris@16 274 // Start an asynchronous wait until data can be sent without blocking.
Chris@16 275 template <typename Handler>
Chris@16 276 void async_send(implementation_type&, const null_buffers&,
Chris@16 277 socket_base::message_flags, Handler& handler)
Chris@16 278 {
Chris@16 279 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 280 const std::size_t bytes_transferred = 0;
Chris@16 281 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 282 }
Chris@16 283
Chris@16 284 // Receive some data from the peer. Returns the number of bytes received.
Chris@16 285 template <typename MutableBufferSequence>
Chris@16 286 std::size_t receive(implementation_type&, const MutableBufferSequence&,
Chris@16 287 socket_base::message_flags, boost::system::error_code& ec)
Chris@16 288 {
Chris@16 289 ec = boost::asio::error::operation_not_supported;
Chris@16 290 return 0;
Chris@16 291 }
Chris@16 292
Chris@16 293 // Wait until data can be received without blocking.
Chris@16 294 std::size_t receive(implementation_type&, const null_buffers&,
Chris@16 295 socket_base::message_flags, boost::system::error_code& ec)
Chris@16 296 {
Chris@16 297 ec = boost::asio::error::operation_not_supported;
Chris@16 298 return 0;
Chris@16 299 }
Chris@16 300
Chris@16 301 // Start an asynchronous receive. The buffer for the data being received
Chris@16 302 // must be valid for the lifetime of the asynchronous operation.
Chris@16 303 template <typename MutableBufferSequence, typename Handler>
Chris@16 304 void async_receive(implementation_type&, const MutableBufferSequence&,
Chris@16 305 socket_base::message_flags, Handler& handler)
Chris@16 306 {
Chris@16 307 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 308 const std::size_t bytes_transferred = 0;
Chris@16 309 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 310 }
Chris@16 311
Chris@16 312 // Wait until data can be received without blocking.
Chris@16 313 template <typename Handler>
Chris@16 314 void async_receive(implementation_type&, const null_buffers&,
Chris@16 315 socket_base::message_flags, Handler& handler)
Chris@16 316 {
Chris@16 317 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 318 const std::size_t bytes_transferred = 0;
Chris@16 319 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 320 }
Chris@16 321
Chris@16 322 // Receive some data with associated flags. Returns the number of bytes
Chris@16 323 // received.
Chris@16 324 template <typename MutableBufferSequence>
Chris@16 325 std::size_t receive_with_flags(implementation_type&,
Chris@16 326 const MutableBufferSequence&, socket_base::message_flags,
Chris@16 327 socket_base::message_flags&, boost::system::error_code& ec)
Chris@16 328 {
Chris@16 329 ec = boost::asio::error::operation_not_supported;
Chris@16 330 return 0;
Chris@16 331 }
Chris@16 332
Chris@16 333 // Wait until data can be received without blocking.
Chris@16 334 std::size_t receive_with_flags(implementation_type&,
Chris@16 335 const null_buffers&, socket_base::message_flags,
Chris@16 336 socket_base::message_flags&, boost::system::error_code& ec)
Chris@16 337 {
Chris@16 338 ec = boost::asio::error::operation_not_supported;
Chris@16 339 return 0;
Chris@16 340 }
Chris@16 341
Chris@16 342 // Start an asynchronous receive. The buffer for the data being received
Chris@16 343 // must be valid for the lifetime of the asynchronous operation.
Chris@16 344 template <typename MutableBufferSequence, typename Handler>
Chris@16 345 void async_receive_with_flags(implementation_type&,
Chris@16 346 const MutableBufferSequence&, socket_base::message_flags,
Chris@16 347 socket_base::message_flags&, Handler& handler)
Chris@16 348 {
Chris@16 349 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 350 const std::size_t bytes_transferred = 0;
Chris@16 351 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 352 }
Chris@16 353
Chris@16 354 // Wait until data can be received without blocking.
Chris@16 355 template <typename Handler>
Chris@16 356 void async_receive_with_flags(implementation_type&,
Chris@16 357 const null_buffers&, socket_base::message_flags,
Chris@16 358 socket_base::message_flags&, Handler& handler)
Chris@16 359 {
Chris@16 360 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 361 const std::size_t bytes_transferred = 0;
Chris@16 362 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 363 }
Chris@16 364
Chris@16 365 // Send a datagram to the specified endpoint. Returns the number of bytes
Chris@16 366 // sent.
Chris@16 367 template <typename ConstBufferSequence>
Chris@16 368 std::size_t send_to(implementation_type&, const ConstBufferSequence&,
Chris@16 369 const endpoint_type&, socket_base::message_flags,
Chris@16 370 boost::system::error_code& ec)
Chris@16 371 {
Chris@16 372 ec = boost::asio::error::operation_not_supported;
Chris@16 373 return 0;
Chris@16 374 }
Chris@16 375
Chris@16 376 // Wait until data can be sent without blocking.
Chris@16 377 std::size_t send_to(implementation_type&, const null_buffers&,
Chris@16 378 const endpoint_type&, socket_base::message_flags,
Chris@16 379 boost::system::error_code& ec)
Chris@16 380 {
Chris@16 381 ec = boost::asio::error::operation_not_supported;
Chris@16 382 return 0;
Chris@16 383 }
Chris@16 384
Chris@16 385 // Start an asynchronous send. The data being sent must be valid for the
Chris@16 386 // lifetime of the asynchronous operation.
Chris@16 387 template <typename ConstBufferSequence, typename Handler>
Chris@16 388 void async_send_to(implementation_type&, const ConstBufferSequence&,
Chris@16 389 const endpoint_type&, socket_base::message_flags,
Chris@16 390 Handler& handler)
Chris@16 391 {
Chris@16 392 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 393 const std::size_t bytes_transferred = 0;
Chris@16 394 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 395 }
Chris@16 396
Chris@16 397 // Start an asynchronous wait until data can be sent without blocking.
Chris@16 398 template <typename Handler>
Chris@16 399 void async_send_to(implementation_type&, const null_buffers&,
Chris@16 400 const endpoint_type&, socket_base::message_flags, Handler& handler)
Chris@16 401 {
Chris@16 402 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 403 const std::size_t bytes_transferred = 0;
Chris@16 404 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 405 }
Chris@16 406
Chris@16 407 // Receive a datagram with the endpoint of the sender. Returns the number of
Chris@16 408 // bytes received.
Chris@16 409 template <typename MutableBufferSequence>
Chris@16 410 std::size_t receive_from(implementation_type&, const MutableBufferSequence&,
Chris@16 411 endpoint_type&, socket_base::message_flags,
Chris@16 412 boost::system::error_code& ec)
Chris@16 413 {
Chris@16 414 ec = boost::asio::error::operation_not_supported;
Chris@16 415 return 0;
Chris@16 416 }
Chris@16 417
Chris@16 418 // Wait until data can be received without blocking.
Chris@16 419 std::size_t receive_from(implementation_type&, const null_buffers&,
Chris@16 420 endpoint_type&, socket_base::message_flags,
Chris@16 421 boost::system::error_code& ec)
Chris@16 422 {
Chris@16 423 ec = boost::asio::error::operation_not_supported;
Chris@16 424 return 0;
Chris@16 425 }
Chris@16 426
Chris@16 427 // Start an asynchronous receive. The buffer for the data being received and
Chris@16 428 // the sender_endpoint object must both be valid for the lifetime of the
Chris@16 429 // asynchronous operation.
Chris@16 430 template <typename MutableBufferSequence, typename Handler>
Chris@16 431 void async_receive_from(implementation_type&,
Chris@16 432 const MutableBufferSequence&, endpoint_type&,
Chris@16 433 socket_base::message_flags, Handler& handler)
Chris@16 434 {
Chris@16 435 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 436 const std::size_t bytes_transferred = 0;
Chris@16 437 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 438 }
Chris@16 439
Chris@16 440 // Wait until data can be received without blocking.
Chris@16 441 template <typename Handler>
Chris@16 442 void async_receive_from(implementation_type&,
Chris@16 443 const null_buffers&, endpoint_type&,
Chris@16 444 socket_base::message_flags, Handler& handler)
Chris@16 445 {
Chris@16 446 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 447 const std::size_t bytes_transferred = 0;
Chris@16 448 io_service_.post(detail::bind_handler(handler, ec, bytes_transferred));
Chris@16 449 }
Chris@16 450
Chris@16 451 // Accept a new connection.
Chris@16 452 template <typename Socket>
Chris@16 453 boost::system::error_code accept(implementation_type&,
Chris@16 454 Socket&, endpoint_type*, boost::system::error_code& ec)
Chris@16 455 {
Chris@16 456 ec = boost::asio::error::operation_not_supported;
Chris@16 457 return ec;
Chris@16 458 }
Chris@16 459
Chris@16 460 // Start an asynchronous accept. The peer and peer_endpoint objects
Chris@16 461 // must be valid until the accept's handler is invoked.
Chris@16 462 template <typename Socket, typename Handler>
Chris@16 463 void async_accept(implementation_type&, Socket&,
Chris@16 464 endpoint_type*, Handler& handler)
Chris@16 465 {
Chris@16 466 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 467 io_service_.post(detail::bind_handler(handler, ec));
Chris@16 468 }
Chris@16 469
Chris@16 470 // Connect the socket to the specified endpoint.
Chris@16 471 boost::system::error_code connect(implementation_type&,
Chris@16 472 const endpoint_type&, boost::system::error_code& ec)
Chris@16 473 {
Chris@16 474 ec = boost::asio::error::operation_not_supported;
Chris@16 475 return ec;
Chris@16 476 }
Chris@16 477
Chris@16 478 // Start an asynchronous connect.
Chris@16 479 template <typename Handler>
Chris@16 480 void async_connect(implementation_type&,
Chris@16 481 const endpoint_type&, Handler& handler)
Chris@16 482 {
Chris@16 483 boost::system::error_code ec = boost::asio::error::operation_not_supported;
Chris@16 484 io_service_.post(detail::bind_handler(handler, ec));
Chris@16 485 }
Chris@16 486
Chris@16 487 private:
Chris@16 488 boost::asio::io_service& io_service_;
Chris@16 489 };
Chris@16 490
Chris@16 491 } // namespace detail
Chris@16 492 } // namespace asio
Chris@16 493 } // namespace boost
Chris@16 494
Chris@16 495 #include <boost/asio/detail/pop_options.hpp>
Chris@16 496
Chris@16 497 #endif // defined(BOOST_ASIO_WINDOWS_RUNTIME)
Chris@16 498
Chris@16 499 #endif // BOOST_ASIO_DETAIL_NULL_SOCKET_SERVICE_HPP