diff options
author | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-09-14 11:01:23 +0300 |
---|---|---|
committer | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-09-14 11:01:23 +0300 |
commit | f2881db44b78415704730ade4598eebf77315aef (patch) | |
tree | 32a975d9b0cf7d110f5bf7e4e15fc844a6a1966d | |
parent | cf4d965eab8e00116d391487e1775b363a968aef (diff) | |
download | ydb-f2881db44b78415704730ade4598eebf77315aef.tar.gz |
Reimport boost/asio as a separate project
486 files changed, 182 insertions, 58194 deletions
diff --git a/contrib/libs/apache/avro/CMakeLists.txt b/contrib/libs/apache/avro/CMakeLists.txt index b5695605b2..45a386ff77 100644 --- a/contrib/libs/apache/avro/CMakeLists.txt +++ b/contrib/libs/apache/avro/CMakeLists.txt @@ -28,6 +28,7 @@ target_link_libraries(libs-apache-avro PUBLIC contrib-libs-cxxsupp contrib-libs-snappy contrib-restricted-boost + restricted-boost-asio restricted-boost-crc restricted-boost-iostreams ) diff --git a/contrib/restricted/boost/CMakeLists.txt b/contrib/restricted/boost/CMakeLists.txt index b6ff8b2fc5..a4b9ad80d4 100644 --- a/contrib/restricted/boost/CMakeLists.txt +++ b/contrib/restricted/boost/CMakeLists.txt @@ -10,6 +10,7 @@ add_subdirectory(algorithm) add_subdirectory(align) add_subdirectory(any) add_subdirectory(array) +add_subdirectory(asio) add_subdirectory(assert) add_subdirectory(atomic) add_subdirectory(bind) @@ -19,8 +20,10 @@ add_subdirectory(concept_check) add_subdirectory(config) add_subdirectory(container) add_subdirectory(container_hash) +add_subdirectory(context) add_subdirectory(conversion) add_subdirectory(core) +add_subdirectory(coroutine) add_subdirectory(crc) add_subdirectory(date_time) add_subdirectory(detail) diff --git a/contrib/restricted/boost/asio/CMakeLists.txt b/contrib/restricted/boost/asio/CMakeLists.txt new file mode 100644 index 0000000000..646ddf760a --- /dev/null +++ b/contrib/restricted/boost/asio/CMakeLists.txt @@ -0,0 +1,34 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +find_package(OpenSSL REQUIRED) + +add_library(restricted-boost-asio INTERFACE) +target_include_directories(restricted-boost-asio INTERFACE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/asio/include +) +target_link_libraries(restricted-boost-asio INTERFACE + contrib-libs-cxxsupp + yutil + OpenSSL::OpenSSL + restricted-boost-array + restricted-boost-assert + restricted-boost-bind + restricted-boost-chrono + restricted-boost-config + restricted-boost-core + restricted-boost-coroutine + restricted-boost-date_time + restricted-boost-function + restricted-boost-regex + restricted-boost-smart_ptr + restricted-boost-system + restricted-boost-throw_exception + restricted-boost-type_traits + restricted-boost-utility +) diff --git a/contrib/restricted/boost/boost/asio/associated_allocator.hpp b/contrib/restricted/boost/asio/include/boost/asio/associated_allocator.hpp index bcf1eca3ae..bcf1eca3ae 100644 --- a/contrib/restricted/boost/boost/asio/associated_allocator.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/associated_allocator.hpp diff --git a/contrib/restricted/boost/boost/asio/associated_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/associated_executor.hpp index c31800f394..c31800f394 100644 --- a/contrib/restricted/boost/boost/asio/associated_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/associated_executor.hpp diff --git a/contrib/restricted/boost/boost/asio/async_result.hpp b/contrib/restricted/boost/asio/include/boost/asio/async_result.hpp index a2aafce134..a2aafce134 100644 --- a/contrib/restricted/boost/boost/asio/async_result.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/async_result.hpp diff --git a/contrib/restricted/boost/boost/asio/basic_datagram_socket.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_datagram_socket.hpp index b512b75dde..b512b75dde 100644 --- a/contrib/restricted/boost/boost/asio/basic_datagram_socket.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_datagram_socket.hpp diff --git a/contrib/restricted/boost/boost/asio/basic_io_object.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_io_object.hpp index c0c2c714eb..c0c2c714eb 100644 --- a/contrib/restricted/boost/boost/asio/basic_io_object.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_io_object.hpp diff --git a/contrib/restricted/boost/boost/asio/basic_socket.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_socket.hpp index ed22cd2b79..ed22cd2b79 100644 --- a/contrib/restricted/boost/boost/asio/basic_socket.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_socket.hpp diff --git a/contrib/restricted/boost/boost/asio/buffer.hpp b/contrib/restricted/boost/asio/include/boost/asio/buffer.hpp index 8abe0be499..8abe0be499 100644 --- a/contrib/restricted/boost/boost/asio/buffer.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/buffer.hpp diff --git a/contrib/restricted/boost/boost/asio/datagram_socket_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/datagram_socket_service.hpp index 816433ba78..816433ba78 100644 --- a/contrib/restricted/boost/boost/asio/datagram_socket_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/datagram_socket_service.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/array.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/array.hpp index 238118e3a6..238118e3a6 100644 --- a/contrib/restricted/boost/boost/asio/detail/array.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/array.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/array_fwd.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/array_fwd.hpp index 82f357785d..82f357785d 100644 --- a/contrib/restricted/boost/boost/asio/detail/array_fwd.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/array_fwd.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/assert.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/assert.hpp index fe306ce614..fe306ce614 100644 --- a/contrib/restricted/boost/boost/asio/detail/assert.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/assert.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/atomic_count.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/atomic_count.hpp index 78cd0fb333..78cd0fb333 100644 --- a/contrib/restricted/boost/boost/asio/detail/atomic_count.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/atomic_count.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/bind_handler.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/bind_handler.hpp index 39f1b29bcd..39f1b29bcd 100644 --- a/contrib/restricted/boost/boost/asio/detail/bind_handler.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/bind_handler.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/buffer_sequence_adapter.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/buffer_sequence_adapter.hpp index 5ba55d266d..5ba55d266d 100644 --- a/contrib/restricted/boost/boost/asio/detail/buffer_sequence_adapter.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/buffer_sequence_adapter.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/call_stack.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/call_stack.hpp index 34f4de607f..34f4de607f 100644 --- a/contrib/restricted/boost/boost/asio/detail/call_stack.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/call_stack.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/chrono.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/chrono.hpp index 044f12c6c3..044f12c6c3 100644 --- a/contrib/restricted/boost/boost/asio/detail/chrono.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/chrono.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/chrono_time_traits.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/chrono_time_traits.hpp index 256389acaf..256389acaf 100644 --- a/contrib/restricted/boost/boost/asio/detail/chrono_time_traits.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/chrono_time_traits.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/completion_handler.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/completion_handler.hpp index e856a86f5a..e856a86f5a 100644 --- a/contrib/restricted/boost/boost/asio/detail/completion_handler.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/completion_handler.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/concurrency_hint.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/concurrency_hint.hpp index c11b7f6109..c11b7f6109 100644 --- a/contrib/restricted/boost/boost/asio/detail/concurrency_hint.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/concurrency_hint.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/conditionally_enabled_event.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/conditionally_enabled_event.hpp index 9319c87538..9319c87538 100644 --- a/contrib/restricted/boost/boost/asio/detail/conditionally_enabled_event.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/conditionally_enabled_event.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/conditionally_enabled_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/conditionally_enabled_mutex.hpp index ab4ef48afc..ab4ef48afc 100644 --- a/contrib/restricted/boost/boost/asio/detail/conditionally_enabled_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/conditionally_enabled_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/config.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp index 6a30d4aa11..854b75bb03 100644 --- a/contrib/restricted/boost/boost/asio/detail/config.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp @@ -255,7 +255,7 @@ # define BOOST_ASIO_NOEXCEPT # endif // !defined(BOOST_ASIO_NOEXCEPT) # if !defined(BOOST_ASIO_NOEXCEPT_OR_NOTHROW) -# define BOOST_ASIO_NOEXCEPT_OR_NOTHROW noexcept +# define BOOST_ASIO_NOEXCEPT_OR_NOTHROW throw() # endif // !defined(BOOST_ASIO_NOEXCEPT_OR_NOTHROW) #endif // !defined(BOOST_ASIO_NOEXCEPT) @@ -804,14 +804,14 @@ # if defined(__clang__) # if (__cplusplus >= 201402) # if __has_include(<experimental/string_view>) -//# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 +# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 # endif // __has_include(<experimental/string_view>) # endif // (__cplusplus >= 201402) # endif // defined(__clang__) # if defined(__GNUC__) # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4) # if (__cplusplus >= 201402) -//# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 +# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 # endif // (__cplusplus >= 201402) # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4) # endif // defined(__GNUC__) @@ -861,7 +861,7 @@ # define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1 # endif // (__cplusplus >= 202002) # endif // (_LIBCPP_VERSION >= 13000) -# endif +# endif // defined(BOOST_ASIO_HAS_CLANG_LIBCXX) # endif // !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT) #endif // !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT) diff --git a/contrib/restricted/boost/boost/asio/detail/cstdint.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/cstdint.hpp index 24e203aa6d..24e203aa6d 100644 --- a/contrib/restricted/boost/boost/asio/detail/cstdint.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/cstdint.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/dev_poll_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/dev_poll_reactor.hpp index cb15a9671b..cb15a9671b 100644 --- a/contrib/restricted/boost/boost/asio/detail/dev_poll_reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/dev_poll_reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/epoll_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/epoll_reactor.hpp index 31a7b3dff3..31a7b3dff3 100644 --- a/contrib/restricted/boost/boost/asio/detail/epoll_reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/epoll_reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/event.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/event.hpp index 8cb097cb24..8cb097cb24 100644 --- a/contrib/restricted/boost/boost/asio/detail/event.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/event.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/eventfd_select_interrupter.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/eventfd_select_interrupter.hpp index 4871c971ed..4871c971ed 100644 --- a/contrib/restricted/boost/boost/asio/detail/eventfd_select_interrupter.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/eventfd_select_interrupter.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/executor_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/executor_op.hpp index 1c8671abc8..1c8671abc8 100644 --- a/contrib/restricted/boost/boost/asio/detail/executor_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/executor_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/fd_set_adapter.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/fd_set_adapter.hpp index 26ba12665e..26ba12665e 100644 --- a/contrib/restricted/boost/boost/asio/detail/fd_set_adapter.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/fd_set_adapter.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/fenced_block.hpp index 789b9d8a80..e80ed4073c 100644 --- a/contrib/restricted/boost/boost/asio/detail/fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/fenced_block.hpp @@ -25,7 +25,7 @@ #elif defined(__MACH__) && defined(__APPLE__) # include <boost/asio/detail/macos_fenced_block.hpp> #elif defined(__sun) -# error include <boost/asio/detail/solaris_fenced_block.hpp> +# include <boost/asio/detail/solaris_fenced_block.hpp> #elif defined(__GNUC__) && defined(__arm__) \ && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) # include <boost/asio/detail/gcc_arm_fenced_block.hpp> diff --git a/contrib/restricted/boost/boost/asio/detail/functional.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/functional.hpp index 23218bb5df..23218bb5df 100644 --- a/contrib/restricted/boost/boost/asio/detail/functional.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/functional.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/gcc_arm_fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/gcc_arm_fenced_block.hpp index 3a5a1dfacf..3a5a1dfacf 100644 --- a/contrib/restricted/boost/boost/asio/detail/gcc_arm_fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/gcc_arm_fenced_block.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/gcc_hppa_fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/gcc_hppa_fenced_block.hpp index bc0bc8afb4..bc0bc8afb4 100644 --- a/contrib/restricted/boost/boost/asio/detail/gcc_hppa_fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/gcc_hppa_fenced_block.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/gcc_sync_fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/gcc_sync_fenced_block.hpp index e464738ee0..e464738ee0 100644 --- a/contrib/restricted/boost/boost/asio/detail/gcc_sync_fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/gcc_sync_fenced_block.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/gcc_x86_fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/gcc_x86_fenced_block.hpp index f66289fe96..f66289fe96 100644 --- a/contrib/restricted/boost/boost/asio/detail/gcc_x86_fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/gcc_x86_fenced_block.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/global.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/global.hpp index 967890408f..967890408f 100644 --- a/contrib/restricted/boost/boost/asio/detail/global.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/global.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/handler_alloc_helpers.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_alloc_helpers.hpp index 6e72051393..6e72051393 100644 --- a/contrib/restricted/boost/boost/asio/detail/handler_alloc_helpers.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_alloc_helpers.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/handler_cont_helpers.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_cont_helpers.hpp index 700505d579..700505d579 100644 --- a/contrib/restricted/boost/boost/asio/detail/handler_cont_helpers.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_cont_helpers.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/handler_invoke_helpers.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_invoke_helpers.hpp index 8ced5f617c..8ced5f617c 100644 --- a/contrib/restricted/boost/boost/asio/detail/handler_invoke_helpers.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_invoke_helpers.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/handler_tracking.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_tracking.hpp index 0839e09159..0839e09159 100644 --- a/contrib/restricted/boost/boost/asio/detail/handler_tracking.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_tracking.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/handler_type_requirements.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_type_requirements.hpp index 3a83c8d154..3a83c8d154 100644 --- a/contrib/restricted/boost/boost/asio/detail/handler_type_requirements.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_type_requirements.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/handler_work.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_work.hpp index dbd1bb911a..dbd1bb911a 100644 --- a/contrib/restricted/boost/boost/asio/detail/handler_work.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_work.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/hash_map.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/hash_map.hpp index 6a13620e92..6a13620e92 100644 --- a/contrib/restricted/boost/boost/asio/detail/hash_map.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/hash_map.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/buffer_sequence_adapter.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/buffer_sequence_adapter.ipp index 26708ced33..26708ced33 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/buffer_sequence_adapter.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/buffer_sequence_adapter.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/dev_poll_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/dev_poll_reactor.hpp index 797937bad8..797937bad8 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/dev_poll_reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/dev_poll_reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/dev_poll_reactor.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/dev_poll_reactor.ipp index 5cc73ca9c1..5cc73ca9c1 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/dev_poll_reactor.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/dev_poll_reactor.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/epoll_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/epoll_reactor.hpp index 101b1d6ead..101b1d6ead 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/epoll_reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/epoll_reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/epoll_reactor.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/epoll_reactor.ipp index 1e9babcc14..1e9babcc14 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/epoll_reactor.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/epoll_reactor.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/eventfd_select_interrupter.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/eventfd_select_interrupter.ipp index 8804009442..8804009442 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/eventfd_select_interrupter.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/eventfd_select_interrupter.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/handler_tracking.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/handler_tracking.ipp index b3abbb513a..b3abbb513a 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/handler_tracking.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/handler_tracking.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/kqueue_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/kqueue_reactor.hpp index 4d79ba5d7c..4d79ba5d7c 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/kqueue_reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/kqueue_reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/kqueue_reactor.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/kqueue_reactor.ipp index 9069ae4442..9069ae4442 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/kqueue_reactor.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/kqueue_reactor.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/null_event.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/null_event.ipp index 19bab80b33..19bab80b33 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/null_event.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/null_event.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/pipe_select_interrupter.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/pipe_select_interrupter.ipp index bfff076747..bfff076747 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/pipe_select_interrupter.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/pipe_select_interrupter.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/posix_event.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/posix_event.ipp index 6f096bc08e..6f096bc08e 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/posix_event.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/posix_event.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/posix_mutex.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/posix_mutex.ipp index 57564714a1..57564714a1 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/posix_mutex.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/posix_mutex.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/posix_thread.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/posix_thread.ipp index c2ee8efef7..c2ee8efef7 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/posix_thread.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/posix_thread.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/posix_tss_ptr.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/posix_tss_ptr.ipp index a40f3f81a6..a40f3f81a6 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/posix_tss_ptr.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/posix_tss_ptr.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/reactive_socket_service_base.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/reactive_socket_service_base.ipp index 6fdf437c1d..6fdf437c1d 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/reactive_socket_service_base.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/reactive_socket_service_base.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/resolver_service_base.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/resolver_service_base.ipp index 144e2a1753..144e2a1753 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/resolver_service_base.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/resolver_service_base.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/scheduler.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/scheduler.ipp index 9dae6836ce..9dae6836ce 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/scheduler.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/scheduler.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/select_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/select_reactor.hpp index 0fbaeb9ced..0fbaeb9ced 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/select_reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/select_reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/select_reactor.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/select_reactor.ipp index 4f1f5a8303..4f1f5a8303 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/select_reactor.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/select_reactor.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/service_registry.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/service_registry.hpp index c50614410e..c50614410e 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/service_registry.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/service_registry.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/service_registry.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/service_registry.ipp index abdcd6a01a..abdcd6a01a 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/service_registry.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/service_registry.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/socket_ops.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/socket_ops.ipp index 3442ac3de1..3442ac3de1 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/socket_ops.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/socket_ops.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/socket_select_interrupter.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/socket_select_interrupter.ipp index 3d9e5289d3..3d9e5289d3 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/socket_select_interrupter.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/socket_select_interrupter.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/strand_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/strand_service.hpp index d47708bb98..d47708bb98 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/strand_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/strand_service.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/strand_service.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/strand_service.ipp index 9926f9abf3..9926f9abf3 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/strand_service.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/strand_service.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/throw_error.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/throw_error.ipp index ffcacf47ae..ffcacf47ae 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/throw_error.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/throw_error.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/timer_queue_set.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/timer_queue_set.ipp index 71f83216aa..71f83216aa 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/timer_queue_set.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/timer_queue_set.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_event.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_event.ipp index 3e7dfdcf21..3e7dfdcf21 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_event.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_event.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_io_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_io_context.hpp index 771c1f3c3a..771c1f3c3a 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_io_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_io_context.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_io_context.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_io_context.ipp index 87637f0b5c..87637f0b5c 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_io_context.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_io_context.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_socket_service_base.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_socket_service_base.ipp index 3b7e7066f5..3b7e7066f5 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_socket_service_base.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_socket_service_base.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_mutex.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_mutex.ipp index 12922263f2..12922263f2 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_mutex.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_mutex.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_static_mutex.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_static_mutex.ipp index 10e8622e37..10e8622e37 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_static_mutex.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_static_mutex.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_thread.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_thread.ipp index 710c9b9f9b..710c9b9f9b 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_thread.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_thread.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_tss_ptr.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_tss_ptr.ipp index 755d020703..755d020703 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_tss_ptr.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_tss_ptr.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/winrt_ssocket_service_base.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/winrt_ssocket_service_base.ipp index e6254aed93..e6254aed93 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/winrt_ssocket_service_base.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/winrt_ssocket_service_base.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/impl/winsock_init.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/winsock_init.ipp index 5d31a03b06..5d31a03b06 100644 --- a/contrib/restricted/boost/boost/asio/detail/impl/winsock_init.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/winsock_init.ipp diff --git a/contrib/restricted/boost/boost/asio/detail/io_control.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/io_control.hpp index 112b0ad751..112b0ad751 100644 --- a/contrib/restricted/boost/boost/asio/detail/io_control.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/io_control.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/is_buffer_sequence.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/is_buffer_sequence.hpp index 370b2c81c0..370b2c81c0 100644 --- a/contrib/restricted/boost/boost/asio/detail/is_buffer_sequence.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/is_buffer_sequence.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/is_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/is_executor.hpp index bc52ee87ce..bc52ee87ce 100644 --- a/contrib/restricted/boost/boost/asio/detail/is_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/is_executor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/keyword_tss_ptr.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/keyword_tss_ptr.hpp index 8451b17510..8451b17510 100644 --- a/contrib/restricted/boost/boost/asio/detail/keyword_tss_ptr.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/keyword_tss_ptr.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/kqueue_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/kqueue_reactor.hpp index 31d79ca6a4..31d79ca6a4 100644 --- a/contrib/restricted/boost/boost/asio/detail/kqueue_reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/kqueue_reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/limits.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/limits.hpp index 036c5999b8..036c5999b8 100644 --- a/contrib/restricted/boost/boost/asio/detail/limits.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/limits.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/macos_fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/macos_fenced_block.hpp index 20196a78f6..20196a78f6 100644 --- a/contrib/restricted/boost/boost/asio/detail/macos_fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/macos_fenced_block.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/memory.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/memory.hpp index 21a68e456f..21a68e456f 100644 --- a/contrib/restricted/boost/boost/asio/detail/memory.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/memory.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/mutex.hpp index 9fe4ad333e..9fe4ad333e 100644 --- a/contrib/restricted/boost/boost/asio/detail/mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/noncopyable.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/noncopyable.hpp index 36b30c074d..36b30c074d 100644 --- a/contrib/restricted/boost/boost/asio/detail/noncopyable.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/noncopyable.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_event.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_event.hpp index 8394028e41..8394028e41 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_event.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_event.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_fenced_block.hpp index f9f59af3a9..f9f59af3a9 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_fenced_block.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_global.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_global.hpp index 3a4d516889..3a4d516889 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_global.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_global.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_mutex.hpp index 90b92fe77b..90b92fe77b 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_reactor.hpp index 028f0f3535..028f0f3535 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_signal_blocker.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_signal_blocker.hpp index b2285c1f45..b2285c1f45 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_signal_blocker.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_signal_blocker.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_socket_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_socket_service.hpp index 2c5b784125..2c5b784125 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_socket_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_socket_service.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_static_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_static_mutex.hpp index 7e2c0b522c..7e2c0b522c 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_static_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_static_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_thread.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_thread.hpp index 56ad8bf806..56ad8bf806 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_thread.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_thread.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/null_tss_ptr.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/null_tss_ptr.hpp index 06d5a4d522..06d5a4d522 100644 --- a/contrib/restricted/boost/boost/asio/detail/null_tss_ptr.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/null_tss_ptr.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/object_pool.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/object_pool.hpp index 7e454a7138..7e454a7138 100644 --- a/contrib/restricted/boost/boost/asio/detail/object_pool.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/object_pool.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/old_win_sdk_compat.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/old_win_sdk_compat.hpp index f1b63cba0e..f1b63cba0e 100644 --- a/contrib/restricted/boost/boost/asio/detail/old_win_sdk_compat.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/old_win_sdk_compat.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/op_queue.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/op_queue.hpp index 935e45920f..935e45920f 100644 --- a/contrib/restricted/boost/boost/asio/detail/op_queue.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/op_queue.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/operation.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/operation.hpp index 13220231ab..13220231ab 100644 --- a/contrib/restricted/boost/boost/asio/detail/operation.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/operation.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/pipe_select_interrupter.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/pipe_select_interrupter.hpp index 696d565729..696d565729 100644 --- a/contrib/restricted/boost/boost/asio/detail/pipe_select_interrupter.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/pipe_select_interrupter.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/pop_options.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/pop_options.hpp index 10450eacb5..10450eacb5 100644 --- a/contrib/restricted/boost/boost/asio/detail/pop_options.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/pop_options.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/posix_event.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_event.hpp index 98529eaf26..98529eaf26 100644 --- a/contrib/restricted/boost/boost/asio/detail/posix_event.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_event.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/posix_fd_set_adapter.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_fd_set_adapter.hpp index f68f2aa1c4..f68f2aa1c4 100644 --- a/contrib/restricted/boost/boost/asio/detail/posix_fd_set_adapter.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_fd_set_adapter.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/posix_global.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_global.hpp index c2c2996f88..c2c2996f88 100644 --- a/contrib/restricted/boost/boost/asio/detail/posix_global.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_global.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/posix_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_mutex.hpp index 5e1d42c530..5e1d42c530 100644 --- a/contrib/restricted/boost/boost/asio/detail/posix_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/posix_signal_blocker.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_signal_blocker.hpp index ea5758fb2c..ea5758fb2c 100644 --- a/contrib/restricted/boost/boost/asio/detail/posix_signal_blocker.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_signal_blocker.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/posix_static_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_static_mutex.hpp index cbf7013c2d..cbf7013c2d 100644 --- a/contrib/restricted/boost/boost/asio/detail/posix_static_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_static_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/posix_thread.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_thread.hpp index b2821f5356..b2821f5356 100644 --- a/contrib/restricted/boost/boost/asio/detail/posix_thread.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_thread.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/posix_tss_ptr.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_tss_ptr.hpp index 93d06744a7..93d06744a7 100644 --- a/contrib/restricted/boost/boost/asio/detail/posix_tss_ptr.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/posix_tss_ptr.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/push_options.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/push_options.hpp index 4927df93a2..4927df93a2 100644 --- a/contrib/restricted/boost/boost/asio/detail/push_options.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/push_options.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_null_buffers_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_null_buffers_op.hpp index dca3a3285f..dca3a3285f 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_null_buffers_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_null_buffers_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_socket_accept_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_accept_op.hpp index 292f3bdf25..292f3bdf25 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_socket_accept_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_accept_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_socket_connect_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_connect_op.hpp index bbb5020501..bbb5020501 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_socket_connect_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_connect_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_socket_recv_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_recv_op.hpp index 0f124627bd..0f124627bd 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_socket_recv_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_recv_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_socket_recvfrom_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_recvfrom_op.hpp index b96a01327a..b96a01327a 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_socket_recvfrom_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_recvfrom_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_socket_recvmsg_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_recvmsg_op.hpp index 6ae324947c..6ae324947c 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_socket_recvmsg_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_recvmsg_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_socket_send_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_send_op.hpp index 11f3ad80af..11f3ad80af 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_socket_send_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_send_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_socket_sendto_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_sendto_op.hpp index a73934bfc1..a73934bfc1 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_socket_sendto_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_sendto_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_socket_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_service.hpp index 89940d9af0..89940d9af0 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_socket_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_service.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_socket_service_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_service_base.hpp index 9d3d54cc11..9d3d54cc11 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_socket_service_base.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_service_base.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_wait_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_wait_op.hpp index ee32502482..ee32502482 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactive_wait_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_wait_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactor.hpp index f1e5d95864..f1e5d95864 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactor_fwd.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactor_fwd.hpp index b222b134e6..b222b134e6 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactor_fwd.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactor_fwd.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactor_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactor_op.hpp index beb443eb69..beb443eb69 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactor_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactor_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/reactor_op_queue.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactor_op_queue.hpp index fec0dd7d37..fec0dd7d37 100644 --- a/contrib/restricted/boost/boost/asio/detail/reactor_op_queue.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactor_op_queue.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/recycling_allocator.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/recycling_allocator.hpp index adab0a7a61..adab0a7a61 100644 --- a/contrib/restricted/boost/boost/asio/detail/recycling_allocator.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/recycling_allocator.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/resolve_endpoint_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/resolve_endpoint_op.hpp index 970544c783..970544c783 100644 --- a/contrib/restricted/boost/boost/asio/detail/resolve_endpoint_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/resolve_endpoint_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/resolve_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/resolve_op.hpp index fd72994fc5..fd72994fc5 100644 --- a/contrib/restricted/boost/boost/asio/detail/resolve_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/resolve_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/resolve_query_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/resolve_query_op.hpp index 91bdd79654..91bdd79654 100644 --- a/contrib/restricted/boost/boost/asio/detail/resolve_query_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/resolve_query_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/resolver_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/resolver_service.hpp index 85c9c2a0a7..85c9c2a0a7 100644 --- a/contrib/restricted/boost/boost/asio/detail/resolver_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/resolver_service.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/resolver_service_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/resolver_service_base.hpp index 40adca655a..40adca655a 100644 --- a/contrib/restricted/boost/boost/asio/detail/resolver_service_base.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/resolver_service_base.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/scheduler.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/scheduler.hpp index 835e4c9237..835e4c9237 100644 --- a/contrib/restricted/boost/boost/asio/detail/scheduler.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/scheduler.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/scheduler_operation.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/scheduler_operation.hpp index 633a8c594f..633a8c594f 100644 --- a/contrib/restricted/boost/boost/asio/detail/scheduler_operation.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/scheduler_operation.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/scheduler_thread_info.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/scheduler_thread_info.hpp index 5f18381d50..5f18381d50 100644 --- a/contrib/restricted/boost/boost/asio/detail/scheduler_thread_info.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/scheduler_thread_info.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/scoped_lock.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/scoped_lock.hpp index 005585c700..005585c700 100644 --- a/contrib/restricted/boost/boost/asio/detail/scoped_lock.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/scoped_lock.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/scoped_ptr.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/scoped_ptr.hpp index 12ad834919..12ad834919 100644 --- a/contrib/restricted/boost/boost/asio/detail/scoped_ptr.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/scoped_ptr.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/select_interrupter.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/select_interrupter.hpp index d837634e89..d837634e89 100644 --- a/contrib/restricted/boost/boost/asio/detail/select_interrupter.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/select_interrupter.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/select_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/select_reactor.hpp index dfb5e96943..dfb5e96943 100644 --- a/contrib/restricted/boost/boost/asio/detail/select_reactor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/select_reactor.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/service_registry.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/service_registry.hpp index 894fdb1b75..894fdb1b75 100644 --- a/contrib/restricted/boost/boost/asio/detail/service_registry.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/service_registry.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/signal_blocker.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/signal_blocker.hpp index 875f188f48..875f188f48 100644 --- a/contrib/restricted/boost/boost/asio/detail/signal_blocker.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/signal_blocker.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/signal_init.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/signal_init.hpp index 1889de689b..1889de689b 100644 --- a/contrib/restricted/boost/boost/asio/detail/signal_init.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/signal_init.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/socket_holder.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_holder.hpp index b229f66b1b..b229f66b1b 100644 --- a/contrib/restricted/boost/boost/asio/detail/socket_holder.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_holder.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/socket_ops.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_ops.hpp index 8f5fa0b3ca..8f5fa0b3ca 100644 --- a/contrib/restricted/boost/boost/asio/detail/socket_ops.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_ops.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/socket_option.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_option.hpp index bd940142ca..bd940142ca 100644 --- a/contrib/restricted/boost/boost/asio/detail/socket_option.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_option.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/socket_select_interrupter.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_select_interrupter.hpp index dc7e30d69b..dc7e30d69b 100644 --- a/contrib/restricted/boost/boost/asio/detail/socket_select_interrupter.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_select_interrupter.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/socket_types.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_types.hpp index 3e8d1b0a22..11ed551838 100644 --- a/contrib/restricted/boost/boost/asio/detail/socket_types.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/socket_types.hpp @@ -102,11 +102,7 @@ const int max_addr_v4_str_len = 256; const int max_addr_v6_str_len = 256; typedef unsigned __int32 u_long_type; typedef unsigned __int16 u_short_type; -#ifdef s_addr -using in4_addr_type = in_addr; -#else struct in4_addr_type { u_long_type s_addr; }; -#endif struct in4_mreq_type { in4_addr_type imr_multiaddr, imr_interface; }; struct in6_addr_type { unsigned char s6_addr[16]; }; struct in6_mreq_type { in6_addr_type ipv6mr_multiaddr; diff --git a/contrib/restricted/boost/boost/asio/detail/solaris_fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/solaris_fenced_block.hpp index 3b605daf39..07cbd0dfa0 100644 --- a/contrib/restricted/boost/boost/asio/detail/solaris_fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/solaris_fenced_block.hpp @@ -19,7 +19,7 @@ #if defined(__sun) -#include <atomic.h> +#error #include <atomic.h> #include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/detail/push_options.hpp> diff --git a/contrib/restricted/boost/boost/asio/detail/static_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/static_mutex.hpp index 1bc5c2c813..1bc5c2c813 100644 --- a/contrib/restricted/boost/boost/asio/detail/static_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/static_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/std_event.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/std_event.hpp index d32bff422e..d32bff422e 100644 --- a/contrib/restricted/boost/boost/asio/detail/std_event.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/std_event.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/std_fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/std_fenced_block.hpp index 3993199145..3993199145 100644 --- a/contrib/restricted/boost/boost/asio/detail/std_fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/std_fenced_block.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/std_global.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/std_global.hpp index f9df646bc6..f9df646bc6 100644 --- a/contrib/restricted/boost/boost/asio/detail/std_global.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/std_global.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/std_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/std_mutex.hpp index 463735b92a..463735b92a 100644 --- a/contrib/restricted/boost/boost/asio/detail/std_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/std_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/std_static_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/std_static_mutex.hpp index 16104bcfa6..16104bcfa6 100644 --- a/contrib/restricted/boost/boost/asio/detail/std_static_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/std_static_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/std_thread.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/std_thread.hpp index af507ed32f..af507ed32f 100644 --- a/contrib/restricted/boost/boost/asio/detail/std_thread.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/std_thread.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/strand_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/strand_service.hpp index f036264b95..f036264b95 100644 --- a/contrib/restricted/boost/boost/asio/detail/strand_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/strand_service.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/string_view.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/string_view.hpp index 7f601199b1..fa2ee54f10 100644 --- a/contrib/restricted/boost/boost/asio/detail/string_view.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/string_view.hpp @@ -22,7 +22,7 @@ #if defined(BOOST_ASIO_HAS_STD_STRING_VIEW) # include <string_view> #elif defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) -# error include <experimental/string_view> +# error #include <experimental/string_view> #else // defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) # error BOOST_ASIO_HAS_STRING_VIEW is set but no string_view is available #endif // defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) diff --git a/contrib/restricted/boost/boost/asio/detail/thread.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/thread.hpp index 41810c6477..41810c6477 100644 --- a/contrib/restricted/boost/boost/asio/detail/thread.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/thread.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/thread_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/thread_context.hpp index b4a2435f0f..b4a2435f0f 100644 --- a/contrib/restricted/boost/boost/asio/detail/thread_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/thread_context.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/thread_group.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/thread_group.hpp index c9c194142f..c9c194142f 100644 --- a/contrib/restricted/boost/boost/asio/detail/thread_group.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/thread_group.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/thread_info_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/thread_info_base.hpp index 16bb1787f3..16bb1787f3 100644 --- a/contrib/restricted/boost/boost/asio/detail/thread_info_base.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/thread_info_base.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/throw_error.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/throw_error.hpp index c1775b2536..c1775b2536 100644 --- a/contrib/restricted/boost/boost/asio/detail/throw_error.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/throw_error.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/throw_exception.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/throw_exception.hpp index 8690fa6f63..8690fa6f63 100644 --- a/contrib/restricted/boost/boost/asio/detail/throw_exception.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/throw_exception.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/timer_queue_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/timer_queue_base.hpp index f3a14238aa..f3a14238aa 100644 --- a/contrib/restricted/boost/boost/asio/detail/timer_queue_base.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/timer_queue_base.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/timer_queue_set.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/timer_queue_set.hpp index 2bed122fc2..2bed122fc2 100644 --- a/contrib/restricted/boost/boost/asio/detail/timer_queue_set.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/timer_queue_set.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/tss_ptr.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/tss_ptr.hpp index 7850718a3c..7850718a3c 100644 --- a/contrib/restricted/boost/boost/asio/detail/tss_ptr.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/tss_ptr.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/type_traits.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/type_traits.hpp index a0d4cb4902..a0d4cb4902 100644 --- a/contrib/restricted/boost/boost/asio/detail/type_traits.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/type_traits.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/variadic_templates.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/variadic_templates.hpp index c358feec18..c358feec18 100644 --- a/contrib/restricted/boost/boost/asio/detail/variadic_templates.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/variadic_templates.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/wait_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/wait_op.hpp index 3a95a37580..3a95a37580 100644 --- a/contrib/restricted/boost/boost/asio/detail/wait_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/wait_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_event.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_event.hpp index 67edbcfb89..67edbcfb89 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_event.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_event.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_fd_set_adapter.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_fd_set_adapter.hpp index bdddb32a9d..bdddb32a9d 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_fd_set_adapter.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_fd_set_adapter.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_fenced_block.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_fenced_block.hpp index c595eaa00f..c595eaa00f 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_fenced_block.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_fenced_block.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_global.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_global.hpp index 4234a6d4e0..4234a6d4e0 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_global.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_global.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_io_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_io_context.hpp index 1ccdf35f65..1ccdf35f65 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_io_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_io_context.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_null_buffers_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_null_buffers_op.hpp index 106bedeba0..106bedeba0 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_null_buffers_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_null_buffers_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_operation.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_operation.hpp index 11111f3150..11111f3150 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_operation.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_operation.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_accept_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_accept_op.hpp index 8e1b7fc93a..8e1b7fc93a 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_accept_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_accept_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_connect_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_connect_op.hpp index 916d22ee49..916d22ee49 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_connect_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_connect_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_recv_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_recv_op.hpp index b052ec236e..b052ec236e 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_recv_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_recv_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp index a7338c8877..a7338c8877 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp index 4a8313225d..4a8313225d 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_send_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_send_op.hpp index 7dc9ab3175..7dc9ab3175 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_send_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_send_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_service.hpp index d71c6ee046..d71c6ee046 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_service.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_service_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_service_base.hpp index dd2bf9f6a9..dd2bf9f6a9 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_socket_service_base.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_socket_service_base.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_thread_info.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_thread_info.hpp index 53f853e104..53f853e104 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_thread_info.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_thread_info.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_wait_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_wait_op.hpp index b067da3e3d..b067da3e3d 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_wait_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_iocp_wait_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_mutex.hpp index 45d87c63bb..45d87c63bb 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_static_mutex.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_static_mutex.hpp index 78d3a2eb7f..78d3a2eb7f 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_static_mutex.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_static_mutex.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_thread.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_thread.hpp index 377c3e3f93..377c3e3f93 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_thread.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_thread.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/win_tss_ptr.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/win_tss_ptr.hpp index e1761c2e27..e1761c2e27 100644 --- a/contrib/restricted/boost/boost/asio/detail/win_tss_ptr.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/win_tss_ptr.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winapp_thread.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winapp_thread.hpp index 775f663d84..775f663d84 100644 --- a/contrib/restricted/boost/boost/asio/detail/winapp_thread.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winapp_thread.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/wince_thread.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/wince_thread.hpp index 77ec7c8265..77ec7c8265 100644 --- a/contrib/restricted/boost/boost/asio/detail/wince_thread.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/wince_thread.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_async_manager.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_async_manager.hpp index 57d6a1c218..57d6a1c218 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_async_manager.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_async_manager.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_async_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_async_op.hpp index c3203ff88a..c3203ff88a 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_async_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_async_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_resolve_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_resolve_op.hpp index 80f102f4c8..80f102f4c8 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_resolve_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_resolve_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_resolver_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_resolver_service.hpp index 463dbde11f..463dbde11f 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_resolver_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_resolver_service.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_socket_connect_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_socket_connect_op.hpp index 9926da97d9..9926da97d9 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_socket_connect_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_socket_connect_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_socket_recv_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_socket_recv_op.hpp index 0701208da4..0701208da4 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_socket_recv_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_socket_recv_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_socket_send_op.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_socket_send_op.hpp index 4e62056c4f..4e62056c4f 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_socket_send_op.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_socket_send_op.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_ssocket_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_ssocket_service.hpp index c874f2520d..c874f2520d 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_ssocket_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_ssocket_service.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_ssocket_service_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_ssocket_service_base.hpp index dcb5aa1c40..dcb5aa1c40 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_ssocket_service_base.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_ssocket_service_base.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_utils.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_utils.hpp index 765edeecb8..765edeecb8 100644 --- a/contrib/restricted/boost/boost/asio/detail/winrt_utils.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winrt_utils.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/winsock_init.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/winsock_init.hpp index abf59cd1bf..abf59cd1bf 100644 --- a/contrib/restricted/boost/boost/asio/detail/winsock_init.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/winsock_init.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/work_dispatcher.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/work_dispatcher.hpp index 3167f244fd..3167f244fd 100644 --- a/contrib/restricted/boost/boost/asio/detail/work_dispatcher.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/work_dispatcher.hpp diff --git a/contrib/restricted/boost/boost/asio/detail/wrapped_handler.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/wrapped_handler.hpp index 8e23d1db9e..8e23d1db9e 100644 --- a/contrib/restricted/boost/boost/asio/detail/wrapped_handler.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/wrapped_handler.hpp diff --git a/contrib/restricted/boost/boost/asio/error.hpp b/contrib/restricted/boost/asio/include/boost/asio/error.hpp index 53810b287a..53810b287a 100644 --- a/contrib/restricted/boost/boost/asio/error.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/error.hpp diff --git a/contrib/restricted/boost/boost/asio/execution_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution_context.hpp index 4ebb607a1a..4ebb607a1a 100644 --- a/contrib/restricted/boost/boost/asio/execution_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution_context.hpp diff --git a/contrib/restricted/boost/boost/asio/executor_work_guard.hpp b/contrib/restricted/boost/asio/include/boost/asio/executor_work_guard.hpp index a9303462eb..a9303462eb 100644 --- a/contrib/restricted/boost/boost/asio/executor_work_guard.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/executor_work_guard.hpp diff --git a/contrib/restricted/boost/boost/asio/handler_alloc_hook.hpp b/contrib/restricted/boost/asio/include/boost/asio/handler_alloc_hook.hpp index c9636b53ad..c9636b53ad 100644 --- a/contrib/restricted/boost/boost/asio/handler_alloc_hook.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/handler_alloc_hook.hpp diff --git a/contrib/restricted/boost/boost/asio/handler_continuation_hook.hpp b/contrib/restricted/boost/asio/include/boost/asio/handler_continuation_hook.hpp index 4f446b0953..4f446b0953 100644 --- a/contrib/restricted/boost/boost/asio/handler_continuation_hook.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/handler_continuation_hook.hpp diff --git a/contrib/restricted/boost/boost/asio/handler_invoke_hook.hpp b/contrib/restricted/boost/asio/include/boost/asio/handler_invoke_hook.hpp index a853bdfadd..a853bdfadd 100644 --- a/contrib/restricted/boost/boost/asio/handler_invoke_hook.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/handler_invoke_hook.hpp diff --git a/contrib/restricted/boost/boost/asio/handler_type.hpp b/contrib/restricted/boost/asio/include/boost/asio/handler_type.hpp index 0c43189338..0c43189338 100644 --- a/contrib/restricted/boost/boost/asio/handler_type.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/handler_type.hpp diff --git a/contrib/restricted/boost/boost/asio/impl/error.ipp b/contrib/restricted/boost/asio/include/boost/asio/impl/error.ipp index 49a10462bd..49a10462bd 100644 --- a/contrib/restricted/boost/boost/asio/impl/error.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/error.ipp diff --git a/contrib/restricted/boost/boost/asio/impl/execution_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/execution_context.hpp index eadf36b145..eadf36b145 100644 --- a/contrib/restricted/boost/boost/asio/impl/execution_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/execution_context.hpp diff --git a/contrib/restricted/boost/boost/asio/impl/execution_context.ipp b/contrib/restricted/boost/asio/include/boost/asio/impl/execution_context.ipp index 219a66113d..219a66113d 100644 --- a/contrib/restricted/boost/boost/asio/impl/execution_context.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/execution_context.ipp diff --git a/contrib/restricted/boost/boost/asio/impl/handler_alloc_hook.ipp b/contrib/restricted/boost/asio/include/boost/asio/impl/handler_alloc_hook.ipp index 2b04ec104e..2b04ec104e 100644 --- a/contrib/restricted/boost/boost/asio/impl/handler_alloc_hook.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/handler_alloc_hook.ipp diff --git a/contrib/restricted/boost/boost/asio/impl/io_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/io_context.hpp index 21dd83688c..21dd83688c 100644 --- a/contrib/restricted/boost/boost/asio/impl/io_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/io_context.hpp diff --git a/contrib/restricted/boost/boost/asio/impl/io_context.ipp b/contrib/restricted/boost/asio/include/boost/asio/impl/io_context.ipp index 96a7de7415..96a7de7415 100644 --- a/contrib/restricted/boost/boost/asio/impl/io_context.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/io_context.ipp diff --git a/contrib/restricted/boost/boost/asio/impl/post.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/post.hpp index d318f890ff..d318f890ff 100644 --- a/contrib/restricted/boost/boost/asio/impl/post.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/post.hpp diff --git a/contrib/restricted/boost/boost/asio/impl/system_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/system_context.hpp index dab5d4d085..dab5d4d085 100644 --- a/contrib/restricted/boost/boost/asio/impl/system_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/system_context.hpp diff --git a/contrib/restricted/boost/boost/asio/impl/system_context.ipp b/contrib/restricted/boost/asio/include/boost/asio/impl/system_context.ipp index e56632c816..e56632c816 100644 --- a/contrib/restricted/boost/boost/asio/impl/system_context.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/system_context.ipp diff --git a/contrib/restricted/boost/boost/asio/impl/system_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/system_executor.hpp index c59e780d3f..c59e780d3f 100644 --- a/contrib/restricted/boost/boost/asio/impl/system_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/system_executor.hpp diff --git a/contrib/restricted/boost/boost/asio/io_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/io_context.hpp index 51377467ea..51377467ea 100644 --- a/contrib/restricted/boost/boost/asio/io_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/io_context.hpp diff --git a/contrib/restricted/boost/boost/asio/io_context_strand.hpp b/contrib/restricted/boost/asio/include/boost/asio/io_context_strand.hpp index 144e308a21..144e308a21 100644 --- a/contrib/restricted/boost/boost/asio/io_context_strand.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/io_context_strand.hpp diff --git a/contrib/restricted/boost/boost/asio/io_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/io_service.hpp index 76af8e0cbd..76af8e0cbd 100644 --- a/contrib/restricted/boost/boost/asio/io_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/io_service.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/address.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/address.hpp index 9b0cbdd3ee..9b0cbdd3ee 100644 --- a/contrib/restricted/boost/boost/asio/ip/address.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/address.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/address_v4.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/address_v4.hpp index 68d724085d..68d724085d 100644 --- a/contrib/restricted/boost/boost/asio/ip/address_v4.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/address_v4.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/address_v6.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/address_v6.hpp index 8c4ac0a732..8c4ac0a732 100644 --- a/contrib/restricted/boost/boost/asio/ip/address_v6.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/address_v6.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/bad_address_cast.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/bad_address_cast.hpp index 4e62bcd32b..4e62bcd32b 100644 --- a/contrib/restricted/boost/boost/asio/ip/bad_address_cast.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/bad_address_cast.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/basic_endpoint.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_endpoint.hpp index bad4114f0b..bad4114f0b 100644 --- a/contrib/restricted/boost/boost/asio/ip/basic_endpoint.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_endpoint.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/basic_resolver.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver.hpp index 969d9d8ac3..969d9d8ac3 100644 --- a/contrib/restricted/boost/boost/asio/ip/basic_resolver.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/basic_resolver_entry.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver_entry.hpp index efaf976577..efaf976577 100644 --- a/contrib/restricted/boost/boost/asio/ip/basic_resolver_entry.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver_entry.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/basic_resolver_iterator.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver_iterator.hpp index dd93b84149..dd93b84149 100644 --- a/contrib/restricted/boost/boost/asio/ip/basic_resolver_iterator.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver_iterator.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/basic_resolver_query.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver_query.hpp index cbbae25ae7..cbbae25ae7 100644 --- a/contrib/restricted/boost/boost/asio/ip/basic_resolver_query.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver_query.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/basic_resolver_results.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver_results.hpp index 29238b9a68..29238b9a68 100644 --- a/contrib/restricted/boost/boost/asio/ip/basic_resolver_results.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/basic_resolver_results.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/detail/endpoint.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/detail/endpoint.hpp index a6f04abed9..a6f04abed9 100644 --- a/contrib/restricted/boost/boost/asio/ip/detail/endpoint.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/detail/endpoint.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/detail/impl/endpoint.ipp b/contrib/restricted/boost/asio/include/boost/asio/ip/detail/impl/endpoint.ipp index 49f5af116f..49f5af116f 100644 --- a/contrib/restricted/boost/boost/asio/ip/detail/impl/endpoint.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/detail/impl/endpoint.ipp diff --git a/contrib/restricted/boost/boost/asio/ip/host_name.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/host_name.hpp index c1e4e0cf8b..c1e4e0cf8b 100644 --- a/contrib/restricted/boost/boost/asio/ip/host_name.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/host_name.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/impl/address.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address.hpp index cf5afb4fcf..cf5afb4fcf 100644 --- a/contrib/restricted/boost/boost/asio/ip/impl/address.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/impl/address.ipp b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address.ipp index 9afa566a35..9afa566a35 100644 --- a/contrib/restricted/boost/boost/asio/ip/impl/address.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address.ipp diff --git a/contrib/restricted/boost/boost/asio/ip/impl/address_v4.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address_v4.hpp index 838dc613e2..838dc613e2 100644 --- a/contrib/restricted/boost/boost/asio/ip/impl/address_v4.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address_v4.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/impl/address_v4.ipp b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address_v4.ipp index 7693deaf40..7693deaf40 100644 --- a/contrib/restricted/boost/boost/asio/ip/impl/address_v4.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address_v4.ipp diff --git a/contrib/restricted/boost/boost/asio/ip/impl/address_v6.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address_v6.hpp index f989b6a702..f989b6a702 100644 --- a/contrib/restricted/boost/boost/asio/ip/impl/address_v6.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address_v6.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/impl/address_v6.ipp b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address_v6.ipp index 4eea4bc5a0..4eea4bc5a0 100644 --- a/contrib/restricted/boost/boost/asio/ip/impl/address_v6.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/address_v6.ipp diff --git a/contrib/restricted/boost/boost/asio/ip/impl/basic_endpoint.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/basic_endpoint.hpp index 23655bf940..23655bf940 100644 --- a/contrib/restricted/boost/boost/asio/ip/impl/basic_endpoint.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/basic_endpoint.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/impl/host_name.ipp b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/host_name.ipp index 17b8395a76..17b8395a76 100644 --- a/contrib/restricted/boost/boost/asio/ip/impl/host_name.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/impl/host_name.ipp diff --git a/contrib/restricted/boost/boost/asio/ip/resolver_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/resolver_base.hpp index 06cbcd0220..06cbcd0220 100644 --- a/contrib/restricted/boost/boost/asio/ip/resolver_base.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/resolver_base.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/resolver_query_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/resolver_query_base.hpp index 1e287c6225..1e287c6225 100644 --- a/contrib/restricted/boost/boost/asio/ip/resolver_query_base.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/resolver_query_base.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/resolver_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/resolver_service.hpp index 3e1fd38a70..3e1fd38a70 100644 --- a/contrib/restricted/boost/boost/asio/ip/resolver_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/resolver_service.hpp diff --git a/contrib/restricted/boost/boost/asio/ip/udp.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/udp.hpp index 9f07a55e7e..9f07a55e7e 100644 --- a/contrib/restricted/boost/boost/asio/ip/udp.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ip/udp.hpp diff --git a/contrib/restricted/boost/boost/asio/is_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/is_executor.hpp index 8570475241..8570475241 100644 --- a/contrib/restricted/boost/boost/asio/is_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/is_executor.hpp diff --git a/contrib/restricted/boost/boost/asio/post.hpp b/contrib/restricted/boost/asio/include/boost/asio/post.hpp index 667613ec54..667613ec54 100644 --- a/contrib/restricted/boost/boost/asio/post.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/post.hpp diff --git a/contrib/restricted/boost/boost/asio/socket_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/socket_base.hpp index ee8aa6b262..ee8aa6b262 100644 --- a/contrib/restricted/boost/boost/asio/socket_base.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/socket_base.hpp diff --git a/contrib/restricted/boost/boost/asio/system_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/system_context.hpp index 22f6b19426..22f6b19426 100644 --- a/contrib/restricted/boost/boost/asio/system_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/system_context.hpp diff --git a/contrib/restricted/boost/boost/asio/system_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/system_executor.hpp index d6f5b7def8..d6f5b7def8 100644 --- a/contrib/restricted/boost/boost/asio/system_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/system_executor.hpp diff --git a/contrib/restricted/boost/boost/asio/time_traits.hpp b/contrib/restricted/boost/asio/include/boost/asio/time_traits.hpp index d11ea0050f..d11ea0050f 100644 --- a/contrib/restricted/boost/boost/asio/time_traits.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/time_traits.hpp diff --git a/contrib/restricted/boost/boost/asio/wait_traits.hpp b/contrib/restricted/boost/asio/include/boost/asio/wait_traits.hpp index 9f5be813a7..9f5be813a7 100644 --- a/contrib/restricted/boost/boost/asio/wait_traits.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/wait_traits.hpp diff --git a/contrib/restricted/boost/boost/asio.hpp b/contrib/restricted/boost/boost/asio.hpp deleted file mode 100644 index 53841de1fc..0000000000 --- a/contrib/restricted/boost/boost/asio.hpp +++ /dev/null @@ -1,151 +0,0 @@ -// -// asio.hpp -// ~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See www.boost.org/libs/asio for documentation. -// - -#ifndef BOOST_ASIO_HPP -#define BOOST_ASIO_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/async_result.hpp> -#include <boost/asio/basic_datagram_socket.hpp> -#include <boost/asio/basic_deadline_timer.hpp> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/basic_raw_socket.hpp> -#include <boost/asio/basic_seq_packet_socket.hpp> -#include <boost/asio/basic_serial_port.hpp> -#include <boost/asio/basic_signal_set.hpp> -#include <boost/asio/basic_socket_acceptor.hpp> -#include <boost/asio/basic_socket_iostream.hpp> -#include <boost/asio/basic_socket_streambuf.hpp> -#include <boost/asio/basic_stream_socket.hpp> -#include <boost/asio/basic_streambuf.hpp> -#include <boost/asio/basic_waitable_timer.hpp> -#include <boost/asio/bind_executor.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/buffered_read_stream_fwd.hpp> -#include <boost/asio/buffered_read_stream.hpp> -#include <boost/asio/buffered_stream_fwd.hpp> -#include <boost/asio/buffered_stream.hpp> -#include <boost/asio/buffered_write_stream_fwd.hpp> -#include <boost/asio/buffered_write_stream.hpp> -#include <boost/asio/buffers_iterator.hpp> -#include <boost/asio/completion_condition.hpp> -#include <boost/asio/connect.hpp> -#include <boost/asio/coroutine.hpp> -#include <boost/asio/datagram_socket_service.hpp> -#include <boost/asio/deadline_timer_service.hpp> -#include <boost/asio/deadline_timer.hpp> -#include <boost/asio/defer.hpp> -#include <boost/asio/dispatch.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/execution_context.hpp> -#include <boost/asio/executor.hpp> -#include <boost/asio/executor_work_guard.hpp> -#include <boost/asio/generic/basic_endpoint.hpp> -#include <boost/asio/generic/datagram_protocol.hpp> -#include <boost/asio/generic/raw_protocol.hpp> -#include <boost/asio/generic/seq_packet_protocol.hpp> -#include <boost/asio/generic/stream_protocol.hpp> -#include <boost/asio/handler_alloc_hook.hpp> -#include <boost/asio/handler_continuation_hook.hpp> -#include <boost/asio/handler_invoke_hook.hpp> -#include <boost/asio/handler_type.hpp> -#include <boost/asio/high_resolution_timer.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/io_context_strand.hpp> -#include <boost/asio/io_service.hpp> -#include <boost/asio/io_service_strand.hpp> -#include <boost/asio/ip/address.hpp> -#include <boost/asio/ip/address_v4.hpp> -#include <boost/asio/ip/address_v4_iterator.hpp> -#include <boost/asio/ip/address_v4_range.hpp> -#include <boost/asio/ip/address_v6.hpp> -#include <boost/asio/ip/address_v6_iterator.hpp> -#include <boost/asio/ip/address_v6_range.hpp> -#include <boost/asio/ip/bad_address_cast.hpp> -#include <boost/asio/ip/basic_endpoint.hpp> -#include <boost/asio/ip/basic_resolver.hpp> -#include <boost/asio/ip/basic_resolver_entry.hpp> -#include <boost/asio/ip/basic_resolver_iterator.hpp> -#include <boost/asio/ip/basic_resolver_query.hpp> -#include <boost/asio/ip/host_name.hpp> -#include <boost/asio/ip/icmp.hpp> -#include <boost/asio/ip/multicast.hpp> -#include <boost/asio/ip/resolver_base.hpp> -#include <boost/asio/ip/resolver_query_base.hpp> -#include <boost/asio/ip/resolver_service.hpp> -#include <boost/asio/ip/tcp.hpp> -#include <boost/asio/ip/udp.hpp> -#include <boost/asio/ip/unicast.hpp> -#include <boost/asio/ip/v6_only.hpp> -#include <boost/asio/is_executor.hpp> -#include <boost/asio/is_read_buffered.hpp> -#include <boost/asio/is_write_buffered.hpp> -#include <boost/asio/local/basic_endpoint.hpp> -#include <boost/asio/local/connect_pair.hpp> -#include <boost/asio/local/datagram_protocol.hpp> -#include <boost/asio/local/stream_protocol.hpp> -#include <boost/asio/packaged_task.hpp> -#include <boost/asio/placeholders.hpp> -#include <boost/asio/posix/basic_descriptor.hpp> -#include <boost/asio/posix/basic_stream_descriptor.hpp> -#include <boost/asio/posix/descriptor.hpp> -#include <boost/asio/posix/descriptor_base.hpp> -#include <boost/asio/posix/stream_descriptor.hpp> -#include <boost/asio/posix/stream_descriptor_service.hpp> -#include <boost/asio/post.hpp> -#include <boost/asio/raw_socket_service.hpp> -#include <boost/asio/read.hpp> -#include <boost/asio/read_at.hpp> -#include <boost/asio/read_until.hpp> -#include <boost/asio/seq_packet_socket_service.hpp> -#include <boost/asio/serial_port.hpp> -#include <boost/asio/serial_port_base.hpp> -#include <boost/asio/serial_port_service.hpp> -#include <boost/asio/signal_set.hpp> -#include <boost/asio/signal_set_service.hpp> -#include <boost/asio/socket_acceptor_service.hpp> -#include <boost/asio/socket_base.hpp> -#include <boost/asio/steady_timer.hpp> -#include <boost/asio/strand.hpp> -#include <boost/asio/stream_socket_service.hpp> -#include <boost/asio/streambuf.hpp> -#include <boost/asio/system_context.hpp> -#include <boost/asio/system_executor.hpp> -#include <boost/asio/system_timer.hpp> -#include <boost/asio/thread_pool.hpp> -#include <boost/asio/time_traits.hpp> -#include <boost/asio/use_future.hpp> -#include <boost/asio/uses_executor.hpp> -#include <boost/asio/version.hpp> -#include <boost/asio/wait_traits.hpp> -#include <boost/asio/waitable_timer_service.hpp> -#include <boost/asio/windows/basic_handle.hpp> -#include <boost/asio/windows/basic_object_handle.hpp> -#include <boost/asio/windows/basic_random_access_handle.hpp> -#include <boost/asio/windows/basic_stream_handle.hpp> -#include <boost/asio/windows/object_handle.hpp> -#include <boost/asio/windows/object_handle_service.hpp> -#include <boost/asio/windows/overlapped_handle.hpp> -#include <boost/asio/windows/overlapped_ptr.hpp> -#include <boost/asio/windows/random_access_handle.hpp> -#include <boost/asio/windows/random_access_handle_service.hpp> -#include <boost/asio/windows/stream_handle.hpp> -#include <boost/asio/windows/stream_handle_service.hpp> -#include <boost/asio/write.hpp> -#include <boost/asio/write_at.hpp> - -#endif // BOOST_ASIO_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_deadline_timer.hpp b/contrib/restricted/boost/boost/asio/basic_deadline_timer.hpp deleted file mode 100644 index 56a265bfbc..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_deadline_timer.hpp +++ /dev/null @@ -1,630 +0,0 @@ -// -// basic_deadline_timer.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_DEADLINE_TIMER_HPP -#define BOOST_ASIO_BASIC_DEADLINE_TIMER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/time_traits.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/deadline_timer_service.hpp> -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/detail/deadline_timer_service.hpp> -# define BOOST_ASIO_SVC_T detail::deadline_timer_service<TimeTraits> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Provides waitable timer functionality. -/** - * The basic_deadline_timer class template provides the ability to perform a - * blocking or asynchronous wait for a timer to expire. - * - * A deadline timer is always in one of two states: "expired" or "not expired". - * If the wait() or async_wait() function is called on an expired timer, the - * wait operation will complete immediately. - * - * Most applications will use the boost::asio::deadline_timer typedef. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Examples - * Performing a blocking wait: - * @code - * // Construct a timer without setting an expiry time. - * boost::asio::deadline_timer timer(io_context); - * - * // Set an expiry time relative to now. - * timer.expires_from_now(boost::posix_time::seconds(5)); - * - * // Wait for the timer to expire. - * timer.wait(); - * @endcode - * - * @par - * Performing an asynchronous wait: - * @code - * void handler(const boost::system::error_code& error) - * { - * if (!error) - * { - * // Timer expired. - * } - * } - * - * ... - * - * // Construct a timer with an absolute expiry time. - * boost::asio::deadline_timer timer(io_context, - * boost::posix_time::time_from_string("2005-12-07 23:59:59.000")); - * - * // Start an asynchronous wait. - * timer.async_wait(handler); - * @endcode - * - * @par Changing an active deadline_timer's expiry time - * - * Changing the expiry time of a timer while there are pending asynchronous - * waits causes those wait operations to be cancelled. To ensure that the action - * associated with the timer is performed only once, use something like this: - * used: - * - * @code - * void on_some_event() - * { - * if (my_timer.expires_from_now(seconds(5)) > 0) - * { - * // We managed to cancel the timer. Start new asynchronous wait. - * my_timer.async_wait(on_timeout); - * } - * else - * { - * // Too late, timer has already expired! - * } - * } - * - * void on_timeout(const boost::system::error_code& e) - * { - * if (e != boost::asio::error::operation_aborted) - * { - * // Timer was not cancelled, take necessary action. - * } - * } - * @endcode - * - * @li The boost::asio::basic_deadline_timer::expires_from_now() function - * cancels any pending asynchronous waits, and returns the number of - * asynchronous waits that were cancelled. If it returns 0 then you were too - * late and the wait handler has already been executed, or will soon be - * executed. If it returns 1 then the wait handler was successfully cancelled. - * - * @li If a wait handler is cancelled, the boost::system::error_code passed to - * it contains the value boost::asio::error::operation_aborted. - */ -template <typename Time, - typename TimeTraits = boost::asio::time_traits<Time> - BOOST_ASIO_SVC_TPARAM_DEF2(= deadline_timer_service<Time, TimeTraits>)> -class basic_deadline_timer - : BOOST_ASIO_SVC_ACCESS basic_io_object<BOOST_ASIO_SVC_T> -{ -public: - /// The type of the executor associated with the object. - typedef io_context::executor_type executor_type; - - /// The time traits type. - typedef TimeTraits traits_type; - - /// The time type. - typedef typename traits_type::time_type time_type; - - /// The duration type. - typedef typename traits_type::duration_type duration_type; - - /// Constructor. - /** - * This constructor creates a timer without setting an expiry time. The - * expires_at() or expires_from_now() functions must be called to set an - * expiry time before the timer can be waited on. - * - * @param io_context The io_context object that the timer will use to dispatch - * handlers for any asynchronous operations performed on the timer. - */ - explicit basic_deadline_timer(boost::asio::io_context& io_context) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - } - - /// Constructor to set a particular expiry time as an absolute time. - /** - * This constructor creates a timer and sets the expiry time. - * - * @param io_context The io_context object that the timer will use to dispatch - * handlers for any asynchronous operations performed on the timer. - * - * @param expiry_time The expiry time to be used for the timer, expressed - * as an absolute time. - */ - basic_deadline_timer(boost::asio::io_context& io_context, - const time_type& expiry_time) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().expires_at(this->get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_at"); - } - - /// Constructor to set a particular expiry time relative to now. - /** - * This constructor creates a timer and sets the expiry time. - * - * @param io_context The io_context object that the timer will use to dispatch - * handlers for any asynchronous operations performed on the timer. - * - * @param expiry_time The expiry time to be used for the timer, relative to - * now. - */ - basic_deadline_timer(boost::asio::io_context& io_context, - const duration_type& expiry_time) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().expires_from_now( - this->get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_from_now"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_deadline_timer from another. - /** - * This constructor moves a timer from one object to another. - * - * @param other The other basic_deadline_timer object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_deadline_timer(io_context&) constructor. - */ - basic_deadline_timer(basic_deadline_timer&& other) - : basic_io_object<BOOST_ASIO_SVC_T>(std::move(other)) - { - } - - /// Move-assign a basic_deadline_timer from another. - /** - * This assignment operator moves a timer from one object to another. Cancels - * any outstanding asynchronous operations associated with the target object. - * - * @param other The other basic_deadline_timer object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_deadline_timer(io_context&) constructor. - */ - basic_deadline_timer& operator=(basic_deadline_timer&& other) - { - basic_io_object<BOOST_ASIO_SVC_T>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroys the timer. - /** - * This function destroys the timer, cancelling any outstanding asynchronous - * wait operations associated with the timer as if by calling @c cancel. - */ - ~basic_deadline_timer() - { - } - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - // These functions are provided by basic_io_object<>. -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_context() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_service() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_executor(); - } -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - - /// Cancel any asynchronous operations that are waiting on the timer. - /** - * This function forces the completion of any pending asynchronous wait - * operations against the timer. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @return The number of asynchronous operations that were cancelled. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when cancel() is called, then the - * handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel() - { - boost::system::error_code ec; - std::size_t s = this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - return s; - } - - /// Cancel any asynchronous operations that are waiting on the timer. - /** - * This function forces the completion of any pending asynchronous wait - * operations against the timer. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. - * - * @note If the timer has already expired when cancel() is called, then the - * handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel(boost::system::error_code& ec) - { - return this->get_service().cancel(this->get_implementation(), ec); - } - - /// Cancels one asynchronous operation that is waiting on the timer. - /** - * This function forces the completion of one pending asynchronous wait - * operation against the timer. Handlers are cancelled in FIFO order. The - * handler for the cancelled operation will be invoked with the - * boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @return The number of asynchronous operations that were cancelled. That is, - * either 0 or 1. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when cancel_one() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel_one() - { - boost::system::error_code ec; - std::size_t s = this->get_service().cancel_one( - this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel_one"); - return s; - } - - /// Cancels one asynchronous operation that is waiting on the timer. - /** - * This function forces the completion of one pending asynchronous wait - * operation against the timer. Handlers are cancelled in FIFO order. The - * handler for the cancelled operation will be invoked with the - * boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. That is, - * either 0 or 1. - * - * @note If the timer has already expired when cancel_one() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel_one(boost::system::error_code& ec) - { - return this->get_service().cancel_one(this->get_implementation(), ec); - } - - /// Get the timer's expiry time as an absolute time. - /** - * This function may be used to obtain the timer's current expiry time. - * Whether the timer has expired or not does not affect this value. - */ - time_type expires_at() const - { - return this->get_service().expires_at(this->get_implementation()); - } - - /// Set the timer's expiry time as an absolute time. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @return The number of asynchronous operations that were cancelled. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when expires_at() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_at(const time_type& expiry_time) - { - boost::system::error_code ec; - std::size_t s = this->get_service().expires_at( - this->get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_at"); - return s; - } - - /// Set the timer's expiry time as an absolute time. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. - * - * @note If the timer has already expired when expires_at() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_at(const time_type& expiry_time, - boost::system::error_code& ec) - { - return this->get_service().expires_at( - this->get_implementation(), expiry_time, ec); - } - - /// Get the timer's expiry time relative to now. - /** - * This function may be used to obtain the timer's current expiry time. - * Whether the timer has expired or not does not affect this value. - */ - duration_type expires_from_now() const - { - return this->get_service().expires_from_now(this->get_implementation()); - } - - /// Set the timer's expiry time relative to now. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @return The number of asynchronous operations that were cancelled. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when expires_from_now() is called, - * then the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_from_now(const duration_type& expiry_time) - { - boost::system::error_code ec; - std::size_t s = this->get_service().expires_from_now( - this->get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_from_now"); - return s; - } - - /// Set the timer's expiry time relative to now. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. - * - * @note If the timer has already expired when expires_from_now() is called, - * then the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_from_now(const duration_type& expiry_time, - boost::system::error_code& ec) - { - return this->get_service().expires_from_now( - this->get_implementation(), expiry_time, ec); - } - - /// Perform a blocking wait on the timer. - /** - * This function is used to wait for the timer to expire. This function - * blocks and does not return until the timer has expired. - * - * @throws boost::system::system_error Thrown on failure. - */ - void wait() - { - boost::system::error_code ec; - this->get_service().wait(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "wait"); - } - - /// Perform a blocking wait on the timer. - /** - * This function is used to wait for the timer to expire. This function - * blocks and does not return until the timer has expired. - * - * @param ec Set to indicate what error occurred, if any. - */ - void wait(boost::system::error_code& ec) - { - this->get_service().wait(this->get_implementation(), ec); - } - - /// Start an asynchronous wait on the timer. - /** - * This function may be used to initiate an asynchronous wait against the - * timer. It always returns immediately. - * - * For each call to async_wait(), the supplied handler will be called exactly - * once. The handler will be called when: - * - * @li The timer has expired. - * - * @li The timer was cancelled, in which case the handler is passed the error - * code boost::asio::error::operation_aborted. - * - * @param handler The handler to be called when the timer expires. Copies - * will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WaitHandler. - BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_wait(this->get_implementation(), - BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - this->get_service().async_wait(this->get_implementation(), - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# undef BOOST_ASIO_SVC_T -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_BASIC_DEADLINE_TIMER_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_raw_socket.hpp b/contrib/restricted/boost/boost/asio/basic_raw_socket.hpp deleted file mode 100644 index b24d079659..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_raw_socket.hpp +++ /dev/null @@ -1,1032 +0,0 @@ -// -// basic_raw_socket.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_RAW_SOCKET_HPP -#define BOOST_ASIO_BASIC_RAW_SOCKET_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/basic_socket.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/raw_socket_service.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Provides raw-oriented socket functionality. -/** - * The basic_raw_socket class template provides asynchronous and blocking - * raw-oriented socket functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <typename Protocol - BOOST_ASIO_SVC_TPARAM_DEF1(= raw_socket_service<Protocol>)> -class basic_raw_socket - : public basic_socket<Protocol BOOST_ASIO_SVC_TARG> -{ -public: - /// The native representation of a socket. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef typename basic_socket< - Protocol BOOST_ASIO_SVC_TARG>::native_handle_type native_handle_type; -#endif - - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename Protocol::endpoint endpoint_type; - - /// Construct a basic_raw_socket without opening it. - /** - * This constructor creates a raw socket without opening it. The open() - * function must be called before data can be sent or received on the socket. - * - * @param io_context The io_context object that the raw socket will use - * to dispatch handlers for any asynchronous operations performed on the - * socket. - */ - explicit basic_raw_socket(boost::asio::io_context& io_context) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(io_context) - { - } - - /// Construct and open a basic_raw_socket. - /** - * This constructor creates and opens a raw socket. - * - * @param io_context The io_context object that the raw socket will use - * to dispatch handlers for any asynchronous operations performed on the - * socket. - * - * @param protocol An object specifying protocol parameters to be used. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_raw_socket(boost::asio::io_context& io_context, - const protocol_type& protocol) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(io_context, protocol) - { - } - - /// Construct a basic_raw_socket, opening it and binding it to the given - /// local endpoint. - /** - * This constructor creates a raw socket and automatically opens it bound - * to the specified endpoint on the local machine. The protocol used is the - * protocol associated with the given endpoint. - * - * @param io_context The io_context object that the raw socket will use - * to dispatch handlers for any asynchronous operations performed on the - * socket. - * - * @param endpoint An endpoint on the local machine to which the raw - * socket will be bound. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_raw_socket(boost::asio::io_context& io_context, - const endpoint_type& endpoint) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(io_context, endpoint) - { - } - - /// Construct a basic_raw_socket on an existing native socket. - /** - * This constructor creates a raw socket object to hold an existing - * native socket. - * - * @param io_context The io_context object that the raw socket will use - * to dispatch handlers for any asynchronous operations performed on the - * socket. - * - * @param protocol An object specifying protocol parameters to be used. - * - * @param native_socket The new underlying socket implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_raw_socket(boost::asio::io_context& io_context, - const protocol_type& protocol, const native_handle_type& native_socket) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>( - io_context, protocol, native_socket) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_raw_socket from another. - /** - * This constructor moves a raw socket from one object to another. - * - * @param other The other basic_raw_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_raw_socket(io_context&) constructor. - */ - basic_raw_socket(basic_raw_socket&& other) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(std::move(other)) - { - } - - /// Move-assign a basic_raw_socket from another. - /** - * This assignment operator moves a raw socket from one object to another. - * - * @param other The other basic_raw_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_raw_socket(io_context&) constructor. - */ - basic_raw_socket& operator=(basic_raw_socket&& other) - { - basic_socket<Protocol BOOST_ASIO_SVC_TARG>::operator=(std::move(other)); - return *this; - } - - /// Move-construct a basic_raw_socket from a socket of another protocol type. - /** - * This constructor moves a raw socket from one object to another. - * - * @param other The other basic_raw_socket object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_raw_socket(io_context&) constructor. - */ - template <typename Protocol1 BOOST_ASIO_SVC_TPARAM1> - basic_raw_socket(basic_raw_socket<Protocol1 BOOST_ASIO_SVC_TARG1>&& other, - typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(std::move(other)) - { - } - - /// Move-assign a basic_raw_socket from a socket of another protocol type. - /** - * This assignment operator moves a raw socket from one object to another. - * - * @param other The other basic_raw_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_raw_socket(io_context&) constructor. - */ - template <typename Protocol1 BOOST_ASIO_SVC_TPARAM1> - typename enable_if<is_convertible<Protocol1, Protocol>::value, - basic_raw_socket>::type& operator=( - basic_raw_socket<Protocol1 BOOST_ASIO_SVC_TARG1>&& other) - { - basic_socket<Protocol BOOST_ASIO_SVC_TARG>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroys the socket. - /** - * This function destroys the socket, cancelling any outstanding asynchronous - * operations associated with the socket as if by calling @c cancel. - */ - ~basic_raw_socket() - { - } - - /// Send some data on a connected socket. - /** - * This function is used to send data on the raw socket. The function call - * will block until the data has been sent successfully or an error occurs. - * - * @param buffers One ore more data buffers to be sent on the socket. - * - * @returns The number of bytes sent. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The send operation can only be used with a connected socket. Use - * the send_to function to send data on an unconnected raw socket. - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code socket.send(boost::asio::buffer(data, size)); @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t send(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().send( - this->get_implementation(), buffers, 0, ec); - boost::asio::detail::throw_error(ec, "send"); - return s; - } - - /// Send some data on a connected socket. - /** - * This function is used to send data on the raw socket. The function call - * will block until the data has been sent successfully or an error occurs. - * - * @param buffers One ore more data buffers to be sent on the socket. - * - * @param flags Flags specifying how the send call is to be made. - * - * @returns The number of bytes sent. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The send operation can only be used with a connected socket. Use - * the send_to function to send data on an unconnected raw socket. - */ - template <typename ConstBufferSequence> - std::size_t send(const ConstBufferSequence& buffers, - socket_base::message_flags flags) - { - boost::system::error_code ec; - std::size_t s = this->get_service().send( - this->get_implementation(), buffers, flags, ec); - boost::asio::detail::throw_error(ec, "send"); - return s; - } - - /// Send some data on a connected socket. - /** - * This function is used to send data on the raw socket. The function call - * will block until the data has been sent successfully or an error occurs. - * - * @param buffers One or more data buffers to be sent on the socket. - * - * @param flags Flags specifying how the send call is to be made. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes sent. - * - * @note The send operation can only be used with a connected socket. Use - * the send_to function to send data on an unconnected raw socket. - */ - template <typename ConstBufferSequence> - std::size_t send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return this->get_service().send( - this->get_implementation(), buffers, flags, ec); - } - - /// Start an asynchronous send on a connected socket. - /** - * This function is used to send data on the raw socket. The function call - * will block until the data has been sent successfully or an error occurs. - * - * @param buffers One or more data buffers to be sent on the socket. Although - * the buffers object may be copied as necessary, ownership of the underlying - * memory blocks is retained by the caller, which must guarantee that they - * remain valid until the handler is called. - * - * @param handler The handler to be called when the send operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes sent. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The async_send operation can only be used with a connected socket. - * Use the async_send_to function to send data on an unconnected raw - * socket. - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code - * socket.async_send(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_send(this->get_implementation(), - buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_send(this->get_implementation(), - buffers, 0, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Start an asynchronous send on a connected socket. - /** - * This function is used to send data on the raw socket. The function call - * will block until the data has been sent successfully or an error occurs. - * - * @param buffers One or more data buffers to be sent on the socket. Although - * the buffers object may be copied as necessary, ownership of the underlying - * memory blocks is retained by the caller, which must guarantee that they - * remain valid until the handler is called. - * - * @param flags Flags specifying how the send call is to be made. - * - * @param handler The handler to be called when the send operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes sent. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The async_send operation can only be used with a connected socket. - * Use the async_send_to function to send data on an unconnected raw - * socket. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_send(this->get_implementation(), - buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_send(this->get_implementation(), - buffers, flags, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Send raw data to the specified endpoint. - /** - * This function is used to send raw data to the specified remote endpoint. - * The function call will block until the data has been sent successfully or - * an error occurs. - * - * @param buffers One or more data buffers to be sent to the remote endpoint. - * - * @param destination The remote endpoint to which the data will be sent. - * - * @returns The number of bytes sent. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code - * boost::asio::ip::udp::endpoint destination( - * boost::asio::ip::address::from_string("1.2.3.4"), 12345); - * socket.send_to(boost::asio::buffer(data, size), destination); - * @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t send_to(const ConstBufferSequence& buffers, - const endpoint_type& destination) - { - boost::system::error_code ec; - std::size_t s = this->get_service().send_to( - this->get_implementation(), buffers, destination, 0, ec); - boost::asio::detail::throw_error(ec, "send_to"); - return s; - } - - /// Send raw data to the specified endpoint. - /** - * This function is used to send raw data to the specified remote endpoint. - * The function call will block until the data has been sent successfully or - * an error occurs. - * - * @param buffers One or more data buffers to be sent to the remote endpoint. - * - * @param destination The remote endpoint to which the data will be sent. - * - * @param flags Flags specifying how the send call is to be made. - * - * @returns The number of bytes sent. - * - * @throws boost::system::system_error Thrown on failure. - */ - template <typename ConstBufferSequence> - std::size_t send_to(const ConstBufferSequence& buffers, - const endpoint_type& destination, socket_base::message_flags flags) - { - boost::system::error_code ec; - std::size_t s = this->get_service().send_to( - this->get_implementation(), buffers, destination, flags, ec); - boost::asio::detail::throw_error(ec, "send_to"); - return s; - } - - /// Send raw data to the specified endpoint. - /** - * This function is used to send raw data to the specified remote endpoint. - * The function call will block until the data has been sent successfully or - * an error occurs. - * - * @param buffers One or more data buffers to be sent to the remote endpoint. - * - * @param destination The remote endpoint to which the data will be sent. - * - * @param flags Flags specifying how the send call is to be made. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes sent. - */ - template <typename ConstBufferSequence> - std::size_t send_to(const ConstBufferSequence& buffers, - const endpoint_type& destination, socket_base::message_flags flags, - boost::system::error_code& ec) - { - return this->get_service().send_to(this->get_implementation(), - buffers, destination, flags, ec); - } - - /// Start an asynchronous send. - /** - * This function is used to asynchronously send raw data to the specified - * remote endpoint. The function call always returns immediately. - * - * @param buffers One or more data buffers to be sent to the remote endpoint. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param destination The remote endpoint to which the data will be sent. - * Copies will be made of the endpoint as required. - * - * @param handler The handler to be called when the send operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes sent. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code - * boost::asio::ip::udp::endpoint destination( - * boost::asio::ip::address::from_string("1.2.3.4"), 12345); - * socket.async_send_to( - * boost::asio::buffer(data, size), destination, handler); - * @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send_to(const ConstBufferSequence& buffers, - const endpoint_type& destination, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_send_to(this->get_implementation(), - buffers, destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_send_to(this->get_implementation(), - buffers, destination, 0, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Start an asynchronous send. - /** - * This function is used to asynchronously send raw data to the specified - * remote endpoint. The function call always returns immediately. - * - * @param buffers One or more data buffers to be sent to the remote endpoint. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param flags Flags specifying how the send call is to be made. - * - * @param destination The remote endpoint to which the data will be sent. - * Copies will be made of the endpoint as required. - * - * @param handler The handler to be called when the send operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes sent. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send_to(const ConstBufferSequence& buffers, - const endpoint_type& destination, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_send_to( - this->get_implementation(), buffers, destination, flags, - BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_send_to( - this->get_implementation(), buffers, destination, flags, - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Receive some data on a connected socket. - /** - * This function is used to receive data on the raw socket. The function - * call will block until data has been received successfully or an error - * occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @returns The number of bytes received. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The receive operation can only be used with a connected socket. Use - * the receive_from function to receive data on an unconnected raw - * socket. - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code socket.receive(boost::asio::buffer(data, size)); @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t receive(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().receive( - this->get_implementation(), buffers, 0, ec); - boost::asio::detail::throw_error(ec, "receive"); - return s; - } - - /// Receive some data on a connected socket. - /** - * This function is used to receive data on the raw socket. The function - * call will block until data has been received successfully or an error - * occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param flags Flags specifying how the receive call is to be made. - * - * @returns The number of bytes received. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The receive operation can only be used with a connected socket. Use - * the receive_from function to receive data on an unconnected raw - * socket. - */ - template <typename MutableBufferSequence> - std::size_t receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags) - { - boost::system::error_code ec; - std::size_t s = this->get_service().receive( - this->get_implementation(), buffers, flags, ec); - boost::asio::detail::throw_error(ec, "receive"); - return s; - } - - /// Receive some data on a connected socket. - /** - * This function is used to receive data on the raw socket. The function - * call will block until data has been received successfully or an error - * occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param flags Flags specifying how the receive call is to be made. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes received. - * - * @note The receive operation can only be used with a connected socket. Use - * the receive_from function to receive data on an unconnected raw - * socket. - */ - template <typename MutableBufferSequence> - std::size_t receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return this->get_service().receive( - this->get_implementation(), buffers, flags, ec); - } - - /// Start an asynchronous receive on a connected socket. - /** - * This function is used to asynchronously receive data from the raw - * socket. The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be received. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the receive operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes received. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The async_receive operation can only be used with a connected socket. - * Use the async_receive_from function to receive data on an unconnected - * raw socket. - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * socket.async_receive(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_receive(this->get_implementation(), - buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_receive(this->get_implementation(), - buffers, 0, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Start an asynchronous receive on a connected socket. - /** - * This function is used to asynchronously receive data from the raw - * socket. The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be received. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param flags Flags specifying how the receive call is to be made. - * - * @param handler The handler to be called when the receive operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes received. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The async_receive operation can only be used with a connected socket. - * Use the async_receive_from function to receive data on an unconnected - * raw socket. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_receive(this->get_implementation(), - buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_receive(this->get_implementation(), - buffers, flags, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Receive raw data with the endpoint of the sender. - /** - * This function is used to receive raw data. The function call will block - * until data has been received successfully or an error occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param sender_endpoint An endpoint object that receives the endpoint of - * the remote sender of the data. - * - * @returns The number of bytes received. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * boost::asio::ip::udp::endpoint sender_endpoint; - * socket.receive_from( - * boost::asio::buffer(data, size), sender_endpoint); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t receive_from(const MutableBufferSequence& buffers, - endpoint_type& sender_endpoint) - { - boost::system::error_code ec; - std::size_t s = this->get_service().receive_from( - this->get_implementation(), buffers, sender_endpoint, 0, ec); - boost::asio::detail::throw_error(ec, "receive_from"); - return s; - } - - /// Receive raw data with the endpoint of the sender. - /** - * This function is used to receive raw data. The function call will block - * until data has been received successfully or an error occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param sender_endpoint An endpoint object that receives the endpoint of - * the remote sender of the data. - * - * @param flags Flags specifying how the receive call is to be made. - * - * @returns The number of bytes received. - * - * @throws boost::system::system_error Thrown on failure. - */ - template <typename MutableBufferSequence> - std::size_t receive_from(const MutableBufferSequence& buffers, - endpoint_type& sender_endpoint, socket_base::message_flags flags) - { - boost::system::error_code ec; - std::size_t s = this->get_service().receive_from( - this->get_implementation(), buffers, sender_endpoint, flags, ec); - boost::asio::detail::throw_error(ec, "receive_from"); - return s; - } - - /// Receive raw data with the endpoint of the sender. - /** - * This function is used to receive raw data. The function call will block - * until data has been received successfully or an error occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param sender_endpoint An endpoint object that receives the endpoint of - * the remote sender of the data. - * - * @param flags Flags specifying how the receive call is to be made. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes received. - */ - template <typename MutableBufferSequence> - std::size_t receive_from(const MutableBufferSequence& buffers, - endpoint_type& sender_endpoint, socket_base::message_flags flags, - boost::system::error_code& ec) - { - return this->get_service().receive_from(this->get_implementation(), - buffers, sender_endpoint, flags, ec); - } - - /// Start an asynchronous receive. - /** - * This function is used to asynchronously receive raw data. The function - * call always returns immediately. - * - * @param buffers One or more buffers into which the data will be received. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param sender_endpoint An endpoint object that receives the endpoint of - * the remote sender of the data. Ownership of the sender_endpoint object - * is retained by the caller, which must guarantee that it is valid until the - * handler is called. - * - * @param handler The handler to be called when the receive operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes received. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code socket.async_receive_from( - * boost::asio::buffer(data, size), 0, sender_endpoint, handler); @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive_from(const MutableBufferSequence& buffers, - endpoint_type& sender_endpoint, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_receive_from( - this->get_implementation(), buffers, sender_endpoint, 0, - BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_receive_from( - this->get_implementation(), buffers, sender_endpoint, 0, - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Start an asynchronous receive. - /** - * This function is used to asynchronously receive raw data. The function - * call always returns immediately. - * - * @param buffers One or more buffers into which the data will be received. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param sender_endpoint An endpoint object that receives the endpoint of - * the remote sender of the data. Ownership of the sender_endpoint object - * is retained by the caller, which must guarantee that it is valid until the - * handler is called. - * - * @param flags Flags specifying how the receive call is to be made. - * - * @param handler The handler to be called when the receive operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes received. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive_from(const MutableBufferSequence& buffers, - endpoint_type& sender_endpoint, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_receive_from( - this->get_implementation(), buffers, sender_endpoint, flags, - BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_receive_from( - this->get_implementation(), buffers, sender_endpoint, flags, - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_BASIC_RAW_SOCKET_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_seq_packet_socket.hpp b/contrib/restricted/boost/boost/asio/basic_seq_packet_socket.hpp deleted file mode 100644 index cc98656df3..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_seq_packet_socket.hpp +++ /dev/null @@ -1,620 +0,0 @@ -// -// basic_seq_packet_socket.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP -#define BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/basic_socket.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/seq_packet_socket_service.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Provides sequenced packet socket functionality. -/** - * The basic_seq_packet_socket class template provides asynchronous and blocking - * sequenced packet socket functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <typename Protocol - BOOST_ASIO_SVC_TPARAM_DEF1(= seq_packet_socket_service<Protocol>)> -class basic_seq_packet_socket - : public basic_socket<Protocol BOOST_ASIO_SVC_TARG> -{ -public: - /// The native representation of a socket. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef typename basic_socket< - Protocol BOOST_ASIO_SVC_TARG>::native_handle_type native_handle_type; -#endif - - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename Protocol::endpoint endpoint_type; - - /// Construct a basic_seq_packet_socket without opening it. - /** - * This constructor creates a sequenced packet socket without opening it. The - * socket needs to be opened and then connected or accepted before data can - * be sent or received on it. - * - * @param io_context The io_context object that the sequenced packet socket - * will use to dispatch handlers for any asynchronous operations performed on - * the socket. - */ - explicit basic_seq_packet_socket(boost::asio::io_context& io_context) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(io_context) - { - } - - /// Construct and open a basic_seq_packet_socket. - /** - * This constructor creates and opens a sequenced_packet socket. The socket - * needs to be connected or accepted before data can be sent or received on - * it. - * - * @param io_context The io_context object that the sequenced packet socket - * will use to dispatch handlers for any asynchronous operations performed on - * the socket. - * - * @param protocol An object specifying protocol parameters to be used. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_seq_packet_socket(boost::asio::io_context& io_context, - const protocol_type& protocol) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(io_context, protocol) - { - } - - /// Construct a basic_seq_packet_socket, opening it and binding it to the - /// given local endpoint. - /** - * This constructor creates a sequenced packet socket and automatically opens - * it bound to the specified endpoint on the local machine. The protocol used - * is the protocol associated with the given endpoint. - * - * @param io_context The io_context object that the sequenced packet socket - * will use to dispatch handlers for any asynchronous operations performed on - * the socket. - * - * @param endpoint An endpoint on the local machine to which the sequenced - * packet socket will be bound. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_seq_packet_socket(boost::asio::io_context& io_context, - const endpoint_type& endpoint) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(io_context, endpoint) - { - } - - /// Construct a basic_seq_packet_socket on an existing native socket. - /** - * This constructor creates a sequenced packet socket object to hold an - * existing native socket. - * - * @param io_context The io_context object that the sequenced packet socket - * will use to dispatch handlers for any asynchronous operations performed on - * the socket. - * - * @param protocol An object specifying protocol parameters to be used. - * - * @param native_socket The new underlying socket implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_seq_packet_socket(boost::asio::io_context& io_context, - const protocol_type& protocol, const native_handle_type& native_socket) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>( - io_context, protocol, native_socket) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_seq_packet_socket from another. - /** - * This constructor moves a sequenced packet socket from one object to - * another. - * - * @param other The other basic_seq_packet_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_seq_packet_socket(io_context&) constructor. - */ - basic_seq_packet_socket(basic_seq_packet_socket&& other) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(std::move(other)) - { - } - - /// Move-assign a basic_seq_packet_socket from another. - /** - * This assignment operator moves a sequenced packet socket from one object to - * another. - * - * @param other The other basic_seq_packet_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_seq_packet_socket(io_context&) constructor. - */ - basic_seq_packet_socket& operator=(basic_seq_packet_socket&& other) - { - basic_socket<Protocol BOOST_ASIO_SVC_TARG>::operator=(std::move(other)); - return *this; - } - - /// Move-construct a basic_seq_packet_socket from a socket of another protocol - /// type. - /** - * This constructor moves a sequenced packet socket from one object to - * another. - * - * @param other The other basic_seq_packet_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_seq_packet_socket(io_context&) constructor. - */ - template <typename Protocol1 BOOST_ASIO_SVC_TPARAM1> - basic_seq_packet_socket( - basic_seq_packet_socket<Protocol1 BOOST_ASIO_SVC_TARG1>&& other, - typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(std::move(other)) - { - } - - /// Move-assign a basic_seq_packet_socket from a socket of another protocol - /// type. - /** - * This assignment operator moves a sequenced packet socket from one object to - * another. - * - * @param other The other basic_seq_packet_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_seq_packet_socket(io_context&) constructor. - */ - template <typename Protocol1 BOOST_ASIO_SVC_TPARAM1> - typename enable_if<is_convertible<Protocol1, Protocol>::value, - basic_seq_packet_socket>::type& operator=( - basic_seq_packet_socket<Protocol1 BOOST_ASIO_SVC_TARG1>&& other) - { - basic_socket<Protocol BOOST_ASIO_SVC_TARG>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroys the socket. - /** - * This function destroys the socket, cancelling any outstanding asynchronous - * operations associated with the socket as if by calling @c cancel. - */ - ~basic_seq_packet_socket() - { - } - - /// Send some data on the socket. - /** - * This function is used to send data on the sequenced packet socket. The - * function call will block until the data has been sent successfully, or an - * until error occurs. - * - * @param buffers One or more data buffers to be sent on the socket. - * - * @param flags Flags specifying how the send call is to be made. - * - * @returns The number of bytes sent. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code - * socket.send(boost::asio::buffer(data, size), 0); - * @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t send(const ConstBufferSequence& buffers, - socket_base::message_flags flags) - { - boost::system::error_code ec; - std::size_t s = this->get_service().send( - this->get_implementation(), buffers, flags, ec); - boost::asio::detail::throw_error(ec, "send"); - return s; - } - - /// Send some data on the socket. - /** - * This function is used to send data on the sequenced packet socket. The - * function call will block the data has been sent successfully, or an until - * error occurs. - * - * @param buffers One or more data buffers to be sent on the socket. - * - * @param flags Flags specifying how the send call is to be made. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes sent. Returns 0 if an error occurred. - * - * @note The send operation may not transmit all of the data to the peer. - * Consider using the @ref write function if you need to ensure that all data - * is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return this->get_service().send( - this->get_implementation(), buffers, flags, ec); - } - - /// Start an asynchronous send. - /** - * This function is used to asynchronously send data on the sequenced packet - * socket. The function call always returns immediately. - * - * @param buffers One or more data buffers to be sent on the socket. Although - * the buffers object may be copied as necessary, ownership of the underlying - * memory blocks is retained by the caller, which must guarantee that they - * remain valid until the handler is called. - * - * @param flags Flags specifying how the send call is to be made. - * - * @param handler The handler to be called when the send operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes sent. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code - * socket.async_send(boost::asio::buffer(data, size), 0, handler); - * @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_send(this->get_implementation(), - buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_send(this->get_implementation(), - buffers, flags, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Receive some data on the socket. - /** - * This function is used to receive data on the sequenced packet socket. The - * function call will block until data has been received successfully, or - * until an error occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param out_flags After the receive call completes, contains flags - * associated with the received data. For example, if the - * socket_base::message_end_of_record bit is set then the received data marks - * the end of a record. - * - * @returns The number of bytes received. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * socket.receive(boost::asio::buffer(data, size), out_flags); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t receive(const MutableBufferSequence& buffers, - socket_base::message_flags& out_flags) - { - boost::system::error_code ec; -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - std::size_t s = this->get_service().receive( - this->get_implementation(), buffers, 0, out_flags, ec); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - std::size_t s = this->get_service().receive_with_flags( - this->get_implementation(), buffers, 0, out_flags, ec); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - boost::asio::detail::throw_error(ec, "receive"); - return s; - } - - /// Receive some data on the socket. - /** - * This function is used to receive data on the sequenced packet socket. The - * function call will block until data has been received successfully, or - * until an error occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param in_flags Flags specifying how the receive call is to be made. - * - * @param out_flags After the receive call completes, contains flags - * associated with the received data. For example, if the - * socket_base::message_end_of_record bit is set then the received data marks - * the end of a record. - * - * @returns The number of bytes received. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The receive operation may not receive all of the requested number of - * 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. - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * socket.receive(boost::asio::buffer(data, size), 0, out_flags); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t receive(const MutableBufferSequence& buffers, - socket_base::message_flags in_flags, - socket_base::message_flags& out_flags) - { - boost::system::error_code ec; -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - std::size_t s = this->get_service().receive( - this->get_implementation(), buffers, in_flags, out_flags, ec); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - std::size_t s = this->get_service().receive_with_flags( - this->get_implementation(), buffers, in_flags, out_flags, ec); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - boost::asio::detail::throw_error(ec, "receive"); - return s; - } - - /// Receive some data on a connected socket. - /** - * This function is used to receive data on the sequenced packet socket. The - * function call will block until data has been received successfully, or - * until an error occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param in_flags Flags specifying how the receive call is to be made. - * - * @param out_flags After the receive call completes, contains flags - * associated with the received data. For example, if the - * socket_base::message_end_of_record bit is set then the received data marks - * the end of a record. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes received. Returns 0 if an error occurred. - * - * @note The receive operation may not receive all of the requested number of - * 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 MutableBufferSequence> - std::size_t receive(const MutableBufferSequence& buffers, - socket_base::message_flags in_flags, - socket_base::message_flags& out_flags, boost::system::error_code& ec) - { -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().receive(this->get_implementation(), - buffers, in_flags, out_flags, ec); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().receive_with_flags(this->get_implementation(), - buffers, in_flags, out_flags, ec); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Start an asynchronous receive. - /** - * This function is used to asynchronously receive data from the sequenced - * packet socket. The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be received. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param out_flags Once the asynchronous operation completes, contains flags - * associated with the received data. For example, if the - * socket_base::message_end_of_record bit is set then the received data marks - * the end of a record. The caller must guarantee that the referenced - * variable remains valid until the handler is called. - * - * @param handler The handler to be called when the receive operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes received. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * socket.async_receive(boost::asio::buffer(data, size), out_flags, handler); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags& out_flags, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_receive( - this->get_implementation(), buffers, 0, out_flags, - BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_receive_with_flags( - this->get_implementation(), buffers, 0, out_flags, - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Start an asynchronous receive. - /** - * This function is used to asynchronously receive data from the sequenced - * data socket. The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be received. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param in_flags Flags specifying how the receive call is to be made. - * - * @param out_flags Once the asynchronous operation completes, contains flags - * associated with the received data. For example, if the - * socket_base::message_end_of_record bit is set then the received data marks - * the end of a record. The caller must guarantee that the referenced - * variable remains valid until the handler is called. - * - * @param handler The handler to be called when the receive operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes received. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * socket.async_receive( - * boost::asio::buffer(data, size), - * 0, out_flags, handler); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags in_flags, - socket_base::message_flags& out_flags, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_receive( - this->get_implementation(), buffers, in_flags, out_flags, - BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_receive_with_flags( - this->get_implementation(), buffers, in_flags, out_flags, - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_serial_port.hpp b/contrib/restricted/boost/boost/asio/basic_serial_port.hpp deleted file mode 100644 index 2f6c8cf887..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_serial_port.hpp +++ /dev/null @@ -1,690 +0,0 @@ -// -// basic_serial_port.hpp -// ~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_SERIAL_PORT_HPP -#define BOOST_ASIO_BASIC_SERIAL_PORT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_SERIAL_PORT) \ - || defined(GENERATING_DOCUMENTATION) - -#include <string> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/serial_port_base.hpp> -#include <boost/asio/serial_port_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Provides serial port functionality. -/** - * The basic_serial_port class template provides functionality that is common - * to all serial ports. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <typename SerialPortService = serial_port_service> -class basic_serial_port - : public basic_io_object<SerialPortService>, - public serial_port_base -{ -public: - /// The native representation of a serial port. - typedef typename SerialPortService::native_handle_type native_handle_type; - - /// A basic_serial_port is always the lowest layer. - typedef basic_serial_port<SerialPortService> lowest_layer_type; - - /// Construct a basic_serial_port without opening it. - /** - * This constructor creates a serial port without opening it. - * - * @param io_context The io_context object that the serial port will use to - * dispatch handlers for any asynchronous operations performed on the port. - */ - explicit basic_serial_port(boost::asio::io_context& io_context) - : basic_io_object<SerialPortService>(io_context) - { - } - - /// Construct and open a basic_serial_port. - /** - * This constructor creates and opens a serial port for the specified device - * name. - * - * @param io_context The io_context object that the serial port will use to - * dispatch handlers for any asynchronous operations performed on the port. - * - * @param device The platform-specific device name for this serial - * port. - */ - explicit basic_serial_port(boost::asio::io_context& io_context, - const char* device) - : basic_io_object<SerialPortService>(io_context) - { - boost::system::error_code ec; - this->get_service().open(this->get_implementation(), device, ec); - boost::asio::detail::throw_error(ec, "open"); - } - - /// Construct and open a basic_serial_port. - /** - * This constructor creates and opens a serial port for the specified device - * name. - * - * @param io_context The io_context object that the serial port will use to - * dispatch handlers for any asynchronous operations performed on the port. - * - * @param device The platform-specific device name for this serial - * port. - */ - explicit basic_serial_port(boost::asio::io_context& io_context, - const std::string& device) - : basic_io_object<SerialPortService>(io_context) - { - boost::system::error_code ec; - this->get_service().open(this->get_implementation(), device, ec); - boost::asio::detail::throw_error(ec, "open"); - } - - /// Construct a basic_serial_port on an existing native serial port. - /** - * This constructor creates a serial port object to hold an existing native - * serial port. - * - * @param io_context The io_context object that the serial port will use to - * dispatch handlers for any asynchronous operations performed on the port. - * - * @param native_serial_port A native serial port. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_serial_port(boost::asio::io_context& io_context, - const native_handle_type& native_serial_port) - : basic_io_object<SerialPortService>(io_context) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - native_serial_port, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_serial_port from another. - /** - * This constructor moves a serial port from one object to another. - * - * @param other The other basic_serial_port object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_serial_port(io_context&) constructor. - */ - basic_serial_port(basic_serial_port&& other) - : basic_io_object<SerialPortService>( - BOOST_ASIO_MOVE_CAST(basic_serial_port)(other)) - { - } - - /// Move-assign a basic_serial_port from another. - /** - * This assignment operator moves a serial port from one object to another. - * - * @param other The other basic_serial_port object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_serial_port(io_context&) constructor. - */ - basic_serial_port& operator=(basic_serial_port&& other) - { - basic_io_object<SerialPortService>::operator=( - BOOST_ASIO_MOVE_CAST(basic_serial_port)(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Get a reference to the lowest layer. - /** - * This function returns a reference to the lowest layer in a stack of - * layers. Since a basic_serial_port cannot contain any further layers, it - * simply returns a reference to itself. - * - * @return A reference to the lowest layer in the stack of layers. Ownership - * is not transferred to the caller. - */ - lowest_layer_type& lowest_layer() - { - return *this; - } - - /// Get a const reference to the lowest layer. - /** - * This function returns a const reference to the lowest layer in a stack of - * layers. Since a basic_serial_port cannot contain any further layers, it - * simply returns a reference to itself. - * - * @return A const reference to the lowest layer in the stack of layers. - * Ownership is not transferred to the caller. - */ - const lowest_layer_type& lowest_layer() const - { - return *this; - } - - /// Open the serial port using the specified device name. - /** - * This function opens the serial port for the specified device name. - * - * @param device The platform-specific device name. - * - * @throws boost::system::system_error Thrown on failure. - */ - void open(const std::string& device) - { - boost::system::error_code ec; - this->get_service().open(this->get_implementation(), device, ec); - boost::asio::detail::throw_error(ec, "open"); - } - - /// Open the serial port using the specified device name. - /** - * This function opens the serial port using the given platform-specific - * device name. - * - * @param device The platform-specific device name. - * - * @param ec Set the indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID open(const std::string& device, - boost::system::error_code& ec) - { - this->get_service().open(this->get_implementation(), device, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Assign an existing native serial port to the serial port. - /* - * This function opens the serial port to hold an existing native serial port. - * - * @param native_serial_port A native serial port. - * - * @throws boost::system::system_error Thrown on failure. - */ - void assign(const native_handle_type& native_serial_port) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - native_serial_port, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - - /// Assign an existing native serial port to the serial port. - /* - * This function opens the serial port to hold an existing native serial port. - * - * @param native_serial_port A native serial port. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID assign(const native_handle_type& native_serial_port, - boost::system::error_code& ec) - { - this->get_service().assign(this->get_implementation(), - native_serial_port, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the serial port is open. - bool is_open() const - { - return this->get_service().is_open(this->get_implementation()); - } - - /// Close the serial port. - /** - * This function is used to close the serial port. Any asynchronous read or - * write operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void close() - { - boost::system::error_code ec; - this->get_service().close(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "close"); - } - - /// Close the serial port. - /** - * This function is used to close the serial port. Any asynchronous read or - * write operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - this->get_service().close(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native serial port representation. - /** - * This function may be used to obtain the underlying representation of the - * serial port. This is intended to allow access to native serial port - * functionality that is not otherwise provided. - */ - native_handle_type native_handle() - { - return this->get_service().native_handle(this->get_implementation()); - } - - /// Cancel all asynchronous operations associated with the serial port. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all asynchronous operations associated with the serial port. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Send a break sequence to the serial port. - /** - * This function causes a break sequence of platform-specific duration to be - * sent out the serial port. - * - * @throws boost::system::system_error Thrown on failure. - */ - void send_break() - { - boost::system::error_code ec; - this->get_service().send_break(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "send_break"); - } - - /// Send a break sequence to the serial port. - /** - * This function causes a break sequence of platform-specific duration to be - * sent out the serial port. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID send_break(boost::system::error_code& ec) - { - this->get_service().send_break(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Set an option on the serial port. - /** - * This function is used to set an option on the serial port. - * - * @param option The option value to be set on the serial port. - * - * @throws boost::system::system_error Thrown on failure. - * - * @sa SettableSerialPortOption @n - * boost::asio::serial_port_base::baud_rate @n - * boost::asio::serial_port_base::flow_control @n - * boost::asio::serial_port_base::parity @n - * boost::asio::serial_port_base::stop_bits @n - * boost::asio::serial_port_base::character_size - */ - template <typename SettableSerialPortOption> - void set_option(const SettableSerialPortOption& option) - { - boost::system::error_code ec; - this->get_service().set_option(this->get_implementation(), option, ec); - boost::asio::detail::throw_error(ec, "set_option"); - } - - /// Set an option on the serial port. - /** - * This function is used to set an option on the serial port. - * - * @param option The option value to be set on the serial port. - * - * @param ec Set to indicate what error occurred, if any. - * - * @sa SettableSerialPortOption @n - * boost::asio::serial_port_base::baud_rate @n - * boost::asio::serial_port_base::flow_control @n - * boost::asio::serial_port_base::parity @n - * boost::asio::serial_port_base::stop_bits @n - * boost::asio::serial_port_base::character_size - */ - template <typename SettableSerialPortOption> - BOOST_ASIO_SYNC_OP_VOID set_option(const SettableSerialPortOption& option, - boost::system::error_code& ec) - { - this->get_service().set_option(this->get_implementation(), option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get an option from the serial port. - /** - * This function is used to get the current value of an option on the serial - * port. - * - * @param option The option value to be obtained from the serial port. - * - * @throws boost::system::system_error Thrown on failure. - * - * @sa GettableSerialPortOption @n - * boost::asio::serial_port_base::baud_rate @n - * boost::asio::serial_port_base::flow_control @n - * boost::asio::serial_port_base::parity @n - * boost::asio::serial_port_base::stop_bits @n - * boost::asio::serial_port_base::character_size - */ - template <typename GettableSerialPortOption> - void get_option(GettableSerialPortOption& option) - { - boost::system::error_code ec; - this->get_service().get_option(this->get_implementation(), option, ec); - boost::asio::detail::throw_error(ec, "get_option"); - } - - /// Get an option from the serial port. - /** - * This function is used to get the current value of an option on the serial - * port. - * - * @param option The option value to be obtained from the serial port. - * - * @param ec Set to indicate what error occurred, if any. - * - * @sa GettableSerialPortOption @n - * boost::asio::serial_port_base::baud_rate @n - * boost::asio::serial_port_base::flow_control @n - * boost::asio::serial_port_base::parity @n - * boost::asio::serial_port_base::stop_bits @n - * boost::asio::serial_port_base::character_size - */ - template <typename GettableSerialPortOption> - BOOST_ASIO_SYNC_OP_VOID get_option(GettableSerialPortOption& option, - boost::system::error_code& ec) - { - this->get_service().get_option(this->get_implementation(), option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Write some data to the serial port. - /** - * This function is used to write data to the serial port. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the serial port. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * serial_port.write_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().write_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "write_some"); - return s; - } - - /// Write some data to the serial port. - /** - * This function is used to write data to the serial port. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the serial port. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().write_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous write. - /** - * This function is used to asynchronously write data to the serial port. - * The function call always returns immediately. - * - * @param buffers One or more data buffers to be written to the serial port. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The write operation may not transmit all of the data to the peer. - * Consider using the @ref async_write function if you need to ensure that all - * data is written before the asynchronous operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * serial_port.async_write_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - return this->get_service().async_write_some(this->get_implementation(), - buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); - } - - /// Read some data from the serial port. - /** - * This function is used to read data from the serial port. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The read_some operation may not read all of the requested number of - * 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. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * serial_port.read_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().read_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "read_some"); - return s; - } - - /// Read some data from the serial port. - /** - * This function is used to read data from the serial port. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().read_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous read. - /** - * This function is used to asynchronously read data from the serial port. - * The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The read operation may not read all of the requested number of bytes. - * Consider using the @ref async_read function if you need to ensure that the - * requested amount of data is read before the asynchronous operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * serial_port.async_read_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - return this->get_service().async_read_some(this->get_implementation(), - buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); - } -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_BASIC_SERIAL_PORT_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_signal_set.hpp b/contrib/restricted/boost/boost/asio/basic_signal_set.hpp deleted file mode 100644 index 8ca5dfa1d9..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_signal_set.hpp +++ /dev/null @@ -1,393 +0,0 @@ -// -// basic_signal_set.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_SIGNAL_SET_HPP -#define BOOST_ASIO_BASIC_SIGNAL_SET_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/signal_set_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Provides signal functionality. -/** - * The basic_signal_set class template provides the ability to perform an - * asynchronous wait for one or more signals to occur. - * - * Most applications will use the boost::asio::signal_set typedef. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Example - * Performing an asynchronous wait: - * @code - * void handler( - * const boost::system::error_code& error, - * int signal_number) - * { - * if (!error) - * { - * // A signal occurred. - * } - * } - * - * ... - * - * // Construct a signal set registered for process termination. - * boost::asio::signal_set signals(io_context, SIGINT, SIGTERM); - * - * // Start an asynchronous wait for one of the signals to occur. - * signals.async_wait(handler); - * @endcode - * - * @par Queueing of signal notifications - * - * If a signal is registered with a signal_set, and the signal occurs when - * there are no waiting handlers, then the signal notification is queued. The - * next async_wait operation on that signal_set will dequeue the notification. - * If multiple notifications are queued, subsequent async_wait operations - * dequeue them one at a time. Signal notifications are dequeued in order of - * ascending signal number. - * - * If a signal number is removed from a signal_set (using the @c remove or @c - * erase member functions) then any queued notifications for that signal are - * discarded. - * - * @par Multiple registration of signals - * - * The same signal number may be registered with different signal_set objects. - * When the signal occurs, one handler is called for each signal_set object. - * - * Note that multiple registration only works for signals that are registered - * using Asio. The application must not also register a signal handler using - * functions such as @c signal() or @c sigaction(). - * - * @par Signal masking on POSIX platforms - * - * POSIX allows signals to be blocked using functions such as @c sigprocmask() - * and @c pthread_sigmask(). For signals to be delivered, programs must ensure - * that any signals registered using signal_set objects are unblocked in at - * least one thread. - */ -template <typename SignalSetService = signal_set_service> -class basic_signal_set - : public basic_io_object<SignalSetService> -{ -public: - /// Construct a signal set without adding any signals. - /** - * This constructor creates a signal set without registering for any signals. - * - * @param io_context The io_context object that the signal set will use to - * dispatch handlers for any asynchronous operations performed on the set. - */ - explicit basic_signal_set(boost::asio::io_context& io_context) - : basic_io_object<SignalSetService>(io_context) - { - } - - /// Construct a signal set and add one signal. - /** - * This constructor creates a signal set and registers for one signal. - * - * @param io_context The io_context object that the signal set will use to - * dispatch handlers for any asynchronous operations performed on the set. - * - * @param signal_number_1 The signal number to be added. - * - * @note This constructor is equivalent to performing: - * @code boost::asio::signal_set signals(io_context); - * signals.add(signal_number_1); @endcode - */ - basic_signal_set(boost::asio::io_context& io_context, int signal_number_1) - : basic_io_object<SignalSetService>(io_context) - { - boost::system::error_code ec; - this->get_service().add(this->get_implementation(), signal_number_1, ec); - boost::asio::detail::throw_error(ec, "add"); - } - - /// Construct a signal set and add two signals. - /** - * This constructor creates a signal set and registers for two signals. - * - * @param io_context The io_context object that the signal set will use to - * dispatch handlers for any asynchronous operations performed on the set. - * - * @param signal_number_1 The first signal number to be added. - * - * @param signal_number_2 The second signal number to be added. - * - * @note This constructor is equivalent to performing: - * @code boost::asio::signal_set signals(io_context); - * signals.add(signal_number_1); - * signals.add(signal_number_2); @endcode - */ - basic_signal_set(boost::asio::io_context& io_context, int signal_number_1, - int signal_number_2) - : basic_io_object<SignalSetService>(io_context) - { - boost::system::error_code ec; - this->get_service().add(this->get_implementation(), signal_number_1, ec); - boost::asio::detail::throw_error(ec, "add"); - this->get_service().add(this->get_implementation(), signal_number_2, ec); - boost::asio::detail::throw_error(ec, "add"); - } - - /// Construct a signal set and add three signals. - /** - * This constructor creates a signal set and registers for three signals. - * - * @param io_context The io_context object that the signal set will use to - * dispatch handlers for any asynchronous operations performed on the set. - * - * @param signal_number_1 The first signal number to be added. - * - * @param signal_number_2 The second signal number to be added. - * - * @param signal_number_3 The third signal number to be added. - * - * @note This constructor is equivalent to performing: - * @code boost::asio::signal_set signals(io_context); - * signals.add(signal_number_1); - * signals.add(signal_number_2); - * signals.add(signal_number_3); @endcode - */ - basic_signal_set(boost::asio::io_context& io_context, int signal_number_1, - int signal_number_2, int signal_number_3) - : basic_io_object<SignalSetService>(io_context) - { - boost::system::error_code ec; - this->get_service().add(this->get_implementation(), signal_number_1, ec); - boost::asio::detail::throw_error(ec, "add"); - this->get_service().add(this->get_implementation(), signal_number_2, ec); - boost::asio::detail::throw_error(ec, "add"); - this->get_service().add(this->get_implementation(), signal_number_3, ec); - boost::asio::detail::throw_error(ec, "add"); - } - - /// Add a signal to a signal_set. - /** - * This function adds the specified signal to the set. It has no effect if the - * signal is already in the set. - * - * @param signal_number The signal to be added to the set. - * - * @throws boost::system::system_error Thrown on failure. - */ - void add(int signal_number) - { - boost::system::error_code ec; - this->get_service().add(this->get_implementation(), signal_number, ec); - boost::asio::detail::throw_error(ec, "add"); - } - - /// Add a signal to a signal_set. - /** - * This function adds the specified signal to the set. It has no effect if the - * signal is already in the set. - * - * @param signal_number The signal to be added to the set. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID add(int signal_number, boost::system::error_code& ec) - { - this->get_service().add(this->get_implementation(), signal_number, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Remove a signal from a signal_set. - /** - * This function removes the specified signal from the set. It has no effect - * if the signal is not in the set. - * - * @param signal_number The signal to be removed from the set. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Removes any notifications that have been queued for the specified - * signal number. - */ - void remove(int signal_number) - { - boost::system::error_code ec; - this->get_service().remove(this->get_implementation(), signal_number, ec); - boost::asio::detail::throw_error(ec, "remove"); - } - - /// Remove a signal from a signal_set. - /** - * This function removes the specified signal from the set. It has no effect - * if the signal is not in the set. - * - * @param signal_number The signal to be removed from the set. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Removes any notifications that have been queued for the specified - * signal number. - */ - BOOST_ASIO_SYNC_OP_VOID remove(int signal_number, - boost::system::error_code& ec) - { - this->get_service().remove(this->get_implementation(), signal_number, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Remove all signals from a signal_set. - /** - * This function removes all signals from the set. It has no effect if the set - * is already empty. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Removes all queued notifications. - */ - void clear() - { - boost::system::error_code ec; - this->get_service().clear(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "clear"); - } - - /// Remove all signals from a signal_set. - /** - * This function removes all signals from the set. It has no effect if the set - * is already empty. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Removes all queued notifications. - */ - BOOST_ASIO_SYNC_OP_VOID clear(boost::system::error_code& ec) - { - this->get_service().clear(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Cancel all operations associated with the signal set. - /** - * This function forces the completion of any pending asynchronous wait - * operations against the signal set. The handler for each cancelled - * operation will be invoked with the boost::asio::error::operation_aborted - * error code. - * - * Cancellation does not alter the set of registered signals. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If a registered signal occurred before cancel() is called, then the - * handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all operations associated with the signal set. - /** - * This function forces the completion of any pending asynchronous wait - * operations against the signal set. The handler for each cancelled - * operation will be invoked with the boost::asio::error::operation_aborted - * error code. - * - * Cancellation does not alter the set of registered signals. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note If a registered signal occurred before cancel() is called, then the - * handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Start an asynchronous operation to wait for a signal to be delivered. - /** - * This function may be used to initiate an asynchronous wait against the - * signal set. It always returns immediately. - * - * For each call to async_wait(), the supplied handler will be called exactly - * once. The handler will be called when: - * - * @li One of the registered signals in the signal set occurs; or - * - * @li The signal set was cancelled, in which case the handler is passed the - * error code boost::asio::error::operation_aborted. - * - * @param handler The handler to be called when the signal occurs. Copies - * will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * int signal_number // Indicates which signal occurred. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ - template <typename SignalHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(SignalHandler, - void (boost::system::error_code, int)) - async_wait(BOOST_ASIO_MOVE_ARG(SignalHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a SignalHandler. - BOOST_ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check; - - return this->get_service().async_wait(this->get_implementation(), - BOOST_ASIO_MOVE_CAST(SignalHandler)(handler)); - } -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_BASIC_SIGNAL_SET_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_socket_acceptor.hpp b/contrib/restricted/boost/boost/asio/basic_socket_acceptor.hpp deleted file mode 100644 index 8afdfd3009..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_socket_acceptor.hpp +++ /dev/null @@ -1,1988 +0,0 @@ -// -// basic_socket_acceptor.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_SOCKET_ACCEPTOR_HPP -#define BOOST_ASIO_BASIC_SOCKET_ACCEPTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/basic_socket.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/socket_base.hpp> - -#if defined(BOOST_ASIO_HAS_MOVE) -# include <utility> -#endif // defined(BOOST_ASIO_HAS_MOVE) - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/socket_acceptor_service.hpp> -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# if defined(BOOST_ASIO_WINDOWS_RUNTIME) -# include <boost/asio/detail/null_socket_service.hpp> -# define BOOST_ASIO_SVC_T detail::null_socket_service<Protocol> -# elif defined(BOOST_ASIO_HAS_IOCP) -# include <boost/asio/detail/win_iocp_socket_service.hpp> -# define BOOST_ASIO_SVC_T detail::win_iocp_socket_service<Protocol> -# else -# include <boost/asio/detail/reactive_socket_service.hpp> -# define BOOST_ASIO_SVC_T detail::reactive_socket_service<Protocol> -# endif -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Provides the ability to accept new connections. -/** - * The basic_socket_acceptor class template is used for accepting new socket - * connections. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Example - * Opening a socket acceptor with the SO_REUSEADDR option enabled: - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port); - * acceptor.open(endpoint.protocol()); - * acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); - * acceptor.bind(endpoint); - * acceptor.listen(); - * @endcode - */ -template <typename Protocol - BOOST_ASIO_SVC_TPARAM_DEF1(= socket_acceptor_service<Protocol>)> -class basic_socket_acceptor - : BOOST_ASIO_SVC_ACCESS basic_io_object<BOOST_ASIO_SVC_T>, - public socket_base -{ -public: - /// The type of the executor associated with the object. - typedef io_context::executor_type executor_type; - - /// The native representation of an acceptor. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef typename BOOST_ASIO_SVC_T::native_handle_type native_handle_type; -#endif - - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename Protocol::endpoint endpoint_type; - - /// Construct an acceptor without opening it. - /** - * This constructor creates an acceptor without opening it to listen for new - * connections. The open() function must be called before the acceptor can - * accept new socket connections. - * - * @param io_context The io_context object that the acceptor will use to - * dispatch handlers for any asynchronous operations performed on the - * acceptor. - */ - explicit basic_socket_acceptor(boost::asio::io_context& io_context) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - } - - /// Construct an open acceptor. - /** - * This constructor creates an acceptor and automatically opens it. - * - * @param io_context The io_context object that the acceptor will use to - * dispatch handlers for any asynchronous operations performed on the - * acceptor. - * - * @param protocol An object specifying protocol parameters to be used. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_socket_acceptor(boost::asio::io_context& io_context, - const protocol_type& protocol) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().open(this->get_implementation(), protocol, ec); - boost::asio::detail::throw_error(ec, "open"); - } - - /// Construct an acceptor opened on the given endpoint. - /** - * This constructor creates an acceptor and automatically opens it to listen - * for new connections on the specified endpoint. - * - * @param io_context The io_context object that the acceptor will use to - * dispatch handlers for any asynchronous operations performed on the - * acceptor. - * - * @param endpoint An endpoint on the local machine on which the acceptor - * will listen for new connections. - * - * @param reuse_addr Whether the constructor should set the socket option - * socket_base::reuse_address. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note This constructor is equivalent to the following code: - * @code - * basic_socket_acceptor<Protocol> acceptor(io_context); - * acceptor.open(endpoint.protocol()); - * if (reuse_addr) - * acceptor.set_option(socket_base::reuse_address(true)); - * acceptor.bind(endpoint); - * acceptor.listen(listen_backlog); - * @endcode - */ - basic_socket_acceptor(boost::asio::io_context& io_context, - const endpoint_type& endpoint, bool reuse_addr = true) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - const protocol_type protocol = endpoint.protocol(); - this->get_service().open(this->get_implementation(), protocol, ec); - boost::asio::detail::throw_error(ec, "open"); - if (reuse_addr) - { - this->get_service().set_option(this->get_implementation(), - socket_base::reuse_address(true), ec); - boost::asio::detail::throw_error(ec, "set_option"); - } - this->get_service().bind(this->get_implementation(), endpoint, ec); - boost::asio::detail::throw_error(ec, "bind"); - this->get_service().listen(this->get_implementation(), - socket_base::max_listen_connections, ec); - boost::asio::detail::throw_error(ec, "listen"); - } - - /// Construct a basic_socket_acceptor on an existing native acceptor. - /** - * This constructor creates an acceptor object to hold an existing native - * acceptor. - * - * @param io_context The io_context object that the acceptor will use to - * dispatch handlers for any asynchronous operations performed on the - * acceptor. - * - * @param protocol An object specifying protocol parameters to be used. - * - * @param native_acceptor A native acceptor. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_socket_acceptor(boost::asio::io_context& io_context, - const protocol_type& protocol, const native_handle_type& native_acceptor) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - protocol, native_acceptor, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_socket_acceptor from another. - /** - * This constructor moves an acceptor from one object to another. - * - * @param other The other basic_socket_acceptor object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket_acceptor(io_context&) constructor. - */ - basic_socket_acceptor(basic_socket_acceptor&& other) - : basic_io_object<BOOST_ASIO_SVC_T>(std::move(other)) - { - } - - /// Move-assign a basic_socket_acceptor from another. - /** - * This assignment operator moves an acceptor from one object to another. - * - * @param other The other basic_socket_acceptor object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket_acceptor(io_context&) constructor. - */ - basic_socket_acceptor& operator=(basic_socket_acceptor&& other) - { - basic_io_object<BOOST_ASIO_SVC_T>::operator=(std::move(other)); - return *this; - } - - // All socket acceptors have access to each other's implementations. - template <typename Protocol1 BOOST_ASIO_SVC_TPARAM1> - friend class basic_socket_acceptor; - - /// Move-construct a basic_socket_acceptor from an acceptor of another - /// protocol type. - /** - * This constructor moves an acceptor from one object to another. - * - * @param other The other basic_socket_acceptor object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket(io_context&) constructor. - */ - template <typename Protocol1 BOOST_ASIO_SVC_TPARAM1> - basic_socket_acceptor( - basic_socket_acceptor<Protocol1 BOOST_ASIO_SVC_TARG1>&& other, - typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0) - : basic_io_object<BOOST_ASIO_SVC_T>( - other.get_service(), other.get_implementation()) - { - } - - /// Move-assign a basic_socket_acceptor from an acceptor of another protocol - /// type. - /** - * This assignment operator moves an acceptor from one object to another. - * - * @param other The other basic_socket_acceptor object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_socket(io_context&) constructor. - */ - template <typename Protocol1 BOOST_ASIO_SVC_TPARAM1> - typename enable_if<is_convertible<Protocol1, Protocol>::value, - basic_socket_acceptor>::type& operator=( - basic_socket_acceptor<Protocol1 BOOST_ASIO_SVC_TARG1>&& other) - { - basic_socket_acceptor tmp(std::move(other)); - basic_io_object<BOOST_ASIO_SVC_T>::operator=(std::move(tmp)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroys the acceptor. - /** - * This function destroys the acceptor, cancelling any outstanding - * asynchronous operations associated with the acceptor as if by calling - * @c cancel. - */ - ~basic_socket_acceptor() - { - } - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - // These functions are provided by basic_io_object<>. -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_context() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_service() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_executor(); - } -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - - /// Open the acceptor using the specified protocol. - /** - * This function opens the socket acceptor so that it will use the specified - * protocol. - * - * @param protocol An object specifying which protocol is to be used. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * acceptor.open(boost::asio::ip::tcp::v4()); - * @endcode - */ - void open(const protocol_type& protocol = protocol_type()) - { - boost::system::error_code ec; - this->get_service().open(this->get_implementation(), protocol, ec); - boost::asio::detail::throw_error(ec, "open"); - } - - /// Open the acceptor using the specified protocol. - /** - * This function opens the socket acceptor so that it will use the specified - * protocol. - * - * @param protocol An object specifying which protocol is to be used. - * - * @param ec Set to indicate what error occurred, if any. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * boost::system::error_code ec; - * acceptor.open(boost::asio::ip::tcp::v4(), ec); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - BOOST_ASIO_SYNC_OP_VOID open(const protocol_type& protocol, - boost::system::error_code& ec) - { - this->get_service().open(this->get_implementation(), protocol, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Assigns an existing native acceptor to the acceptor. - /* - * This function opens the acceptor to hold an existing native acceptor. - * - * @param protocol An object specifying which protocol is to be used. - * - * @param native_acceptor A native acceptor. - * - * @throws boost::system::system_error Thrown on failure. - */ - void assign(const protocol_type& protocol, - const native_handle_type& native_acceptor) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - protocol, native_acceptor, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - - /// Assigns an existing native acceptor to the acceptor. - /* - * This function opens the acceptor to hold an existing native acceptor. - * - * @param protocol An object specifying which protocol is to be used. - * - * @param native_acceptor A native acceptor. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID assign(const protocol_type& protocol, - const native_handle_type& native_acceptor, boost::system::error_code& ec) - { - this->get_service().assign(this->get_implementation(), - protocol, native_acceptor, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the acceptor is open. - bool is_open() const - { - return this->get_service().is_open(this->get_implementation()); - } - - /// Bind the acceptor to the given local endpoint. - /** - * This function binds the socket acceptor to the specified endpoint on the - * local machine. - * - * @param endpoint An endpoint on the local machine to which the socket - * acceptor will be bound. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345); - * acceptor.open(endpoint.protocol()); - * acceptor.bind(endpoint); - * @endcode - */ - void bind(const endpoint_type& endpoint) - { - boost::system::error_code ec; - this->get_service().bind(this->get_implementation(), endpoint, ec); - boost::asio::detail::throw_error(ec, "bind"); - } - - /// Bind the acceptor to the given local endpoint. - /** - * This function binds the socket acceptor to the specified endpoint on the - * local machine. - * - * @param endpoint An endpoint on the local machine to which the socket - * acceptor will be bound. - * - * @param ec Set to indicate what error occurred, if any. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345); - * acceptor.open(endpoint.protocol()); - * boost::system::error_code ec; - * acceptor.bind(endpoint, ec); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - BOOST_ASIO_SYNC_OP_VOID bind(const endpoint_type& endpoint, - boost::system::error_code& ec) - { - this->get_service().bind(this->get_implementation(), endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Place the acceptor into the state where it will listen for new - /// connections. - /** - * This function puts the socket acceptor into the state where it may accept - * new connections. - * - * @param backlog The maximum length of the queue of pending connections. - * - * @throws boost::system::system_error Thrown on failure. - */ - void listen(int backlog = socket_base::max_listen_connections) - { - boost::system::error_code ec; - this->get_service().listen(this->get_implementation(), backlog, ec); - boost::asio::detail::throw_error(ec, "listen"); - } - - /// Place the acceptor into the state where it will listen for new - /// connections. - /** - * This function puts the socket acceptor into the state where it may accept - * new connections. - * - * @param backlog The maximum length of the queue of pending connections. - * - * @param ec Set to indicate what error occurred, if any. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::system::error_code ec; - * acceptor.listen(boost::asio::socket_base::max_listen_connections, ec); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - BOOST_ASIO_SYNC_OP_VOID listen(int backlog, boost::system::error_code& ec) - { - this->get_service().listen(this->get_implementation(), backlog, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Close the acceptor. - /** - * This function is used to close the acceptor. Any asynchronous accept - * operations will be cancelled immediately. - * - * A subsequent call to open() is required before the acceptor can again be - * used to again perform socket accept operations. - * - * @throws boost::system::system_error Thrown on failure. - */ - void close() - { - boost::system::error_code ec; - this->get_service().close(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "close"); - } - - /// Close the acceptor. - /** - * This function is used to close the acceptor. Any asynchronous accept - * operations will be cancelled immediately. - * - * A subsequent call to open() is required before the acceptor can again be - * used to again perform socket accept operations. - * - * @param ec Set to indicate what error occurred, if any. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::system::error_code ec; - * acceptor.close(ec); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - this->get_service().close(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Release ownership of the underlying native acceptor. - /** - * This function causes all outstanding asynchronous accept operations to - * finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. Ownership of the - * native acceptor is then transferred to the caller. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note This function is unsupported on Windows versions prior to Windows - * 8.1, and will fail with boost::asio::error::operation_not_supported on - * these platforms. - */ -#if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC >= 1400) \ - && (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0603) - __declspec(deprecated("This function always fails with " - "operation_not_supported when used on Windows versions " - "prior to Windows 8.1.")) -#endif - native_handle_type release() - { - boost::system::error_code ec; - native_handle_type s = this->get_service().release( - this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "release"); - return s; - } - - /// Release ownership of the underlying native acceptor. - /** - * This function causes all outstanding asynchronous accept operations to - * finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. Ownership of the - * native acceptor is then transferred to the caller. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note This function is unsupported on Windows versions prior to Windows - * 8.1, and will fail with boost::asio::error::operation_not_supported on - * these platforms. - */ -#if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC >= 1400) \ - && (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0603) - __declspec(deprecated("This function always fails with " - "operation_not_supported when used on Windows versions " - "prior to Windows 8.1.")) -#endif - native_handle_type release(boost::system::error_code& ec) - { - return this->get_service().release(this->get_implementation(), ec); - } - - /// Get the native acceptor representation. - /** - * This function may be used to obtain the underlying representation of the - * acceptor. This is intended to allow access to native acceptor functionality - * that is not otherwise provided. - */ - native_handle_type native_handle() - { - return this->get_service().native_handle(this->get_implementation()); - } - - /// Cancel all asynchronous operations associated with the acceptor. - /** - * This function causes all outstanding asynchronous connect, send and receive - * operations to finish immediately, and the handlers for cancelled operations - * will be passed the boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all asynchronous operations associated with the acceptor. - /** - * This function causes all outstanding asynchronous connect, send and receive - * operations to finish immediately, and the handlers for cancelled operations - * will be passed the boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Set an option on the acceptor. - /** - * This function is used to set an option on the acceptor. - * - * @param option The new option value to be set on the acceptor. - * - * @throws boost::system::system_error Thrown on failure. - * - * @sa SettableSocketOption @n - * boost::asio::socket_base::reuse_address - * boost::asio::socket_base::enable_connection_aborted - * - * @par Example - * Setting the SOL_SOCKET/SO_REUSEADDR option: - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::acceptor::reuse_address option(true); - * acceptor.set_option(option); - * @endcode - */ - template <typename SettableSocketOption> - void set_option(const SettableSocketOption& option) - { - boost::system::error_code ec; - this->get_service().set_option(this->get_implementation(), option, ec); - boost::asio::detail::throw_error(ec, "set_option"); - } - - /// Set an option on the acceptor. - /** - * This function is used to set an option on the acceptor. - * - * @param option The new option value to be set on the acceptor. - * - * @param ec Set to indicate what error occurred, if any. - * - * @sa SettableSocketOption @n - * boost::asio::socket_base::reuse_address - * boost::asio::socket_base::enable_connection_aborted - * - * @par Example - * Setting the SOL_SOCKET/SO_REUSEADDR option: - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::acceptor::reuse_address option(true); - * boost::system::error_code ec; - * acceptor.set_option(option, ec); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - template <typename SettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID set_option(const SettableSocketOption& option, - boost::system::error_code& ec) - { - this->get_service().set_option(this->get_implementation(), option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get an option from the acceptor. - /** - * This function is used to get the current value of an option on the - * acceptor. - * - * @param option The option value to be obtained from the acceptor. - * - * @throws boost::system::system_error Thrown on failure. - * - * @sa GettableSocketOption @n - * boost::asio::socket_base::reuse_address - * - * @par Example - * Getting the value of the SOL_SOCKET/SO_REUSEADDR option: - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::acceptor::reuse_address option; - * acceptor.get_option(option); - * bool is_set = option.get(); - * @endcode - */ - template <typename GettableSocketOption> - void get_option(GettableSocketOption& option) const - { - boost::system::error_code ec; - this->get_service().get_option(this->get_implementation(), option, ec); - boost::asio::detail::throw_error(ec, "get_option"); - } - - /// Get an option from the acceptor. - /** - * This function is used to get the current value of an option on the - * acceptor. - * - * @param option The option value to be obtained from the acceptor. - * - * @param ec Set to indicate what error occurred, if any. - * - * @sa GettableSocketOption @n - * boost::asio::socket_base::reuse_address - * - * @par Example - * Getting the value of the SOL_SOCKET/SO_REUSEADDR option: - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::acceptor::reuse_address option; - * boost::system::error_code ec; - * acceptor.get_option(option, ec); - * if (ec) - * { - * // An error occurred. - * } - * bool is_set = option.get(); - * @endcode - */ - template <typename GettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID get_option(GettableSocketOption& option, - boost::system::error_code& ec) const - { - this->get_service().get_option(this->get_implementation(), option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform an IO control command on the acceptor. - /** - * This function is used to execute an IO control command on the acceptor. - * - * @param command The IO control command to be performed on the acceptor. - * - * @throws boost::system::system_error Thrown on failure. - * - * @sa IoControlCommand @n - * boost::asio::socket_base::non_blocking_io - * - * @par Example - * Getting the number of bytes ready to read: - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::acceptor::non_blocking_io command(true); - * socket.io_control(command); - * @endcode - */ - template <typename IoControlCommand> - void io_control(IoControlCommand& command) - { - boost::system::error_code ec; - this->get_service().io_control(this->get_implementation(), command, ec); - boost::asio::detail::throw_error(ec, "io_control"); - } - - /// Perform an IO control command on the acceptor. - /** - * This function is used to execute an IO control command on the acceptor. - * - * @param command The IO control command to be performed on the acceptor. - * - * @param ec Set to indicate what error occurred, if any. - * - * @sa IoControlCommand @n - * boost::asio::socket_base::non_blocking_io - * - * @par Example - * Getting the number of bytes ready to read: - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::acceptor::non_blocking_io command(true); - * boost::system::error_code ec; - * socket.io_control(command, ec); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - template <typename IoControlCommand> - BOOST_ASIO_SYNC_OP_VOID io_control(IoControlCommand& command, - boost::system::error_code& ec) - { - this->get_service().io_control(this->get_implementation(), command, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the acceptor. - /** - * @returns @c true if the acceptor's synchronous operations will fail with - * boost::asio::error::would_block if they are unable to perform the requested - * operation immediately. If @c false, synchronous operations will block - * until complete. - * - * @note The non-blocking mode has no effect on the behaviour of asynchronous - * operations. Asynchronous operations will never fail with the error - * boost::asio::error::would_block. - */ - bool non_blocking() const - { - return this->get_service().non_blocking(this->get_implementation()); - } - - /// Sets the non-blocking mode of the acceptor. - /** - * @param mode If @c true, the acceptor's synchronous operations will fail - * with boost::asio::error::would_block if they are unable to perform the - * requested operation immediately. If @c false, synchronous operations will - * block until complete. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The non-blocking mode has no effect on the behaviour of asynchronous - * operations. Asynchronous operations will never fail with the error - * boost::asio::error::would_block. - */ - void non_blocking(bool mode) - { - boost::system::error_code ec; - this->get_service().non_blocking(this->get_implementation(), mode, ec); - boost::asio::detail::throw_error(ec, "non_blocking"); - } - - /// Sets the non-blocking mode of the acceptor. - /** - * @param mode If @c true, the acceptor's synchronous operations will fail - * with boost::asio::error::would_block if they are unable to perform the - * requested operation immediately. If @c false, synchronous operations will - * block until complete. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note The non-blocking mode has no effect on the behaviour of asynchronous - * operations. Asynchronous operations will never fail with the error - * boost::asio::error::would_block. - */ - BOOST_ASIO_SYNC_OP_VOID non_blocking( - bool mode, boost::system::error_code& ec) - { - this->get_service().non_blocking(this->get_implementation(), mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the native acceptor implementation. - /** - * This function is used to retrieve the non-blocking mode of the underlying - * native acceptor. This mode has no effect on the behaviour of the acceptor - * object's synchronous operations. - * - * @returns @c true if the underlying acceptor is in non-blocking mode and - * direct system calls may fail with boost::asio::error::would_block (or the - * equivalent system error). - * - * @note The current non-blocking mode is cached by the acceptor object. - * Consequently, the return value may be incorrect if the non-blocking mode - * was set directly on the native acceptor. - */ - bool native_non_blocking() const - { - return this->get_service().native_non_blocking(this->get_implementation()); - } - - /// Sets the non-blocking mode of the native acceptor implementation. - /** - * This function is used to modify the non-blocking mode of the underlying - * native acceptor. It has no effect on the behaviour of the acceptor object's - * synchronous operations. - * - * @param mode If @c true, the underlying acceptor is put into non-blocking - * mode and direct system calls may fail with boost::asio::error::would_block - * (or the equivalent system error). - * - * @throws boost::system::system_error Thrown on failure. If the @c mode is - * @c false, but the current value of @c non_blocking() is @c true, this - * function fails with boost::asio::error::invalid_argument, as the - * combination does not make sense. - */ - void native_non_blocking(bool mode) - { - boost::system::error_code ec; - this->get_service().native_non_blocking( - this->get_implementation(), mode, ec); - boost::asio::detail::throw_error(ec, "native_non_blocking"); - } - - /// Sets the non-blocking mode of the native acceptor implementation. - /** - * This function is used to modify the non-blocking mode of the underlying - * native acceptor. It has no effect on the behaviour of the acceptor object's - * synchronous operations. - * - * @param mode If @c true, the underlying acceptor is put into non-blocking - * mode and direct system calls may fail with boost::asio::error::would_block - * (or the equivalent system error). - * - * @param ec Set to indicate what error occurred, if any. If the @c mode is - * @c false, but the current value of @c non_blocking() is @c true, this - * function fails with boost::asio::error::invalid_argument, as the - * combination does not make sense. - */ - BOOST_ASIO_SYNC_OP_VOID native_non_blocking( - bool mode, boost::system::error_code& ec) - { - this->get_service().native_non_blocking( - this->get_implementation(), mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the local endpoint of the acceptor. - /** - * This function is used to obtain the locally bound endpoint of the acceptor. - * - * @returns An object that represents the local endpoint of the acceptor. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(); - * @endcode - */ - endpoint_type local_endpoint() const - { - boost::system::error_code ec; - endpoint_type ep = this->get_service().local_endpoint( - this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "local_endpoint"); - return ep; - } - - /// Get the local endpoint of the acceptor. - /** - * This function is used to obtain the locally bound endpoint of the acceptor. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns An object that represents the local endpoint of the acceptor. - * Returns a default-constructed endpoint object if an error occurred and the - * error handler did not throw an exception. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::system::error_code ec; - * boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - endpoint_type local_endpoint(boost::system::error_code& ec) const - { - return this->get_service().local_endpoint(this->get_implementation(), ec); - } - - /// Wait for the acceptor to become ready to read, ready to write, or to have - /// pending error conditions. - /** - * This function is used to perform a blocking wait for an acceptor to enter - * a ready to read, write or error condition state. - * - * @param w Specifies the desired acceptor state. - * - * @par Example - * Waiting for an acceptor to become readable. - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * acceptor.wait(boost::asio::ip::tcp::acceptor::wait_read); - * @endcode - */ - void wait(wait_type w) - { - boost::system::error_code ec; - this->get_service().wait(this->get_implementation(), w, ec); - boost::asio::detail::throw_error(ec, "wait"); - } - - /// Wait for the acceptor to become ready to read, ready to write, or to have - /// pending error conditions. - /** - * This function is used to perform a blocking wait for an acceptor to enter - * a ready to read, write or error condition state. - * - * @param w Specifies the desired acceptor state. - * - * @param ec Set to indicate what error occurred, if any. - * - * @par Example - * Waiting for an acceptor to become readable. - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::system::error_code ec; - * acceptor.wait(boost::asio::ip::tcp::acceptor::wait_read, ec); - * @endcode - */ - BOOST_ASIO_SYNC_OP_VOID wait(wait_type w, boost::system::error_code& ec) - { - this->get_service().wait(this->get_implementation(), w, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Asynchronously wait for the acceptor to become ready to read, ready to - /// write, or to have pending error conditions. - /** - * This function is used to perform an asynchronous wait for an acceptor to - * enter a ready to read, write or error condition state. - * - * @param w Specifies the desired acceptor state. - * - * @param handler The handler to be called when the wait operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code - * void wait_handler(const boost::system::error_code& error) - * { - * if (!error) - * { - * // Wait succeeded. - * } - * } - * - * ... - * - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * acceptor.async_wait( - * boost::asio::ip::tcp::acceptor::wait_read, - * wait_handler); - * @endcode - */ - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(wait_type w, BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WaitHandler. - BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_wait(this->get_implementation(), - w, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - this->get_service().async_wait(this->get_implementation(), - w, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer into the - * given socket. The function call will block until a new connection has been - * accepted successfully or an error occurs. - * - * @param peer The socket into which the new connection will be accepted. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::socket socket(io_context); - * acceptor.accept(socket); - * @endcode - */ -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename Protocol1, typename SocketService> - void accept(basic_socket<Protocol1, SocketService>& peer, - typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0) -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename Protocol1> - void accept(basic_socket<Protocol1>& peer, - typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0) -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - { - boost::system::error_code ec; - this->get_service().accept(this->get_implementation(), - peer, static_cast<endpoint_type*>(0), ec); - boost::asio::detail::throw_error(ec, "accept"); - } - - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer into the - * given socket. The function call will block until a new connection has been - * accepted successfully or an error occurs. - * - * @param peer The socket into which the new connection will be accepted. - * - * @param ec Set to indicate what error occurred, if any. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::socket socket(io_context); - * boost::system::error_code ec; - * acceptor.accept(socket, ec); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename Protocol1, typename SocketService> - BOOST_ASIO_SYNC_OP_VOID accept( - basic_socket<Protocol1, SocketService>& peer, - boost::system::error_code& ec, - typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0) -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename Protocol1> - BOOST_ASIO_SYNC_OP_VOID accept( - basic_socket<Protocol1>& peer, boost::system::error_code& ec, - typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0) -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - { - this->get_service().accept(this->get_implementation(), - peer, static_cast<endpoint_type*>(0), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Start an asynchronous accept. - /** - * This function is used to asynchronously accept a new connection into a - * socket. The function call always returns immediately. - * - * @param peer The socket into which the new connection will be accepted. - * Ownership of the peer object is retained by the caller, which must - * guarantee that it is valid until the handler is called. - * - * @param handler The handler to be called when the accept operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code - * void accept_handler(const boost::system::error_code& error) - * { - * if (!error) - * { - * // Accept succeeded. - * } - * } - * - * ... - * - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::socket socket(io_context); - * acceptor.async_accept(socket, accept_handler); - * @endcode - */ -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename Protocol1, typename SocketService, typename AcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, - void (boost::system::error_code)) - async_accept(basic_socket<Protocol1, SocketService>& peer, - BOOST_ASIO_MOVE_ARG(AcceptHandler) handler, - typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0) -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename Protocol1, typename AcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, - void (boost::system::error_code)) - async_accept(basic_socket<Protocol1>& peer, - BOOST_ASIO_MOVE_ARG(AcceptHandler) handler, - typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0) -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a AcceptHandler. - BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_accept(this->get_implementation(), - peer, static_cast<endpoint_type*>(0), - BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<AcceptHandler, - void (boost::system::error_code)> init(handler); - - this->get_service().async_accept(this->get_implementation(), - peer, static_cast<endpoint_type*>(0), init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Accept a new connection and obtain the endpoint of the peer - /** - * This function is used to accept a new connection from a peer into the - * given socket, and additionally provide the endpoint of the remote peer. - * The function call will block until a new connection has been accepted - * successfully or an error occurs. - * - * @param peer The socket into which the new connection will be accepted. - * - * @param peer_endpoint An endpoint object which will receive the endpoint of - * the remote peer. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::socket socket(io_context); - * boost::asio::ip::tcp::endpoint endpoint; - * acceptor.accept(socket, endpoint); - * @endcode - */ -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename SocketService> - void accept(basic_socket<protocol_type, SocketService>& peer, - endpoint_type& peer_endpoint) -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - void accept(basic_socket<protocol_type>& peer, endpoint_type& peer_endpoint) -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - { - boost::system::error_code ec; - this->get_service().accept(this->get_implementation(), - peer, &peer_endpoint, ec); - boost::asio::detail::throw_error(ec, "accept"); - } - - /// Accept a new connection and obtain the endpoint of the peer - /** - * This function is used to accept a new connection from a peer into the - * given socket, and additionally provide the endpoint of the remote peer. - * The function call will block until a new connection has been accepted - * successfully or an error occurs. - * - * @param peer The socket into which the new connection will be accepted. - * - * @param peer_endpoint An endpoint object which will receive the endpoint of - * the remote peer. - * - * @param ec Set to indicate what error occurred, if any. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::socket socket(io_context); - * boost::asio::ip::tcp::endpoint endpoint; - * boost::system::error_code ec; - * acceptor.accept(socket, endpoint, ec); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename SocketService> - BOOST_ASIO_SYNC_OP_VOID accept( - basic_socket<protocol_type, SocketService>& peer, - endpoint_type& peer_endpoint, boost::system::error_code& ec) -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - BOOST_ASIO_SYNC_OP_VOID accept(basic_socket<protocol_type>& peer, - endpoint_type& peer_endpoint, boost::system::error_code& ec) -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - { - this->get_service().accept( - this->get_implementation(), peer, &peer_endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Start an asynchronous accept. - /** - * This function is used to asynchronously accept a new connection into a - * socket, and additionally obtain the endpoint of the remote peer. The - * function call always returns immediately. - * - * @param peer The socket into which the new connection will be accepted. - * Ownership of the peer object is retained by the caller, which must - * guarantee that it is valid until the handler is called. - * - * @param peer_endpoint An endpoint object into which the endpoint of the - * remote peer will be written. Ownership of the peer_endpoint object is - * retained by the caller, which must guarantee that it is valid until the - * handler is called. - * - * @param handler The handler to be called when the accept operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename SocketService, typename AcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, - void (boost::system::error_code)) - async_accept(basic_socket<protocol_type, SocketService>& peer, - endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - template <typename AcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, - void (boost::system::error_code)) - async_accept(basic_socket<protocol_type>& peer, - endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a AcceptHandler. - BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_accept(this->get_implementation(), peer, - &peer_endpoint, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<AcceptHandler, - void (boost::system::error_code)> init(handler); - - this->get_service().async_accept(this->get_implementation(), - peer, &peer_endpoint, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer. The function - * call will block until a new connection has been accepted successfully or - * an error occurs. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @returns A socket object representing the newly accepted connection. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::socket socket(acceptor.accept()); - * @endcode - */ - typename Protocol::socket accept() - { - boost::system::error_code ec; - typename Protocol::socket peer( - this->get_service().accept( - this->get_implementation(), 0, 0, ec)); - boost::asio::detail::throw_error(ec, "accept"); - return peer; - } - - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer. The function - * call will block until a new connection has been accepted successfully or - * an error occurs. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns On success, a socket object representing the newly accepted - * connection. On error, a socket object where is_open() is false. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::socket socket(acceptor.accept(ec)); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - typename Protocol::socket accept(boost::system::error_code& ec) - { - return this->get_service().accept(this->get_implementation(), 0, 0, ec); - } - - /// Start an asynchronous accept. - /** - * This function is used to asynchronously accept a new connection. The - * function call always returns immediately. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param handler The handler to be called when the accept operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * typename Protocol::socket peer // On success, the newly accepted socket. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code - * void accept_handler(const boost::system::error_code& error, - * boost::asio::ip::tcp::socket peer) - * { - * if (!error) - * { - * // Accept succeeded. - * } - * } - * - * ... - * - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * acceptor.async_accept(accept_handler); - * @endcode - */ - template <typename MoveAcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler, - void (boost::system::error_code, typename Protocol::socket)) - async_accept(BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a MoveAcceptHandler. - BOOST_ASIO_MOVE_ACCEPT_HANDLER_CHECK(MoveAcceptHandler, - handler, typename Protocol::socket) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_accept( - this->get_implementation(), static_cast<boost::asio::io_context*>(0), - static_cast<endpoint_type*>(0), - BOOST_ASIO_MOVE_CAST(MoveAcceptHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<MoveAcceptHandler, - void (boost::system::error_code, - typename Protocol::socket)> init(handler); - - this->get_service().async_accept( - this->get_implementation(), static_cast<boost::asio::io_context*>(0), - static_cast<endpoint_type*>(0), init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer. The function - * call will block until a new connection has been accepted successfully or - * an error occurs. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param io_context The io_context object to be used for the newly accepted - * socket. - * - * @returns A socket object representing the newly accepted connection. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::socket socket(acceptor.accept()); - * @endcode - */ - typename Protocol::socket accept(boost::asio::io_context& io_context) - { - boost::system::error_code ec; - typename Protocol::socket peer( - this->get_service().accept(this->get_implementation(), - &io_context, static_cast<endpoint_type*>(0), ec)); - boost::asio::detail::throw_error(ec, "accept"); - return peer; - } - - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer. The function - * call will block until a new connection has been accepted successfully or - * an error occurs. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param io_context The io_context object to be used for the newly accepted - * socket. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns On success, a socket object representing the newly accepted - * connection. On error, a socket object where is_open() is false. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::socket socket(acceptor.accept(io_context2, ec)); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - typename Protocol::socket accept( - boost::asio::io_context& io_context, boost::system::error_code& ec) - { - return this->get_service().accept(this->get_implementation(), - &io_context, static_cast<endpoint_type*>(0), ec); - } - - /// Start an asynchronous accept. - /** - * This function is used to asynchronously accept a new connection. The - * function call always returns immediately. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param io_context The io_context object to be used for the newly accepted - * socket. - * - * @param handler The handler to be called when the accept operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * typename Protocol::socket peer // On success, the newly accepted socket. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code - * void accept_handler(const boost::system::error_code& error, - * boost::asio::ip::tcp::socket peer) - * { - * if (!error) - * { - * // Accept succeeded. - * } - * } - * - * ... - * - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * acceptor.async_accept(io_context2, accept_handler); - * @endcode - */ - template <typename MoveAcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler, - void (boost::system::error_code, typename Protocol::socket)) - async_accept(boost::asio::io_context& io_context, - BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a MoveAcceptHandler. - BOOST_ASIO_MOVE_ACCEPT_HANDLER_CHECK(MoveAcceptHandler, - handler, typename Protocol::socket) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_accept(this->get_implementation(), - &io_context, static_cast<endpoint_type*>(0), - BOOST_ASIO_MOVE_CAST(MoveAcceptHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<MoveAcceptHandler, - void (boost::system::error_code, - typename Protocol::socket)> init(handler); - - this->get_service().async_accept(this->get_implementation(), - &io_context, static_cast<endpoint_type*>(0), init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer. The function - * call will block until a new connection has been accepted successfully or - * an error occurs. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param peer_endpoint An endpoint object into which the endpoint of the - * remote peer will be written. - * - * @returns A socket object representing the newly accepted connection. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::endpoint endpoint; - * boost::asio::ip::tcp::socket socket(acceptor.accept(endpoint)); - * @endcode - */ - typename Protocol::socket accept(endpoint_type& peer_endpoint) - { - boost::system::error_code ec; - typename Protocol::socket peer( - this->get_service().accept(this->get_implementation(), - static_cast<boost::asio::io_context*>(0), &peer_endpoint, ec)); - boost::asio::detail::throw_error(ec, "accept"); - return peer; - } - - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer. The function - * call will block until a new connection has been accepted successfully or - * an error occurs. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param peer_endpoint An endpoint object into which the endpoint of the - * remote peer will be written. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns On success, a socket object representing the newly accepted - * connection. On error, a socket object where is_open() is false. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::endpoint endpoint; - * boost::asio::ip::tcp::socket socket(acceptor.accept(endpoint, ec)); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - typename Protocol::socket accept( - endpoint_type& peer_endpoint, boost::system::error_code& ec) - { - return this->get_service().accept(this->get_implementation(), - static_cast<boost::asio::io_context*>(0), &peer_endpoint, ec); - } - - /// Start an asynchronous accept. - /** - * This function is used to asynchronously accept a new connection. The - * function call always returns immediately. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param peer_endpoint An endpoint object into which the endpoint of the - * remote peer will be written. Ownership of the peer_endpoint object is - * retained by the caller, which must guarantee that it is valid until the - * handler is called. - * - * @param handler The handler to be called when the accept operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * typename Protocol::socket peer // On success, the newly accepted socket. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code - * void accept_handler(const boost::system::error_code& error, - * boost::asio::ip::tcp::socket peer) - * { - * if (!error) - * { - * // Accept succeeded. - * } - * } - * - * ... - * - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::endpoint endpoint; - * acceptor.async_accept(endpoint, accept_handler); - * @endcode - */ - template <typename MoveAcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler, - void (boost::system::error_code, typename Protocol::socket)) - async_accept(endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a MoveAcceptHandler. - BOOST_ASIO_MOVE_ACCEPT_HANDLER_CHECK(MoveAcceptHandler, - handler, typename Protocol::socket) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_accept(this->get_implementation(), - static_cast<boost::asio::io_context*>(0), &peer_endpoint, - BOOST_ASIO_MOVE_CAST(MoveAcceptHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<MoveAcceptHandler, - void (boost::system::error_code, - typename Protocol::socket)> init(handler); - - this->get_service().async_accept(this->get_implementation(), - static_cast<boost::asio::io_context*>(0), &peer_endpoint, - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer. The function - * call will block until a new connection has been accepted successfully or - * an error occurs. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param io_context The io_context object to be used for the newly accepted - * socket. - * - * @param peer_endpoint An endpoint object into which the endpoint of the - * remote peer will be written. - * - * @returns A socket object representing the newly accepted connection. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::endpoint endpoint; - * boost::asio::ip::tcp::socket socket( - * acceptor.accept(io_context2, endpoint)); - * @endcode - */ - typename Protocol::socket accept( - boost::asio::io_context& io_context, endpoint_type& peer_endpoint) - { - boost::system::error_code ec; - typename Protocol::socket peer( - this->get_service().accept(this->get_implementation(), - &io_context, &peer_endpoint, ec)); - boost::asio::detail::throw_error(ec, "accept"); - return peer; - } - - /// Accept a new connection. - /** - * This function is used to accept a new connection from a peer. The function - * call will block until a new connection has been accepted successfully or - * an error occurs. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param io_context The io_context object to be used for the newly accepted - * socket. - * - * @param peer_endpoint An endpoint object into which the endpoint of the - * remote peer will be written. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns On success, a socket object representing the newly accepted - * connection. On error, a socket object where is_open() is false. - * - * @par Example - * @code - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::endpoint endpoint; - * boost::asio::ip::tcp::socket socket( - * acceptor.accept(io_context2, endpoint, ec)); - * if (ec) - * { - * // An error occurred. - * } - * @endcode - */ - typename Protocol::socket accept(boost::asio::io_context& io_context, - endpoint_type& peer_endpoint, boost::system::error_code& ec) - { - return this->get_service().accept(this->get_implementation(), - &io_context, &peer_endpoint, ec); - } - - /// Start an asynchronous accept. - /** - * This function is used to asynchronously accept a new connection. The - * function call always returns immediately. - * - * This overload requires that the Protocol template parameter satisfy the - * AcceptableProtocol type requirements. - * - * @param io_context The io_context object to be used for the newly accepted - * socket. - * - * @param peer_endpoint An endpoint object into which the endpoint of the - * remote peer will be written. Ownership of the peer_endpoint object is - * retained by the caller, which must guarantee that it is valid until the - * handler is called. - * - * @param handler The handler to be called when the accept operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * typename Protocol::socket peer // On success, the newly accepted socket. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code - * void accept_handler(const boost::system::error_code& error, - * boost::asio::ip::tcp::socket peer) - * { - * if (!error) - * { - * // Accept succeeded. - * } - * } - * - * ... - * - * boost::asio::ip::tcp::acceptor acceptor(io_context); - * ... - * boost::asio::ip::tcp::endpoint endpoint; - * acceptor.async_accept(io_context2, endpoint, accept_handler); - * @endcode - */ - template <typename MoveAcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler, - void (boost::system::error_code, typename Protocol::socket)) - async_accept(boost::asio::io_context& io_context, - endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a MoveAcceptHandler. - BOOST_ASIO_MOVE_ACCEPT_HANDLER_CHECK(MoveAcceptHandler, - handler, typename Protocol::socket) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_accept( - this->get_implementation(), &io_context, &peer_endpoint, - BOOST_ASIO_MOVE_CAST(MoveAcceptHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<MoveAcceptHandler, - void (boost::system::error_code, - typename Protocol::socket)> init(handler); - - this->get_service().async_accept(this->get_implementation(), - &io_context, &peer_endpoint, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# undef BOOST_ASIO_SVC_T -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_BASIC_SOCKET_ACCEPTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_socket_iostream.hpp b/contrib/restricted/boost/boost/asio/basic_socket_iostream.hpp deleted file mode 100644 index 7a7cab9c93..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_socket_iostream.hpp +++ /dev/null @@ -1,432 +0,0 @@ -// -// basic_socket_iostream.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_SOCKET_IOSTREAM_HPP -#define BOOST_ASIO_BASIC_SOCKET_IOSTREAM_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -#include <istream> -#include <ostream> -#include <boost/asio/basic_socket_streambuf.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/stream_socket_service.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -# include <boost/asio/detail/variadic_templates.hpp> - -// A macro that should expand to: -// template <typename T1, ..., typename Tn> -// explicit basic_socket_iostream(T1 x1, ..., Tn xn) -// : std::basic_iostream<char>( -// &this->detail::socket_iostream_base< -// Protocol BOOST_ASIO_SVC_TARG, Clock, -// WaitTraits BOOST_ASIO_SVC_TARG1>::streambuf_) -// { -// if (rdbuf()->connect(x1, ..., xn) == 0) -// this->setstate(std::ios_base::failbit); -// } -// This macro should only persist within this file. - -# define BOOST_ASIO_PRIVATE_CTR_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - explicit basic_socket_iostream(BOOST_ASIO_VARIADIC_BYVAL_PARAMS(n)) \ - : std::basic_iostream<char>( \ - &this->detail::socket_iostream_base< \ - Protocol BOOST_ASIO_SVC_TARG, Clock, \ - WaitTraits BOOST_ASIO_SVC_TARG1>::streambuf_) \ - { \ - this->setf(std::ios_base::unitbuf); \ - if (rdbuf()->connect(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) == 0) \ - this->setstate(std::ios_base::failbit); \ - } \ - /**/ - -// A macro that should expand to: -// template <typename T1, ..., typename Tn> -// void connect(T1 x1, ..., Tn xn) -// { -// if (rdbuf()->connect(x1, ..., xn) == 0) -// this->setstate(std::ios_base::failbit); -// } -// This macro should only persist within this file. - -# define BOOST_ASIO_PRIVATE_CONNECT_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - void connect(BOOST_ASIO_VARIADIC_BYVAL_PARAMS(n)) \ - { \ - if (rdbuf()->connect(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) == 0) \ - this->setstate(std::ios_base::failbit); \ - } \ - /**/ - -#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -// A separate base class is used to ensure that the streambuf is initialised -// prior to the basic_socket_iostream's basic_iostream base class. -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Clock, typename WaitTraits BOOST_ASIO_SVC_TPARAM1> -class socket_iostream_base -{ -protected: - socket_iostream_base() - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - socket_iostream_base(socket_iostream_base&& other) - : streambuf_(std::move(other.streambuf_)) - { - } - - socket_iostream_base(basic_stream_socket<Protocol> s) - : streambuf_(std::move(s)) - { - } - - socket_iostream_base& operator=(socket_iostream_base&& other) - { - streambuf_ = std::move(other.streambuf_); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - basic_socket_streambuf<Protocol BOOST_ASIO_SVC_TARG, - Clock, WaitTraits BOOST_ASIO_SVC_TARG1> streambuf_; -}; - -} // namespace detail - -#if !defined(BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL) -#define BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL - -// Forward declaration with defaulted arguments. -template <typename Protocol - BOOST_ASIO_SVC_TPARAM_DEF1(= stream_socket_service<Protocol>), -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typename Clock = boost::posix_time::ptime, - typename WaitTraits = time_traits<Clock> - BOOST_ASIO_SVC_TPARAM1_DEF2(= deadline_timer_service<Clock, WaitTraits>)> -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typename Clock = chrono::steady_clock, - typename WaitTraits = wait_traits<Clock> - BOOST_ASIO_SVC_TPARAM1_DEF1(= steady_timer::service_type)> -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) -class basic_socket_iostream; - -#endif // !defined(BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL) - -/// Iostream interface for a socket. -#if defined(GENERATING_DOCUMENTATION) -template <typename Protocol, - typename Clock = chrono::steady_clock, - typename WaitTraits = wait_traits<Clock> > -#else // defined(GENERATING_DOCUMENTATION) -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Clock, typename WaitTraits BOOST_ASIO_SVC_TPARAM1> -#endif // defined(GENERATING_DOCUMENTATION) -class basic_socket_iostream - : private detail::socket_iostream_base<Protocol - BOOST_ASIO_SVC_TARG, Clock, WaitTraits BOOST_ASIO_SVC_TARG1>, - public std::basic_iostream<char> -{ -private: - // These typedefs are intended keep this class's implementation independent - // of whether it's using Boost.DateClock, Boost.Chrono or std::chrono. -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typedef WaitTraits traits_helper; -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typedef detail::chrono_time_traits<Clock, WaitTraits> traits_helper; -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - -public: - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename Protocol::endpoint endpoint_type; - - /// The clock type. - typedef Clock clock_type; - -#if defined(GENERATING_DOCUMENTATION) - /// (Deprecated: Use time_point.) The time type. - typedef typename WaitTraits::time_type time_type; - - /// The time type. - typedef typename WaitTraits::time_point time_point; - - /// (Deprecated: Use duration.) The duration type. - typedef typename WaitTraits::duration_type duration_type; - - /// The duration type. - typedef typename WaitTraits::duration duration; -#else -# if !defined(BOOST_ASIO_NO_DEPRECATED) - typedef typename traits_helper::time_type time_type; - typedef typename traits_helper::duration_type duration_type; -# endif // !defined(BOOST_ASIO_NO_DEPRECATED) - typedef typename traits_helper::time_type time_point; - typedef typename traits_helper::duration_type duration; -#endif - - /// Construct a basic_socket_iostream without establishing a connection. - basic_socket_iostream() - : std::basic_iostream<char>( - &this->detail::socket_iostream_base< - Protocol BOOST_ASIO_SVC_TARG, Clock, - WaitTraits BOOST_ASIO_SVC_TARG1>::streambuf_) - { - this->setf(std::ios_base::unitbuf); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Construct a basic_socket_iostream from the supplied socket. - explicit basic_socket_iostream(basic_stream_socket<protocol_type> s) - : detail::socket_iostream_base< - Protocol BOOST_ASIO_SVC_TARG, Clock, - WaitTraits BOOST_ASIO_SVC_TARG1>(std::move(s)), - std::basic_iostream<char>( - &this->detail::socket_iostream_base< - Protocol BOOST_ASIO_SVC_TARG, Clock, - WaitTraits BOOST_ASIO_SVC_TARG1>::streambuf_) - { - this->setf(std::ios_base::unitbuf); - } - -#if defined(BOOST_ASIO_HAS_STD_IOSTREAM_MOVE) \ - || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_socket_iostream from another. - basic_socket_iostream(basic_socket_iostream&& other) - : detail::socket_iostream_base< - Protocol BOOST_ASIO_SVC_TARG, Clock, - WaitTraits BOOST_ASIO_SVC_TARG1>(std::move(other)), - std::basic_iostream<char>(std::move(other)) - { - this->set_rdbuf(&this->detail::socket_iostream_base< - Protocol BOOST_ASIO_SVC_TARG, Clock, - WaitTraits BOOST_ASIO_SVC_TARG1>::streambuf_); - } - - /// Move-assign a basic_socket_iostream from another. - basic_socket_iostream& operator=(basic_socket_iostream&& other) - { - std::basic_iostream<char>::operator=(std::move(other)); - detail::socket_iostream_base< - Protocol BOOST_ASIO_SVC_TARG, Clock, - WaitTraits BOOST_ASIO_SVC_TARG1>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_STD_IOSTREAM_MOVE) - // || defined(GENERATING_DOCUMENTATION) -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - -#if defined(GENERATING_DOCUMENTATION) - /// Establish a connection to an endpoint corresponding to a resolver query. - /** - * This constructor automatically establishes a connection based on the - * supplied resolver query parameters. The arguments are used to construct - * a resolver query object. - */ - template <typename T1, ..., typename TN> - explicit basic_socket_iostream(T1 t1, ..., TN tn); -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - template <typename... T> - explicit basic_socket_iostream(T... x) - : std::basic_iostream<char>( - &this->detail::socket_iostream_base< - Protocol BOOST_ASIO_SVC_TARG, Clock, - WaitTraits BOOST_ASIO_SVC_TARG1>::streambuf_) - { - this->setf(std::ios_base::unitbuf); - if (rdbuf()->connect(x...) == 0) - this->setstate(std::ios_base::failbit); - } -#else - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CTR_DEF) -#endif - -#if defined(GENERATING_DOCUMENTATION) - /// Establish a connection to an endpoint corresponding to a resolver query. - /** - * This function automatically establishes a connection based on the supplied - * resolver query parameters. The arguments are used to construct a resolver - * query object. - */ - template <typename T1, ..., typename TN> - void connect(T1 t1, ..., TN tn); -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - template <typename... T> - void connect(T... x) - { - if (rdbuf()->connect(x...) == 0) - this->setstate(std::ios_base::failbit); - } -#else - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CONNECT_DEF) -#endif - - /// Close the connection. - void close() - { - if (rdbuf()->close() == 0) - this->setstate(std::ios_base::failbit); - } - - /// Return a pointer to the underlying streambuf. - basic_socket_streambuf<Protocol BOOST_ASIO_SVC_TARG, - Clock, WaitTraits BOOST_ASIO_SVC_TARG1>* rdbuf() const - { - return const_cast<basic_socket_streambuf<Protocol BOOST_ASIO_SVC_TARG, - Clock, WaitTraits BOOST_ASIO_SVC_TARG1>*>( - &this->detail::socket_iostream_base< - Protocol BOOST_ASIO_SVC_TARG, Clock, - WaitTraits BOOST_ASIO_SVC_TARG1>::streambuf_); - } - - /// Get a reference to the underlying socket. - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& socket() - { - return rdbuf()->socket(); - } - - /// Get the last error associated with the stream. - /** - * @return An \c error_code corresponding to the last error from the stream. - * - * @par Example - * To print the error associated with a failure to establish a connection: - * @code tcp::iostream s("www.boost.org", "http"); - * if (!s) - * { - * std::cout << "Error: " << s.error().message() << std::endl; - * } @endcode - */ - const boost::system::error_code& error() const - { - return rdbuf()->error(); - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the stream's expiry time as an absolute - /// time. - /** - * @return An absolute time value representing the stream's expiry time. - */ - time_point expires_at() const - { - return rdbuf()->expires_at(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the stream's expiry time as an absolute time. - /** - * @return An absolute time value representing the stream's expiry time. - */ - time_point expiry() const - { - return rdbuf()->expiry(); - } - - /// Set the stream's expiry time as an absolute time. - /** - * This function sets the expiry time associated with the stream. Stream - * operations performed after this time (where the operations cannot be - * completed using the internal buffers) will fail with the error - * boost::asio::error::operation_aborted. - * - * @param expiry_time The expiry time to be used for the stream. - */ - void expires_at(const time_point& expiry_time) - { - rdbuf()->expires_at(expiry_time); - } - - /// Set the stream's expiry time relative to now. - /** - * This function sets the expiry time associated with the stream. Stream - * operations performed after this time (where the operations cannot be - * completed using the internal buffers) will fail with the error - * boost::asio::error::operation_aborted. - * - * @param expiry_time The expiry time to be used for the timer. - */ - void expires_after(const duration& expiry_time) - { - rdbuf()->expires_after(expiry_time); - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the stream's expiry time relative to now. - /** - * @return A relative time value representing the stream's expiry time. - */ - duration expires_from_now() const - { - return rdbuf()->expires_from_now(); - } - - /// (Deprecated: Use expires_after().) Set the stream's expiry time relative - /// to now. - /** - * This function sets the expiry time associated with the stream. Stream - * operations performed after this time (where the operations cannot be - * completed using the internal buffers) will fail with the error - * boost::asio::error::operation_aborted. - * - * @param expiry_time The expiry time to be used for the timer. - */ - void expires_from_now(const duration& expiry_time) - { - rdbuf()->expires_from_now(expiry_time); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -private: - // Disallow copying and assignment. - basic_socket_iostream(const basic_socket_iostream&) BOOST_ASIO_DELETED; - basic_socket_iostream& operator=( - const basic_socket_iostream&) BOOST_ASIO_DELETED; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) -# undef BOOST_ASIO_PRIVATE_CTR_DEF -# undef BOOST_ASIO_PRIVATE_CONNECT_DEF -#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -#endif // BOOST_ASIO_BASIC_SOCKET_IOSTREAM_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_socket_streambuf.hpp b/contrib/restricted/boost/boost/asio/basic_socket_streambuf.hpp deleted file mode 100644 index 0a2bbe56a6..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_socket_streambuf.hpp +++ /dev/null @@ -1,709 +0,0 @@ -// -// basic_socket_streambuf.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_SOCKET_STREAMBUF_HPP -#define BOOST_ASIO_BASIC_SOCKET_STREAMBUF_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -#include <streambuf> -#include <vector> -#include <boost/asio/basic_socket.hpp> -#include <boost/asio/basic_stream_socket.hpp> -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/io_context.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/stream_socket_service.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) -# if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/deadline_timer_service.hpp> -# else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/detail/deadline_timer_service.hpp> -# endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) -# include <boost/asio/steady_timer.hpp> -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - -#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -# include <boost/asio/detail/variadic_templates.hpp> - -// A macro that should expand to: -// template <typename T1, ..., typename Tn> -// basic_socket_streambuf* connect(T1 x1, ..., Tn xn) -// { -// init_buffers(); -// typedef typename Protocol::resolver resolver_type; -// resolver_type resolver(socket().get_executor().context()); -// connect_to_endpoints( -// resolver.resolve(x1, ..., xn, ec_)); -// return !ec_ ? this : 0; -// } -// This macro should only persist within this file. - -# define BOOST_ASIO_PRIVATE_CONNECT_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - basic_socket_streambuf* connect(BOOST_ASIO_VARIADIC_BYVAL_PARAMS(n)) \ - { \ - init_buffers(); \ - typedef typename Protocol::resolver resolver_type; \ - resolver_type resolver(socket().get_executor().context()); \ - connect_to_endpoints( \ - resolver.resolve(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n), ec_)); \ - return !ec_ ? this : 0; \ - } \ - /**/ - -#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#if !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# define BOOST_ASIO_SVC_T1 detail::deadline_timer_service<traits_helper> -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -// A separate base class is used to ensure that the io_context member is -// initialised prior to the basic_socket_streambuf's basic_socket base class. -class socket_streambuf_io_context -{ -protected: - socket_streambuf_io_context(io_context* ctx) - : default_io_context_(ctx) - { - } - - shared_ptr<io_context> default_io_context_; -}; - -// A separate base class is used to ensure that the dynamically allocated -// buffers are constructed prior to the basic_socket_streambuf's basic_socket -// base class. This makes moving the socket is the last potentially throwing -// step in the streambuf's move constructor, giving the constructor a strong -// exception safety guarantee. -class socket_streambuf_buffers -{ -protected: - socket_streambuf_buffers() - : get_buffer_(buffer_size), - put_buffer_(buffer_size) - { - } - - enum { buffer_size = 512 }; - std::vector<char> get_buffer_; - std::vector<char> put_buffer_; -}; - -} // namespace detail - -#if !defined(BOOST_ASIO_BASIC_SOCKET_STREAMBUF_FWD_DECL) -#define BOOST_ASIO_BASIC_SOCKET_STREAMBUF_FWD_DECL - -// Forward declaration with defaulted arguments. -template <typename Protocol - BOOST_ASIO_SVC_TPARAM_DEF1(= stream_socket_service<Protocol>), -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typename Clock = boost::posix_time::ptime, - typename WaitTraits = time_traits<Clock> - BOOST_ASIO_SVC_TPARAM1_DEF2(= deadline_timer_service<Clock, WaitTraits>)> -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typename Clock = chrono::steady_clock, - typename WaitTraits = wait_traits<Clock> - BOOST_ASIO_SVC_TPARAM1_DEF1(= steady_timer::service_type)> -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) -class basic_socket_streambuf; - -#endif // !defined(BOOST_ASIO_BASIC_SOCKET_STREAMBUF_FWD_DECL) - -/// Iostream streambuf for a socket. -#if defined(GENERATING_DOCUMENTATION) -template <typename Protocol, - typename Clock = chrono::steady_clock, - typename WaitTraits = wait_traits<Clock> > -#else // defined(GENERATING_DOCUMENTATION) -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Clock, typename WaitTraits BOOST_ASIO_SVC_TPARAM1> -#endif // defined(GENERATING_DOCUMENTATION) -class basic_socket_streambuf - : public std::streambuf, - private detail::socket_streambuf_io_context, - private detail::socket_streambuf_buffers, -#if defined(BOOST_ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION) - private basic_socket<Protocol BOOST_ASIO_SVC_TARG> -#else // defined(BOOST_ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION) - public basic_socket<Protocol BOOST_ASIO_SVC_TARG> -#endif // defined(BOOST_ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION) -{ -private: - // These typedefs are intended keep this class's implementation independent - // of whether it's using Boost.DateClock, Boost.Chrono or std::chrono. -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typedef WaitTraits traits_helper; -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typedef detail::chrono_time_traits<Clock, WaitTraits> traits_helper; -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - -public: - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename Protocol::endpoint endpoint_type; - - /// The clock type. - typedef Clock clock_type; - -#if defined(GENERATING_DOCUMENTATION) - /// (Deprecated: Use time_point.) The time type. - typedef typename WaitTraits::time_type time_type; - - /// The time type. - typedef typename WaitTraits::time_point time_point; - - /// (Deprecated: Use duration.) The duration type. - typedef typename WaitTraits::duration_type duration_type; - - /// The duration type. - typedef typename WaitTraits::duration duration; -#else -# if !defined(BOOST_ASIO_NO_DEPRECATED) - typedef typename traits_helper::time_type time_type; - typedef typename traits_helper::duration_type duration_type; -# endif // !defined(BOOST_ASIO_NO_DEPRECATED) - typedef typename traits_helper::time_type time_point; - typedef typename traits_helper::duration_type duration; -#endif - - /// Construct a basic_socket_streambuf without establishing a connection. - basic_socket_streambuf() - : detail::socket_streambuf_io_context(new io_context), - basic_socket<Protocol BOOST_ASIO_SVC_TARG>(*default_io_context_), - expiry_time_(max_expiry_time()) - { - init_buffers(); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Construct a basic_socket_streambuf from the supplied socket. - explicit basic_socket_streambuf(basic_stream_socket<protocol_type> s) - : detail::socket_streambuf_io_context(0), - basic_socket<Protocol BOOST_ASIO_SVC_TARG>(std::move(s)), - expiry_time_(max_expiry_time()) - { - init_buffers(); - } - - /// Move-construct a basic_socket_streambuf from another. - basic_socket_streambuf(basic_socket_streambuf&& other) - : detail::socket_streambuf_io_context(other), - basic_socket<Protocol BOOST_ASIO_SVC_TARG>(std::move(other.socket())), - ec_(other.ec_), - expiry_time_(other.expiry_time_) - { - get_buffer_.swap(other.get_buffer_); - put_buffer_.swap(other.put_buffer_); - setg(other.eback(), other.gptr(), other.egptr()); - setp(other.pptr(), other.epptr()); - other.ec_ = boost::system::error_code(); - other.expiry_time_ = max_expiry_time(); - other.init_buffers(); - } - - /// Move-assign a basic_socket_streambuf from another. - basic_socket_streambuf& operator=(basic_socket_streambuf&& other) - { - this->close(); - socket() = std::move(other.socket()); - detail::socket_streambuf_io_context::operator=(other); - ec_ = other.ec_; - expiry_time_ = other.expiry_time_; - get_buffer_.swap(other.get_buffer_); - put_buffer_.swap(other.put_buffer_); - setg(other.eback(), other.gptr(), other.egptr()); - setp(other.pptr(), other.epptr()); - other.ec_ = boost::system::error_code(); - other.expiry_time_ = max_expiry_time(); - other.put_buffer_.resize(buffer_size); - other.init_buffers(); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destructor flushes buffered data. - virtual ~basic_socket_streambuf() - { - if (pptr() != pbase()) - overflow(traits_type::eof()); - } - - /// Establish a connection. - /** - * This function establishes a connection to the specified endpoint. - * - * @return \c this if a connection was successfully established, a null - * pointer otherwise. - */ - basic_socket_streambuf* connect(const endpoint_type& endpoint) - { - init_buffers(); - ec_ = boost::system::error_code(); - this->connect_to_endpoints(&endpoint, &endpoint + 1); - return !ec_ ? this : 0; - } - -#if defined(GENERATING_DOCUMENTATION) - /// Establish a connection. - /** - * This function automatically establishes a connection based on the supplied - * resolver query parameters. The arguments are used to construct a resolver - * query object. - * - * @return \c this if a connection was successfully established, a null - * pointer otherwise. - */ - template <typename T1, ..., typename TN> - basic_socket_streambuf* connect(T1 t1, ..., TN tn); -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - template <typename... T> - basic_socket_streambuf* connect(T... x) - { - init_buffers(); - typedef typename Protocol::resolver resolver_type; - resolver_type resolver(socket().get_executor().context()); - connect_to_endpoints(resolver.resolve(x..., ec_)); - return !ec_ ? this : 0; - } -#else - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CONNECT_DEF) -#endif - - /// Close the connection. - /** - * @return \c this if a connection was successfully established, a null - * pointer otherwise. - */ - basic_socket_streambuf* close() - { - sync(); - socket().close(ec_); - if (!ec_) - init_buffers(); - return !ec_ ? this : 0; - } - - /// Get a reference to the underlying socket. - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& socket() - { - return *this; - } - - /// Get the last error associated with the stream buffer. - /** - * @return An \c error_code corresponding to the last error from the stream - * buffer. - */ - const boost::system::error_code& error() const - { - return ec_; - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use error().) Get the last error associated with the stream - /// buffer. - /** - * @return An \c error_code corresponding to the last error from the stream - * buffer. - */ - const boost::system::error_code& puberror() const - { - return error(); - } - - /// (Deprecated: Use expiry().) Get the stream buffer's expiry time as an - /// absolute time. - /** - * @return An absolute time value representing the stream buffer's expiry - * time. - */ - time_point expires_at() const - { - return expiry_time_; - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the stream buffer's expiry time as an absolute time. - /** - * @return An absolute time value representing the stream buffer's expiry - * time. - */ - time_point expiry() const - { - return expiry_time_; - } - - /// Set the stream buffer's expiry time as an absolute time. - /** - * This function sets the expiry time associated with the stream. Stream - * operations performed after this time (where the operations cannot be - * completed using the internal buffers) will fail with the error - * boost::asio::error::operation_aborted. - * - * @param expiry_time The expiry time to be used for the stream. - */ - void expires_at(const time_point& expiry_time) - { - expiry_time_ = expiry_time; - } - - /// Set the stream buffer's expiry time relative to now. - /** - * This function sets the expiry time associated with the stream. Stream - * operations performed after this time (where the operations cannot be - * completed using the internal buffers) will fail with the error - * boost::asio::error::operation_aborted. - * - * @param expiry_time The expiry time to be used for the timer. - */ - void expires_after(const duration& expiry_time) - { - expiry_time_ = traits_helper::add(traits_helper::now(), expiry_time); - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the stream buffer's expiry time relative - /// to now. - /** - * @return A relative time value representing the stream buffer's expiry time. - */ - duration expires_from_now() const - { - return traits_helper::subtract(expires_at(), traits_helper::now()); - } - - /// (Deprecated: Use expires_after().) Set the stream buffer's expiry time - /// relative to now. - /** - * This function sets the expiry time associated with the stream. Stream - * operations performed after this time (where the operations cannot be - * completed using the internal buffers) will fail with the error - * boost::asio::error::operation_aborted. - * - * @param expiry_time The expiry time to be used for the timer. - */ - void expires_from_now(const duration& expiry_time) - { - expiry_time_ = traits_helper::add(traits_helper::now(), expiry_time); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -protected: - int_type underflow() - { -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - ec_ = boost::asio::error::operation_not_supported; - return traits_type::eof(); -#else // defined(BOOST_ASIO_WINDOWS_RUNTIME) - if (gptr() != egptr()) - return traits_type::eof(); - - for (;;) - { - // Check if we are past the expiry time. - if (traits_helper::less_than(expiry_time_, traits_helper::now())) - { - ec_ = boost::asio::error::timed_out; - return traits_type::eof(); - } - - // Try to complete the operation without blocking. - if (!socket().native_non_blocking()) - socket().native_non_blocking(true, ec_); - detail::buffer_sequence_adapter<mutable_buffer, mutable_buffer> - bufs(boost::asio::buffer(get_buffer_) + putback_max); - detail::signed_size_type bytes = detail::socket_ops::recv( - socket().native_handle(), bufs.buffers(), bufs.count(), 0, ec_); - - // Check if operation succeeded. - if (bytes > 0) - { - setg(&get_buffer_[0], &get_buffer_[0] + putback_max, - &get_buffer_[0] + putback_max + bytes); - return traits_type::to_int_type(*gptr()); - } - - // Check for EOF. - if (bytes == 0) - { - ec_ = boost::asio::error::eof; - return traits_type::eof(); - } - - // Operation failed. - if (ec_ != boost::asio::error::would_block - && ec_ != boost::asio::error::try_again) - return traits_type::eof(); - - // Wait for socket to become ready. - if (detail::socket_ops::poll_read( - socket().native_handle(), 0, timeout(), ec_) < 0) - return traits_type::eof(); - } -#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) - } - - int_type overflow(int_type c) - { -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - ec_ = boost::asio::error::operation_not_supported; - return traits_type::eof(); -#else // defined(BOOST_ASIO_WINDOWS_RUNTIME) - char_type ch = traits_type::to_char_type(c); - - // Determine what needs to be sent. - const_buffer output_buffer; - if (put_buffer_.empty()) - { - if (traits_type::eq_int_type(c, traits_type::eof())) - return traits_type::not_eof(c); // Nothing to do. - output_buffer = boost::asio::buffer(&ch, sizeof(char_type)); - } - else - { - output_buffer = boost::asio::buffer(pbase(), - (pptr() - pbase()) * sizeof(char_type)); - } - - while (output_buffer.size() > 0) - { - // Check if we are past the expiry time. - if (traits_helper::less_than(expiry_time_, traits_helper::now())) - { - ec_ = boost::asio::error::timed_out; - return traits_type::eof(); - } - - // Try to complete the operation without blocking. - if (!socket().native_non_blocking()) - socket().native_non_blocking(true, ec_); - detail::buffer_sequence_adapter< - const_buffer, const_buffer> bufs(output_buffer); - detail::signed_size_type bytes = detail::socket_ops::send( - socket().native_handle(), bufs.buffers(), bufs.count(), 0, ec_); - - // Check if operation succeeded. - if (bytes > 0) - { - output_buffer += static_cast<std::size_t>(bytes); - continue; - } - - // Operation failed. - if (ec_ != boost::asio::error::would_block - && ec_ != boost::asio::error::try_again) - return traits_type::eof(); - - // Wait for socket to become ready. - if (detail::socket_ops::poll_write( - socket().native_handle(), 0, timeout(), ec_) < 0) - return traits_type::eof(); - } - - if (!put_buffer_.empty()) - { - setp(&put_buffer_[0], &put_buffer_[0] + put_buffer_.size()); - - // If the new character is eof then our work here is done. - if (traits_type::eq_int_type(c, traits_type::eof())) - return traits_type::not_eof(c); - - // Add the new character to the output buffer. - *pptr() = ch; - pbump(1); - } - - return c; -#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) - } - - int sync() - { - return overflow(traits_type::eof()); - } - - std::streambuf* setbuf(char_type* s, std::streamsize n) - { - if (pptr() == pbase() && s == 0 && n == 0) - { - put_buffer_.clear(); - setp(0, 0); - sync(); - return this; - } - - return 0; - } - -private: - // Disallow copying and assignment. - basic_socket_streambuf(const basic_socket_streambuf&) BOOST_ASIO_DELETED; - basic_socket_streambuf& operator=( - const basic_socket_streambuf&) BOOST_ASIO_DELETED; - - void init_buffers() - { - setg(&get_buffer_[0], - &get_buffer_[0] + putback_max, - &get_buffer_[0] + putback_max); - - if (put_buffer_.empty()) - setp(0, 0); - else - setp(&put_buffer_[0], &put_buffer_[0] + put_buffer_.size()); - } - - int timeout() const - { - int64_t msec = traits_helper::to_posix_duration( - traits_helper::subtract(expiry_time_, - traits_helper::now())).total_milliseconds(); - if (msec > (std::numeric_limits<int>::max)()) - msec = (std::numeric_limits<int>::max)(); - else if (msec < 0) - msec = 0; - return static_cast<int>(msec); - } - - template <typename EndpointSequence> - void connect_to_endpoints(const EndpointSequence& endpoints) - { - this->connect_to_endpoints(endpoints.begin(), endpoints.end()); - } - - template <typename EndpointIterator> - void connect_to_endpoints(EndpointIterator begin, EndpointIterator end) - { -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - ec_ = boost::asio::error::operation_not_supported; -#else // defined(BOOST_ASIO_WINDOWS_RUNTIME) - if (ec_) - return; - - ec_ = boost::asio::error::not_found; - for (EndpointIterator i = begin; i != end; ++i) - { - // Check if we are past the expiry time. - if (traits_helper::less_than(expiry_time_, traits_helper::now())) - { - ec_ = boost::asio::error::timed_out; - return; - } - - // Close and reopen the socket. - typename Protocol::endpoint ep(*i); - socket().close(ec_); - socket().open(ep.protocol(), ec_); - if (ec_) - continue; - - // Try to complete the operation without blocking. - if (!socket().native_non_blocking()) - socket().native_non_blocking(true, ec_); - detail::socket_ops::connect(socket().native_handle(), - ep.data(), ep.size(), ec_); - - // Check if operation succeeded. - if (!ec_) - return; - - // Operation failed. - if (ec_ != boost::asio::error::in_progress - && ec_ != boost::asio::error::would_block) - continue; - - // Wait for socket to become ready. - if (detail::socket_ops::poll_connect( - socket().native_handle(), timeout(), ec_) < 0) - continue; - - // Get the error code from the connect operation. - int connect_error = 0; - size_t connect_error_len = sizeof(connect_error); - if (detail::socket_ops::getsockopt(socket().native_handle(), 0, - SOL_SOCKET, SO_ERROR, &connect_error, &connect_error_len, ec_) - == detail::socket_error_retval) - return; - - // Check the result of the connect operation. - ec_ = boost::system::error_code(connect_error, - boost::asio::error::get_system_category()); - if (!ec_) - return; - } -#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) - } - - // Helper function to get the maximum expiry time. - static time_point max_expiry_time() - { -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - return boost::posix_time::pos_infin; -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - return (time_point::max)(); -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - } - - enum { putback_max = 8 }; - boost::system::error_code ec_; - time_point expiry_time_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# undef BOOST_ASIO_SVC_T1 -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) -# undef BOOST_ASIO_PRIVATE_CONNECT_DEF -#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -#endif // BOOST_ASIO_BASIC_SOCKET_STREAMBUF_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_stream_socket.hpp b/contrib/restricted/boost/boost/asio/basic_stream_socket.hpp deleted file mode 100644 index 9732c3c303..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_stream_socket.hpp +++ /dev/null @@ -1,923 +0,0 @@ -// -// basic_stream_socket.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_STREAM_SOCKET_HPP -#define BOOST_ASIO_BASIC_STREAM_SOCKET_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/basic_socket.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/stream_socket_service.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Provides stream-oriented socket functionality. -/** - * The basic_stream_socket class template provides asynchronous and blocking - * stream-oriented socket functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream. - */ -template <typename Protocol - BOOST_ASIO_SVC_TPARAM_DEF1(= stream_socket_service<Protocol>)> -class basic_stream_socket - : public basic_socket<Protocol BOOST_ASIO_SVC_TARG> -{ -public: - /// The native representation of a socket. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef typename basic_socket< - Protocol BOOST_ASIO_SVC_TARG>::native_handle_type native_handle_type; -#endif - - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename Protocol::endpoint endpoint_type; - - /// Construct a basic_stream_socket without opening it. - /** - * This constructor creates a stream socket without opening it. The socket - * needs to be opened and then connected or accepted before data can be sent - * or received on it. - * - * @param io_context The io_context object that the stream socket will use to - * dispatch handlers for any asynchronous operations performed on the socket. - */ - explicit basic_stream_socket(boost::asio::io_context& io_context) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(io_context) - { - } - - /// Construct and open a basic_stream_socket. - /** - * This constructor creates and opens a stream socket. The socket needs to be - * connected or accepted before data can be sent or received on it. - * - * @param io_context The io_context object that the stream socket will use to - * dispatch handlers for any asynchronous operations performed on the socket. - * - * @param protocol An object specifying protocol parameters to be used. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_stream_socket(boost::asio::io_context& io_context, - const protocol_type& protocol) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(io_context, protocol) - { - } - - /// Construct a basic_stream_socket, opening it and binding it to the given - /// local endpoint. - /** - * This constructor creates a stream socket and automatically opens it bound - * to the specified endpoint on the local machine. The protocol used is the - * protocol associated with the given endpoint. - * - * @param io_context The io_context object that the stream socket will use to - * dispatch handlers for any asynchronous operations performed on the socket. - * - * @param endpoint An endpoint on the local machine to which the stream - * socket will be bound. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_stream_socket(boost::asio::io_context& io_context, - const endpoint_type& endpoint) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(io_context, endpoint) - { - } - - /// Construct a basic_stream_socket on an existing native socket. - /** - * This constructor creates a stream socket object to hold an existing native - * socket. - * - * @param io_context The io_context object that the stream socket will use to - * dispatch handlers for any asynchronous operations performed on the socket. - * - * @param protocol An object specifying protocol parameters to be used. - * - * @param native_socket The new underlying socket implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_stream_socket(boost::asio::io_context& io_context, - const protocol_type& protocol, const native_handle_type& native_socket) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>( - io_context, protocol, native_socket) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_stream_socket from another. - /** - * This constructor moves a stream socket from one object to another. - * - * @param other The other basic_stream_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_socket(io_context&) constructor. - */ - basic_stream_socket(basic_stream_socket&& other) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(std::move(other)) - { - } - - /// Move-assign a basic_stream_socket from another. - /** - * This assignment operator moves a stream socket from one object to another. - * - * @param other The other basic_stream_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_socket(io_context&) constructor. - */ - basic_stream_socket& operator=(basic_stream_socket&& other) - { - basic_socket<Protocol BOOST_ASIO_SVC_TARG>::operator=(std::move(other)); - return *this; - } - - /// Move-construct a basic_stream_socket from a socket of another protocol - /// type. - /** - * This constructor moves a stream socket from one object to another. - * - * @param other The other basic_stream_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_socket(io_context&) constructor. - */ - template <typename Protocol1 BOOST_ASIO_SVC_TPARAM1> - basic_stream_socket( - basic_stream_socket<Protocol1 BOOST_ASIO_SVC_TARG1>&& other, - typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0) - : basic_socket<Protocol BOOST_ASIO_SVC_TARG>(std::move(other)) - { - } - - /// Move-assign a basic_stream_socket from a socket of another protocol type. - /** - * This assignment operator moves a stream socket from one object to another. - * - * @param other The other basic_stream_socket object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_socket(io_context&) constructor. - */ - template <typename Protocol1 BOOST_ASIO_SVC_TPARAM1> - typename enable_if<is_convertible<Protocol1, Protocol>::value, - basic_stream_socket>::type& operator=( - basic_stream_socket<Protocol1 BOOST_ASIO_SVC_TARG1>&& other) - { - basic_socket<Protocol BOOST_ASIO_SVC_TARG>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroys the socket. - /** - * This function destroys the socket, cancelling any outstanding asynchronous - * operations associated with the socket as if by calling @c cancel. - */ - ~basic_stream_socket() - { - } - - /// Send some data on the socket. - /** - * This function is used to send data on the stream socket. The function - * call will block until one or more bytes of the data has been sent - * successfully, or an until error occurs. - * - * @param buffers One or more data buffers to be sent on the socket. - * - * @returns The number of bytes sent. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The send operation may not transmit all of the data to the peer. - * Consider using the @ref write function if you need to ensure that all data - * is written before the blocking operation completes. - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code - * socket.send(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t send(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().send( - this->get_implementation(), buffers, 0, ec); - boost::asio::detail::throw_error(ec, "send"); - return s; - } - - /// Send some data on the socket. - /** - * This function is used to send data on the stream socket. The function - * call will block until one or more bytes of the data has been sent - * successfully, or an until error occurs. - * - * @param buffers One or more data buffers to be sent on the socket. - * - * @param flags Flags specifying how the send call is to be made. - * - * @returns The number of bytes sent. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The send operation may not transmit all of the data to the peer. - * Consider using the @ref write function if you need to ensure that all data - * is written before the blocking operation completes. - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code - * socket.send(boost::asio::buffer(data, size), 0); - * @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t send(const ConstBufferSequence& buffers, - socket_base::message_flags flags) - { - boost::system::error_code ec; - std::size_t s = this->get_service().send( - this->get_implementation(), buffers, flags, ec); - boost::asio::detail::throw_error(ec, "send"); - return s; - } - - /// Send some data on the socket. - /** - * This function is used to send data on the stream socket. The function - * call will block until one or more bytes of the data has been sent - * successfully, or an until error occurs. - * - * @param buffers One or more data buffers to be sent on the socket. - * - * @param flags Flags specifying how the send call is to be made. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes sent. Returns 0 if an error occurred. - * - * @note The send operation may not transmit all of the data to the peer. - * Consider using the @ref write function if you need to ensure that all data - * is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return this->get_service().send( - this->get_implementation(), buffers, flags, ec); - } - - /// Start an asynchronous send. - /** - * This function is used to asynchronously send data on the stream socket. - * The function call always returns immediately. - * - * @param buffers One or more data buffers to be sent on the socket. Although - * the buffers object may be copied as necessary, ownership of the underlying - * memory blocks is retained by the caller, which must guarantee that they - * remain valid until the handler is called. - * - * @param handler The handler to be called when the send operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes sent. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The send operation may not transmit all of the data to the peer. - * Consider using the @ref async_write function if you need to ensure that all - * data is written before the asynchronous operation completes. - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code - * socket.async_send(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_send( - this->get_implementation(), buffers, 0, - BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_send( - this->get_implementation(), buffers, 0, - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Start an asynchronous send. - /** - * This function is used to asynchronously send data on the stream socket. - * The function call always returns immediately. - * - * @param buffers One or more data buffers to be sent on the socket. Although - * the buffers object may be copied as necessary, ownership of the underlying - * memory blocks is retained by the caller, which must guarantee that they - * remain valid until the handler is called. - * - * @param flags Flags specifying how the send call is to be made. - * - * @param handler The handler to be called when the send operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes sent. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The send operation may not transmit all of the data to the peer. - * Consider using the @ref async_write function if you need to ensure that all - * data is written before the asynchronous operation completes. - * - * @par Example - * To send a single data buffer use the @ref buffer function as follows: - * @code - * socket.async_send(boost::asio::buffer(data, size), 0, handler); - * @endcode - * See the @ref buffer documentation for information on sending multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_send( - this->get_implementation(), buffers, flags, - BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_send( - this->get_implementation(), buffers, flags, - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Receive some data on the socket. - /** - * This function is used to receive data on the stream socket. The function - * call will block until one or more bytes of data has been received - * successfully, or until an error occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @returns The number of bytes received. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The receive operation may not receive all of the requested number of - * 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. - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * socket.receive(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t receive(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().receive( - this->get_implementation(), buffers, 0, ec); - boost::asio::detail::throw_error(ec, "receive"); - return s; - } - - /// Receive some data on the socket. - /** - * This function is used to receive data on the stream socket. The function - * call will block until one or more bytes of data has been received - * successfully, or until an error occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param flags Flags specifying how the receive call is to be made. - * - * @returns The number of bytes received. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The receive operation may not receive all of the requested number of - * 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. - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * socket.receive(boost::asio::buffer(data, size), 0); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags) - { - boost::system::error_code ec; - std::size_t s = this->get_service().receive( - this->get_implementation(), buffers, flags, ec); - boost::asio::detail::throw_error(ec, "receive"); - return s; - } - - /// Receive some data on a connected socket. - /** - * This function is used to receive data on the stream socket. The function - * call will block until one or more bytes of data has been received - * successfully, or until an error occurs. - * - * @param buffers One or more buffers into which the data will be received. - * - * @param flags Flags specifying how the receive call is to be made. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes received. Returns 0 if an error occurred. - * - * @note The receive operation may not receive all of the requested number of - * 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 MutableBufferSequence> - std::size_t receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return this->get_service().receive( - this->get_implementation(), buffers, flags, ec); - } - - /// Start an asynchronous receive. - /** - * This function is used to asynchronously receive data from the stream - * socket. The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be received. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the receive operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes received. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The receive operation may not receive all of the requested number of - * bytes. Consider using the @ref async_read function if you need to ensure - * that the requested amount of data is received before the asynchronous - * operation completes. - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * socket.async_receive(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_receive(this->get_implementation(), - buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_receive(this->get_implementation(), - buffers, 0, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Start an asynchronous receive. - /** - * This function is used to asynchronously receive data from the stream - * socket. The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be received. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param flags Flags specifying how the receive call is to be made. - * - * @param handler The handler to be called when the receive operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes received. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The receive operation may not receive all of the requested number of - * bytes. Consider using the @ref async_read function if you need to ensure - * that the requested amount of data is received before the asynchronous - * operation completes. - * - * @par Example - * To receive into a single data buffer use the @ref buffer function as - * follows: - * @code - * socket.async_receive(boost::asio::buffer(data, size), 0, handler); - * @endcode - * See the @ref buffer documentation for information on receiving into - * multiple buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_receive(this->get_implementation(), - buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_receive(this->get_implementation(), - buffers, flags, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Write some data to the socket. - /** - * This function is used to write data to the stream socket. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the socket. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * socket.write_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().send( - this->get_implementation(), buffers, 0, ec); - boost::asio::detail::throw_error(ec, "write_some"); - return s; - } - - /// Write some data to the socket. - /** - * This function is used to write data to the stream socket. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the socket. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().send(this->get_implementation(), buffers, 0, ec); - } - - /// Start an asynchronous write. - /** - * This function is used to asynchronously write data to the stream socket. - * The function call always returns immediately. - * - * @param buffers One or more data buffers to be written to the socket. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The write operation may not transmit all of the data to the peer. - * Consider using the @ref async_write function if you need to ensure that all - * data is written before the asynchronous operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * socket.async_write_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_send(this->get_implementation(), - buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_send(this->get_implementation(), - buffers, 0, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - - /// Read some data from the socket. - /** - * This function is used to read data from the stream socket. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The read_some operation may not read all of the requested number of - * 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. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * socket.read_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().receive( - this->get_implementation(), buffers, 0, ec); - boost::asio::detail::throw_error(ec, "read_some"); - return s; - } - - /// Read some data from the socket. - /** - * This function is used to read data from the stream socket. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().receive( - this->get_implementation(), buffers, 0, ec); - } - - /// Start an asynchronous read. - /** - * This function is used to asynchronously read data from the stream socket. - * The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The read operation may not read all of the requested number of bytes. - * Consider using the @ref async_read function if you need to ensure that the - * requested amount of data is read before the asynchronous operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * socket.async_read_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_receive(this->get_implementation(), - buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_receive(this->get_implementation(), - buffers, 0, init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_BASIC_STREAM_SOCKET_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_streambuf.hpp b/contrib/restricted/boost/boost/asio/basic_streambuf.hpp deleted file mode 100644 index e6f8f33f6b..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_streambuf.hpp +++ /dev/null @@ -1,454 +0,0 @@ -// -// basic_streambuf.hpp -// ~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_STREAMBUF_HPP -#define BOOST_ASIO_BASIC_STREAMBUF_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -#include <algorithm> -#include <cstring> -#include <stdexcept> -#include <streambuf> -#include <vector> -#include <boost/asio/basic_streambuf_fwd.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/detail/limits.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/throw_exception.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Automatically resizable buffer class based on std::streambuf. -/** - * The @c basic_streambuf class is derived from @c std::streambuf to associate - * the streambuf's input and output sequences with one or more character - * arrays. These character arrays are internal to the @c basic_streambuf - * object, but direct access to the array elements is provided to permit them - * to be used efficiently with I/O operations. Characters written to the output - * sequence of a @c basic_streambuf object are appended to the input sequence - * of the same object. - * - * The @c basic_streambuf class's public interface is intended to permit the - * following implementation strategies: - * - * @li A single contiguous character array, which is reallocated as necessary - * to accommodate changes in the size of the character sequence. This is the - * implementation approach currently used in Asio. - * - * @li A sequence of one or more character arrays, where each array is of the - * same size. Additional character array objects are appended to the sequence - * to accommodate changes in the size of the character sequence. - * - * @li A sequence of one or more character arrays of varying sizes. Additional - * character array objects are appended to the sequence to accommodate changes - * in the size of the character sequence. - * - * The constructor for basic_streambuf accepts a @c size_t argument specifying - * the maximum of the sum of the sizes of the input sequence and output - * sequence. During the lifetime of the @c basic_streambuf object, the following - * invariant holds: - * @code size() <= max_size()@endcode - * Any member function that would, if successful, cause the invariant to be - * violated shall throw an exception of class @c std::length_error. - * - * The constructor for @c basic_streambuf takes an Allocator argument. A copy - * of this argument is used for any memory allocation performed, by the - * constructor and by all member functions, during the lifetime of each @c - * basic_streambuf object. - * - * @par Examples - * Writing directly from an streambuf to a socket: - * @code - * boost::asio::streambuf b; - * std::ostream os(&b); - * os << "Hello, World!\n"; - * - * // try sending some data in input sequence - * size_t n = sock.send(b.data()); - * - * b.consume(n); // sent data is removed from input sequence - * @endcode - * - * Reading from a socket directly into a streambuf: - * @code - * boost::asio::streambuf b; - * - * // reserve 512 bytes in output sequence - * boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512); - * - * size_t n = sock.receive(bufs); - * - * // received data is "committed" from output sequence to input sequence - * b.commit(n); - * - * std::istream is(&b); - * std::string s; - * is >> s; - * @endcode - */ -#if defined(GENERATING_DOCUMENTATION) -template <typename Allocator = std::allocator<char> > -#else -template <typename Allocator> -#endif -class basic_streambuf - : public std::streambuf, - private noncopyable -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The type used to represent the input sequence as a list of buffers. - typedef implementation_defined const_buffers_type; - - /// The type used to represent the output sequence as a list of buffers. - typedef implementation_defined mutable_buffers_type; -#else - typedef BOOST_ASIO_CONST_BUFFER const_buffers_type; - typedef BOOST_ASIO_MUTABLE_BUFFER mutable_buffers_type; -#endif - - /// Construct a basic_streambuf object. - /** - * Constructs a streambuf with the specified maximum size. The initial size - * of the streambuf's input sequence is 0. - */ - explicit basic_streambuf( - std::size_t maximum_size = (std::numeric_limits<std::size_t>::max)(), - const Allocator& allocator = Allocator()) - : max_size_(maximum_size), - buffer_(allocator) - { - std::size_t pend = (std::min<std::size_t>)(max_size_, buffer_delta); - buffer_.resize((std::max<std::size_t>)(pend, 1)); - setg(&buffer_[0], &buffer_[0], &buffer_[0]); - setp(&buffer_[0], &buffer_[0] + pend); - } - - /// Get the size of the input sequence. - /** - * @returns The size of the input sequence. The value is equal to that - * calculated for @c s in the following code: - * @code - * size_t s = 0; - * const_buffers_type bufs = data(); - * const_buffers_type::const_iterator i = bufs.begin(); - * while (i != bufs.end()) - * { - * const_buffer buf(*i++); - * s += buf.size(); - * } - * @endcode - */ - std::size_t size() const BOOST_ASIO_NOEXCEPT - { - return pptr() - gptr(); - } - - /// Get the maximum size of the basic_streambuf. - /** - * @returns The allowed maximum of the sum of the sizes of the input sequence - * and output sequence. - */ - std::size_t max_size() const BOOST_ASIO_NOEXCEPT - { - return max_size_; - } - - /// Get the current capacity of the basic_streambuf. - /** - * @returns The current total capacity of the streambuf, i.e. for both the - * input sequence and output sequence. - */ - std::size_t capacity() const BOOST_ASIO_NOEXCEPT - { - return buffer_.capacity(); - } - - /// Get a list of buffers that represents the input sequence. - /** - * @returns An object of type @c const_buffers_type that satisfies - * ConstBufferSequence requirements, representing all character arrays in the - * input sequence. - * - * @note The returned object is invalidated by any @c basic_streambuf member - * function that modifies the input sequence or output sequence. - */ - const_buffers_type data() const BOOST_ASIO_NOEXCEPT - { - return boost::asio::buffer(boost::asio::const_buffer(gptr(), - (pptr() - gptr()) * sizeof(char_type))); - } - - /// Get a list of buffers that represents the output sequence, with the given - /// size. - /** - * Ensures that the output sequence can accommodate @c n characters, - * reallocating character array objects as necessary. - * - * @returns An object of type @c mutable_buffers_type that satisfies - * MutableBufferSequence requirements, representing character array objects - * at the start of the output sequence such that the sum of the buffer sizes - * is @c n. - * - * @throws std::length_error If <tt>size() + n > max_size()</tt>. - * - * @note The returned object is invalidated by any @c basic_streambuf member - * function that modifies the input sequence or output sequence. - */ - mutable_buffers_type prepare(std::size_t n) - { - reserve(n); - return boost::asio::buffer(boost::asio::mutable_buffer( - pptr(), n * sizeof(char_type))); - } - - /// Move characters from the output sequence to the input sequence. - /** - * Appends @c n characters from the start of the output sequence to the input - * sequence. The beginning of the output sequence is advanced by @c n - * characters. - * - * Requires a preceding call <tt>prepare(x)</tt> where <tt>x >= n</tt>, and - * no intervening operations that modify the input or output sequence. - * - * @note If @c n is greater than the size of the output sequence, the entire - * output sequence is moved to the input sequence and no error is issued. - */ - void commit(std::size_t n) - { - n = std::min<std::size_t>(n, epptr() - pptr()); - pbump(static_cast<int>(n)); - setg(eback(), gptr(), pptr()); - } - - /// Remove characters from the input sequence. - /** - * Removes @c n characters from the beginning of the input sequence. - * - * @note If @c n is greater than the size of the input sequence, the entire - * input sequence is consumed and no error is issued. - */ - void consume(std::size_t n) - { - if (egptr() < pptr()) - setg(&buffer_[0], gptr(), pptr()); - if (gptr() + n > pptr()) - n = pptr() - gptr(); - gbump(static_cast<int>(n)); - } - -protected: - enum { buffer_delta = 128 }; - - /// Override std::streambuf behaviour. - /** - * Behaves according to the specification of @c std::streambuf::underflow(). - */ - int_type underflow() - { - if (gptr() < pptr()) - { - setg(&buffer_[0], gptr(), pptr()); - return traits_type::to_int_type(*gptr()); - } - else - { - return traits_type::eof(); - } - } - - /// Override std::streambuf behaviour. - /** - * Behaves according to the specification of @c std::streambuf::overflow(), - * with the specialisation that @c std::length_error is thrown if appending - * the character to the input sequence would require the condition - * <tt>size() > max_size()</tt> to be true. - */ - int_type overflow(int_type c) - { - if (!traits_type::eq_int_type(c, traits_type::eof())) - { - if (pptr() == epptr()) - { - std::size_t buffer_size = pptr() - gptr(); - if (buffer_size < max_size_ && max_size_ - buffer_size < buffer_delta) - { - reserve(max_size_ - buffer_size); - } - else - { - reserve(buffer_delta); - } - } - - *pptr() = traits_type::to_char_type(c); - pbump(1); - return c; - } - - return traits_type::not_eof(c); - } - - void reserve(std::size_t n) - { - // Get current stream positions as offsets. - std::size_t gnext = gptr() - &buffer_[0]; - std::size_t pnext = pptr() - &buffer_[0]; - std::size_t pend = epptr() - &buffer_[0]; - - // Check if there is already enough space in the put area. - if (n <= pend - pnext) - { - return; - } - - // Shift existing contents of get area to start of buffer. - if (gnext > 0) - { - pnext -= gnext; - std::memmove(&buffer_[0], &buffer_[0] + gnext, pnext); - } - - // Ensure buffer is large enough to hold at least the specified size. - if (n > pend - pnext) - { - if (n <= max_size_ && pnext <= max_size_ - n) - { - pend = pnext + n; - buffer_.resize((std::max<std::size_t>)(pend, 1)); - } - else - { - std::length_error ex("boost::asio::streambuf too long"); - boost::asio::detail::throw_exception(ex); - } - } - - // Update stream positions. - setg(&buffer_[0], &buffer_[0], &buffer_[0] + pnext); - setp(&buffer_[0] + pnext, &buffer_[0] + pend); - } - -private: - std::size_t max_size_; - std::vector<char_type, Allocator> buffer_; - - // Helper function to get the preferred size for reading data. - friend std::size_t read_size_helper( - basic_streambuf& sb, std::size_t max_size) - { - return std::min<std::size_t>( - std::max<std::size_t>(512, sb.buffer_.capacity() - sb.size()), - std::min<std::size_t>(max_size, sb.max_size() - sb.size())); - } -}; - -/// Adapts basic_streambuf to the dynamic buffer sequence type requirements. -#if defined(GENERATING_DOCUMENTATION) -template <typename Allocator = std::allocator<char> > -#else -template <typename Allocator> -#endif -class basic_streambuf_ref -{ -public: - /// The type used to represent the input sequence as a list of buffers. - typedef typename basic_streambuf<Allocator>::const_buffers_type - const_buffers_type; - - /// The type used to represent the output sequence as a list of buffers. - typedef typename basic_streambuf<Allocator>::mutable_buffers_type - mutable_buffers_type; - - /// Construct a basic_streambuf_ref for the given basic_streambuf object. - explicit basic_streambuf_ref(basic_streambuf<Allocator>& sb) - : sb_(sb) - { - } - - /// Copy construct a basic_streambuf_ref. - basic_streambuf_ref(const basic_streambuf_ref& other) BOOST_ASIO_NOEXCEPT - : sb_(other.sb_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move construct a basic_streambuf_ref. - basic_streambuf_ref(basic_streambuf_ref&& other) BOOST_ASIO_NOEXCEPT - : sb_(other.sb_) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Get the size of the input sequence. - std::size_t size() const BOOST_ASIO_NOEXCEPT - { - return sb_.size(); - } - - /// Get the maximum size of the dynamic buffer. - std::size_t max_size() const BOOST_ASIO_NOEXCEPT - { - return sb_.max_size(); - } - - /// Get the current capacity of the dynamic buffer. - std::size_t capacity() const BOOST_ASIO_NOEXCEPT - { - return sb_.capacity(); - } - - /// Get a list of buffers that represents the input sequence. - const_buffers_type data() const BOOST_ASIO_NOEXCEPT - { - return sb_.data(); - } - - /// Get a list of buffers that represents the output sequence, with the given - /// size. - mutable_buffers_type prepare(std::size_t n) - { - return sb_.prepare(n); - } - - /// Move bytes from the output sequence to the input sequence. - void commit(std::size_t n) - { - return sb_.commit(n); - } - - /// Remove characters from the input sequence. - void consume(std::size_t n) - { - return sb_.consume(n); - } - -private: - basic_streambuf<Allocator>& sb_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -#endif // BOOST_ASIO_BASIC_STREAMBUF_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_streambuf_fwd.hpp b/contrib/restricted/boost/boost/asio/basic_streambuf_fwd.hpp deleted file mode 100644 index f2ef522d9b..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_streambuf_fwd.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// -// basic_streambuf_fwd.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_STREAMBUF_FWD_HPP -#define BOOST_ASIO_BASIC_STREAMBUF_FWD_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -#include <memory> - -namespace boost { -namespace asio { - -template <typename Allocator = std::allocator<char> > -class basic_streambuf; - -template <typename Allocator = std::allocator<char> > -class basic_streambuf_ref; - -} // namespace asio -} // namespace boost - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -#endif // BOOST_ASIO_BASIC_STREAMBUF_FWD_HPP diff --git a/contrib/restricted/boost/boost/asio/basic_waitable_timer.hpp b/contrib/restricted/boost/boost/asio/basic_waitable_timer.hpp deleted file mode 100644 index 6dc4bded98..0000000000 --- a/contrib/restricted/boost/boost/asio/basic_waitable_timer.hpp +++ /dev/null @@ -1,707 +0,0 @@ -// -// basic_waitable_timer.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP -#define BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/wait_traits.hpp> - -#if defined(BOOST_ASIO_HAS_MOVE) -# include <utility> -#endif // defined(BOOST_ASIO_HAS_MOVE) - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/waitable_timer_service.hpp> -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/detail/chrono_time_traits.hpp> -# include <boost/asio/detail/deadline_timer_service.hpp> -# define BOOST_ASIO_SVC_T \ - detail::deadline_timer_service< \ - detail::chrono_time_traits<Clock, WaitTraits> > -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -#if !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL) -#define BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL - -// Forward declaration with defaulted arguments. -template <typename Clock, - typename WaitTraits = boost::asio::wait_traits<Clock> - BOOST_ASIO_SVC_TPARAM_DEF2(= waitable_timer_service<Clock, WaitTraits>)> -class basic_waitable_timer; - -#endif // !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL) - -/// Provides waitable timer functionality. -/** - * The basic_waitable_timer class template provides the ability to perform a - * blocking or asynchronous wait for a timer to expire. - * - * A waitable timer is always in one of two states: "expired" or "not expired". - * If the wait() or async_wait() function is called on an expired timer, the - * wait operation will complete immediately. - * - * Most applications will use one of the boost::asio::steady_timer, - * boost::asio::system_timer or boost::asio::high_resolution_timer typedefs. - * - * @note This waitable timer functionality is for use with the C++11 standard - * library's @c <chrono> facility, or with the Boost.Chrono library. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Examples - * Performing a blocking wait (C++11): - * @code - * // Construct a timer without setting an expiry time. - * boost::asio::steady_timer timer(io_context); - * - * // Set an expiry time relative to now. - * timer.expires_after(std::chrono::seconds(5)); - * - * // Wait for the timer to expire. - * timer.wait(); - * @endcode - * - * @par - * Performing an asynchronous wait (C++11): - * @code - * void handler(const boost::system::error_code& error) - * { - * if (!error) - * { - * // Timer expired. - * } - * } - * - * ... - * - * // Construct a timer with an absolute expiry time. - * boost::asio::steady_timer timer(io_context, - * std::chrono::steady_clock::now() + std::chrono::seconds(60)); - * - * // Start an asynchronous wait. - * timer.async_wait(handler); - * @endcode - * - * @par Changing an active waitable timer's expiry time - * - * Changing the expiry time of a timer while there are pending asynchronous - * waits causes those wait operations to be cancelled. To ensure that the action - * associated with the timer is performed only once, use something like this: - * used: - * - * @code - * void on_some_event() - * { - * if (my_timer.expires_after(seconds(5)) > 0) - * { - * // We managed to cancel the timer. Start new asynchronous wait. - * my_timer.async_wait(on_timeout); - * } - * else - * { - * // Too late, timer has already expired! - * } - * } - * - * void on_timeout(const boost::system::error_code& e) - * { - * if (e != boost::asio::error::operation_aborted) - * { - * // Timer was not cancelled, take necessary action. - * } - * } - * @endcode - * - * @li The boost::asio::basic_waitable_timer::expires_after() function - * cancels any pending asynchronous waits, and returns the number of - * asynchronous waits that were cancelled. If it returns 0 then you were too - * late and the wait handler has already been executed, or will soon be - * executed. If it returns 1 then the wait handler was successfully cancelled. - * - * @li If a wait handler is cancelled, the boost::system::error_code passed to - * it contains the value boost::asio::error::operation_aborted. - */ -template <typename Clock, typename WaitTraits BOOST_ASIO_SVC_TPARAM> -class basic_waitable_timer - : BOOST_ASIO_SVC_ACCESS basic_io_object<BOOST_ASIO_SVC_T> -{ -public: - /// The type of the executor associated with the object. - typedef io_context::executor_type executor_type; - - /// The clock type. - typedef Clock clock_type; - - /// The duration type of the clock. - typedef typename clock_type::duration duration; - - /// The time point type of the clock. - typedef typename clock_type::time_point time_point; - - /// The wait traits type. - typedef WaitTraits traits_type; - - /// Constructor. - /** - * This constructor creates a timer without setting an expiry time. The - * expires_at() or expires_after() functions must be called to set an expiry - * time before the timer can be waited on. - * - * @param io_context The io_context object that the timer will use to dispatch - * handlers for any asynchronous operations performed on the timer. - */ - explicit basic_waitable_timer(boost::asio::io_context& io_context) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - } - - /// Constructor to set a particular expiry time as an absolute time. - /** - * This constructor creates a timer and sets the expiry time. - * - * @param io_context The io_context object that the timer will use to dispatch - * handlers for any asynchronous operations performed on the timer. - * - * @param expiry_time The expiry time to be used for the timer, expressed - * as an absolute time. - */ - basic_waitable_timer(boost::asio::io_context& io_context, - const time_point& expiry_time) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().expires_at(this->get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_at"); - } - - /// Constructor to set a particular expiry time relative to now. - /** - * This constructor creates a timer and sets the expiry time. - * - * @param io_context The io_context object that the timer will use to dispatch - * handlers for any asynchronous operations performed on the timer. - * - * @param expiry_time The expiry time to be used for the timer, relative to - * now. - */ - basic_waitable_timer(boost::asio::io_context& io_context, - const duration& expiry_time) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().expires_after( - this->get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_after"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_waitable_timer from another. - /** - * This constructor moves a timer from one object to another. - * - * @param other The other basic_waitable_timer object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_waitable_timer(io_context&) constructor. - */ - basic_waitable_timer(basic_waitable_timer&& other) - : basic_io_object<BOOST_ASIO_SVC_T>(std::move(other)) - { - } - - /// Move-assign a basic_waitable_timer from another. - /** - * This assignment operator moves a timer from one object to another. Cancels - * any outstanding asynchronous operations associated with the target object. - * - * @param other The other basic_waitable_timer object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_waitable_timer(io_context&) constructor. - */ - basic_waitable_timer& operator=(basic_waitable_timer&& other) - { - basic_io_object<BOOST_ASIO_SVC_T>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroys the timer. - /** - * This function destroys the timer, cancelling any outstanding asynchronous - * wait operations associated with the timer as if by calling @c cancel. - */ - ~basic_waitable_timer() - { - } - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - // These functions are provided by basic_io_object<>. -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_context() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_service() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_executor(); - } -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - - /// Cancel any asynchronous operations that are waiting on the timer. - /** - * This function forces the completion of any pending asynchronous wait - * operations against the timer. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @return The number of asynchronous operations that were cancelled. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when cancel() is called, then the - * handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel() - { - boost::system::error_code ec; - std::size_t s = this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - return s; - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use non-error_code overload.) Cancel any asynchronous - /// operations that are waiting on the timer. - /** - * This function forces the completion of any pending asynchronous wait - * operations against the timer. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. - * - * @note If the timer has already expired when cancel() is called, then the - * handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel(boost::system::error_code& ec) - { - return this->get_service().cancel(this->get_implementation(), ec); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Cancels one asynchronous operation that is waiting on the timer. - /** - * This function forces the completion of one pending asynchronous wait - * operation against the timer. Handlers are cancelled in FIFO order. The - * handler for the cancelled operation will be invoked with the - * boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @return The number of asynchronous operations that were cancelled. That is, - * either 0 or 1. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when cancel_one() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel_one() - { - boost::system::error_code ec; - std::size_t s = this->get_service().cancel_one( - this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel_one"); - return s; - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use non-error_code overload.) Cancels one asynchronous - /// operation that is waiting on the timer. - /** - * This function forces the completion of one pending asynchronous wait - * operation against the timer. Handlers are cancelled in FIFO order. The - * handler for the cancelled operation will be invoked with the - * boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. That is, - * either 0 or 1. - * - * @note If the timer has already expired when cancel_one() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel_one(boost::system::error_code& ec) - { - return this->get_service().cancel_one(this->get_implementation(), ec); - } - - /// (Deprecated: Use expiry().) Get the timer's expiry time as an absolute - /// time. - /** - * This function may be used to obtain the timer's current expiry time. - * Whether the timer has expired or not does not affect this value. - */ - time_point expires_at() const - { - return this->get_service().expires_at(this->get_implementation()); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the timer's expiry time as an absolute time. - /** - * This function may be used to obtain the timer's current expiry time. - * Whether the timer has expired or not does not affect this value. - */ - time_point expiry() const - { - return this->get_service().expiry(this->get_implementation()); - } - - /// Set the timer's expiry time as an absolute time. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @return The number of asynchronous operations that were cancelled. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when expires_at() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_at(const time_point& expiry_time) - { - boost::system::error_code ec; - std::size_t s = this->get_service().expires_at( - this->get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_at"); - return s; - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use non-error_code overload.) Set the timer's expiry time as - /// an absolute time. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. - * - * @note If the timer has already expired when expires_at() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_at(const time_point& expiry_time, - boost::system::error_code& ec) - { - return this->get_service().expires_at( - this->get_implementation(), expiry_time, ec); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Set the timer's expiry time relative to now. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @return The number of asynchronous operations that were cancelled. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when expires_after() is called, - * then the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_after(const duration& expiry_time) - { - boost::system::error_code ec; - std::size_t s = this->get_service().expires_after( - this->get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_after"); - return s; - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the timer's expiry time relative to now. - /** - * This function may be used to obtain the timer's current expiry time. - * Whether the timer has expired or not does not affect this value. - */ - duration expires_from_now() const - { - return this->get_service().expires_from_now(this->get_implementation()); - } - - /// (Deprecated: Use expires_after().) Set the timer's expiry time relative - /// to now. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @return The number of asynchronous operations that were cancelled. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when expires_from_now() is called, - * then the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_from_now(const duration& expiry_time) - { - boost::system::error_code ec; - std::size_t s = this->get_service().expires_from_now( - this->get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_from_now"); - return s; - } - - /// (Deprecated: Use expires_after().) Set the timer's expiry time relative - /// to now. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. - * - * @note If the timer has already expired when expires_from_now() is called, - * then the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_from_now(const duration& expiry_time, - boost::system::error_code& ec) - { - return this->get_service().expires_from_now( - this->get_implementation(), expiry_time, ec); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Perform a blocking wait on the timer. - /** - * This function is used to wait for the timer to expire. This function - * blocks and does not return until the timer has expired. - * - * @throws boost::system::system_error Thrown on failure. - */ - void wait() - { - boost::system::error_code ec; - this->get_service().wait(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "wait"); - } - - /// Perform a blocking wait on the timer. - /** - * This function is used to wait for the timer to expire. This function - * blocks and does not return until the timer has expired. - * - * @param ec Set to indicate what error occurred, if any. - */ - void wait(boost::system::error_code& ec) - { - this->get_service().wait(this->get_implementation(), ec); - } - - /// Start an asynchronous wait on the timer. - /** - * This function may be used to initiate an asynchronous wait against the - * timer. It always returns immediately. - * - * For each call to async_wait(), the supplied handler will be called exactly - * once. The handler will be called when: - * - * @li The timer has expired. - * - * @li The timer was cancelled, in which case the handler is passed the error - * code boost::asio::error::operation_aborted. - * - * @param handler The handler to be called when the timer expires. Copies - * will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WaitHandler. - BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - return this->get_service().async_wait(this->get_implementation(), - BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - this->get_service().async_wait(this->get_implementation(), - init.completion_handler); - - return init.result.get(); -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - } - -private: - // Disallow copying and assignment. - basic_waitable_timer(const basic_waitable_timer&) BOOST_ASIO_DELETED; - basic_waitable_timer& operator=( - const basic_waitable_timer&) BOOST_ASIO_DELETED; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# undef BOOST_ASIO_SVC_T -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP diff --git a/contrib/restricted/boost/boost/asio/bind_executor.hpp b/contrib/restricted/boost/boost/asio/bind_executor.hpp deleted file mode 100644 index c4086b6135..0000000000 --- a/contrib/restricted/boost/boost/asio/bind_executor.hpp +++ /dev/null @@ -1,613 +0,0 @@ -// -// bind_executor.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BIND_EXECUTOR_HPP -#define BOOST_ASIO_BIND_EXECUTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/detail/variadic_templates.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/async_result.hpp> -#include <boost/asio/execution_context.hpp> -#include <boost/asio/is_executor.hpp> -#include <boost/asio/uses_executor.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename T> -struct executor_binder_check -{ - typedef void type; -}; - -// Helper to automatically define nested typedef result_type. - -template <typename T, typename = void> -struct executor_binder_result_type -{ -protected: - typedef void result_type_or_void; -}; - -template <typename T> -struct executor_binder_result_type<T, - typename executor_binder_check<typename T::result_type>::type> -{ - typedef typename T::result_type result_type; -protected: - typedef result_type result_type_or_void; -}; - -template <typename R> -struct executor_binder_result_type<R(*)()> -{ - typedef R result_type; -protected: - typedef result_type result_type_or_void; -}; - -template <typename R> -struct executor_binder_result_type<R(&)()> -{ - typedef R result_type; -protected: - typedef result_type result_type_or_void; -}; - -template <typename R, typename A1> -struct executor_binder_result_type<R(*)(A1)> -{ - typedef R result_type; -protected: - typedef result_type result_type_or_void; -}; - -template <typename R, typename A1> -struct executor_binder_result_type<R(&)(A1)> -{ - typedef R result_type; -protected: - typedef result_type result_type_or_void; -}; - -template <typename R, typename A1, typename A2> -struct executor_binder_result_type<R(*)(A1, A2)> -{ - typedef R result_type; -protected: - typedef result_type result_type_or_void; -}; - -template <typename R, typename A1, typename A2> -struct executor_binder_result_type<R(&)(A1, A2)> -{ - typedef R result_type; -protected: - typedef result_type result_type_or_void; -}; - -// Helper to automatically define nested typedef argument_type. - -template <typename T, typename = void> -struct executor_binder_argument_type {}; - -template <typename T> -struct executor_binder_argument_type<T, - typename executor_binder_check<typename T::argument_type>::type> -{ - typedef typename T::argument_type argument_type; -}; - -template <typename R, typename A1> -struct executor_binder_argument_type<R(*)(A1)> -{ - typedef A1 argument_type; -}; - -template <typename R, typename A1> -struct executor_binder_argument_type<R(&)(A1)> -{ - typedef A1 argument_type; -}; - -// Helper to automatically define nested typedefs first_argument_type and -// second_argument_type. - -template <typename T, typename = void> -struct executor_binder_argument_types {}; - -template <typename T> -struct executor_binder_argument_types<T, - typename executor_binder_check<typename T::first_argument_type>::type> -{ - typedef typename T::first_argument_type first_argument_type; - typedef typename T::second_argument_type second_argument_type; -}; - -template <typename R, typename A1, typename A2> -struct executor_binder_argument_type<R(*)(A1, A2)> -{ - typedef A1 first_argument_type; - typedef A2 second_argument_type; -}; - -template <typename R, typename A1, typename A2> -struct executor_binder_argument_type<R(&)(A1, A2)> -{ - typedef A1 first_argument_type; - typedef A2 second_argument_type; -}; - -// Helper to: -// - Apply the empty base optimisation to the executor. -// - Perform uses_executor construction of the target type, if required. - -template <typename T, typename Executor, bool UsesExecutor> -class executor_binder_base; - -template <typename T, typename Executor> -class executor_binder_base<T, Executor, true> - : protected Executor -{ -protected: - template <typename E, typename U> - executor_binder_base(BOOST_ASIO_MOVE_ARG(E) e, BOOST_ASIO_MOVE_ARG(U) u) - : executor_(BOOST_ASIO_MOVE_CAST(E)(e)), - target_(executor_arg_t(), executor_, BOOST_ASIO_MOVE_CAST(U)(u)) - { - } - - Executor executor_; - T target_; -}; - -template <typename T, typename Executor> -class executor_binder_base<T, Executor, false> -{ -protected: - template <typename E, typename U> - executor_binder_base(BOOST_ASIO_MOVE_ARG(E) e, BOOST_ASIO_MOVE_ARG(U) u) - : executor_(BOOST_ASIO_MOVE_CAST(E)(e)), - target_(BOOST_ASIO_MOVE_CAST(U)(u)) - { - } - - Executor executor_; - T target_; -}; - -// Helper to enable SFINAE on zero-argument operator() below. - -template <typename T, typename = void> -struct executor_binder_result_of0 -{ - typedef void type; -}; - -template <typename T> -struct executor_binder_result_of0<T, - typename executor_binder_check<typename result_of<T()>::type>::type> -{ - typedef typename result_of<T()>::type type; -}; - -} // namespace detail - -/// A call wrapper type to bind an executor of type @c Executor to an object of -/// type @c T. -template <typename T, typename Executor> -class executor_binder -#if !defined(GENERATING_DOCUMENTATION) - : public detail::executor_binder_result_type<T>, - public detail::executor_binder_argument_type<T>, - public detail::executor_binder_argument_types<T>, - private detail::executor_binder_base< - T, Executor, uses_executor<T, Executor>::value> -#endif // !defined(GENERATING_DOCUMENTATION) -{ -public: - /// The type of the target object. - typedef T target_type; - - /// The type of the associated executor. - typedef Executor executor_type; - -#if defined(GENERATING_DOCUMENTATION) - /// The return type if a function. - /** - * The type of @c result_type is based on the type @c T of the wrapper's - * target object: - * - * @li if @c T is a pointer to function type, @c result_type is a synonym for - * the return type of @c T; - * - * @li if @c T is a class type with a member type @c result_type, then @c - * result_type is a synonym for @c T::result_type; - * - * @li otherwise @c result_type is not defined. - */ - typedef see_below result_type; - - /// The type of the function's argument. - /** - * The type of @c argument_type is based on the type @c T of the wrapper's - * target object: - * - * @li if @c T is a pointer to a function type accepting a single argument, - * @c argument_type is a synonym for the return type of @c T; - * - * @li if @c T is a class type with a member type @c argument_type, then @c - * argument_type is a synonym for @c T::argument_type; - * - * @li otherwise @c argument_type is not defined. - */ - typedef see_below argument_type; - - /// The type of the function's first argument. - /** - * The type of @c first_argument_type is based on the type @c T of the - * wrapper's target object: - * - * @li if @c T is a pointer to a function type accepting two arguments, @c - * first_argument_type is a synonym for the return type of @c T; - * - * @li if @c T is a class type with a member type @c first_argument_type, - * then @c first_argument_type is a synonym for @c T::first_argument_type; - * - * @li otherwise @c first_argument_type is not defined. - */ - typedef see_below first_argument_type; - - /// The type of the function's second argument. - /** - * The type of @c second_argument_type is based on the type @c T of the - * wrapper's target object: - * - * @li if @c T is a pointer to a function type accepting two arguments, @c - * second_argument_type is a synonym for the return type of @c T; - * - * @li if @c T is a class type with a member type @c first_argument_type, - * then @c second_argument_type is a synonym for @c T::second_argument_type; - * - * @li otherwise @c second_argument_type is not defined. - */ - typedef see_below second_argument_type; -#endif // defined(GENERATING_DOCUMENTATION) - - /// Construct an executor wrapper for the specified object. - /** - * This constructor is only valid if the type @c T is constructible from type - * @c U. - */ - template <typename U> - executor_binder(executor_arg_t, const executor_type& e, - BOOST_ASIO_MOVE_ARG(U) u) - : base_type(e, BOOST_ASIO_MOVE_CAST(U)(u)) - { - } - - /// Copy constructor. - executor_binder(const executor_binder& other) - : base_type(other.get_executor(), other.get()) - { - } - - /// Construct a copy, but specify a different executor. - executor_binder(executor_arg_t, const executor_type& e, - const executor_binder& other) - : base_type(e, other.get()) - { - } - - /// Construct a copy of a different executor wrapper type. - /** - * This constructor is only valid if the @c Executor type is constructible - * from type @c OtherExecutor, and the type @c T is constructible from type - * @c U. - */ - template <typename U, typename OtherExecutor> - executor_binder(const executor_binder<U, OtherExecutor>& other) - : base_type(other.get_executor(), other.get()) - { - } - - /// Construct a copy of a different executor wrapper type, but specify a - /// different executor. - /** - * This constructor is only valid if the type @c T is constructible from type - * @c U. - */ - template <typename U, typename OtherExecutor> - executor_binder(executor_arg_t, const executor_type& e, - const executor_binder<U, OtherExecutor>& other) - : base_type(e, other.get()) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Move constructor. - executor_binder(executor_binder&& other) - : base_type(BOOST_ASIO_MOVE_CAST(executor_type)(other.get_executor()), - BOOST_ASIO_MOVE_CAST(T)(other.get())) - { - } - - /// Move construct the target object, but specify a different executor. - executor_binder(executor_arg_t, const executor_type& e, - executor_binder&& other) - : base_type(e, BOOST_ASIO_MOVE_CAST(T)(other.get())) - { - } - - /// Move construct from a different executor wrapper type. - template <typename U, typename OtherExecutor> - executor_binder(executor_binder<U, OtherExecutor>&& other) - : base_type(BOOST_ASIO_MOVE_CAST(OtherExecutor)(other.get_executor()), - BOOST_ASIO_MOVE_CAST(U)(other.get())) - { - } - - /// Move construct from a different executor wrapper type, but specify a - /// different executor. - template <typename U, typename OtherExecutor> - executor_binder(executor_arg_t, const executor_type& e, - executor_binder<U, OtherExecutor>&& other) - : base_type(e, BOOST_ASIO_MOVE_CAST(U)(other.get())) - { - } - -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destructor. - ~executor_binder() - { - } - - /// Obtain a reference to the target object. - target_type& get() BOOST_ASIO_NOEXCEPT - { - return this->target_; - } - - /// Obtain a reference to the target object. - const target_type& get() const BOOST_ASIO_NOEXCEPT - { - return this->target_; - } - - /// Obtain the associated executor. - executor_type get_executor() const BOOST_ASIO_NOEXCEPT - { - return this->executor_; - } - -#if defined(GENERATING_DOCUMENTATION) - - template <typename... Args> auto operator()(Args&& ...); - template <typename... Args> auto operator()(Args&& ...) const; - -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - /// Forwarding function call operator. - template <typename... Args> - typename result_of<T(Args...)>::type operator()( - BOOST_ASIO_MOVE_ARG(Args)... args) - { - return this->target_(BOOST_ASIO_MOVE_CAST(Args)(args)...); - } - - /// Forwarding function call operator. - template <typename... Args> - typename result_of<T(Args...)>::type operator()( - BOOST_ASIO_MOVE_ARG(Args)... args) const - { - return this->target_(BOOST_ASIO_MOVE_CAST(Args)(args)...); - } - -#elif defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER) - - typename detail::executor_binder_result_of0<T>::type operator()() - { - return this->target_(); - } - - typename detail::executor_binder_result_of0<T>::type operator()() const - { - return this->target_(); - } - -#define BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - typename result_of<T(BOOST_ASIO_VARIADIC_TARGS(n))>::type operator()( \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - return this->target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - typename result_of<T(BOOST_ASIO_VARIADIC_TARGS(n))>::type operator()( \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) const \ - { \ - return this->target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF) -#undef BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF - -#else // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER) - - typedef typename detail::executor_binder_result_type<T>::result_type_or_void - result_type_or_void; - - result_type_or_void operator()() - { - return this->target_(); - } - - result_type_or_void operator()() const - { - return this->target_(); - } - -#define BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - result_type_or_void operator()( \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - return this->target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - result_type_or_void operator()( \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) const \ - { \ - return this->target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF) -#undef BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF - -#endif // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER) - -private: - typedef detail::executor_binder_base<T, Executor, - uses_executor<T, Executor>::value> base_type; -}; - -/// Associate an object of type @c T with an executor of type @c Executor. -template <typename Executor, typename T> -inline executor_binder<typename decay<T>::type, Executor> -bind_executor(const Executor& ex, BOOST_ASIO_MOVE_ARG(T) t, - typename enable_if<is_executor<Executor>::value>::type* = 0) -{ - return executor_binder<typename decay<T>::type, Executor>( - executor_arg_t(), ex, BOOST_ASIO_MOVE_CAST(T)(t)); -} - -/// Associate an object of type @c T with an execution context's executor. -template <typename ExecutionContext, typename T> -inline executor_binder<typename decay<T>::type, - typename ExecutionContext::executor_type> -bind_executor(ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(T) t, - typename enable_if<is_convertible< - ExecutionContext&, execution_context&>::value>::type* = 0) -{ - return executor_binder<typename decay<T>::type, - typename ExecutionContext::executor_type>( - executor_arg_t(), ctx.get_executor(), BOOST_ASIO_MOVE_CAST(T)(t)); -} - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename T, typename Executor> -struct uses_executor<executor_binder<T, Executor>, Executor> - : true_type {}; - -template <typename T, typename Executor, typename Signature> -class async_result<executor_binder<T, Executor>, Signature> -{ -public: - typedef executor_binder< - typename async_result<T, Signature>::completion_handler_type, Executor> - completion_handler_type; - - typedef typename async_result<T, Signature>::return_type return_type; - - explicit async_result(executor_binder<T, Executor>& b) - : target_(b.get()) - { - } - - return_type get() - { - return target_.get(); - } - -private: - async_result(const async_result&) BOOST_ASIO_DELETED; - async_result& operator=(const async_result&) BOOST_ASIO_DELETED; - - async_result<T, Signature> target_; -}; - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename T, typename Executor, typename Signature> -struct handler_type<executor_binder<T, Executor>, Signature> -{ - typedef executor_binder< - typename handler_type<T, Signature>::type, Executor> type; -}; - -template <typename T, typename Executor> -class async_result<executor_binder<T, Executor> > -{ -public: - typedef typename async_result<T>::type type; - - explicit async_result(executor_binder<T, Executor>& b) - : target_(b.get()) - { - } - - type get() - { - return target_.get(); - } - -private: - async_result<T> target_; -}; - -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename T, typename Executor, typename Allocator> -struct associated_allocator<executor_binder<T, Executor>, Allocator> -{ - typedef typename associated_allocator<T, Allocator>::type type; - - static type get(const executor_binder<T, Executor>& b, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<T, Allocator>::get(b.get(), a); - } -}; - -template <typename T, typename Executor, typename Executor1> -struct associated_executor<executor_binder<T, Executor>, Executor1> -{ - typedef Executor type; - - static type get(const executor_binder<T, Executor>& b, - const Executor1& = Executor1()) BOOST_ASIO_NOEXCEPT - { - return b.get_executor(); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_BIND_EXECUTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/buffered_read_stream.hpp b/contrib/restricted/boost/boost/asio/buffered_read_stream.hpp deleted file mode 100644 index 28df23908d..0000000000 --- a/contrib/restricted/boost/boost/asio/buffered_read_stream.hpp +++ /dev/null @@ -1,259 +0,0 @@ -// -// buffered_read_stream.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BUFFERED_READ_STREAM_HPP -#define BOOST_ASIO_BUFFERED_READ_STREAM_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/buffered_read_stream_fwd.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/buffer_resize_guard.hpp> -#include <boost/asio/detail/buffered_stream_storage.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Adds buffering to the read-related operations of a stream. -/** - * The buffered_read_stream class template can be used to add buffering to the - * synchronous and asynchronous read operations of a stream. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream. - */ -template <typename Stream> -class buffered_read_stream - : private noncopyable -{ -public: - /// The type of the next layer. - typedef typename remove_reference<Stream>::type next_layer_type; - - /// The type of the lowest layer. - typedef typename next_layer_type::lowest_layer_type lowest_layer_type; - - /// The type of the executor associated with the object. - typedef typename lowest_layer_type::executor_type executor_type; - -#if defined(GENERATING_DOCUMENTATION) - /// The default buffer size. - static const std::size_t default_buffer_size = implementation_defined; -#else - BOOST_ASIO_STATIC_CONSTANT(std::size_t, default_buffer_size = 1024); -#endif - - /// Construct, passing the specified argument to initialise the next layer. - template <typename Arg> - explicit buffered_read_stream(Arg& a) - : next_layer_(a), - storage_(default_buffer_size) - { - } - - /// Construct, passing the specified argument to initialise the next layer. - template <typename Arg> - buffered_read_stream(Arg& a, std::size_t buffer_size) - : next_layer_(a), - storage_(buffer_size) - { - } - - /// Get a reference to the next layer. - next_layer_type& next_layer() - { - return next_layer_; - } - - /// Get a reference to the lowest layer. - lowest_layer_type& lowest_layer() - { - return next_layer_.lowest_layer(); - } - - /// Get a const reference to the lowest layer. - const lowest_layer_type& lowest_layer() const - { - return next_layer_.lowest_layer(); - } - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return next_layer_.lowest_layer().get_executor(); - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - boost::asio::io_context& get_io_context() - { - return next_layer_.get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - boost::asio::io_context& get_io_service() - { - return next_layer_.get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Close the stream. - void close() - { - next_layer_.close(); - } - - /// Close the stream. - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - next_layer_.close(ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Write the given data to the stream. Returns the number of bytes written. - /// Throws an exception on failure. - 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 ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return next_layer_.write_some(buffers, ec); - } - - /// Start an asynchronous write. The data being written must be valid for the - /// lifetime of the asynchronous operation. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - return next_layer_.async_write_some(buffers, - BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); - } - - /// Fill the buffer with some data. Returns the number of bytes placed in the - /// buffer as a result of the operation. Throws an exception on failure. - std::size_t fill(); - - /// Fill the buffer with some data. Returns the number of bytes placed in the - /// buffer as a result of the operation, or 0 if an error occurred. - std::size_t fill(boost::system::error_code& ec); - - /// Start an asynchronous fill. - template <typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_fill(BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - - /// Read some data from the stream. Returns the number of bytes read. Throws - /// an exception on failure. - template <typename MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers); - - /// Read some data from the stream. Returns the number of bytes read or 0 if - /// an error occurred. - template <typename MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec); - - /// 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 MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - - /// Peek at the incoming data on the stream. Returns the number of bytes read. - /// Throws an exception on failure. - template <typename MutableBufferSequence> - std::size_t peek(const MutableBufferSequence& buffers); - - /// Peek at the incoming data on the stream. Returns the number of bytes read, - /// or 0 if an error occurred. - template <typename MutableBufferSequence> - std::size_t peek(const MutableBufferSequence& buffers, - boost::system::error_code& ec); - - /// Determine the amount of data that may be read without blocking. - std::size_t in_avail() - { - return storage_.size(); - } - - /// Determine the amount of data that may be read without blocking. - std::size_t in_avail(boost::system::error_code& ec) - { - ec = boost::system::error_code(); - return storage_.size(); - } - -private: - /// Copy data out of the internal buffer to the specified target buffer. - /// Returns the number of bytes copied. - template <typename MutableBufferSequence> - std::size_t copy(const MutableBufferSequence& buffers) - { - std::size_t bytes_copied = boost::asio::buffer_copy( - buffers, storage_.data(), storage_.size()); - storage_.consume(bytes_copied); - return bytes_copied; - } - - /// 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 MutableBufferSequence> - std::size_t peek_copy(const MutableBufferSequence& buffers) - { - return boost::asio::buffer_copy(buffers, storage_.data(), storage_.size()); - } - - /// The next layer. - Stream next_layer_; - - // The data in the buffer. - detail::buffered_stream_storage storage_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/buffered_read_stream.hpp> - -#endif // BOOST_ASIO_BUFFERED_READ_STREAM_HPP diff --git a/contrib/restricted/boost/boost/asio/buffered_read_stream_fwd.hpp b/contrib/restricted/boost/boost/asio/buffered_read_stream_fwd.hpp deleted file mode 100644 index d6b0ad14be..0000000000 --- a/contrib/restricted/boost/boost/asio/buffered_read_stream_fwd.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// -// buffered_read_stream_fwd.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BUFFERED_READ_STREAM_FWD_HPP -#define BOOST_ASIO_BUFFERED_READ_STREAM_FWD_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -namespace boost { -namespace asio { - -template <typename Stream> -class buffered_read_stream; - -} // namespace asio -} // namespace boost - -#endif // BOOST_ASIO_BUFFERED_READ_STREAM_FWD_HPP diff --git a/contrib/restricted/boost/boost/asio/buffered_stream.hpp b/contrib/restricted/boost/boost/asio/buffered_stream.hpp deleted file mode 100644 index ada06e1d9c..0000000000 --- a/contrib/restricted/boost/boost/asio/buffered_stream.hpp +++ /dev/null @@ -1,280 +0,0 @@ -// -// buffered_stream.hpp -// ~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BUFFERED_STREAM_HPP -#define BOOST_ASIO_BUFFERED_STREAM_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/buffered_read_stream.hpp> -#include <boost/asio/buffered_write_stream.hpp> -#include <boost/asio/buffered_stream_fwd.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Adds buffering to the read- and write-related operations of a stream. -/** - * The buffered_stream class template can be used to add buffering to the - * synchronous and asynchronous read and write operations of a stream. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream. - */ -template <typename Stream> -class buffered_stream - : private noncopyable -{ -public: - /// The type of the next layer. - typedef typename remove_reference<Stream>::type next_layer_type; - - /// The type of the lowest layer. - typedef typename next_layer_type::lowest_layer_type lowest_layer_type; - - /// The type of the executor associated with the object. - typedef typename lowest_layer_type::executor_type executor_type; - - /// Construct, passing the specified argument to initialise the next layer. - template <typename Arg> - explicit buffered_stream(Arg& a) - : inner_stream_impl_(a), - stream_impl_(inner_stream_impl_) - { - } - - /// Construct, passing the specified argument to initialise the next layer. - template <typename Arg> - explicit buffered_stream(Arg& a, std::size_t read_buffer_size, - std::size_t write_buffer_size) - : inner_stream_impl_(a, write_buffer_size), - stream_impl_(inner_stream_impl_, read_buffer_size) - { - } - - /// Get a reference to the next layer. - next_layer_type& next_layer() - { - return stream_impl_.next_layer().next_layer(); - } - - /// Get a reference to the lowest layer. - lowest_layer_type& lowest_layer() - { - return stream_impl_.lowest_layer(); - } - - /// Get a const reference to the lowest layer. - const lowest_layer_type& lowest_layer() const - { - return stream_impl_.lowest_layer(); - } - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return stream_impl_.lowest_layer().get_executor(); - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - boost::asio::io_context& get_io_context() - { - return stream_impl_.get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - boost::asio::io_context& get_io_service() - { - return stream_impl_.get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Close the stream. - void close() - { - stream_impl_.close(); - } - - /// Close the stream. - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - stream_impl_.close(ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Flush all data from the buffer to the next layer. Returns the number of - /// bytes written to the next layer on the last write operation. Throws an - /// exception on failure. - std::size_t flush() - { - return stream_impl_.next_layer().flush(); - } - - /// Flush all data from the buffer to the next layer. Returns the number of - /// bytes written to the next layer on the last write operation, or 0 if an - /// error occurred. - std::size_t flush(boost::system::error_code& ec) - { - return stream_impl_.next_layer().flush(ec); - } - - /// Start an asynchronous flush. - template <typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_flush(BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - return stream_impl_.next_layer().async_flush( - BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); - } - - /// Write the given data to the stream. Returns the number of bytes written. - /// Throws an exception on failure. - 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 ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return stream_impl_.write_some(buffers, ec); - } - - /// Start an asynchronous write. The data being written must be valid for the - /// lifetime of the asynchronous operation. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - return stream_impl_.async_write_some(buffers, - BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); - } - - /// Fill the buffer with some data. Returns the number of bytes placed in the - /// buffer as a result of the operation. Throws an exception on failure. - std::size_t fill() - { - return stream_impl_.fill(); - } - - /// Fill the buffer with some data. Returns the number of bytes placed in the - /// buffer as a result of the operation, or 0 if an error occurred. - std::size_t fill(boost::system::error_code& ec) - { - return stream_impl_.fill(ec); - } - - /// Start an asynchronous fill. - template <typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_fill(BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - return stream_impl_.async_fill(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); - } - - /// Read some data from the stream. Returns the number of bytes read. Throws - /// an exception on failure. - 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return stream_impl_.read_some(buffers, ec); - } - - /// 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 MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - return stream_impl_.async_read_some(buffers, - BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); - } - - /// Peek at the incoming data on the stream. Returns the number of bytes read. - /// Throws an exception on failure. - 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 MutableBufferSequence> - std::size_t peek(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return stream_impl_.peek(buffers, ec); - } - - /// Determine the amount of data that may be read without blocking. - std::size_t in_avail() - { - return stream_impl_.in_avail(); - } - - /// Determine the amount of data that may be read without blocking. - std::size_t in_avail(boost::system::error_code& ec) - { - return stream_impl_.in_avail(ec); - } - -private: - // The buffered write stream. - typedef buffered_write_stream<Stream> write_stream_type; - write_stream_type inner_stream_impl_; - - // The buffered read stream. - typedef buffered_read_stream<write_stream_type&> read_stream_type; - read_stream_type stream_impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_BUFFERED_STREAM_HPP diff --git a/contrib/restricted/boost/boost/asio/buffered_stream_fwd.hpp b/contrib/restricted/boost/boost/asio/buffered_stream_fwd.hpp deleted file mode 100644 index a477f2be65..0000000000 --- a/contrib/restricted/boost/boost/asio/buffered_stream_fwd.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// -// buffered_stream_fwd.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BUFFERED_STREAM_FWD_HPP -#define BOOST_ASIO_BUFFERED_STREAM_FWD_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -namespace boost { -namespace asio { - -template <typename Stream> -class buffered_stream; - -} // namespace asio -} // namespace boost - -#endif // BOOST_ASIO_BUFFERED_STREAM_FWD_HPP diff --git a/contrib/restricted/boost/boost/asio/buffered_write_stream.hpp b/contrib/restricted/boost/boost/asio/buffered_write_stream.hpp deleted file mode 100644 index 3eacd5f150..0000000000 --- a/contrib/restricted/boost/boost/asio/buffered_write_stream.hpp +++ /dev/null @@ -1,251 +0,0 @@ -// -// buffered_write_stream.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BUFFERED_WRITE_STREAM_HPP -#define BOOST_ASIO_BUFFERED_WRITE_STREAM_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/buffered_write_stream_fwd.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/completion_condition.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/buffered_stream_storage.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/write.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Adds buffering to the write-related operations of a stream. -/** - * The buffered_write_stream class template can be used to add buffering to the - * synchronous and asynchronous write operations of a stream. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream. - */ -template <typename Stream> -class buffered_write_stream - : private noncopyable -{ -public: - /// The type of the next layer. - typedef typename remove_reference<Stream>::type next_layer_type; - - /// The type of the lowest layer. - typedef typename next_layer_type::lowest_layer_type lowest_layer_type; - - /// The type of the executor associated with the object. - typedef typename lowest_layer_type::executor_type executor_type; - -#if defined(GENERATING_DOCUMENTATION) - /// The default buffer size. - static const std::size_t default_buffer_size = implementation_defined; -#else - BOOST_ASIO_STATIC_CONSTANT(std::size_t, default_buffer_size = 1024); -#endif - - /// Construct, passing the specified argument to initialise the next layer. - template <typename Arg> - explicit buffered_write_stream(Arg& a) - : next_layer_(a), - storage_(default_buffer_size) - { - } - - /// Construct, passing the specified argument to initialise the next layer. - template <typename Arg> - buffered_write_stream(Arg& a, std::size_t buffer_size) - : next_layer_(a), - storage_(buffer_size) - { - } - - /// Get a reference to the next layer. - next_layer_type& next_layer() - { - return next_layer_; - } - - /// Get a reference to the lowest layer. - lowest_layer_type& lowest_layer() - { - return next_layer_.lowest_layer(); - } - - /// Get a const reference to the lowest layer. - const lowest_layer_type& lowest_layer() const - { - return next_layer_.lowest_layer(); - } - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return next_layer_.lowest_layer().get_executor(); - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - boost::asio::io_context& get_io_context() - { - return next_layer_.get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - boost::asio::io_context& get_io_service() - { - return next_layer_.get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Close the stream. - void close() - { - next_layer_.close(); - } - - /// Close the stream. - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - next_layer_.close(ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Flush all data from the buffer to the next layer. Returns the number of - /// bytes written to the next layer on the last write operation. Throws an - /// exception on failure. - std::size_t flush(); - - /// Flush all data from the buffer to the next layer. Returns the number of - /// bytes written to the next layer on the last write operation, or 0 if an - /// error occurred. - std::size_t flush(boost::system::error_code& ec); - - /// Start an asynchronous flush. - template <typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_flush(BOOST_ASIO_MOVE_ARG(WriteHandler) handler); - - /// Write the given data to the stream. Returns the number of bytes written. - /// Throws an exception on failure. - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers); - - /// 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 ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec); - - /// Start an asynchronous write. The data being written must be valid for the - /// lifetime of the asynchronous operation. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler); - - /// Read some data from the stream. Returns the number of bytes read. Throws - /// an exception on failure. - 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return next_layer_.read_some(buffers, ec); - } - - /// 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 MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - return next_layer_.async_read_some(buffers, - BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); - } - - /// Peek at the incoming data on the stream. Returns the number of bytes read. - /// Throws an exception on failure. - 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 MutableBufferSequence> - std::size_t peek(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return next_layer_.peek(buffers, ec); - } - - /// Determine the amount of data that may be read without blocking. - std::size_t in_avail() - { - return next_layer_.in_avail(); - } - - /// Determine the amount of data that may be read without blocking. - std::size_t in_avail(boost::system::error_code& ec) - { - return next_layer_.in_avail(ec); - } - -private: - /// Copy data into the internal buffer from the specified source buffer. - /// Returns the number of bytes copied. - template <typename ConstBufferSequence> - std::size_t copy(const ConstBufferSequence& buffers); - - /// The next layer. - Stream next_layer_; - - // The data in the buffer. - detail::buffered_stream_storage storage_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/buffered_write_stream.hpp> - -#endif // BOOST_ASIO_BUFFERED_WRITE_STREAM_HPP diff --git a/contrib/restricted/boost/boost/asio/buffered_write_stream_fwd.hpp b/contrib/restricted/boost/boost/asio/buffered_write_stream_fwd.hpp deleted file mode 100644 index 68ab9a4d31..0000000000 --- a/contrib/restricted/boost/boost/asio/buffered_write_stream_fwd.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// -// buffered_write_stream_fwd.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BUFFERED_WRITE_STREAM_FWD_HPP -#define BOOST_ASIO_BUFFERED_WRITE_STREAM_FWD_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -namespace boost { -namespace asio { - -template <typename Stream> -class buffered_write_stream; - -} // namespace asio -} // namespace boost - -#endif // BOOST_ASIO_BUFFERED_WRITE_STREAM_FWD_HPP diff --git a/contrib/restricted/boost/boost/asio/buffers_iterator.hpp b/contrib/restricted/boost/boost/asio/buffers_iterator.hpp deleted file mode 100644 index 9de385128f..0000000000 --- a/contrib/restricted/boost/boost/asio/buffers_iterator.hpp +++ /dev/null @@ -1,523 +0,0 @@ -// -// buffers_iterator.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_BUFFERS_ITERATOR_HPP -#define BOOST_ASIO_BUFFERS_ITERATOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <iterator> -#include <boost/asio/buffer.hpp> -#include <boost/asio/detail/assert.hpp> -#include <boost/asio/detail/type_traits.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail -{ - template <bool IsMutable> - struct buffers_iterator_types_helper; - - template <> - struct buffers_iterator_types_helper<false> - { - typedef const_buffer buffer_type; - template <typename ByteType> - struct byte_type - { - typedef typename add_const<ByteType>::type type; - }; - }; - - template <> - struct buffers_iterator_types_helper<true> - { - typedef mutable_buffer buffer_type; - template <typename ByteType> - struct byte_type - { - typedef ByteType type; - }; - }; - - template <typename BufferSequence, typename ByteType> - struct buffers_iterator_types - { - enum - { - is_mutable = is_convertible< - typename BufferSequence::value_type, - mutable_buffer>::value - }; - typedef buffers_iterator_types_helper<is_mutable> helper; - typedef typename helper::buffer_type buffer_type; - typedef typename helper::template byte_type<ByteType>::type byte_type; - typedef typename BufferSequence::const_iterator const_iterator; - }; - - template <typename ByteType> - struct buffers_iterator_types<mutable_buffer, ByteType> - { - typedef mutable_buffer buffer_type; - typedef ByteType byte_type; - typedef const mutable_buffer* const_iterator; - }; - - template <typename ByteType> - struct buffers_iterator_types<const_buffer, ByteType> - { - typedef const_buffer buffer_type; - typedef typename add_const<ByteType>::type byte_type; - typedef const const_buffer* const_iterator; - }; - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - - template <typename ByteType> - struct buffers_iterator_types<mutable_buffers_1, ByteType> - { - typedef mutable_buffer buffer_type; - typedef ByteType byte_type; - typedef const mutable_buffer* const_iterator; - }; - - template <typename ByteType> - struct buffers_iterator_types<const_buffers_1, ByteType> - { - typedef const_buffer buffer_type; - typedef typename add_const<ByteType>::type byte_type; - typedef const const_buffer* const_iterator; - }; - -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) -} - -/// A random access iterator over the bytes in a buffer sequence. -template <typename BufferSequence, typename ByteType = char> -class buffers_iterator -{ -private: - typedef typename detail::buffers_iterator_types< - BufferSequence, ByteType>::buffer_type buffer_type; - - typedef typename detail::buffers_iterator_types<BufferSequence, - ByteType>::const_iterator buffer_sequence_iterator_type; - -public: - /// The type used for the distance between two iterators. - typedef std::ptrdiff_t difference_type; - - /// The type of the value pointed to by the iterator. - typedef ByteType value_type; - -#if defined(GENERATING_DOCUMENTATION) - /// The type of the result of applying operator->() to the iterator. - /** - * If the buffer sequence stores buffer objects that are convertible to - * mutable_buffer, this is a pointer to a non-const ByteType. Otherwise, a - * pointer to a const ByteType. - */ - typedef const_or_non_const_ByteType* pointer; -#else // defined(GENERATING_DOCUMENTATION) - typedef typename detail::buffers_iterator_types< - BufferSequence, ByteType>::byte_type* pointer; -#endif // defined(GENERATING_DOCUMENTATION) - -#if defined(GENERATING_DOCUMENTATION) - /// The type of the result of applying operator*() to the iterator. - /** - * If the buffer sequence stores buffer objects that are convertible to - * mutable_buffer, this is a reference to a non-const ByteType. Otherwise, a - * reference to a const ByteType. - */ - typedef const_or_non_const_ByteType& reference; -#else // defined(GENERATING_DOCUMENTATION) - typedef typename detail::buffers_iterator_types< - BufferSequence, ByteType>::byte_type& reference; -#endif // defined(GENERATING_DOCUMENTATION) - - /// The iterator category. - typedef std::random_access_iterator_tag iterator_category; - - /// Default constructor. Creates an iterator in an undefined state. - buffers_iterator() - : current_buffer_(), - current_buffer_position_(0), - begin_(), - current_(), - end_(), - position_(0) - { - } - - /// Construct an iterator representing the beginning of the buffers' data. - static buffers_iterator begin(const BufferSequence& buffers) -#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) - __attribute__ ((__noinline__)) -#endif // defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) - { - buffers_iterator new_iter; - new_iter.begin_ = boost::asio::buffer_sequence_begin(buffers); - new_iter.current_ = boost::asio::buffer_sequence_begin(buffers); - new_iter.end_ = boost::asio::buffer_sequence_end(buffers); - while (new_iter.current_ != new_iter.end_) - { - new_iter.current_buffer_ = *new_iter.current_; - if (new_iter.current_buffer_.size() > 0) - break; - ++new_iter.current_; - } - return new_iter; - } - - /// Construct an iterator representing the end of the buffers' data. - static buffers_iterator end(const BufferSequence& buffers) -#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) - __attribute__ ((__noinline__)) -#endif // defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) - { - buffers_iterator new_iter; - new_iter.begin_ = boost::asio::buffer_sequence_begin(buffers); - new_iter.current_ = boost::asio::buffer_sequence_begin(buffers); - new_iter.end_ = boost::asio::buffer_sequence_end(buffers); - while (new_iter.current_ != new_iter.end_) - { - buffer_type buffer = *new_iter.current_; - new_iter.position_ += buffer.size(); - ++new_iter.current_; - } - return new_iter; - } - - /// Dereference an iterator. - reference operator*() const - { - return dereference(); - } - - /// Dereference an iterator. - pointer operator->() const - { - return &dereference(); - } - - /// Access an individual element. - reference operator[](std::ptrdiff_t difference) const - { - buffers_iterator tmp(*this); - tmp.advance(difference); - return *tmp; - } - - /// Increment operator (prefix). - buffers_iterator& operator++() - { - increment(); - return *this; - } - - /// Increment operator (postfix). - buffers_iterator operator++(int) - { - buffers_iterator tmp(*this); - ++*this; - return tmp; - } - - /// Decrement operator (prefix). - buffers_iterator& operator--() - { - decrement(); - return *this; - } - - /// Decrement operator (postfix). - buffers_iterator operator--(int) - { - buffers_iterator tmp(*this); - --*this; - return tmp; - } - - /// Addition operator. - buffers_iterator& operator+=(std::ptrdiff_t difference) - { - advance(difference); - return *this; - } - - /// Subtraction operator. - buffers_iterator& operator-=(std::ptrdiff_t difference) - { - advance(-difference); - return *this; - } - - /// Addition operator. - friend buffers_iterator operator+(const buffers_iterator& iter, - std::ptrdiff_t difference) - { - buffers_iterator tmp(iter); - tmp.advance(difference); - return tmp; - } - - /// Addition operator. - friend buffers_iterator operator+(std::ptrdiff_t difference, - const buffers_iterator& iter) - { - buffers_iterator tmp(iter); - tmp.advance(difference); - return tmp; - } - - /// Subtraction operator. - friend buffers_iterator operator-(const buffers_iterator& iter, - std::ptrdiff_t difference) - { - buffers_iterator tmp(iter); - tmp.advance(-difference); - return tmp; - } - - /// Subtraction operator. - friend std::ptrdiff_t operator-(const buffers_iterator& a, - const buffers_iterator& b) - { - return b.distance_to(a); - } - - /// Test two iterators for equality. - friend bool operator==(const buffers_iterator& a, const buffers_iterator& b) - { - return a.equal(b); - } - - /// Test two iterators for inequality. - friend bool operator!=(const buffers_iterator& a, const buffers_iterator& b) - { - return !a.equal(b); - } - - /// Compare two iterators. - friend bool operator<(const buffers_iterator& a, const buffers_iterator& b) - { - return a.distance_to(b) > 0; - } - - /// Compare two iterators. - friend bool operator<=(const buffers_iterator& a, const buffers_iterator& b) - { - return !(b < a); - } - - /// Compare two iterators. - friend bool operator>(const buffers_iterator& a, const buffers_iterator& b) - { - return b < a; - } - - /// Compare two iterators. - friend bool operator>=(const buffers_iterator& a, const buffers_iterator& b) - { - return !(a < b); - } - -private: - // Dereference the iterator. - reference dereference() const - { - return static_cast<pointer>( - current_buffer_.data())[current_buffer_position_]; - } - - // Compare two iterators for equality. - bool equal(const buffers_iterator& other) const - { - return position_ == other.position_; - } - - // Increment the iterator. - void increment() - { - BOOST_ASIO_ASSERT(current_ != end_ && "iterator out of bounds"); - ++position_; - - // Check if the increment can be satisfied by the current buffer. - ++current_buffer_position_; - if (current_buffer_position_ != current_buffer_.size()) - return; - - // Find the next non-empty buffer. - ++current_; - current_buffer_position_ = 0; - while (current_ != end_) - { - current_buffer_ = *current_; - if (current_buffer_.size() > 0) - return; - ++current_; - } - } - - // Decrement the iterator. - void decrement() - { - BOOST_ASIO_ASSERT(position_ > 0 && "iterator out of bounds"); - --position_; - - // Check if the decrement can be satisfied by the current buffer. - if (current_buffer_position_ != 0) - { - --current_buffer_position_; - return; - } - - // Find the previous non-empty buffer. - buffer_sequence_iterator_type iter = current_; - while (iter != begin_) - { - --iter; - buffer_type buffer = *iter; - std::size_t buffer_size = buffer.size(); - if (buffer_size > 0) - { - current_ = iter; - current_buffer_ = buffer; - current_buffer_position_ = buffer_size - 1; - return; - } - } - } - - // Advance the iterator by the specified distance. - void advance(std::ptrdiff_t n) - { - if (n > 0) - { - BOOST_ASIO_ASSERT(current_ != end_ && "iterator out of bounds"); - for (;;) - { - std::ptrdiff_t current_buffer_balance - = current_buffer_.size() - current_buffer_position_; - - // Check if the advance can be satisfied by the current buffer. - if (current_buffer_balance > n) - { - position_ += n; - current_buffer_position_ += n; - return; - } - - // Update position. - n -= current_buffer_balance; - position_ += current_buffer_balance; - - // Move to next buffer. If it is empty then it will be skipped on the - // next iteration of this loop. - if (++current_ == end_) - { - BOOST_ASIO_ASSERT(n == 0 && "iterator out of bounds"); - current_buffer_ = buffer_type(); - current_buffer_position_ = 0; - return; - } - current_buffer_ = *current_; - current_buffer_position_ = 0; - } - } - else if (n < 0) - { - std::size_t abs_n = -n; - BOOST_ASIO_ASSERT(position_ >= abs_n && "iterator out of bounds"); - for (;;) - { - // Check if the advance can be satisfied by the current buffer. - if (current_buffer_position_ >= abs_n) - { - position_ -= abs_n; - current_buffer_position_ -= abs_n; - return; - } - - // Update position. - abs_n -= current_buffer_position_; - position_ -= current_buffer_position_; - - // Check if we've reached the beginning of the buffers. - if (current_ == begin_) - { - BOOST_ASIO_ASSERT(abs_n == 0 && "iterator out of bounds"); - current_buffer_position_ = 0; - return; - } - - // Find the previous non-empty buffer. - buffer_sequence_iterator_type iter = current_; - while (iter != begin_) - { - --iter; - buffer_type buffer = *iter; - std::size_t buffer_size = buffer.size(); - if (buffer_size > 0) - { - current_ = iter; - current_buffer_ = buffer; - current_buffer_position_ = buffer_size; - break; - } - } - } - } - } - - // Determine the distance between two iterators. - std::ptrdiff_t distance_to(const buffers_iterator& other) const - { - return other.position_ - position_; - } - - buffer_type current_buffer_; - std::size_t current_buffer_position_; - buffer_sequence_iterator_type begin_; - buffer_sequence_iterator_type current_; - buffer_sequence_iterator_type end_; - std::size_t position_; -}; - -/// Construct an iterator representing the beginning of the buffers' data. -template <typename BufferSequence> -inline buffers_iterator<BufferSequence> buffers_begin( - const BufferSequence& buffers) -{ - return buffers_iterator<BufferSequence>::begin(buffers); -} - -/// Construct an iterator representing the end of the buffers' data. -template <typename BufferSequence> -inline buffers_iterator<BufferSequence> buffers_end( - const BufferSequence& buffers) -{ - return buffers_iterator<BufferSequence>::end(buffers); -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_BUFFERS_ITERATOR_HPP diff --git a/contrib/restricted/boost/boost/asio/completion_condition.hpp b/contrib/restricted/boost/boost/asio/completion_condition.hpp deleted file mode 100644 index c49517ba4f..0000000000 --- a/contrib/restricted/boost/boost/asio/completion_condition.hpp +++ /dev/null @@ -1,220 +0,0 @@ -// -// completion_condition.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_COMPLETION_CONDITION_HPP -#define BOOST_ASIO_COMPLETION_CONDITION_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail { - -// The default maximum number of bytes to transfer in a single operation. -enum default_max_transfer_size_t { default_max_transfer_size = 65536 }; - -// Adapt result of old-style completion conditions (which had a bool result -// where true indicated that the operation was complete). -inline std::size_t adapt_completion_condition_result(bool result) -{ - return result ? 0 : default_max_transfer_size; -} - -// Adapt result of current completion conditions (which have a size_t result -// where 0 means the operation is complete, and otherwise the result is the -// maximum number of bytes to transfer on the next underlying operation). -inline std::size_t adapt_completion_condition_result(std::size_t result) -{ - return result; -} - -class transfer_all_t -{ -public: - typedef std::size_t result_type; - - template <typename Error> - std::size_t operator()(const Error& err, std::size_t) - { - return !!err ? 0 : default_max_transfer_size; - } -}; - -class transfer_at_least_t -{ -public: - typedef std::size_t result_type; - - explicit transfer_at_least_t(std::size_t minimum) - : minimum_(minimum) - { - } - - template <typename Error> - std::size_t operator()(const Error& err, std::size_t bytes_transferred) - { - return (!!err || bytes_transferred >= minimum_) - ? 0 : default_max_transfer_size; - } - -private: - std::size_t minimum_; -}; - -class transfer_exactly_t -{ -public: - typedef std::size_t result_type; - - explicit transfer_exactly_t(std::size_t size) - : size_(size) - { - } - - template <typename Error> - std::size_t operator()(const Error& err, std::size_t bytes_transferred) - { - return (!!err || bytes_transferred >= size_) ? 0 : - (size_ - bytes_transferred < default_max_transfer_size - ? size_ - bytes_transferred : std::size_t(default_max_transfer_size)); - } - -private: - std::size_t size_; -}; - -} // namespace detail - -/** - * @defgroup completion_condition Completion Condition Function Objects - * - * Function objects used for determining when a read or write operation should - * complete. - */ -/*@{*/ - -/// Return a completion condition function object that indicates that a read or -/// write operation should continue until all of the data has been transferred, -/// or until an error occurs. -/** - * This function is used to create an object, of unspecified type, that meets - * CompletionCondition requirements. - * - * @par Example - * Reading until a buffer is full: - * @code - * boost::array<char, 128> buf; - * boost::system::error_code ec; - * std::size_t n = boost::asio::read( - * sock, boost::asio::buffer(buf), - * boost::asio::transfer_all(), ec); - * if (ec) - * { - * // An error occurred. - * } - * else - * { - * // n == 128 - * } - * @endcode - */ -#if defined(GENERATING_DOCUMENTATION) -unspecified transfer_all(); -#else -inline detail::transfer_all_t transfer_all() -{ - return detail::transfer_all_t(); -} -#endif - -/// Return a completion condition function object that indicates that a read or -/// write operation should continue until a minimum number of bytes has been -/// transferred, or until an error occurs. -/** - * This function is used to create an object, of unspecified type, that meets - * CompletionCondition requirements. - * - * @par Example - * Reading until a buffer is full or contains at least 64 bytes: - * @code - * boost::array<char, 128> buf; - * boost::system::error_code ec; - * std::size_t n = boost::asio::read( - * sock, boost::asio::buffer(buf), - * boost::asio::transfer_at_least(64), ec); - * if (ec) - * { - * // An error occurred. - * } - * else - * { - * // n >= 64 && n <= 128 - * } - * @endcode - */ -#if defined(GENERATING_DOCUMENTATION) -unspecified transfer_at_least(std::size_t minimum); -#else -inline detail::transfer_at_least_t transfer_at_least(std::size_t minimum) -{ - return detail::transfer_at_least_t(minimum); -} -#endif - -/// Return a completion condition function object that indicates that a read or -/// write operation should continue until an exact number of bytes has been -/// transferred, or until an error occurs. -/** - * This function is used to create an object, of unspecified type, that meets - * CompletionCondition requirements. - * - * @par Example - * Reading until a buffer is full or contains exactly 64 bytes: - * @code - * boost::array<char, 128> buf; - * boost::system::error_code ec; - * std::size_t n = boost::asio::read( - * sock, boost::asio::buffer(buf), - * boost::asio::transfer_exactly(64), ec); - * if (ec) - * { - * // An error occurred. - * } - * else - * { - * // n == 64 - * } - * @endcode - */ -#if defined(GENERATING_DOCUMENTATION) -unspecified transfer_exactly(std::size_t size); -#else -inline detail::transfer_exactly_t transfer_exactly(std::size_t size) -{ - return detail::transfer_exactly_t(size); -} -#endif - -/*@}*/ - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_COMPLETION_CONDITION_HPP diff --git a/contrib/restricted/boost/boost/asio/connect.hpp b/contrib/restricted/boost/boost/asio/connect.hpp deleted file mode 100644 index 5dd5268bc4..0000000000 --- a/contrib/restricted/boost/boost/asio/connect.hpp +++ /dev/null @@ -1,1061 +0,0 @@ -// -// connect.hpp -// ~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_CONNECT_HPP -#define BOOST_ASIO_CONNECT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/async_result.hpp> -#include <boost/asio/basic_socket.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail -{ - char (&has_iterator_helper(...))[2]; - - template <typename T> - char has_iterator_helper(T*, typename T::iterator* = 0); - - template <typename T> - struct has_iterator_typedef - { - enum { value = (sizeof((has_iterator_helper)((T*)(0))) == 1) }; - }; -} // namespace detail - -/// Type trait used to determine whether a type is an endpoint sequence that can -/// be used with with @c connect and @c async_connect. -template <typename T> -struct is_endpoint_sequence -{ -#if defined(GENERATING_DOCUMENTATION) - /// The value member is true if the type may be used as an endpoint sequence. - static const bool value; -#else - enum - { - value = detail::has_iterator_typedef<T>::value - }; -#endif -}; - -/** - * @defgroup connect boost::asio::connect - * - * @brief Establishes a socket connection by trying each endpoint in a sequence. - */ -/*@{*/ - -/// Establishes a socket connection by trying each endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param endpoints A sequence of endpoints. - * - * @returns The successfully connected endpoint. - * - * @throws boost::system::system_error Thrown on failure. If the sequence is - * empty, the associated @c error_code is boost::asio::error::not_found. - * Otherwise, contains the error from the last connection attempt. - * - * @par Example - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_context); - * boost::asio::connect(s, r.resolve(q)); @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename EndpointSequence> -typename Protocol::endpoint connect( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type* = 0); - -/// Establishes a socket connection by trying each endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param endpoints A sequence of endpoints. - * - * @param ec Set to indicate what error occurred, if any. If the sequence is - * empty, set to boost::asio::error::not_found. Otherwise, contains the error - * from the last connection attempt. - * - * @returns On success, the successfully connected endpoint. Otherwise, a - * default-constructed endpoint. - * - * @par Example - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_context); - * boost::system::error_code ec; - * boost::asio::connect(s, r.resolve(q), ec); - * if (ec) - * { - * // An error occurred. - * } @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename EndpointSequence> -typename Protocol::endpoint connect( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, boost::system::error_code& ec, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type* = 0); - -#if !defined(BOOST_ASIO_NO_DEPRECATED) -/// (Deprecated.) Establishes a socket connection by trying each endpoint in a -/// sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @returns On success, an iterator denoting the successfully connected - * endpoint. Otherwise, the end iterator. - * - * @throws boost::system::system_error Thrown on failure. If the sequence is - * empty, the associated @c error_code is boost::asio::error::not_found. - * Otherwise, contains the error from the last connection attempt. - * - * @note This overload assumes that a default constructed object of type @c - * Iterator represents the end of the sequence. This is a valid assumption for - * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, Iterator begin, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0); - -/// (Deprecated.) Establishes a socket connection by trying each endpoint in a -/// sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param ec Set to indicate what error occurred, if any. If the sequence is - * empty, set to boost::asio::error::not_found. Otherwise, contains the error - * from the last connection attempt. - * - * @returns On success, an iterator denoting the successfully connected - * endpoint. Otherwise, the end iterator. - * - * @note This overload assumes that a default constructed object of type @c - * Iterator represents the end of the sequence. This is a valid assumption for - * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, boost::system::error_code& ec, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0); -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -/// Establishes a socket connection by trying each endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param end An iterator pointing to the end of a sequence of endpoints. - * - * @returns An iterator denoting the successfully connected endpoint. - * - * @throws boost::system::system_error Thrown on failure. If the sequence is - * empty, the associated @c error_code is boost::asio::error::not_found. - * Otherwise, contains the error from the last connection attempt. - * - * @par Example - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::resolver::results_type e = r.resolve(q); - * tcp::socket s(io_context); - * boost::asio::connect(s, e.begin(), e.end()); @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end); - -/// Establishes a socket connection by trying each endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param end An iterator pointing to the end of a sequence of endpoints. - * - * @param ec Set to indicate what error occurred, if any. If the sequence is - * empty, set to boost::asio::error::not_found. Otherwise, contains the error - * from the last connection attempt. - * - * @returns On success, an iterator denoting the successfully connected - * endpoint. Otherwise, the end iterator. - * - * @par Example - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::resolver::results_type e = r.resolve(q); - * tcp::socket s(io_context); - * boost::system::error_code ec; - * boost::asio::connect(s, e.begin(), e.end(), ec); - * if (ec) - * { - * // An error occurred. - * } @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end, boost::system::error_code& ec); - -/// Establishes a socket connection by trying each endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param endpoints A sequence of endpoints. - * - * @param connect_condition A function object that is called prior to each - * connection attempt. The signature of the function object must be: - * @code bool connect_condition( - * const boost::system::error_code& ec, - * const typename Protocol::endpoint& next); @endcode - * The @c ec parameter contains the result from the most recent connect - * operation. Before the first connection attempt, @c ec is always set to - * indicate success. The @c next parameter is the next endpoint to be tried. - * The function object should return true if the next endpoint should be tried, - * and false if it should be skipped. - * - * @returns The successfully connected endpoint. - * - * @throws boost::system::system_error Thrown on failure. If the sequence is - * empty, the associated @c error_code is boost::asio::error::not_found. - * Otherwise, contains the error from the last connection attempt. - * - * @par Example - * The following connect condition function object can be used to output - * information about the individual connection attempts: - * @code struct my_connect_condition - * { - * bool operator()( - * const boost::system::error_code& ec, - * const::tcp::endpoint& next) - * { - * if (ec) std::cout << "Error: " << ec.message() << std::endl; - * std::cout << "Trying: " << next << std::endl; - * return true; - * } - * }; @endcode - * It would be used with the boost::asio::connect function as follows: - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_context); - * tcp::endpoint e = boost::asio::connect(s, - * r.resolve(q), my_connect_condition()); - * std::cout << "Connected to: " << e << std::endl; @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition> -typename Protocol::endpoint connect( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, ConnectCondition connect_condition, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type* = 0); - -/// Establishes a socket connection by trying each endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param endpoints A sequence of endpoints. - * - * @param connect_condition A function object that is called prior to each - * connection attempt. The signature of the function object must be: - * @code bool connect_condition( - * const boost::system::error_code& ec, - * const typename Protocol::endpoint& next); @endcode - * The @c ec parameter contains the result from the most recent connect - * operation. Before the first connection attempt, @c ec is always set to - * indicate success. The @c next parameter is the next endpoint to be tried. - * The function object should return true if the next endpoint should be tried, - * and false if it should be skipped. - * - * @param ec Set to indicate what error occurred, if any. If the sequence is - * empty, set to boost::asio::error::not_found. Otherwise, contains the error - * from the last connection attempt. - * - * @returns On success, the successfully connected endpoint. Otherwise, a - * default-constructed endpoint. - * - * @par Example - * The following connect condition function object can be used to output - * information about the individual connection attempts: - * @code struct my_connect_condition - * { - * bool operator()( - * const boost::system::error_code& ec, - * const::tcp::endpoint& next) - * { - * if (ec) std::cout << "Error: " << ec.message() << std::endl; - * std::cout << "Trying: " << next << std::endl; - * return true; - * } - * }; @endcode - * It would be used with the boost::asio::connect function as follows: - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_context); - * boost::system::error_code ec; - * tcp::endpoint e = boost::asio::connect(s, - * r.resolve(q), my_connect_condition(), ec); - * if (ec) - * { - * // An error occurred. - * } - * else - * { - * std::cout << "Connected to: " << e << std::endl; - * } @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition> -typename Protocol::endpoint connect( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, ConnectCondition connect_condition, - boost::system::error_code& ec, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type* = 0); - -#if !defined(BOOST_ASIO_NO_DEPRECATED) -/// (Deprecated.) Establishes a socket connection by trying each endpoint in a -/// sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param connect_condition A function object that is called prior to each - * connection attempt. The signature of the function object must be: - * @code bool connect_condition( - * const boost::system::error_code& ec, - * const typename Protocol::endpoint& next); @endcode - * The @c ec parameter contains the result from the most recent connect - * operation. Before the first connection attempt, @c ec is always set to - * indicate success. The @c next parameter is the next endpoint to be tried. - * The function object should return true if the next endpoint should be tried, - * and false if it should be skipped. - * - * @returns On success, an iterator denoting the successfully connected - * endpoint. Otherwise, the end iterator. - * - * @throws boost::system::system_error Thrown on failure. If the sequence is - * empty, the associated @c error_code is boost::asio::error::not_found. - * Otherwise, contains the error from the last connection attempt. - * - * @note This overload assumes that a default constructed object of type @c - * Iterator represents the end of the sequence. This is a valid assumption for - * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, ConnectCondition connect_condition, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0); - -/// (Deprecated.) Establishes a socket connection by trying each endpoint in a -/// sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param connect_condition A function object that is called prior to each - * connection attempt. The signature of the function object must be: - * @code bool connect_condition( - * const boost::system::error_code& ec, - * const typename Protocol::endpoint& next); @endcode - * The @c ec parameter contains the result from the most recent connect - * operation. Before the first connection attempt, @c ec is always set to - * indicate success. The @c next parameter is the next endpoint to be tried. - * The function object should return true if the next endpoint should be tried, - * and false if it should be skipped. - * - * @param ec Set to indicate what error occurred, if any. If the sequence is - * empty, set to boost::asio::error::not_found. Otherwise, contains the error - * from the last connection attempt. - * - * @returns On success, an iterator denoting the successfully connected - * endpoint. Otherwise, the end iterator. - * - * @note This overload assumes that a default constructed object of type @c - * Iterator represents the end of the sequence. This is a valid assumption for - * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, Iterator begin, - ConnectCondition connect_condition, boost::system::error_code& ec, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0); -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -/// Establishes a socket connection by trying each endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param end An iterator pointing to the end of a sequence of endpoints. - * - * @param connect_condition A function object that is called prior to each - * connection attempt. The signature of the function object must be: - * @code bool connect_condition( - * const boost::system::error_code& ec, - * const typename Protocol::endpoint& next); @endcode - * The @c ec parameter contains the result from the most recent connect - * operation. Before the first connection attempt, @c ec is always set to - * indicate success. The @c next parameter is the next endpoint to be tried. - * The function object should return true if the next endpoint should be tried, - * and false if it should be skipped. - * - * @returns An iterator denoting the successfully connected endpoint. - * - * @throws boost::system::system_error Thrown on failure. If the sequence is - * empty, the associated @c error_code is boost::asio::error::not_found. - * Otherwise, contains the error from the last connection attempt. - * - * @par Example - * The following connect condition function object can be used to output - * information about the individual connection attempts: - * @code struct my_connect_condition - * { - * bool operator()( - * const boost::system::error_code& ec, - * const::tcp::endpoint& next) - * { - * if (ec) std::cout << "Error: " << ec.message() << std::endl; - * std::cout << "Trying: " << next << std::endl; - * return true; - * } - * }; @endcode - * It would be used with the boost::asio::connect function as follows: - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::resolver::results_type e = r.resolve(q); - * tcp::socket s(io_context); - * tcp::resolver::results_type::iterator i = boost::asio::connect( - * s, e.begin(), e.end(), my_connect_condition()); - * std::cout << "Connected to: " << i->endpoint() << std::endl; @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, Iterator begin, - Iterator end, ConnectCondition connect_condition); - -/// Establishes a socket connection by trying each endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c connect member - * function, once for each endpoint in the sequence, until a connection is - * successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param end An iterator pointing to the end of a sequence of endpoints. - * - * @param connect_condition A function object that is called prior to each - * connection attempt. The signature of the function object must be: - * @code bool connect_condition( - * const boost::system::error_code& ec, - * const typename Protocol::endpoint& next); @endcode - * The @c ec parameter contains the result from the most recent connect - * operation. Before the first connection attempt, @c ec is always set to - * indicate success. The @c next parameter is the next endpoint to be tried. - * The function object should return true if the next endpoint should be tried, - * and false if it should be skipped. - * - * @param ec Set to indicate what error occurred, if any. If the sequence is - * empty, set to boost::asio::error::not_found. Otherwise, contains the error - * from the last connection attempt. - * - * @returns On success, an iterator denoting the successfully connected - * endpoint. Otherwise, the end iterator. - * - * @par Example - * The following connect condition function object can be used to output - * information about the individual connection attempts: - * @code struct my_connect_condition - * { - * bool operator()( - * const boost::system::error_code& ec, - * const::tcp::endpoint& next) - * { - * if (ec) std::cout << "Error: " << ec.message() << std::endl; - * std::cout << "Trying: " << next << std::endl; - * return true; - * } - * }; @endcode - * It would be used with the boost::asio::connect function as follows: - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::resolver::results_type e = r.resolve(q); - * tcp::socket s(io_context); - * boost::system::error_code ec; - * tcp::resolver::results_type::iterator i = boost::asio::connect( - * s, e.begin(), e.end(), my_connect_condition()); - * if (ec) - * { - * // An error occurred. - * } - * else - * { - * std::cout << "Connected to: " << i->endpoint() << std::endl; - * } @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end, ConnectCondition connect_condition, - boost::system::error_code& ec); - -/*@}*/ - -/** - * @defgroup async_connect boost::asio::async_connect - * - * @brief Asynchronously establishes a socket connection by trying each - * endpoint in a sequence. - */ -/*@{*/ - -/// Asynchronously establishes a socket connection by trying each endpoint in a -/// sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c async_connect - * member function, once for each endpoint in the sequence, until a connection - * is successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param endpoints A sequence of endpoints. - * - * @param handler The handler to be called when the connect operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * // Result of operation. if the sequence is empty, set to - * // boost::asio::error::not_found. Otherwise, contains the - * // error from the last connection attempt. - * const boost::system::error_code& error, - * - * // On success, the successfully connected endpoint. - * // Otherwise, a default-constructed endpoint. - * const typename Protocol::endpoint& endpoint - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_context); - * - * // ... - * - * r.async_resolve(q, resolve_handler); - * - * // ... - * - * void resolve_handler( - * const boost::system::error_code& ec, - * tcp::resolver::results_type results) - * { - * if (!ec) - * { - * boost::asio::async_connect(s, results, connect_handler); - * } - * } - * - * // ... - * - * void connect_handler( - * const boost::system::error_code& ec, - * const tcp::endpoint& endpoint) - * { - * // ... - * } @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename RangeConnectHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler, - void (boost::system::error_code, typename Protocol::endpoint)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, - BOOST_ASIO_MOVE_ARG(RangeConnectHandler) handler, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type* = 0); - -#if !defined(BOOST_ASIO_NO_DEPRECATED) -/// (Deprecated.) Asynchronously establishes a socket connection by trying each -/// endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c async_connect - * member function, once for each endpoint in the sequence, until a connection - * is successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param handler The handler to be called when the connect operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * // Result of operation. if the sequence is empty, set to - * // boost::asio::error::not_found. Otherwise, contains the - * // error from the last connection attempt. - * const boost::system::error_code& error, - * - * // On success, an iterator denoting the successfully - * // connected endpoint. Otherwise, the end iterator. - * Iterator iterator - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note This overload assumes that a default constructed object of type @c - * Iterator represents the end of the sequence. This is a valid assumption for - * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename IteratorConnectHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler, - void (boost::system::error_code, Iterator)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0); -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -/// Asynchronously establishes a socket connection by trying each endpoint in a -/// sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c async_connect - * member function, once for each endpoint in the sequence, until a connection - * is successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param end An iterator pointing to the end of a sequence of endpoints. - * - * @param handler The handler to be called when the connect operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * // Result of operation. if the sequence is empty, set to - * // boost::asio::error::not_found. Otherwise, contains the - * // error from the last connection attempt. - * const boost::system::error_code& error, - * - * // On success, an iterator denoting the successfully - * // connected endpoint. Otherwise, the end iterator. - * Iterator iterator - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code std::vector<tcp::endpoint> endpoints = ...; - * tcp::socket s(io_context); - * boost::asio::async_connect(s, - * endpoints.begin(), endpoints.end(), - * connect_handler); - * - * // ... - * - * void connect_handler( - * const boost::system::error_code& ec, - * std::vector<tcp::endpoint>::iterator i) - * { - * // ... - * } @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename IteratorConnectHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler, - void (boost::system::error_code, Iterator)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end, - BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler); - -/// Asynchronously establishes a socket connection by trying each endpoint in a -/// sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c async_connect - * member function, once for each endpoint in the sequence, until a connection - * is successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param endpoints A sequence of endpoints. - * - * @param connect_condition A function object that is called prior to each - * connection attempt. The signature of the function object must be: - * @code bool connect_condition( - * const boost::system::error_code& ec, - * const typename Protocol::endpoint& next); @endcode - * The @c ec parameter contains the result from the most recent connect - * operation. Before the first connection attempt, @c ec is always set to - * indicate success. The @c next parameter is the next endpoint to be tried. - * The function object should return true if the next endpoint should be tried, - * and false if it should be skipped. - * - * @param handler The handler to be called when the connect operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * // Result of operation. if the sequence is empty, set to - * // boost::asio::error::not_found. Otherwise, contains the - * // error from the last connection attempt. - * const boost::system::error_code& error, - * - * // On success, an iterator denoting the successfully - * // connected endpoint. Otherwise, the end iterator. - * Iterator iterator - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * The following connect condition function object can be used to output - * information about the individual connection attempts: - * @code struct my_connect_condition - * { - * bool operator()( - * const boost::system::error_code& ec, - * const::tcp::endpoint& next) - * { - * if (ec) std::cout << "Error: " << ec.message() << std::endl; - * std::cout << "Trying: " << next << std::endl; - * return true; - * } - * }; @endcode - * It would be used with the boost::asio::connect function as follows: - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_context); - * - * // ... - * - * r.async_resolve(q, resolve_handler); - * - * // ... - * - * void resolve_handler( - * const boost::system::error_code& ec, - * tcp::resolver::results_type results) - * { - * if (!ec) - * { - * boost::asio::async_connect(s, results, - * my_connect_condition(), - * connect_handler); - * } - * } - * - * // ... - * - * void connect_handler( - * const boost::system::error_code& ec, - * const tcp::endpoint& endpoint) - * { - * if (ec) - * { - * // An error occurred. - * } - * else - * { - * std::cout << "Connected to: " << endpoint << std::endl; - * } - * } @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename EndpointSequence, - typename ConnectCondition, typename RangeConnectHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler, - void (boost::system::error_code, typename Protocol::endpoint)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, ConnectCondition connect_condition, - BOOST_ASIO_MOVE_ARG(RangeConnectHandler) handler, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type* = 0); - -#if !defined(BOOST_ASIO_NO_DEPRECATED) -/// (Deprecated.) Asynchronously establishes a socket connection by trying each -/// endpoint in a sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c async_connect - * member function, once for each endpoint in the sequence, until a connection - * is successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param connect_condition A function object that is called prior to each - * connection attempt. The signature of the function object must be: - * @code bool connect_condition( - * const boost::system::error_code& ec, - * const typename Protocol::endpoint& next); @endcode - * The @c ec parameter contains the result from the most recent connect - * operation. Before the first connection attempt, @c ec is always set to - * indicate success. The @c next parameter is the next endpoint to be tried. - * The function object should return true if the next endpoint should be tried, - * and false if it should be skipped. - * - * @param handler The handler to be called when the connect operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * // Result of operation. if the sequence is empty, set to - * // boost::asio::error::not_found. Otherwise, contains the - * // error from the last connection attempt. - * const boost::system::error_code& error, - * - * // On success, an iterator denoting the successfully - * // connected endpoint. Otherwise, the end iterator. - * Iterator iterator - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note This overload assumes that a default constructed object of type @c - * Iterator represents the end of the sequence. This is a valid assumption for - * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler, - void (boost::system::error_code, Iterator)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, Iterator begin, - ConnectCondition connect_condition, - BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0); -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -/// Asynchronously establishes a socket connection by trying each endpoint in a -/// sequence. -/** - * This function attempts to connect a socket to one of a sequence of - * endpoints. It does this by repeated calls to the socket's @c async_connect - * member function, once for each endpoint in the sequence, until a connection - * is successfully established. - * - * @param s The socket to be connected. If the socket is already open, it will - * be closed. - * - * @param begin An iterator pointing to the start of a sequence of endpoints. - * - * @param end An iterator pointing to the end of a sequence of endpoints. - * - * @param connect_condition A function object that is called prior to each - * connection attempt. The signature of the function object must be: - * @code bool connect_condition( - * const boost::system::error_code& ec, - * const typename Protocol::endpoint& next); @endcode - * The @c ec parameter contains the result from the most recent connect - * operation. Before the first connection attempt, @c ec is always set to - * indicate success. The @c next parameter is the next endpoint to be tried. - * The function object should return true if the next endpoint should be tried, - * and false if it should be skipped. - * - * @param handler The handler to be called when the connect operation - * completes. Copies will be made of the handler as required. The function - * signature of the handler must be: - * @code void handler( - * // Result of operation. if the sequence is empty, set to - * // boost::asio::error::not_found. Otherwise, contains the - * // error from the last connection attempt. - * const boost::system::error_code& error, - * - * // On success, an iterator denoting the successfully - * // connected endpoint. Otherwise, the end iterator. - * Iterator iterator - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * The following connect condition function object can be used to output - * information about the individual connection attempts: - * @code struct my_connect_condition - * { - * bool operator()( - * const boost::system::error_code& ec, - * const::tcp::endpoint& next) - * { - * if (ec) std::cout << "Error: " << ec.message() << std::endl; - * std::cout << "Trying: " << next << std::endl; - * return true; - * } - * }; @endcode - * It would be used with the boost::asio::connect function as follows: - * @code tcp::resolver r(io_context); - * tcp::resolver::query q("host", "service"); - * tcp::socket s(io_context); - * - * // ... - * - * r.async_resolve(q, resolve_handler); - * - * // ... - * - * void resolve_handler( - * const boost::system::error_code& ec, - * tcp::resolver::iterator i) - * { - * if (!ec) - * { - * tcp::resolver::iterator end; - * boost::asio::async_connect(s, i, end, - * my_connect_condition(), - * connect_handler); - * } - * } - * - * // ... - * - * void connect_handler( - * const boost::system::error_code& ec, - * tcp::resolver::iterator i) - * { - * if (ec) - * { - * // An error occurred. - * } - * else - * { - * std::cout << "Connected to: " << i->endpoint() << std::endl; - * } - * } @endcode - */ -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler, - void (boost::system::error_code, Iterator)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end, ConnectCondition connect_condition, - BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler); - -/*@}*/ - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/connect.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/asio/coroutine.hpp b/contrib/restricted/boost/boost/asio/coroutine.hpp deleted file mode 100644 index b195b12ed8..0000000000 --- a/contrib/restricted/boost/boost/asio/coroutine.hpp +++ /dev/null @@ -1,330 +0,0 @@ -// -// coroutine.hpp -// ~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_COROUTINE_HPP -#define BOOST_ASIO_COROUTINE_HPP - -namespace boost { -namespace asio { -namespace detail { - -class coroutine_ref; - -} // namespace detail - -/// Provides support for implementing stackless coroutines. -/** - * The @c coroutine class may be used to implement stackless coroutines. The - * class itself is used to store the current state of the coroutine. - * - * Coroutines are copy-constructible and assignable, and the space overhead is - * a single int. They can be used as a base class: - * - * @code class session : coroutine - * { - * ... - * }; @endcode - * - * or as a data member: - * - * @code class session - * { - * ... - * coroutine coro_; - * }; @endcode - * - * or even bound in as a function argument using lambdas or @c bind(). The - * important thing is that as the application maintains a copy of the object - * for as long as the coroutine must be kept alive. - * - * @par Pseudo-keywords - * - * A coroutine is used in conjunction with certain "pseudo-keywords", which - * are implemented as macros. These macros are defined by a header file: - * - * @code #include <boost/asio/yield.hpp>@endcode - * - * and may conversely be undefined as follows: - * - * @code #include <boost/asio/unyield.hpp>@endcode - * - * <b>reenter</b> - * - * The @c reenter macro is used to define the body of a coroutine. It takes a - * single argument: a pointer or reference to a coroutine object. For example, - * if the base class is a coroutine object you may write: - * - * @code reenter (this) - * { - * ... coroutine body ... - * } @endcode - * - * and if a data member or other variable you can write: - * - * @code reenter (coro_) - * { - * ... coroutine body ... - * } @endcode - * - * When @c reenter is executed at runtime, control jumps to the location of the - * last @c yield or @c fork. - * - * The coroutine body may also be a single statement, such as: - * - * @code reenter (this) for (;;) - * { - * ... - * } @endcode - * - * @b Limitation: The @c reenter macro is implemented using a switch. This - * means that you must take care when using local variables within the - * coroutine body. The local variable is not allowed in a position where - * reentering the coroutine could bypass the variable definition. - * - * <b>yield <em>statement</em></b> - * - * This form of the @c yield keyword is often used with asynchronous operations: - * - * @code yield socket_->async_read_some(buffer(*buffer_), *this); @endcode - * - * This divides into four logical steps: - * - * @li @c yield saves the current state of the coroutine. - * @li The statement initiates the asynchronous operation. - * @li The resume point is defined immediately following the statement. - * @li Control is transferred to the end of the coroutine body. - * - * When the asynchronous operation completes, the function object is invoked - * and @c reenter causes control to transfer to the resume point. It is - * important to remember to carry the coroutine state forward with the - * asynchronous operation. In the above snippet, the current class is a - * function object object with a coroutine object as base class or data member. - * - * The statement may also be a compound statement, and this permits us to - * define local variables with limited scope: - * - * @code yield - * { - * mutable_buffers_1 b = buffer(*buffer_); - * socket_->async_read_some(b, *this); - * } @endcode - * - * <b>yield return <em>expression</em> ;</b> - * - * This form of @c yield is often used in generators or coroutine-based parsers. - * For example, the function object: - * - * @code struct interleave : coroutine - * { - * istream& is1; - * istream& is2; - * char operator()(char c) - * { - * reenter (this) for (;;) - * { - * yield return is1.get(); - * yield return is2.get(); - * } - * } - * }; @endcode - * - * defines a trivial coroutine that interleaves the characters from two input - * streams. - * - * This type of @c yield divides into three logical steps: - * - * @li @c yield saves the current state of the coroutine. - * @li The resume point is defined immediately following the semicolon. - * @li The value of the expression is returned from the function. - * - * <b>yield ;</b> - * - * This form of @c yield is equivalent to the following steps: - * - * @li @c yield saves the current state of the coroutine. - * @li The resume point is defined immediately following the semicolon. - * @li Control is transferred to the end of the coroutine body. - * - * This form might be applied when coroutines are used for cooperative - * threading and scheduling is explicitly managed. For example: - * - * @code struct task : coroutine - * { - * ... - * void operator()() - * { - * reenter (this) - * { - * while (... not finished ...) - * { - * ... do something ... - * yield; - * ... do some more ... - * yield; - * } - * } - * } - * ... - * }; - * ... - * task t1, t2; - * for (;;) - * { - * t1(); - * t2(); - * } @endcode - * - * <b>yield break ;</b> - * - * The final form of @c yield is used to explicitly terminate the coroutine. - * This form is comprised of two steps: - * - * @li @c yield sets the coroutine state to indicate termination. - * @li Control is transferred to the end of the coroutine body. - * - * Once terminated, calls to is_complete() return true and the coroutine cannot - * be reentered. - * - * Note that a coroutine may also be implicitly terminated if the coroutine - * body is exited without a yield, e.g. by return, throw or by running to the - * end of the body. - * - * <b>fork <em>statement</em></b> - * - * The @c fork pseudo-keyword is used when "forking" a coroutine, i.e. splitting - * it into two (or more) copies. One use of @c fork is in a server, where a new - * coroutine is created to handle each client connection: - * - * @code reenter (this) - * { - * do - * { - * socket_.reset(new tcp::socket(io_context_)); - * yield acceptor->async_accept(*socket_, *this); - * fork server(*this)(); - * } while (is_parent()); - * ... client-specific handling follows ... - * } @endcode - * - * The logical steps involved in a @c fork are: - * - * @li @c fork saves the current state of the coroutine. - * @li The statement creates a copy of the coroutine and either executes it - * immediately or schedules it for later execution. - * @li The resume point is defined immediately following the semicolon. - * @li For the "parent", control immediately continues from the next line. - * - * The functions is_parent() and is_child() can be used to differentiate - * between parent and child. You would use these functions to alter subsequent - * control flow. - * - * Note that @c fork doesn't do the actual forking by itself. It is the - * application's responsibility to create a clone of the coroutine and call it. - * The clone can be called immediately, as above, or scheduled for delayed - * execution using something like io_context::post(). - * - * @par Alternate macro names - * - * If preferred, an application can use macro names that follow a more typical - * naming convention, rather than the pseudo-keywords. These are: - * - * @li @c BOOST_ASIO_CORO_REENTER instead of @c reenter - * @li @c BOOST_ASIO_CORO_YIELD instead of @c yield - * @li @c BOOST_ASIO_CORO_FORK instead of @c fork - */ -class coroutine -{ -public: - /// Constructs a coroutine in its initial state. - coroutine() : value_(0) {} - - /// Returns true if the coroutine is the child of a fork. - bool is_child() const { return value_ < 0; } - - /// Returns true if the coroutine is the parent of a fork. - bool is_parent() const { return !is_child(); } - - /// Returns true if the coroutine has reached its terminal state. - bool is_complete() const { return value_ == -1; } - -private: - friend class detail::coroutine_ref; - int value_; -}; - - -namespace detail { - -class coroutine_ref -{ -public: - coroutine_ref(coroutine& c) : value_(c.value_), modified_(false) {} - coroutine_ref(coroutine* c) : value_(c->value_), modified_(false) {} - ~coroutine_ref() { if (!modified_) value_ = -1; } - operator int() const { return value_; } - int& operator=(int v) { modified_ = true; return value_ = v; } -private: - void operator=(const coroutine_ref&); - int& value_; - bool modified_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#define BOOST_ASIO_CORO_REENTER(c) \ - switch (::boost::asio::detail::coroutine_ref _coro_value = c) \ - case -1: if (_coro_value) \ - { \ - goto terminate_coroutine; \ - terminate_coroutine: \ - _coro_value = -1; \ - goto bail_out_of_coroutine; \ - bail_out_of_coroutine: \ - break; \ - } \ - else /* fall-through */ case 0: - -#define BOOST_ASIO_CORO_YIELD_IMPL(n) \ - for (_coro_value = (n);;) \ - if (_coro_value == 0) \ - { \ - case (n): ; \ - break; \ - } \ - else \ - switch (_coro_value ? 0 : 1) \ - for (;;) \ - /* fall-through */ case -1: if (_coro_value) \ - goto terminate_coroutine; \ - else for (;;) \ - /* fall-through */ case 1: if (_coro_value) \ - goto bail_out_of_coroutine; \ - else /* fall-through */ case 0: - -#define BOOST_ASIO_CORO_FORK_IMPL(n) \ - for (_coro_value = -(n);; _coro_value = (n)) \ - if (_coro_value == (n)) \ - { \ - case -(n): ; \ - break; \ - } \ - else - -#if defined(_MSC_VER) -# define BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD_IMPL(__COUNTER__ + 1) -# define BOOST_ASIO_CORO_FORK BOOST_ASIO_CORO_FORK_IMPL(__COUNTER__ + 1) -#else // defined(_MSC_VER) -# define BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD_IMPL(__LINE__) -# define BOOST_ASIO_CORO_FORK BOOST_ASIO_CORO_FORK_IMPL(__LINE__) -#endif // defined(_MSC_VER) - -#endif // BOOST_ASIO_COROUTINE_HPP diff --git a/contrib/restricted/boost/boost/asio/deadline_timer.hpp b/contrib/restricted/boost/boost/asio/deadline_timer.hpp deleted file mode 100644 index 3a020e8b9a..0000000000 --- a/contrib/restricted/boost/boost/asio/deadline_timer.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// deadline_timer.hpp -// ~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DEADLINE_TIMER_HPP -#define BOOST_ASIO_DEADLINE_TIMER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/detail/socket_types.hpp> // Must come before posix_time. -#include <boost/asio/basic_deadline_timer.hpp> - -#include <boost/date_time/posix_time/posix_time_types.hpp> - -namespace boost { -namespace asio { - -/// Typedef for the typical usage of timer. Uses a UTC clock. -typedef basic_deadline_timer<boost::posix_time::ptime> deadline_timer; - -} // namespace asio -} // namespace boost - -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_DEADLINE_TIMER_HPP diff --git a/contrib/restricted/boost/boost/asio/deadline_timer_service.hpp b/contrib/restricted/boost/boost/asio/deadline_timer_service.hpp deleted file mode 100644 index 036378f93b..0000000000 --- a/contrib/restricted/boost/boost/asio/deadline_timer_service.hpp +++ /dev/null @@ -1,175 +0,0 @@ -// -// deadline_timer_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DEADLINE_TIMER_SERVICE_HPP -#define BOOST_ASIO_DEADLINE_TIMER_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/deadline_timer_service.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/time_traits.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Default service implementation for a timer. -template <typename TimeType, - typename TimeTraits = boost::asio::time_traits<TimeType> > -class deadline_timer_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base< - deadline_timer_service<TimeType, TimeTraits> > -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - - /// The time traits type. - typedef TimeTraits traits_type; - - /// The time type. - typedef typename traits_type::time_type time_type; - - /// The duration type. - typedef typename traits_type::duration_type duration_type; - -private: - // The type of the platform-specific implementation. - typedef detail::deadline_timer_service<traits_type> service_impl_type; - -public: - /// The implementation type of the deadline timer. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef typename service_impl_type::implementation_type implementation_type; -#endif - - /// Construct a new timer service for the specified io_context. - explicit deadline_timer_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base< - deadline_timer_service<TimeType, TimeTraits> >(io_context), - service_impl_(io_context) - { - } - - /// Construct a new timer implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - - /// Destroy a timer implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Cancel any asynchronous wait operations associated with the timer. - std::size_t cancel(implementation_type& impl, boost::system::error_code& ec) - { - return service_impl_.cancel(impl, ec); - } - - /// Cancels one asynchronous wait operation associated with the timer. - std::size_t cancel_one(implementation_type& impl, - boost::system::error_code& ec) - { - return service_impl_.cancel_one(impl, ec); - } - - /// Get the expiry time for the timer as an absolute time. - time_type expires_at(const implementation_type& impl) const - { - return service_impl_.expiry(impl); - } - - /// Set the expiry time for the timer as an absolute time. - std::size_t expires_at(implementation_type& impl, - const time_type& expiry_time, boost::system::error_code& ec) - { - return service_impl_.expires_at(impl, expiry_time, ec); - } - - /// Get the expiry time for the timer relative to now. - duration_type expires_from_now(const implementation_type& impl) const - { - return TimeTraits::subtract(service_impl_.expiry(impl), TimeTraits::now()); - } - - /// Set the expiry time for the timer relative to now. - std::size_t expires_from_now(implementation_type& impl, - const duration_type& expiry_time, boost::system::error_code& ec) - { - return service_impl_.expires_after(impl, expiry_time, ec); - } - - // Perform a blocking wait on the timer. - void wait(implementation_type& impl, boost::system::error_code& ec) - { - service_impl_.wait(impl, ec); - } - - // Start an asynchronous wait on the timer. - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(implementation_type& impl, - BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_wait(impl, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_DEADLINE_TIMER_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/defer.hpp b/contrib/restricted/boost/boost/asio/defer.hpp deleted file mode 100644 index 2eaf2d01c6..0000000000 --- a/contrib/restricted/boost/boost/asio/defer.hpp +++ /dev/null @@ -1,109 +0,0 @@ -// -// defer.hpp -// ~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DEFER_HPP -#define BOOST_ASIO_DEFER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/execution_context.hpp> -#include <boost/asio/is_executor.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Submits a completion token or function object for execution. -/** - * This function submits an object for execution using the object's associated - * executor. The function object is queued for execution, and is never called - * from the current thread prior to returning from <tt>defer()</tt>. - * - * This function has the following effects: - * - * @li Constructs a function object handler of type @c Handler, initialized - * with <tt>handler(forward<CompletionToken>(token))</tt>. - * - * @li Constructs an object @c result of type <tt>async_result<Handler></tt>, - * initializing the object as <tt>result(handler)</tt>. - * - * @li Obtains the handler's associated executor object @c ex by performing - * <tt>get_associated_executor(handler)</tt>. - * - * @li Obtains the handler's associated allocator object @c alloc by performing - * <tt>get_associated_allocator(handler)</tt>. - * - * @li Performs <tt>ex.defer(std::move(handler), alloc)</tt>. - * - * @li Returns <tt>result.get()</tt>. - */ -template <typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer( - BOOST_ASIO_MOVE_ARG(CompletionToken) token); - -/// Submits a completion token or function object for execution. -/** - * This function submits an object for execution using the specified executor. - * The function object is queued for execution, and is never called from the - * current thread prior to returning from <tt>defer()</tt>. - * - * This function has the following effects: - * - * @li Constructs a function object handler of type @c Handler, initialized - * with <tt>handler(forward<CompletionToken>(token))</tt>. - * - * @li Constructs an object @c result of type <tt>async_result<Handler></tt>, - * initializing the object as <tt>result(handler)</tt>. - * - * @li Obtains the handler's associated executor object @c ex1 by performing - * <tt>get_associated_executor(handler)</tt>. - * - * @li Creates a work object @c w by performing <tt>make_work(ex1)</tt>. - * - * @li Obtains the handler's associated allocator object @c alloc by performing - * <tt>get_associated_allocator(handler)</tt>. - * - * @li Constructs a function object @c f with a function call operator that - * performs <tt>ex1.dispatch(std::move(handler), alloc)</tt> followed by - * <tt>w.reset()</tt>. - * - * @li Performs <tt>Executor(ex).defer(std::move(f), alloc)</tt>. - * - * @li Returns <tt>result.get()</tt>. - */ -template <typename Executor, typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer( - const Executor& ex, BOOST_ASIO_MOVE_ARG(CompletionToken) token, - typename enable_if<is_executor<Executor>::value>::type* = 0); - -/// Submits a completion token or function object for execution. -/** - * @returns <tt>defer(ctx.get_executor(), forward<CompletionToken>(token))</tt>. - */ -template <typename ExecutionContext, typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer( - ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(CompletionToken) token, - typename enable_if<is_convertible< - ExecutionContext&, execution_context&>::value>::type* = 0); - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/defer.hpp> - -#endif // BOOST_ASIO_DEFER_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/base_from_completion_cond.hpp b/contrib/restricted/boost/boost/asio/detail/base_from_completion_cond.hpp deleted file mode 100644 index 88f167f3f4..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/base_from_completion_cond.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// -// detail/base_from_completion_cond.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP -#define BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/completion_condition.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename CompletionCondition> -class base_from_completion_cond -{ -protected: - explicit base_from_completion_cond(CompletionCondition completion_condition) - : completion_condition_(completion_condition) - { - } - - std::size_t check_for_completion( - const boost::system::error_code& ec, - std::size_t total_transferred) - { - return detail::adapt_completion_condition_result( - completion_condition_(ec, total_transferred)); - } - -private: - CompletionCondition completion_condition_; -}; - -template <> -class base_from_completion_cond<transfer_all_t> -{ -protected: - explicit base_from_completion_cond(transfer_all_t) - { - } - - static std::size_t check_for_completion( - const boost::system::error_code& ec, - std::size_t total_transferred) - { - return transfer_all_t()(ec, total_transferred); - } -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/buffer_resize_guard.hpp b/contrib/restricted/boost/boost/asio/detail/buffer_resize_guard.hpp deleted file mode 100644 index ad07f72c04..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/buffer_resize_guard.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// -// detail/buffer_resize_guard.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_BUFFER_RESIZE_GUARD_HPP -#define BOOST_ASIO_DETAIL_BUFFER_RESIZE_GUARD_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/limits.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -// Helper class to manage buffer resizing in an exception safe way. -template <typename Buffer> -class buffer_resize_guard -{ -public: - // Constructor. - buffer_resize_guard(Buffer& buffer) - : buffer_(buffer), - old_size_(buffer.size()) - { - } - - // Destructor rolls back the buffer resize unless commit was called. - ~buffer_resize_guard() - { - if (old_size_ != (std::numeric_limits<size_t>::max)()) - { - buffer_.resize(old_size_); - } - } - - // Commit the resize transaction. - void commit() - { - old_size_ = (std::numeric_limits<size_t>::max)(); - } - -private: - // The buffer being managed. - Buffer& buffer_; - - // The size of the buffer at the time the guard was constructed. - size_t old_size_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_BUFFER_RESIZE_GUARD_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/buffered_stream_storage.hpp b/contrib/restricted/boost/boost/asio/detail/buffered_stream_storage.hpp deleted file mode 100644 index 3b9ca404c4..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/buffered_stream_storage.hpp +++ /dev/null @@ -1,128 +0,0 @@ -// -// detail/buffered_stream_storage.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_BUFFERED_STREAM_STORAGE_HPP -#define BOOST_ASIO_DETAIL_BUFFERED_STREAM_STORAGE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/detail/assert.hpp> -#include <cstddef> -#include <cstring> -#include <vector> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -class buffered_stream_storage -{ -public: - // The type of the bytes stored in the buffer. - typedef unsigned char byte_type; - - // The type used for offsets into the buffer. - typedef std::size_t size_type; - - // Constructor. - explicit buffered_stream_storage(std::size_t buffer_capacity) - : begin_offset_(0), - end_offset_(0), - buffer_(buffer_capacity) - { - } - - /// Clear the buffer. - void clear() - { - begin_offset_ = 0; - end_offset_ = 0; - } - - // Return a pointer to the beginning of the unread data. - mutable_buffer data() - { - return boost::asio::buffer(buffer_) + begin_offset_; - } - - // Return a pointer to the beginning of the unread data. - const_buffer data() const - { - return boost::asio::buffer(buffer_) + begin_offset_; - } - - // Is there no unread data in the buffer. - bool empty() const - { - return begin_offset_ == end_offset_; - } - - // Return the amount of unread data the is in the buffer. - size_type size() const - { - return end_offset_ - begin_offset_; - } - - // Resize the buffer to the specified length. - void resize(size_type length) - { - BOOST_ASIO_ASSERT(length <= capacity()); - if (begin_offset_ + length <= capacity()) - { - end_offset_ = begin_offset_ + length; - } - else - { - using namespace std; // For memmove. - memmove(&buffer_[0], &buffer_[0] + begin_offset_, size()); - end_offset_ = length; - begin_offset_ = 0; - } - } - - // Return the maximum size for data in the buffer. - size_type capacity() const - { - return buffer_.size(); - } - - // Consume multiple bytes from the beginning of the buffer. - void consume(size_type count) - { - BOOST_ASIO_ASSERT(begin_offset_ + count <= end_offset_); - begin_offset_ += count; - if (empty()) - clear(); - } - -private: - // The offset to the beginning of the unread data. - size_type begin_offset_; - - // The offset to the end of the unread data. - size_type end_offset_; - - // The data in the buffer. - std::vector<byte_type> buffer_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_BUFFERED_STREAM_STORAGE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/consuming_buffers.hpp b/contrib/restricted/boost/boost/asio/detail/consuming_buffers.hpp deleted file mode 100644 index 38eb00576c..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/consuming_buffers.hpp +++ /dev/null @@ -1,416 +0,0 @@ -// -// detail/consuming_buffers.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_CONSUMING_BUFFERS_HPP -#define BOOST_ASIO_DETAIL_CONSUMING_BUFFERS_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/buffer.hpp> -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/detail/limits.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -// Helper template to determine the maximum number of prepared buffers. -template <typename Buffers> -struct prepared_buffers_max -{ - enum { value = buffer_sequence_adapter_base::max_buffers }; -}; - -template <typename Elem, std::size_t N> -struct prepared_buffers_max<boost::array<Elem, N> > -{ - enum { value = N }; -}; - -#if defined(BOOST_ASIO_HAS_STD_ARRAY) - -template <typename Elem, std::size_t N> -struct prepared_buffers_max<std::array<Elem, N> > -{ - enum { value = N }; -}; - -#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) - -// A buffer sequence used to represent a subsequence of the buffers. -template <typename Buffer, std::size_t MaxBuffers> -struct prepared_buffers -{ - typedef Buffer value_type; - typedef const Buffer* const_iterator; - - enum { max_buffers = MaxBuffers < 16 ? MaxBuffers : 16 }; - - prepared_buffers() : count(0) {} - const_iterator begin() const { return elems; } - const_iterator end() const { return elems + count; } - - Buffer elems[max_buffers]; - std::size_t count; -}; - -// A proxy for a sub-range in a list of buffers. -template <typename Buffer, typename Buffers, typename Buffer_Iterator> -class consuming_buffers -{ -public: - typedef prepared_buffers<Buffer, prepared_buffers_max<Buffers>::value> - prepared_buffers_type; - - // Construct to represent the entire list of buffers. - explicit consuming_buffers(const Buffers& buffers) - : buffers_(buffers), - total_consumed_(0), - next_elem_(0), - next_elem_offset_(0) - { - using boost::asio::buffer_size; - total_size_ = buffer_size(buffers); - } - - // Determine if we are at the end of the buffers. - bool empty() const - { - return total_consumed_ >= total_size_; - } - - // Get the buffer for a single transfer, with a size. - prepared_buffers_type prepare(std::size_t max_size) - { - prepared_buffers_type result; - - Buffer_Iterator next = boost::asio::buffer_sequence_begin(buffers_); - Buffer_Iterator end = boost::asio::buffer_sequence_end(buffers_); - - std::advance(next, next_elem_); - std::size_t elem_offset = next_elem_offset_; - while (next != end && max_size > 0 && (result.count) < result.max_buffers) - { - Buffer next_buf = Buffer(*next) + elem_offset; - result.elems[result.count] = boost::asio::buffer(next_buf, max_size); - max_size -= result.elems[result.count].size(); - elem_offset = 0; - if (result.elems[result.count].size() > 0) - ++result.count; - ++next; - } - - return result; - } - - // Consume the specified number of bytes from the buffers. - void consume(std::size_t size) - { - total_consumed_ += size; - - Buffer_Iterator next = boost::asio::buffer_sequence_begin(buffers_); - Buffer_Iterator end = boost::asio::buffer_sequence_end(buffers_); - - std::advance(next, next_elem_); - while (next != end && size > 0) - { - Buffer next_buf = Buffer(*next) + next_elem_offset_; - if (size < next_buf.size()) - { - next_elem_offset_ += size; - size = 0; - } - else - { - size -= next_buf.size(); - next_elem_offset_ = 0; - ++next_elem_; - ++next; - } - } - } - - // Get the total number of bytes consumed from the buffers. - std::size_t total_consumed() const - { - return total_consumed_; - } - -private: - Buffers buffers_; - std::size_t total_size_; - std::size_t total_consumed_; - std::size_t next_elem_; - std::size_t next_elem_offset_; -}; - -// Base class of all consuming_buffers specialisations for single buffers. -template <typename Buffer> -class consuming_single_buffer -{ -public: - // Construct to represent the entire list of buffers. - template <typename Buffer1> - explicit consuming_single_buffer(const Buffer1& buffer) - : buffer_(buffer), - total_consumed_(0) - { - } - - // Determine if we are at the end of the buffers. - bool empty() const - { - return total_consumed_ >= buffer_.size(); - } - - // Get the buffer for a single transfer, with a size. - Buffer prepare(std::size_t max_size) - { - return boost::asio::buffer(buffer_ + total_consumed_, max_size); - } - - // Consume the specified number of bytes from the buffers. - void consume(std::size_t size) - { - total_consumed_ += size; - } - - // Get the total number of bytes consumed from the buffers. - std::size_t total_consumed() const - { - return total_consumed_; - } - -private: - Buffer buffer_; - std::size_t total_consumed_; -}; - -template <> -class consuming_buffers<mutable_buffer, mutable_buffer, const mutable_buffer*> - : public consuming_single_buffer<BOOST_ASIO_MUTABLE_BUFFER> -{ -public: - explicit consuming_buffers(const mutable_buffer& buffer) - : consuming_single_buffer<BOOST_ASIO_MUTABLE_BUFFER>(buffer) - { - } -}; - -template <> -class consuming_buffers<const_buffer, mutable_buffer, const mutable_buffer*> - : public consuming_single_buffer<BOOST_ASIO_CONST_BUFFER> -{ -public: - explicit consuming_buffers(const mutable_buffer& buffer) - : consuming_single_buffer<BOOST_ASIO_CONST_BUFFER>(buffer) - { - } -}; - -template <> -class consuming_buffers<const_buffer, const_buffer, const const_buffer*> - : public consuming_single_buffer<BOOST_ASIO_CONST_BUFFER> -{ -public: - explicit consuming_buffers(const const_buffer& buffer) - : consuming_single_buffer<BOOST_ASIO_CONST_BUFFER>(buffer) - { - } -}; - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - -template <> -class consuming_buffers<mutable_buffer, - mutable_buffers_1, const mutable_buffer*> - : public consuming_single_buffer<BOOST_ASIO_MUTABLE_BUFFER> -{ -public: - explicit consuming_buffers(const mutable_buffers_1& buffer) - : consuming_single_buffer<BOOST_ASIO_MUTABLE_BUFFER>(buffer) - { - } -}; - -template <> -class consuming_buffers<const_buffer, mutable_buffers_1, const mutable_buffer*> - : public consuming_single_buffer<BOOST_ASIO_CONST_BUFFER> -{ -public: - explicit consuming_buffers(const mutable_buffers_1& buffer) - : consuming_single_buffer<BOOST_ASIO_CONST_BUFFER>(buffer) - { - } -}; - -template <> -class consuming_buffers<const_buffer, const_buffers_1, const const_buffer*> - : public consuming_single_buffer<BOOST_ASIO_CONST_BUFFER> -{ -public: - explicit consuming_buffers(const const_buffers_1& buffer) - : consuming_single_buffer<BOOST_ASIO_CONST_BUFFER>(buffer) - { - } -}; - -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Buffer, typename Elem> -class consuming_buffers<Buffer, boost::array<Elem, 2>, - typename boost::array<Elem, 2>::const_iterator> -{ -public: - // Construct to represent the entire list of buffers. - explicit consuming_buffers(const boost::array<Elem, 2>& buffers) - : buffers_(buffers), - total_consumed_(0) - { - } - - // Determine if we are at the end of the buffers. - bool empty() const - { - return total_consumed_ >= - Buffer(buffers_[0]).size() + Buffer(buffers_[1]).size(); - } - - // Get the buffer for a single transfer, with a size. - boost::array<Buffer, 2> prepare(std::size_t max_size) - { - boost::array<Buffer, 2> result = {{ - Buffer(buffers_[0]), Buffer(buffers_[1]) }}; - std::size_t buffer0_size = result[0].size(); - result[0] = boost::asio::buffer(result[0] + total_consumed_, max_size); - result[1] = boost::asio::buffer( - result[1] + (total_consumed_ < buffer0_size - ? 0 : total_consumed_ - buffer0_size), - max_size - result[0].size()); - return result; - } - - // Consume the specified number of bytes from the buffers. - void consume(std::size_t size) - { - total_consumed_ += size; - } - - // Get the total number of bytes consumed from the buffers. - std::size_t total_consumed() const - { - return total_consumed_; - } - -private: - boost::array<Elem, 2> buffers_; - std::size_t total_consumed_; -}; - -#if defined(BOOST_ASIO_HAS_STD_ARRAY) - -template <typename Buffer, typename Elem> -class consuming_buffers<Buffer, std::array<Elem, 2>, - typename std::array<Elem, 2>::const_iterator> -{ -public: - // Construct to represent the entire list of buffers. - explicit consuming_buffers(const std::array<Elem, 2>& buffers) - : buffers_(buffers), - total_consumed_(0) - { - } - - // Determine if we are at the end of the buffers. - bool empty() const - { - return total_consumed_ >= - Buffer(buffers_[0]).size() + Buffer(buffers_[1]).size(); - } - - // Get the buffer for a single transfer, with a size. - std::array<Buffer, 2> prepare(std::size_t max_size) - { - std::array<Buffer, 2> result = {{ - Buffer(buffers_[0]), Buffer(buffers_[1]) }}; - std::size_t buffer0_size = result[0].size(); - result[0] = boost::asio::buffer(result[0] + total_consumed_, max_size); - result[1] = boost::asio::buffer( - result[1] + (total_consumed_ < buffer0_size - ? 0 : total_consumed_ - buffer0_size), - max_size - result[0].size()); - return result; - } - - // Consume the specified number of bytes from the buffers. - void consume(std::size_t size) - { - total_consumed_ += size; - } - - // Get the total number of bytes consumed from the buffers. - std::size_t total_consumed() const - { - return total_consumed_; - } - -private: - std::array<Elem, 2> buffers_; - std::size_t total_consumed_; -}; - -#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) - -// Specialisation for null_buffers to ensure that the null_buffers type is -// always passed through to the underlying read or write operation. -template <typename Buffer> -class consuming_buffers<Buffer, null_buffers, const mutable_buffer*> - : public boost::asio::null_buffers -{ -public: - consuming_buffers(const null_buffers&) - { - // No-op. - } - - bool empty() - { - return false; - } - - null_buffers prepare(std::size_t) - { - return null_buffers(); - } - - void consume(std::size_t) - { - // No-op. - } - - std::size_t total_consumed() const - { - return 0; - } -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_CONSUMING_BUFFERS_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/cstddef.hpp b/contrib/restricted/boost/boost/asio/detail/cstddef.hpp deleted file mode 100644 index 665ff3b3a3..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/cstddef.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// -// detail/cstddef.hpp -// ~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_CSTDDEF_HPP -#define BOOST_ASIO_DETAIL_CSTDDEF_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> - -namespace boost { -namespace asio { - -#if defined(BOOST_ASIO_HAS_NULLPTR) -using std::nullptr_t; -#else // defined(BOOST_ASIO_HAS_NULLPTR) -struct nullptr_t {}; -#endif // defined(BOOST_ASIO_HAS_NULLPTR) - -} // namespace asio -} // namespace boost - -#endif // BOOST_ASIO_DETAIL_CSTDDEF_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/date_time_fwd.hpp b/contrib/restricted/boost/boost/asio/detail/date_time_fwd.hpp deleted file mode 100644 index b6c49c75d1..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/date_time_fwd.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// -// detail/date_time_fwd.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP -#define BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -namespace boost { -namespace date_time { - -template<class T, class TimeSystem> -class base_time; - -} // namespace date_time -namespace posix_time { - -class ptime; - -} // namespace posix_time -} // namespace boost - -#endif // BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/deadline_timer_service.hpp b/contrib/restricted/boost/boost/asio/detail/deadline_timer_service.hpp deleted file mode 100644 index ff162493d8..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/deadline_timer_service.hpp +++ /dev/null @@ -1,280 +0,0 @@ -// -// detail/deadline_timer_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_DEADLINE_TIMER_SERVICE_HPP -#define BOOST_ASIO_DETAIL_DEADLINE_TIMER_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/socket_ops.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_queue.hpp> -#include <boost/asio/detail/timer_queue_ptime.hpp> -#include <boost/asio/detail/timer_scheduler.hpp> -#include <boost/asio/detail/wait_handler.hpp> -#include <boost/asio/detail/wait_op.hpp> - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) -# include <chrono> -# include <thread> -#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename Time_Traits> -class deadline_timer_service - : public service_base<deadline_timer_service<Time_Traits> > -{ -public: - // The time type. - typedef typename Time_Traits::time_type time_type; - - // The duration type. - typedef typename Time_Traits::duration_type duration_type; - - // The implementation type of the timer. This type is dependent on the - // underlying implementation of the timer service. - struct implementation_type - : private boost::asio::detail::noncopyable - { - time_type expiry; - bool might_have_pending_waits; - typename timer_queue<Time_Traits>::per_timer_data timer_data; - }; - - // Constructor. - deadline_timer_service(boost::asio::io_context& io_context) - : service_base<deadline_timer_service<Time_Traits> >(io_context), - scheduler_(boost::asio::use_service<timer_scheduler>(io_context)) - { - scheduler_.init_task(); - scheduler_.add_timer_queue(timer_queue_); - } - - // Destructor. - ~deadline_timer_service() - { - scheduler_.remove_timer_queue(timer_queue_); - } - - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - } - - // Construct a new timer implementation. - void construct(implementation_type& impl) - { - impl.expiry = time_type(); - impl.might_have_pending_waits = false; - } - - // Destroy a timer implementation. - void destroy(implementation_type& impl) - { - boost::system::error_code ec; - cancel(impl, ec); - } - - // Move-construct a new serial port implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - scheduler_.move_timer(timer_queue_, impl.timer_data, other_impl.timer_data); - - impl.expiry = other_impl.expiry; - other_impl.expiry = time_type(); - - impl.might_have_pending_waits = other_impl.might_have_pending_waits; - other_impl.might_have_pending_waits = false; - } - - // Move-assign from another serial port implementation. - void move_assign(implementation_type& impl, - deadline_timer_service& other_service, - implementation_type& other_impl) - { - if (this != &other_service) - if (impl.might_have_pending_waits) - scheduler_.cancel_timer(timer_queue_, impl.timer_data); - - other_service.scheduler_.move_timer(other_service.timer_queue_, - impl.timer_data, other_impl.timer_data); - - impl.expiry = other_impl.expiry; - other_impl.expiry = time_type(); - - impl.might_have_pending_waits = other_impl.might_have_pending_waits; - other_impl.might_have_pending_waits = false; - } - - // Cancel any asynchronous wait operations associated with the timer. - std::size_t cancel(implementation_type& impl, boost::system::error_code& ec) - { - if (!impl.might_have_pending_waits) - { - ec = boost::system::error_code(); - return 0; - } - - BOOST_ASIO_HANDLER_OPERATION((scheduler_.context(), - "deadline_timer", &impl, 0, "cancel")); - - std::size_t count = scheduler_.cancel_timer(timer_queue_, impl.timer_data); - impl.might_have_pending_waits = false; - ec = boost::system::error_code(); - return count; - } - - // Cancels one asynchronous wait operation associated with the timer. - std::size_t cancel_one(implementation_type& impl, - boost::system::error_code& ec) - { - if (!impl.might_have_pending_waits) - { - ec = boost::system::error_code(); - return 0; - } - - BOOST_ASIO_HANDLER_OPERATION((scheduler_.context(), - "deadline_timer", &impl, 0, "cancel_one")); - - std::size_t count = scheduler_.cancel_timer( - timer_queue_, impl.timer_data, 1); - if (count == 0) - impl.might_have_pending_waits = false; - ec = boost::system::error_code(); - return count; - } - - // Get the expiry time for the timer as an absolute time. - time_type expiry(const implementation_type& impl) const - { - return impl.expiry; - } - - // Get the expiry time for the timer as an absolute time. - time_type expires_at(const implementation_type& impl) const - { - return impl.expiry; - } - - // Get the expiry time for the timer relative to now. - duration_type expires_from_now(const implementation_type& impl) const - { - return Time_Traits::subtract(this->expiry(impl), Time_Traits::now()); - } - - // Set the expiry time for the timer as an absolute time. - std::size_t expires_at(implementation_type& impl, - const time_type& expiry_time, boost::system::error_code& ec) - { - std::size_t count = cancel(impl, ec); - impl.expiry = expiry_time; - ec = boost::system::error_code(); - return count; - } - - // Set the expiry time for the timer relative to now. - std::size_t expires_after(implementation_type& impl, - const duration_type& expiry_time, boost::system::error_code& ec) - { - return expires_at(impl, - Time_Traits::add(Time_Traits::now(), expiry_time), ec); - } - - // Set the expiry time for the timer relative to now. - std::size_t expires_from_now(implementation_type& impl, - const duration_type& expiry_time, boost::system::error_code& ec) - { - return expires_at(impl, - Time_Traits::add(Time_Traits::now(), expiry_time), ec); - } - - // Perform a blocking wait on the timer. - void wait(implementation_type& impl, boost::system::error_code& ec) - { - time_type now = Time_Traits::now(); - ec = boost::system::error_code(); - while (Time_Traits::less_than(now, impl.expiry) && !ec) - { - this->do_wait(Time_Traits::to_posix_duration( - Time_Traits::subtract(impl.expiry, now)), ec); - now = Time_Traits::now(); - } - } - - // Start an asynchronous wait on the timer. - template <typename Handler> - void async_wait(implementation_type& impl, Handler& handler) - { - // Allocate and construct an operation to wrap the handler. - typedef wait_handler<Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(handler); - - impl.might_have_pending_waits = true; - - BOOST_ASIO_HANDLER_CREATION((scheduler_.context(), - *p.p, "deadline_timer", &impl, 0, "async_wait")); - - scheduler_.schedule_timer(timer_queue_, impl.expiry, impl.timer_data, p.p); - p.v = p.p = 0; - } - -private: - // Helper function to wait given a duration type. The duration type should - // either be of type boost::posix_time::time_duration, or implement the - // required subset of its interface. - template <typename Duration> - void do_wait(const Duration& timeout, boost::system::error_code& ec) - { -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - std::this_thread::sleep_for( - std::chrono::seconds(timeout.total_seconds()) - + std::chrono::microseconds(timeout.total_microseconds())); - ec = boost::system::error_code(); -#else // defined(BOOST_ASIO_WINDOWS_RUNTIME) - ::timeval tv; - tv.tv_sec = timeout.total_seconds(); - tv.tv_usec = timeout.total_microseconds() % 1000000; - socket_ops::select(0, 0, 0, 0, &tv, ec); -#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) - } - - // The queue of timers. - timer_queue<Time_Traits> timer_queue_; - - // The object that schedules and executes timers. Usually a reactor. - timer_scheduler& scheduler_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_DEADLINE_TIMER_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/dependent_type.hpp b/contrib/restricted/boost/boost/asio/detail/dependent_type.hpp deleted file mode 100644 index 43f87dae7f..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/dependent_type.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// -// detail/dependent_type.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_DEPENDENT_TYPE_HPP -#define BOOST_ASIO_DETAIL_DEPENDENT_TYPE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename DependsOn, typename T> -struct dependent_type -{ - typedef T type; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_DEPENDENT_TYPE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/descriptor_ops.hpp b/contrib/restricted/boost/boost/asio/detail/descriptor_ops.hpp deleted file mode 100644 index bfa6ce99fa..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/descriptor_ops.hpp +++ /dev/null @@ -1,123 +0,0 @@ -// -// detail/descriptor_ops.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_DESCRIPTOR_OPS_HPP -#define BOOST_ASIO_DETAIL_DESCRIPTOR_OPS_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - -#include <cstddef> -#include <boost/asio/error.hpp> -#include <boost/system/error_code.hpp> -#include <boost/asio/detail/socket_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { -namespace descriptor_ops { - -// Descriptor state bits. -enum -{ - // The user wants a non-blocking descriptor. - user_set_non_blocking = 1, - - // The descriptor has been set non-blocking. - internal_non_blocking = 2, - - // Helper "state" used to determine whether the descriptor is non-blocking. - non_blocking = user_set_non_blocking | internal_non_blocking, - - // The descriptor may have been dup()-ed. - possible_dup = 4 -}; - -typedef unsigned char state_type; - -template <typename ReturnType> -inline ReturnType error_wrapper(ReturnType return_value, - boost::system::error_code& ec) -{ - ec = boost::system::error_code(errno, - boost::asio::error::get_system_category()); - return return_value; -} - -BOOST_ASIO_DECL int open(const char* path, int flags, - boost::system::error_code& ec); - -BOOST_ASIO_DECL int close(int d, state_type& state, - boost::system::error_code& ec); - -BOOST_ASIO_DECL bool set_user_non_blocking(int d, - state_type& state, bool value, boost::system::error_code& ec); - -BOOST_ASIO_DECL bool set_internal_non_blocking(int d, - state_type& state, bool value, boost::system::error_code& ec); - -typedef iovec buf; - -BOOST_ASIO_DECL std::size_t sync_read(int d, state_type state, buf* bufs, - std::size_t count, bool all_empty, boost::system::error_code& ec); - -BOOST_ASIO_DECL bool non_blocking_read(int d, buf* bufs, std::size_t count, - boost::system::error_code& ec, std::size_t& bytes_transferred); - -BOOST_ASIO_DECL std::size_t sync_write(int d, state_type state, - const buf* bufs, std::size_t count, bool all_empty, - boost::system::error_code& ec); - -BOOST_ASIO_DECL bool non_blocking_write(int d, - const buf* bufs, std::size_t count, - boost::system::error_code& ec, std::size_t& bytes_transferred); - -BOOST_ASIO_DECL int ioctl(int d, state_type& state, long cmd, - ioctl_arg_type* arg, boost::system::error_code& ec); - -BOOST_ASIO_DECL int fcntl(int d, int cmd, boost::system::error_code& ec); - -BOOST_ASIO_DECL int fcntl(int d, int cmd, - long arg, boost::system::error_code& ec); - -BOOST_ASIO_DECL int poll_read(int d, - state_type state, boost::system::error_code& ec); - -BOOST_ASIO_DECL int poll_write(int d, - state_type state, boost::system::error_code& ec); - -BOOST_ASIO_DECL int poll_error(int d, - state_type state, boost::system::error_code& ec); - -} // namespace descriptor_ops -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/descriptor_ops.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - -#endif // BOOST_ASIO_DETAIL_DESCRIPTOR_OPS_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/descriptor_read_op.hpp b/contrib/restricted/boost/boost/asio/detail/descriptor_read_op.hpp deleted file mode 100644 index 328e2191c0..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/descriptor_read_op.hpp +++ /dev/null @@ -1,130 +0,0 @@ -// -// detail/descriptor_read_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_DESCRIPTOR_READ_OP_HPP -#define BOOST_ASIO_DETAIL_DESCRIPTOR_READ_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/detail/descriptor_ops.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/handler_work.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/reactor_op.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename MutableBufferSequence> -class descriptor_read_op_base : public reactor_op -{ -public: - descriptor_read_op_base(int descriptor, - const MutableBufferSequence& buffers, func_type complete_func) - : reactor_op(&descriptor_read_op_base::do_perform, complete_func), - descriptor_(descriptor), - buffers_(buffers) - { - } - - static status do_perform(reactor_op* base) - { - descriptor_read_op_base* o(static_cast<descriptor_read_op_base*>(base)); - - buffer_sequence_adapter<boost::asio::mutable_buffer, - MutableBufferSequence> bufs(o->buffers_); - - status result = descriptor_ops::non_blocking_read(o->descriptor_, - bufs.buffers(), bufs.count(), o->ec_, o->bytes_transferred_) - ? done : not_done; - - BOOST_ASIO_HANDLER_REACTOR_OPERATION((*o, "non_blocking_read", - o->ec_, o->bytes_transferred_)); - - return result; - } - -private: - int descriptor_; - MutableBufferSequence buffers_; -}; - -template <typename MutableBufferSequence, typename Handler> -class descriptor_read_op - : public descriptor_read_op_base<MutableBufferSequence> -{ -public: - BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_read_op); - - descriptor_read_op(int descriptor, - const MutableBufferSequence& buffers, Handler& handler) - : descriptor_read_op_base<MutableBufferSequence>( - descriptor, buffers, &descriptor_read_op::do_complete), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) - { - handler_work<Handler>::start(handler_); - } - - static void do_complete(void* owner, operation* base, - const boost::system::error_code& /*ec*/, - std::size_t /*bytes_transferred*/) - { - // Take ownership of the handler object. - descriptor_read_op* o(static_cast<descriptor_read_op*>(base)); - ptr p = { boost::asio::detail::addressof(o->handler_), o, o }; - handler_work<Handler> w(o->handler_); - - BOOST_ASIO_HANDLER_COMPLETION((*o)); - - // Make a copy of the handler so that the memory can be deallocated before - // the upcall is made. Even if we're not about to make an upcall, a - // sub-object of the handler may be the true owner of the memory associated - // with the handler. Consequently, a local copy of the handler is required - // to ensure that any owning sub-object remains valid until after we have - // deallocated the memory here. - detail::binder2<Handler, boost::system::error_code, std::size_t> - handler(o->handler_, o->ec_, o->bytes_transferred_); - p.h = boost::asio::detail::addressof(handler.handler_); - p.reset(); - - // Make the upcall if required. - if (owner) - { - fenced_block b(fenced_block::half); - BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); - w.complete(handler, handler.handler_); - BOOST_ASIO_HANDLER_INVOCATION_END; - } - } - -private: - Handler handler_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - -#endif // BOOST_ASIO_DETAIL_DESCRIPTOR_READ_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/descriptor_write_op.hpp b/contrib/restricted/boost/boost/asio/detail/descriptor_write_op.hpp deleted file mode 100644 index 80ddf37d37..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/descriptor_write_op.hpp +++ /dev/null @@ -1,130 +0,0 @@ -// -// detail/descriptor_write_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_DESCRIPTOR_WRITE_OP_HPP -#define BOOST_ASIO_DETAIL_DESCRIPTOR_WRITE_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/detail/descriptor_ops.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/handler_work.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/reactor_op.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename ConstBufferSequence> -class descriptor_write_op_base : public reactor_op -{ -public: - descriptor_write_op_base(int descriptor, - const ConstBufferSequence& buffers, func_type complete_func) - : reactor_op(&descriptor_write_op_base::do_perform, complete_func), - descriptor_(descriptor), - buffers_(buffers) - { - } - - static status do_perform(reactor_op* base) - { - descriptor_write_op_base* o(static_cast<descriptor_write_op_base*>(base)); - - buffer_sequence_adapter<boost::asio::const_buffer, - ConstBufferSequence> bufs(o->buffers_); - - status result = descriptor_ops::non_blocking_write(o->descriptor_, - bufs.buffers(), bufs.count(), o->ec_, o->bytes_transferred_) - ? done : not_done; - - BOOST_ASIO_HANDLER_REACTOR_OPERATION((*o, "non_blocking_write", - o->ec_, o->bytes_transferred_)); - - return result; - } - -private: - int descriptor_; - ConstBufferSequence buffers_; -}; - -template <typename ConstBufferSequence, typename Handler> -class descriptor_write_op - : public descriptor_write_op_base<ConstBufferSequence> -{ -public: - BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_write_op); - - descriptor_write_op(int descriptor, - const ConstBufferSequence& buffers, Handler& handler) - : descriptor_write_op_base<ConstBufferSequence>( - descriptor, buffers, &descriptor_write_op::do_complete), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) - { - handler_work<Handler>::start(handler_); - } - - static void do_complete(void* owner, operation* base, - const boost::system::error_code& /*ec*/, - std::size_t /*bytes_transferred*/) - { - // Take ownership of the handler object. - descriptor_write_op* o(static_cast<descriptor_write_op*>(base)); - ptr p = { boost::asio::detail::addressof(o->handler_), o, o }; - handler_work<Handler> w(o->handler_); - - BOOST_ASIO_HANDLER_COMPLETION((*o)); - - // Make a copy of the handler so that the memory can be deallocated before - // the upcall is made. Even if we're not about to make an upcall, a - // sub-object of the handler may be the true owner of the memory associated - // with the handler. Consequently, a local copy of the handler is required - // to ensure that any owning sub-object remains valid until after we have - // deallocated the memory here. - detail::binder2<Handler, boost::system::error_code, std::size_t> - handler(o->handler_, o->ec_, o->bytes_transferred_); - p.h = boost::asio::detail::addressof(handler.handler_); - p.reset(); - - // Make the upcall if required. - if (owner) - { - fenced_block b(fenced_block::half); - BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); - w.complete(handler, handler.handler_); - BOOST_ASIO_HANDLER_INVOCATION_END; - } - } - -private: - Handler handler_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - -#endif // BOOST_ASIO_DETAIL_DESCRIPTOR_WRITE_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/descriptor_ops.ipp b/contrib/restricted/boost/boost/asio/detail/impl/descriptor_ops.ipp deleted file mode 100644 index 1bb68be1c0..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/descriptor_ops.ipp +++ /dev/null @@ -1,476 +0,0 @@ -// -// detail/impl/descriptor_ops.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_DESCRIPTOR_OPS_IPP -#define BOOST_ASIO_DETAIL_IMPL_DESCRIPTOR_OPS_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cerrno> -#include <boost/asio/detail/descriptor_ops.hpp> -#include <boost/asio/error.hpp> - -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { -namespace descriptor_ops { - -int open(const char* path, int flags, boost::system::error_code& ec) -{ - errno = 0; - int result = error_wrapper(::open(path, flags), ec); - if (result >= 0) - ec = boost::system::error_code(); - return result; -} - -int close(int d, state_type& state, boost::system::error_code& ec) -{ - int result = 0; - if (d != -1) - { - errno = 0; - result = error_wrapper(::close(d), ec); - - if (result != 0 - && (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again)) - { - // According to UNIX Network Programming Vol. 1, it is possible for - // close() to fail with EWOULDBLOCK under certain circumstances. What - // isn't clear is the state of the descriptor after this error. The one - // current OS where this behaviour is seen, Windows, says that the socket - // remains open. Therefore we'll put the descriptor back into blocking - // mode and have another attempt at closing it. -#if defined(__SYMBIAN32__) - int flags = ::fcntl(d, F_GETFL, 0); - if (flags >= 0) - ::fcntl(d, F_SETFL, flags & ~O_NONBLOCK); -#else // defined(__SYMBIAN32__) - ioctl_arg_type arg = 0; - ::ioctl(d, FIONBIO, &arg); -#endif // defined(__SYMBIAN32__) - state &= ~non_blocking; - - errno = 0; - result = error_wrapper(::close(d), ec); - } - } - - if (result == 0) - ec = boost::system::error_code(); - return result; -} - -bool set_user_non_blocking(int d, state_type& state, - bool value, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return false; - } - - errno = 0; -#if defined(__SYMBIAN32__) - int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec); - if (result >= 0) - { - errno = 0; - int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); - result = error_wrapper(::fcntl(d, F_SETFL, flag), ec); - } -#else // defined(__SYMBIAN32__) - ioctl_arg_type arg = (value ? 1 : 0); - int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec); -#endif // defined(__SYMBIAN32__) - - if (result >= 0) - { - ec = boost::system::error_code(); - if (value) - state |= user_set_non_blocking; - else - { - // Clearing the user-set non-blocking mode always overrides any - // internally-set non-blocking flag. Any subsequent asynchronous - // operations will need to re-enable non-blocking I/O. - state &= ~(user_set_non_blocking | internal_non_blocking); - } - return true; - } - - return false; -} - -bool set_internal_non_blocking(int d, state_type& state, - bool value, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return false; - } - - if (!value && (state & user_set_non_blocking)) - { - // It does not make sense to clear the internal non-blocking flag if the - // user still wants non-blocking behaviour. Return an error and let the - // caller figure out whether to update the user-set non-blocking flag. - ec = boost::asio::error::invalid_argument; - return false; - } - - errno = 0; -#if defined(__SYMBIAN32__) - int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec); - if (result >= 0) - { - errno = 0; - int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); - result = error_wrapper(::fcntl(d, F_SETFL, flag), ec); - } -#else // defined(__SYMBIAN32__) - ioctl_arg_type arg = (value ? 1 : 0); - int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec); -#endif // defined(__SYMBIAN32__) - - if (result >= 0) - { - ec = boost::system::error_code(); - if (value) - state |= internal_non_blocking; - else - state &= ~internal_non_blocking; - return true; - } - - return false; -} - -std::size_t sync_read(int d, state_type state, buf* bufs, - std::size_t count, bool all_empty, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return 0; - } - - // A request to read 0 bytes on a stream is a no-op. - if (all_empty) - { - ec = boost::system::error_code(); - return 0; - } - - // Read some data. - for (;;) - { - // Try to complete the operation without blocking. - errno = 0; - signed_size_type bytes = error_wrapper(::readv( - d, bufs, static_cast<int>(count)), ec); - - // Check if operation succeeded. - if (bytes > 0) - return bytes; - - // Check for EOF. - if (bytes == 0) - { - ec = boost::asio::error::eof; - return 0; - } - - // Operation failed. - if ((state & user_set_non_blocking) - || (ec != boost::asio::error::would_block - && ec != boost::asio::error::try_again)) - return 0; - - // Wait for descriptor to become ready. - if (descriptor_ops::poll_read(d, 0, ec) < 0) - return 0; - } -} - -bool non_blocking_read(int d, buf* bufs, std::size_t count, - boost::system::error_code& ec, std::size_t& bytes_transferred) -{ - for (;;) - { - // Read some data. - errno = 0; - signed_size_type bytes = error_wrapper(::readv( - d, bufs, static_cast<int>(count)), ec); - - // Check for end of stream. - if (bytes == 0) - { - ec = boost::asio::error::eof; - return true; - } - - // Retry operation if interrupted by signal. - if (ec == boost::asio::error::interrupted) - continue; - - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; - - // Operation is complete. - if (bytes > 0) - { - ec = boost::system::error_code(); - bytes_transferred = bytes; - } - else - bytes_transferred = 0; - - return true; - } -} - -std::size_t sync_write(int d, state_type state, const buf* bufs, - std::size_t count, bool all_empty, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return 0; - } - - // A request to write 0 bytes on a stream is a no-op. - if (all_empty) - { - ec = boost::system::error_code(); - return 0; - } - - // Write some data. - for (;;) - { - // Try to complete the operation without blocking. - errno = 0; - signed_size_type bytes = error_wrapper(::writev( - d, bufs, static_cast<int>(count)), ec); - - // Check if operation succeeded. - if (bytes > 0) - return bytes; - - // Operation failed. - if ((state & user_set_non_blocking) - || (ec != boost::asio::error::would_block - && ec != boost::asio::error::try_again)) - return 0; - - // Wait for descriptor to become ready. - if (descriptor_ops::poll_write(d, 0, ec) < 0) - return 0; - } -} - -bool non_blocking_write(int d, const buf* bufs, std::size_t count, - boost::system::error_code& ec, std::size_t& bytes_transferred) -{ - for (;;) - { - // Write some data. - errno = 0; - signed_size_type bytes = error_wrapper(::writev( - d, bufs, static_cast<int>(count)), ec); - - // Retry operation if interrupted by signal. - if (ec == boost::asio::error::interrupted) - continue; - - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; - - // Operation is complete. - if (bytes >= 0) - { - ec = boost::system::error_code(); - bytes_transferred = bytes; - } - else - bytes_transferred = 0; - - return true; - } -} - -int ioctl(int d, state_type& state, long cmd, - ioctl_arg_type* arg, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return -1; - } - - errno = 0; - int result = error_wrapper(::ioctl(d, cmd, arg), ec); - - if (result >= 0) - { - ec = boost::system::error_code(); - - // When updating the non-blocking mode we always perform the ioctl syscall, - // even if the flags would otherwise indicate that the descriptor is - // already in the correct state. This ensures that the underlying - // descriptor is put into the state that has been requested by the user. If - // the ioctl syscall was successful then we need to update the flags to - // match. - if (cmd == static_cast<long>(FIONBIO)) - { - if (*arg) - { - state |= user_set_non_blocking; - } - else - { - // Clearing the non-blocking mode always overrides any internally-set - // non-blocking flag. Any subsequent asynchronous operations will need - // to re-enable non-blocking I/O. - state &= ~(user_set_non_blocking | internal_non_blocking); - } - } - } - - return result; -} - -int fcntl(int d, int cmd, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return -1; - } - - errno = 0; - int result = error_wrapper(::fcntl(d, cmd), ec); - if (result != -1) - ec = boost::system::error_code(); - return result; -} - -int fcntl(int d, int cmd, long arg, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return -1; - } - - errno = 0; - int result = error_wrapper(::fcntl(d, cmd, arg), ec); - if (result != -1) - ec = boost::system::error_code(); - return result; -} - -int poll_read(int d, state_type state, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return -1; - } - - pollfd fds; - fds.fd = d; - fds.events = POLLIN; - fds.revents = 0; - int timeout = (state & user_set_non_blocking) ? 0 : -1; - errno = 0; - int result = error_wrapper(::poll(&fds, 1, timeout), ec); - if (result == 0) - ec = (state & user_set_non_blocking) - ? boost::asio::error::would_block : boost::system::error_code(); - else if (result > 0) - ec = boost::system::error_code(); - return result; -} - -int poll_write(int d, state_type state, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return -1; - } - - pollfd fds; - fds.fd = d; - fds.events = POLLOUT; - fds.revents = 0; - int timeout = (state & user_set_non_blocking) ? 0 : -1; - errno = 0; - int result = error_wrapper(::poll(&fds, 1, timeout), ec); - if (result == 0) - ec = (state & user_set_non_blocking) - ? boost::asio::error::would_block : boost::system::error_code(); - else if (result > 0) - ec = boost::system::error_code(); - return result; -} - -int poll_error(int d, state_type state, boost::system::error_code& ec) -{ - if (d == -1) - { - ec = boost::asio::error::bad_descriptor; - return -1; - } - - pollfd fds; - fds.fd = d; - fds.events = POLLPRI | POLLERR | POLLHUP; - fds.revents = 0; - int timeout = (state & user_set_non_blocking) ? 0 : -1; - errno = 0; - int result = error_wrapper(::poll(&fds, 1, timeout), ec); - if (result == 0) - ec = (state & user_set_non_blocking) - ? boost::asio::error::would_block : boost::system::error_code(); - else if (result > 0) - ec = boost::system::error_code(); - return result; -} - -} // namespace descriptor_ops -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - -#endif // BOOST_ASIO_DETAIL_IMPL_DESCRIPTOR_OPS_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/reactive_descriptor_service.ipp b/contrib/restricted/boost/boost/asio/detail/impl/reactive_descriptor_service.ipp deleted file mode 100644 index 735239c597..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/reactive_descriptor_service.ipp +++ /dev/null @@ -1,224 +0,0 @@ -// -// detail/impl/reactive_descriptor_service.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_REACTIVE_DESCRIPTOR_SERVICE_IPP -#define BOOST_ASIO_DETAIL_IMPL_REACTIVE_DESCRIPTOR_SERVICE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - -#include <boost/asio/error.hpp> -#include <boost/asio/detail/reactive_descriptor_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -reactive_descriptor_service::reactive_descriptor_service( - boost::asio::io_context& io_context) - : service_base<reactive_descriptor_service>(io_context), - reactor_(boost::asio::use_service<reactor>(io_context)) -{ - reactor_.init_task(); -} - -void reactive_descriptor_service::shutdown() -{ -} - -void reactive_descriptor_service::construct( - reactive_descriptor_service::implementation_type& impl) -{ - impl.descriptor_ = -1; - impl.state_ = 0; -} - -void reactive_descriptor_service::move_construct( - reactive_descriptor_service::implementation_type& impl, - reactive_descriptor_service::implementation_type& other_impl) -{ - impl.descriptor_ = other_impl.descriptor_; - other_impl.descriptor_ = -1; - - impl.state_ = other_impl.state_; - other_impl.state_ = 0; - - reactor_.move_descriptor(impl.descriptor_, - impl.reactor_data_, other_impl.reactor_data_); -} - -void reactive_descriptor_service::move_assign( - reactive_descriptor_service::implementation_type& impl, - reactive_descriptor_service& other_service, - reactive_descriptor_service::implementation_type& other_impl) -{ - destroy(impl); - - impl.descriptor_ = other_impl.descriptor_; - other_impl.descriptor_ = -1; - - impl.state_ = other_impl.state_; - other_impl.state_ = 0; - - other_service.reactor_.move_descriptor(impl.descriptor_, - impl.reactor_data_, other_impl.reactor_data_); -} - -void reactive_descriptor_service::destroy( - reactive_descriptor_service::implementation_type& impl) -{ - if (is_open(impl)) - { - BOOST_ASIO_HANDLER_OPERATION((reactor_.context(), - "descriptor", &impl, impl.descriptor_, "close")); - - reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, - (impl.state_ & descriptor_ops::possible_dup) == 0); - - boost::system::error_code ignored_ec; - descriptor_ops::close(impl.descriptor_, impl.state_, ignored_ec); - - reactor_.cleanup_descriptor_data(impl.reactor_data_); - } -} - -boost::system::error_code reactive_descriptor_service::assign( - reactive_descriptor_service::implementation_type& impl, - const native_handle_type& native_descriptor, boost::system::error_code& ec) -{ - if (is_open(impl)) - { - ec = boost::asio::error::already_open; - return ec; - } - - if (int err = reactor_.register_descriptor( - native_descriptor, impl.reactor_data_)) - { - ec = boost::system::error_code(err, - boost::asio::error::get_system_category()); - return ec; - } - - impl.descriptor_ = native_descriptor; - impl.state_ = descriptor_ops::possible_dup; - ec = boost::system::error_code(); - return ec; -} - -boost::system::error_code reactive_descriptor_service::close( - reactive_descriptor_service::implementation_type& impl, - boost::system::error_code& ec) -{ - if (is_open(impl)) - { - BOOST_ASIO_HANDLER_OPERATION((reactor_.context(), - "descriptor", &impl, impl.descriptor_, "close")); - - reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, - (impl.state_ & descriptor_ops::possible_dup) == 0); - - descriptor_ops::close(impl.descriptor_, impl.state_, ec); - - reactor_.cleanup_descriptor_data(impl.reactor_data_); - } - else - { - ec = boost::system::error_code(); - } - - // The descriptor is closed by the OS even if close() returns an error. - // - // (Actually, POSIX says the state of the descriptor is unspecified. On - // Linux the descriptor is apparently closed anyway; e.g. see - // http://lkml.org/lkml/2005/9/10/129 - // We'll just have to assume that other OSes follow the same behaviour.) - construct(impl); - - return ec; -} - -reactive_descriptor_service::native_handle_type -reactive_descriptor_service::release( - reactive_descriptor_service::implementation_type& impl) -{ - native_handle_type descriptor = impl.descriptor_; - - if (is_open(impl)) - { - BOOST_ASIO_HANDLER_OPERATION((reactor_.context(), - "descriptor", &impl, impl.descriptor_, "release")); - - reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, false); - reactor_.cleanup_descriptor_data(impl.reactor_data_); - construct(impl); - } - - return descriptor; -} - -boost::system::error_code reactive_descriptor_service::cancel( - reactive_descriptor_service::implementation_type& impl, - boost::system::error_code& ec) -{ - if (!is_open(impl)) - { - ec = boost::asio::error::bad_descriptor; - return ec; - } - - BOOST_ASIO_HANDLER_OPERATION((reactor_.context(), - "descriptor", &impl, impl.descriptor_, "cancel")); - - reactor_.cancel_ops(impl.descriptor_, impl.reactor_data_); - ec = boost::system::error_code(); - return ec; -} - -void reactive_descriptor_service::start_op( - reactive_descriptor_service::implementation_type& impl, - int op_type, reactor_op* op, bool is_continuation, - bool is_non_blocking, bool noop) -{ - if (!noop) - { - if ((impl.state_ & descriptor_ops::non_blocking) || - descriptor_ops::set_internal_non_blocking( - impl.descriptor_, impl.state_, true, op->ec_)) - { - reactor_.start_op(op_type, impl.descriptor_, - impl.reactor_data_, op, is_continuation, is_non_blocking); - return; - } - } - - reactor_.post_immediate_completion(op, is_continuation); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - -#endif // BOOST_ASIO_DETAIL_IMPL_REACTIVE_DESCRIPTOR_SERVICE_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/reactive_serial_port_service.ipp b/contrib/restricted/boost/boost/asio/detail/impl/reactive_serial_port_service.ipp deleted file mode 100644 index c1ff461830..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/reactive_serial_port_service.ipp +++ /dev/null @@ -1,154 +0,0 @@ -// -// detail/impl/reactive_serial_port_service.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_REACTIVE_SERIAL_PORT_SERVICE_IPP -#define BOOST_ASIO_DETAIL_IMPL_REACTIVE_SERIAL_PORT_SERVICE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_SERIAL_PORT) -#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - -#include <cstring> -#include <boost/asio/detail/reactive_serial_port_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -reactive_serial_port_service::reactive_serial_port_service( - boost::asio::io_context& io_context) - : service_base<reactive_serial_port_service>(io_context), - descriptor_service_(io_context) -{ -} - -void reactive_serial_port_service::shutdown() -{ - descriptor_service_.shutdown(); -} - -boost::system::error_code reactive_serial_port_service::open( - reactive_serial_port_service::implementation_type& impl, - const std::string& device, boost::system::error_code& ec) -{ - if (is_open(impl)) - { - ec = boost::asio::error::already_open; - return ec; - } - - descriptor_ops::state_type state = 0; - int fd = descriptor_ops::open(device.c_str(), - O_RDWR | O_NONBLOCK | O_NOCTTY, ec); - if (fd < 0) - return ec; - - int s = descriptor_ops::fcntl(fd, F_GETFL, ec); - if (s >= 0) - s = descriptor_ops::fcntl(fd, F_SETFL, s | O_NONBLOCK, ec); - if (s < 0) - { - boost::system::error_code ignored_ec; - descriptor_ops::close(fd, state, ignored_ec); - return ec; - } - - // Set up default serial port options. - termios ios; - errno = 0; - s = descriptor_ops::error_wrapper(::tcgetattr(fd, &ios), ec); - if (s >= 0) - { -#if defined(_BSD_SOURCE) || defined(_DEFAULT_SOURCE) - ::cfmakeraw(&ios); -#else - ios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK - | ISTRIP | INLCR | IGNCR | ICRNL | IXON); - ios.c_oflag &= ~OPOST; - ios.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); - ios.c_cflag &= ~(CSIZE | PARENB); - ios.c_cflag |= CS8; -#endif - ios.c_iflag |= IGNPAR; - ios.c_cflag |= CREAD | CLOCAL; - errno = 0; - s = descriptor_ops::error_wrapper(::tcsetattr(fd, TCSANOW, &ios), ec); - } - if (s < 0) - { - boost::system::error_code ignored_ec; - descriptor_ops::close(fd, state, ignored_ec); - return ec; - } - - // We're done. Take ownership of the serial port descriptor. - if (descriptor_service_.assign(impl, fd, ec)) - { - boost::system::error_code ignored_ec; - descriptor_ops::close(fd, state, ignored_ec); - } - - return ec; -} - -boost::system::error_code reactive_serial_port_service::do_set_option( - reactive_serial_port_service::implementation_type& impl, - reactive_serial_port_service::store_function_type store, - const void* option, boost::system::error_code& ec) -{ - termios ios; - errno = 0; - descriptor_ops::error_wrapper(::tcgetattr( - descriptor_service_.native_handle(impl), &ios), ec); - if (ec) - return ec; - - if (store(option, ios, ec)) - return ec; - - errno = 0; - descriptor_ops::error_wrapper(::tcsetattr( - descriptor_service_.native_handle(impl), TCSANOW, &ios), ec); - return ec; -} - -boost::system::error_code reactive_serial_port_service::do_get_option( - const reactive_serial_port_service::implementation_type& impl, - reactive_serial_port_service::load_function_type load, - void* option, boost::system::error_code& ec) const -{ - termios ios; - errno = 0; - descriptor_ops::error_wrapper(::tcgetattr( - descriptor_service_.native_handle(impl), &ios), ec); - if (ec) - return ec; - - return load(option, ios, ec); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) -#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) - -#endif // BOOST_ASIO_DETAIL_IMPL_REACTIVE_SERIAL_PORT_SERVICE_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/signal_set_service.ipp b/contrib/restricted/boost/boost/asio/detail/impl/signal_set_service.ipp deleted file mode 100644 index abd83b480c..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/signal_set_service.ipp +++ /dev/null @@ -1,671 +0,0 @@ -// -// detail/impl/signal_set_service.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP -#define BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <cstring> -#include <stdexcept> -#include <boost/asio/detail/reactor.hpp> -#include <boost/asio/detail/signal_blocker.hpp> -#include <boost/asio/detail/signal_set_service.hpp> -#include <boost/asio/detail/static_mutex.hpp> -#include <boost/asio/detail/throw_exception.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -struct signal_state -{ - // Mutex used for protecting global state. - static_mutex mutex_; - - // The read end of the pipe used for signal notifications. - int read_descriptor_; - - // The write end of the pipe used for signal notifications. - int write_descriptor_; - - // Whether the signal state has been prepared for a fork. - bool fork_prepared_; - - // The head of a linked list of all signal_set_service instances. - class signal_set_service* service_list_; - - // A count of the number of objects that are registered for each signal. - std::size_t registration_count_[max_signal_number]; -}; - -signal_state* get_signal_state() -{ - static signal_state state = { - BOOST_ASIO_STATIC_MUTEX_INIT, -1, -1, false, 0, { 0 } }; - return &state; -} - -void boost_asio_signal_handler(int signal_number) -{ -#if defined(BOOST_ASIO_WINDOWS) \ - || defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - || defined(__CYGWIN__) - signal_set_service::deliver_signal(signal_number); -#else // defined(BOOST_ASIO_WINDOWS) - // || defined(BOOST_ASIO_WINDOWS_RUNTIME) - // || defined(__CYGWIN__) - int saved_errno = errno; - signal_state* state = get_signal_state(); - signed_size_type result = ::write(state->write_descriptor_, - &signal_number, sizeof(signal_number)); - (void)result; - errno = saved_errno; -#endif // defined(BOOST_ASIO_WINDOWS) - // || defined(BOOST_ASIO_WINDOWS_RUNTIME) - // || defined(__CYGWIN__) - -#if defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION) - ::signal(signal_number, boost_asio_signal_handler); -#endif // defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION) -} - -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) -class signal_set_service::pipe_read_op : public reactor_op -{ -public: - pipe_read_op() - : reactor_op(&pipe_read_op::do_perform, pipe_read_op::do_complete) - { - } - - static status do_perform(reactor_op*) - { - signal_state* state = get_signal_state(); - - int fd = state->read_descriptor_; - int signal_number = 0; - while (::read(fd, &signal_number, sizeof(int)) == sizeof(int)) - if (signal_number >= 0 && signal_number < max_signal_number) - signal_set_service::deliver_signal(signal_number); - - return not_done; - } - - static void do_complete(void* /*owner*/, operation* base, - const boost::system::error_code& /*ec*/, - std::size_t /*bytes_transferred*/) - { - pipe_read_op* o(static_cast<pipe_read_op*>(base)); - delete o; - } -}; -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - -signal_set_service::signal_set_service( - boost::asio::io_context& io_context) - : service_base<signal_set_service>(io_context), - io_context_(boost::asio::use_service<io_context_impl>(io_context)), -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - reactor_(boost::asio::use_service<reactor>(io_context)), -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - next_(0), - prev_(0) -{ - get_signal_state()->mutex_.init(); - -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - reactor_.init_task(); -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - - for (int i = 0; i < max_signal_number; ++i) - registrations_[i] = 0; - - add_service(this); -} - -signal_set_service::~signal_set_service() -{ - remove_service(this); -} - -void signal_set_service::shutdown() -{ - remove_service(this); - - op_queue<operation> ops; - - for (int i = 0; i < max_signal_number; ++i) - { - registration* reg = registrations_[i]; - while (reg) - { - ops.push(*reg->queue_); - reg = reg->next_in_table_; - } - } - - io_context_.abandon_operations(ops); -} - -void signal_set_service::notify_fork( - boost::asio::io_context::fork_event fork_ev) -{ -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - signal_state* state = get_signal_state(); - static_mutex::scoped_lock lock(state->mutex_); - - switch (fork_ev) - { - case boost::asio::io_context::fork_prepare: - { - int read_descriptor = state->read_descriptor_; - state->fork_prepared_ = true; - lock.unlock(); - reactor_.deregister_internal_descriptor(read_descriptor, reactor_data_); - reactor_.cleanup_descriptor_data(reactor_data_); - } - break; - case boost::asio::io_context::fork_parent: - if (state->fork_prepared_) - { - int read_descriptor = state->read_descriptor_; - state->fork_prepared_ = false; - lock.unlock(); - reactor_.register_internal_descriptor(reactor::read_op, - read_descriptor, reactor_data_, new pipe_read_op); - } - break; - case boost::asio::io_context::fork_child: - if (state->fork_prepared_) - { - boost::asio::detail::signal_blocker blocker; - close_descriptors(); - open_descriptors(); - int read_descriptor = state->read_descriptor_; - state->fork_prepared_ = false; - lock.unlock(); - reactor_.register_internal_descriptor(reactor::read_op, - read_descriptor, reactor_data_, new pipe_read_op); - } - break; - default: - break; - } -#else // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - (void)fork_ev; -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) -} - -void signal_set_service::construct( - signal_set_service::implementation_type& impl) -{ - impl.signals_ = 0; -} - -void signal_set_service::destroy( - signal_set_service::implementation_type& impl) -{ - boost::system::error_code ignored_ec; - clear(impl, ignored_ec); - cancel(impl, ignored_ec); -} - -boost::system::error_code signal_set_service::add( - signal_set_service::implementation_type& impl, - int signal_number, boost::system::error_code& ec) -{ - // Check that the signal number is valid. - if (signal_number < 0 || signal_number >= max_signal_number) - { - ec = boost::asio::error::invalid_argument; - return ec; - } - - signal_state* state = get_signal_state(); - static_mutex::scoped_lock lock(state->mutex_); - - // Find the appropriate place to insert the registration. - registration** insertion_point = &impl.signals_; - registration* next = impl.signals_; - while (next && next->signal_number_ < signal_number) - { - insertion_point = &next->next_in_set_; - next = next->next_in_set_; - } - - // Only do something if the signal is not already registered. - if (next == 0 || next->signal_number_ != signal_number) - { - registration* new_registration = new registration; - -#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) - // Register for the signal if we're the first. - if (state->registration_count_[signal_number] == 0) - { -# if defined(BOOST_ASIO_HAS_SIGACTION) - using namespace std; // For memset. - struct sigaction sa; - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = boost_asio_signal_handler; - sigfillset(&sa.sa_mask); - if (::sigaction(signal_number, &sa, 0) == -1) -# else // defined(BOOST_ASIO_HAS_SIGACTION) - if (::signal(signal_number, boost_asio_signal_handler) == SIG_ERR) -# endif // defined(BOOST_ASIO_HAS_SIGACTION) - { -# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - ec = boost::asio::error::invalid_argument; -# else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - ec = boost::system::error_code(errno, - boost::asio::error::get_system_category()); -# endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - delete new_registration; - return ec; - } - } -#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) - - // Record the new registration in the set. - new_registration->signal_number_ = signal_number; - new_registration->queue_ = &impl.queue_; - new_registration->next_in_set_ = next; - *insertion_point = new_registration; - - // Insert registration into the registration table. - new_registration->next_in_table_ = registrations_[signal_number]; - if (registrations_[signal_number]) - registrations_[signal_number]->prev_in_table_ = new_registration; - registrations_[signal_number] = new_registration; - - ++state->registration_count_[signal_number]; - } - - ec = boost::system::error_code(); - return ec; -} - -boost::system::error_code signal_set_service::remove( - signal_set_service::implementation_type& impl, - int signal_number, boost::system::error_code& ec) -{ - // Check that the signal number is valid. - if (signal_number < 0 || signal_number >= max_signal_number) - { - ec = boost::asio::error::invalid_argument; - return ec; - } - - signal_state* state = get_signal_state(); - static_mutex::scoped_lock lock(state->mutex_); - - // Find the signal number in the list of registrations. - registration** deletion_point = &impl.signals_; - registration* reg = impl.signals_; - while (reg && reg->signal_number_ < signal_number) - { - deletion_point = ®->next_in_set_; - reg = reg->next_in_set_; - } - - if (reg != 0 && reg->signal_number_ == signal_number) - { -#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) - // Set signal handler back to the default if we're the last. - if (state->registration_count_[signal_number] == 1) - { -# if defined(BOOST_ASIO_HAS_SIGACTION) - using namespace std; // For memset. - struct sigaction sa; - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = SIG_DFL; - if (::sigaction(signal_number, &sa, 0) == -1) -# else // defined(BOOST_ASIO_HAS_SIGACTION) - if (::signal(signal_number, SIG_DFL) == SIG_ERR) -# endif // defined(BOOST_ASIO_HAS_SIGACTION) - { -# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - ec = boost::asio::error::invalid_argument; -# else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - ec = boost::system::error_code(errno, - boost::asio::error::get_system_category()); -# endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - return ec; - } - } -#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) - - // Remove the registration from the set. - *deletion_point = reg->next_in_set_; - - // Remove the registration from the registration table. - if (registrations_[signal_number] == reg) - registrations_[signal_number] = reg->next_in_table_; - if (reg->prev_in_table_) - reg->prev_in_table_->next_in_table_ = reg->next_in_table_; - if (reg->next_in_table_) - reg->next_in_table_->prev_in_table_ = reg->prev_in_table_; - - --state->registration_count_[signal_number]; - - delete reg; - } - - ec = boost::system::error_code(); - return ec; -} - -boost::system::error_code signal_set_service::clear( - signal_set_service::implementation_type& impl, - boost::system::error_code& ec) -{ - signal_state* state = get_signal_state(); - static_mutex::scoped_lock lock(state->mutex_); - - while (registration* reg = impl.signals_) - { -#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) - // Set signal handler back to the default if we're the last. - if (state->registration_count_[reg->signal_number_] == 1) - { -# if defined(BOOST_ASIO_HAS_SIGACTION) - using namespace std; // For memset. - struct sigaction sa; - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = SIG_DFL; - if (::sigaction(reg->signal_number_, &sa, 0) == -1) -# else // defined(BOOST_ASIO_HAS_SIGACTION) - if (::signal(reg->signal_number_, SIG_DFL) == SIG_ERR) -# endif // defined(BOOST_ASIO_HAS_SIGACTION) - { -# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - ec = boost::asio::error::invalid_argument; -# else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - ec = boost::system::error_code(errno, - boost::asio::error::get_system_category()); -# endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - return ec; - } - } -#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) - - // Remove the registration from the registration table. - if (registrations_[reg->signal_number_] == reg) - registrations_[reg->signal_number_] = reg->next_in_table_; - if (reg->prev_in_table_) - reg->prev_in_table_->next_in_table_ = reg->next_in_table_; - if (reg->next_in_table_) - reg->next_in_table_->prev_in_table_ = reg->prev_in_table_; - - --state->registration_count_[reg->signal_number_]; - - impl.signals_ = reg->next_in_set_; - delete reg; - } - - ec = boost::system::error_code(); - return ec; -} - -boost::system::error_code signal_set_service::cancel( - signal_set_service::implementation_type& impl, - boost::system::error_code& ec) -{ - BOOST_ASIO_HANDLER_OPERATION((io_context_.context(), - "signal_set", &impl, 0, "cancel")); - - op_queue<operation> ops; - { - signal_state* state = get_signal_state(); - static_mutex::scoped_lock lock(state->mutex_); - - while (signal_op* op = impl.queue_.front()) - { - op->ec_ = boost::asio::error::operation_aborted; - impl.queue_.pop(); - ops.push(op); - } - } - - io_context_.post_deferred_completions(ops); - - ec = boost::system::error_code(); - return ec; -} - -void signal_set_service::deliver_signal(int signal_number) -{ - signal_state* state = get_signal_state(); - static_mutex::scoped_lock lock(state->mutex_); - - signal_set_service* service = state->service_list_; - while (service) - { - op_queue<operation> ops; - - registration* reg = service->registrations_[signal_number]; - while (reg) - { - if (reg->queue_->empty()) - { - ++reg->undelivered_; - } - else - { - while (signal_op* op = reg->queue_->front()) - { - op->signal_number_ = signal_number; - reg->queue_->pop(); - ops.push(op); - } - } - - reg = reg->next_in_table_; - } - - service->io_context_.post_deferred_completions(ops); - - service = service->next_; - } -} - -void signal_set_service::add_service(signal_set_service* service) -{ - signal_state* state = get_signal_state(); - static_mutex::scoped_lock lock(state->mutex_); - -#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - // If this is the first service to be created, open a new pipe. - if (state->service_list_ == 0) - open_descriptors(); -#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - - // If an io_context object is thread-unsafe then it must be the only - // io_context used to create signal_set objects. - if (state->service_list_ != 0) - { - if (!BOOST_ASIO_CONCURRENCY_HINT_IS_LOCKING(SCHEDULER, - service->io_context_.concurrency_hint()) - || !BOOST_ASIO_CONCURRENCY_HINT_IS_LOCKING(SCHEDULER, - state->service_list_->io_context_.concurrency_hint())) - { - std::logic_error ex( - "Thread-unsafe io_context objects require " - "exclusive access to signal handling."); - boost::asio::detail::throw_exception(ex); - } - } - - // Insert service into linked list of all services. - service->next_ = state->service_list_; - service->prev_ = 0; - if (state->service_list_) - state->service_list_->prev_ = service; - state->service_list_ = service; - -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - // Register for pipe readiness notifications. - int read_descriptor = state->read_descriptor_; - lock.unlock(); - service->reactor_.register_internal_descriptor(reactor::read_op, - read_descriptor, service->reactor_data_, new pipe_read_op); -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) -} - -void signal_set_service::remove_service(signal_set_service* service) -{ - signal_state* state = get_signal_state(); - static_mutex::scoped_lock lock(state->mutex_); - - if (service->next_ || service->prev_ || state->service_list_ == service) - { -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - // Disable the pipe readiness notifications. - int read_descriptor = state->read_descriptor_; - lock.unlock(); - service->reactor_.deregister_internal_descriptor( - read_descriptor, service->reactor_data_); - service->reactor_.cleanup_descriptor_data(service->reactor_data_); - lock.lock(); -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - - // Remove service from linked list of all services. - if (state->service_list_ == service) - state->service_list_ = service->next_; - if (service->prev_) - service->prev_->next_ = service->next_; - if (service->next_) - service->next_->prev_= service->prev_; - service->next_ = 0; - service->prev_ = 0; - -#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - // If this is the last service to be removed, close the pipe. - if (state->service_list_ == 0) - close_descriptors(); -#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - } -} - -void signal_set_service::open_descriptors() -{ -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - signal_state* state = get_signal_state(); - - int pipe_fds[2]; - if (::pipe(pipe_fds) == 0) - { - state->read_descriptor_ = pipe_fds[0]; - ::fcntl(state->read_descriptor_, F_SETFL, O_NONBLOCK); - - state->write_descriptor_ = pipe_fds[1]; - ::fcntl(state->write_descriptor_, F_SETFL, O_NONBLOCK); - -#if defined(FD_CLOEXEC) - ::fcntl(state->read_descriptor_, F_SETFD, FD_CLOEXEC); - ::fcntl(state->write_descriptor_, F_SETFD, FD_CLOEXEC); -#endif // defined(FD_CLOEXEC) - } - else - { - boost::system::error_code ec(errno, - boost::asio::error::get_system_category()); - boost::asio::detail::throw_error(ec, "signal_set_service pipe"); - } -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) -} - -void signal_set_service::close_descriptors() -{ -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - signal_state* state = get_signal_state(); - - if (state->read_descriptor_ != -1) - ::close(state->read_descriptor_); - state->read_descriptor_ = -1; - - if (state->write_descriptor_ != -1) - ::close(state->write_descriptor_); - state->write_descriptor_ = -1; -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) -} - -void signal_set_service::start_wait_op( - signal_set_service::implementation_type& impl, signal_op* op) -{ - io_context_.work_started(); - - signal_state* state = get_signal_state(); - static_mutex::scoped_lock lock(state->mutex_); - - registration* reg = impl.signals_; - while (reg) - { - if (reg->undelivered_ > 0) - { - --reg->undelivered_; - op->signal_number_ = reg->signal_number_; - io_context_.post_deferred_completion(op); - return; - } - - reg = reg->next_in_set_; - } - - impl.queue_.push(op); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/strand_executor_service.hpp b/contrib/restricted/boost/boost/asio/detail/impl/strand_executor_service.hpp deleted file mode 100644 index 6452b949f4..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/strand_executor_service.hpp +++ /dev/null @@ -1,181 +0,0 @@ -// -// detail/impl/strand_executor_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_STRAND_EXECUTOR_SERVICE_HPP -#define BOOST_ASIO_DETAIL_IMPL_STRAND_EXECUTOR_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/call_stack.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/recycling_allocator.hpp> -#include <boost/asio/executor_work_guard.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename Executor> -class strand_executor_service::invoker -{ -public: - invoker(const implementation_type& impl, Executor& ex) - : impl_(impl), - work_(ex) - { - } - - invoker(const invoker& other) - : impl_(other.impl_), - work_(other.work_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - invoker(invoker&& other) - : impl_(BOOST_ASIO_MOVE_CAST(implementation_type)(other.impl_)), - work_(BOOST_ASIO_MOVE_CAST(executor_work_guard<Executor>)(other.work_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - struct on_invoker_exit - { - invoker* this_; - - ~on_invoker_exit() - { - this_->impl_->mutex_->lock(); - this_->impl_->ready_queue_.push(this_->impl_->waiting_queue_); - bool more_handlers = this_->impl_->locked_ = - !this_->impl_->ready_queue_.empty(); - this_->impl_->mutex_->unlock(); - - if (more_handlers) - { - Executor ex(this_->work_.get_executor()); - recycling_allocator<void> allocator; - ex.post(BOOST_ASIO_MOVE_CAST(invoker)(*this_), allocator); - } - } - }; - - void operator()() - { - // Indicate that this strand is executing on the current thread. - call_stack<strand_impl>::context ctx(impl_.get()); - - // Ensure the next handler, if any, is scheduled on block exit. - on_invoker_exit on_exit = { this }; - (void)on_exit; - - // Run all ready handlers. No lock is required since the ready queue is - // accessed only within the strand. - boost::system::error_code ec; - while (scheduler_operation* o = impl_->ready_queue_.front()) - { - impl_->ready_queue_.pop(); - o->complete(impl_.get(), ec, 0); - } - } - -private: - implementation_type impl_; - executor_work_guard<Executor> work_; -}; - -template <typename Executor, typename Function, typename Allocator> -void strand_executor_service::dispatch(const implementation_type& impl, - Executor& ex, BOOST_ASIO_MOVE_ARG(Function) function, const Allocator& a) -{ - typedef typename decay<Function>::type function_type; - - // If we are already in the strand then the function can run immediately. - if (call_stack<strand_impl>::contains(impl.get())) - { - // Make a local, non-const copy of the function. - function_type tmp(BOOST_ASIO_MOVE_CAST(Function)(function)); - - fenced_block b(fenced_block::full); - boost_asio_handler_invoke_helpers::invoke(tmp, tmp); - return; - } - - // Allocate and construct an operation to wrap the function. - typedef executor_op<function_type, Allocator> op; - typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; - p.p = new (p.v) op(BOOST_ASIO_MOVE_CAST(Function)(function), a); - - BOOST_ASIO_HANDLER_CREATION((impl->service_->context(), *p.p, - "strand_executor", impl.get(), 0, "dispatch")); - - // Add the function to the strand and schedule the strand if required. - bool first = enqueue(impl, p.p); - p.v = p.p = 0; - if (first) - ex.dispatch(invoker<Executor>(impl, ex), a); -} - -// Request invocation of the given function and return immediately. -template <typename Executor, typename Function, typename Allocator> -void strand_executor_service::post(const implementation_type& impl, - Executor& ex, BOOST_ASIO_MOVE_ARG(Function) function, const Allocator& a) -{ - typedef typename decay<Function>::type function_type; - - // Allocate and construct an operation to wrap the function. - typedef executor_op<function_type, Allocator> op; - typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; - p.p = new (p.v) op(BOOST_ASIO_MOVE_CAST(Function)(function), a); - - BOOST_ASIO_HANDLER_CREATION((impl->service_->context(), *p.p, - "strand_executor", impl.get(), 0, "post")); - - // Add the function to the strand and schedule the strand if required. - bool first = enqueue(impl, p.p); - p.v = p.p = 0; - if (first) - ex.post(invoker<Executor>(impl, ex), a); -} - -// Request invocation of the given function and return immediately. -template <typename Executor, typename Function, typename Allocator> -void strand_executor_service::defer(const implementation_type& impl, - Executor& ex, BOOST_ASIO_MOVE_ARG(Function) function, const Allocator& a) -{ - typedef typename decay<Function>::type function_type; - - // Allocate and construct an operation to wrap the function. - typedef executor_op<function_type, Allocator> op; - typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; - p.p = new (p.v) op(BOOST_ASIO_MOVE_CAST(Function)(function), a); - - BOOST_ASIO_HANDLER_CREATION((impl->service_->context(), *p.p, - "strand_executor", impl.get(), 0, "defer")); - - // Add the function to the strand and schedule the strand if required. - bool first = enqueue(impl, p.p); - p.v = p.p = 0; - if (first) - ex.defer(invoker<Executor>(impl, ex), a); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_IMPL_STRAND_EXECUTOR_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/strand_executor_service.ipp b/contrib/restricted/boost/boost/asio/detail/impl/strand_executor_service.ipp deleted file mode 100644 index aed4d3cf6a..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/strand_executor_service.ipp +++ /dev/null @@ -1,136 +0,0 @@ -// -// detail/impl/strand_executor_service.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_STRAND_EXECUTOR_SERVICE_IPP -#define BOOST_ASIO_DETAIL_IMPL_STRAND_EXECUTOR_SERVICE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/strand_executor_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -strand_executor_service::strand_executor_service(execution_context& ctx) - : execution_context_service_base<strand_executor_service>(ctx), - mutex_(), - salt_(0), - impl_list_(0) -{ -} - -void strand_executor_service::shutdown() -{ - op_queue<scheduler_operation> ops; - - boost::asio::detail::mutex::scoped_lock lock(mutex_); - - strand_impl* impl = impl_list_; - while (impl) - { - impl->mutex_->lock(); - impl->shutdown_ = true; - ops.push(impl->waiting_queue_); - ops.push(impl->ready_queue_); - impl->mutex_->unlock(); - impl = impl->next_; - } -} - -strand_executor_service::implementation_type -strand_executor_service::create_implementation() -{ - implementation_type new_impl(new strand_impl); - new_impl->locked_ = false; - new_impl->shutdown_ = false; - - boost::asio::detail::mutex::scoped_lock lock(mutex_); - - // Select a mutex from the pool of shared mutexes. - std::size_t salt = salt_++; - std::size_t mutex_index = reinterpret_cast<std::size_t>(new_impl.get()); - mutex_index += (reinterpret_cast<std::size_t>(new_impl.get()) >> 3); - mutex_index ^= salt + 0x9e3779b9 + (mutex_index << 6) + (mutex_index >> 2); - mutex_index = mutex_index % num_mutexes; - if (!mutexes_[mutex_index].get()) - mutexes_[mutex_index].reset(new mutex); - new_impl->mutex_ = mutexes_[mutex_index].get(); - - // Insert implementation into linked list of all implementations. - new_impl->next_ = impl_list_; - new_impl->prev_ = 0; - if (impl_list_) - impl_list_->prev_ = new_impl.get(); - impl_list_ = new_impl.get(); - new_impl->service_ = this; - - return new_impl; -} - -strand_executor_service::strand_impl::~strand_impl() -{ - boost::asio::detail::mutex::scoped_lock lock(service_->mutex_); - - // Remove implementation from linked list of all implementations. - if (service_->impl_list_ == this) - service_->impl_list_ = next_; - if (prev_) - prev_->next_ = next_; - if (next_) - next_->prev_= prev_; -} - -bool strand_executor_service::enqueue(const implementation_type& impl, - scheduler_operation* op) -{ - impl->mutex_->lock(); - if (impl->shutdown_) - { - impl->mutex_->unlock(); - op->destroy(); - return false; - } - else if (impl->locked_) - { - // Some other function already holds the strand lock. Enqueue for later. - impl->waiting_queue_.push(op); - impl->mutex_->unlock(); - return false; - } - else - { - // The function is acquiring the strand lock and so is responsible for - // scheduling the strand. - impl->locked_ = true; - impl->mutex_->unlock(); - impl->ready_queue_.push(op); - return true; - } -} - -bool strand_executor_service::running_in_this_thread( - const implementation_type& impl) -{ - return !!call_stack<strand_impl>::contains(impl.get()); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_IMPL_STRAND_EXECUTOR_SERVICE_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/timer_queue_ptime.ipp b/contrib/restricted/boost/boost/asio/detail/impl/timer_queue_ptime.ipp deleted file mode 100644 index 8a6d5af815..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/timer_queue_ptime.ipp +++ /dev/null @@ -1,93 +0,0 @@ -// -// detail/impl/timer_queue_ptime.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP -#define BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - -#include <boost/asio/detail/timer_queue_ptime.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -timer_queue<time_traits<boost::posix_time::ptime> >::timer_queue() -{ -} - -timer_queue<time_traits<boost::posix_time::ptime> >::~timer_queue() -{ -} - -bool timer_queue<time_traits<boost::posix_time::ptime> >::enqueue_timer( - const time_type& time, per_timer_data& timer, wait_op* op) -{ - return impl_.enqueue_timer(time, timer, op); -} - -bool timer_queue<time_traits<boost::posix_time::ptime> >::empty() const -{ - return impl_.empty(); -} - -long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_msec( - long max_duration) const -{ - return impl_.wait_duration_msec(max_duration); -} - -long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_usec( - long max_duration) const -{ - return impl_.wait_duration_usec(max_duration); -} - -void timer_queue<time_traits<boost::posix_time::ptime> >::get_ready_timers( - op_queue<operation>& ops) -{ - impl_.get_ready_timers(ops); -} - -void timer_queue<time_traits<boost::posix_time::ptime> >::get_all_timers( - op_queue<operation>& ops) -{ - impl_.get_all_timers(ops); -} - -std::size_t timer_queue<time_traits<boost::posix_time::ptime> >::cancel_timer( - per_timer_data& timer, op_queue<operation>& ops, std::size_t max_cancelled) -{ - return impl_.cancel_timer(timer, ops, max_cancelled); -} - -void timer_queue<time_traits<boost::posix_time::ptime> >::move_timer( - per_timer_data& target, per_timer_data& source) -{ - impl_.move_timer(target, source); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - -#endif // BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_handle_service.ipp b/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_handle_service.ipp deleted file mode 100644 index 0cd7dd1719..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_handle_service.ipp +++ /dev/null @@ -1,527 +0,0 @@ -// -// detail/impl/win_iocp_handle_service.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_WIN_IOCP_HANDLE_SERVICE_IPP -#define BOOST_ASIO_DETAIL_IMPL_WIN_IOCP_HANDLE_SERVICE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_IOCP) - -#include <boost/asio/detail/win_iocp_handle_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -class win_iocp_handle_service::overlapped_wrapper - : public OVERLAPPED -{ -public: - explicit overlapped_wrapper(boost::system::error_code& ec) - { - Internal = 0; - InternalHigh = 0; - Offset = 0; - OffsetHigh = 0; - - // Create a non-signalled manual-reset event, for GetOverlappedResult. - hEvent = ::CreateEventW(0, TRUE, FALSE, 0); - if (hEvent) - { - // As documented in GetQueuedCompletionStatus, setting the low order - // bit of this event prevents our synchronous writes from being treated - // as completion port events. - DWORD_PTR tmp = reinterpret_cast<DWORD_PTR>(hEvent); - hEvent = reinterpret_cast<HANDLE>(tmp | 1); - } - else - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - } - } - - ~overlapped_wrapper() - { - if (hEvent) - { - ::CloseHandle(hEvent); - } - } -}; - -win_iocp_handle_service::win_iocp_handle_service( - boost::asio::io_context& io_context) - : service_base<win_iocp_handle_service>(io_context), - iocp_service_(boost::asio::use_service<win_iocp_io_context>(io_context)), - mutex_(), - impl_list_(0) -{ -} - -void win_iocp_handle_service::shutdown() -{ - // Close all implementations, causing all operations to complete. - boost::asio::detail::mutex::scoped_lock lock(mutex_); - implementation_type* impl = impl_list_; - while (impl) - { - close_for_destruction(*impl); - impl = impl->next_; - } -} - -void win_iocp_handle_service::construct( - win_iocp_handle_service::implementation_type& impl) -{ - impl.handle_ = INVALID_HANDLE_VALUE; - impl.safe_cancellation_thread_id_ = 0; - - // Insert implementation into linked list of all implementations. - boost::asio::detail::mutex::scoped_lock lock(mutex_); - impl.next_ = impl_list_; - impl.prev_ = 0; - if (impl_list_) - impl_list_->prev_ = &impl; - impl_list_ = &impl; -} - -void win_iocp_handle_service::move_construct( - win_iocp_handle_service::implementation_type& impl, - win_iocp_handle_service::implementation_type& other_impl) -{ - impl.handle_ = other_impl.handle_; - other_impl.handle_ = INVALID_HANDLE_VALUE; - - impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; - other_impl.safe_cancellation_thread_id_ = 0; - - // Insert implementation into linked list of all implementations. - boost::asio::detail::mutex::scoped_lock lock(mutex_); - impl.next_ = impl_list_; - impl.prev_ = 0; - if (impl_list_) - impl_list_->prev_ = &impl; - impl_list_ = &impl; -} - -void win_iocp_handle_service::move_assign( - win_iocp_handle_service::implementation_type& impl, - win_iocp_handle_service& other_service, - win_iocp_handle_service::implementation_type& other_impl) -{ - close_for_destruction(impl); - - if (this != &other_service) - { - // Remove implementation from linked list of all implementations. - boost::asio::detail::mutex::scoped_lock lock(mutex_); - if (impl_list_ == &impl) - impl_list_ = impl.next_; - if (impl.prev_) - impl.prev_->next_ = impl.next_; - if (impl.next_) - impl.next_->prev_= impl.prev_; - impl.next_ = 0; - impl.prev_ = 0; - } - - impl.handle_ = other_impl.handle_; - other_impl.handle_ = INVALID_HANDLE_VALUE; - - impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; - other_impl.safe_cancellation_thread_id_ = 0; - - if (this != &other_service) - { - // Insert implementation into linked list of all implementations. - boost::asio::detail::mutex::scoped_lock lock(other_service.mutex_); - impl.next_ = other_service.impl_list_; - impl.prev_ = 0; - if (other_service.impl_list_) - other_service.impl_list_->prev_ = &impl; - other_service.impl_list_ = &impl; - } -} - -void win_iocp_handle_service::destroy( - win_iocp_handle_service::implementation_type& impl) -{ - close_for_destruction(impl); - - // Remove implementation from linked list of all implementations. - boost::asio::detail::mutex::scoped_lock lock(mutex_); - if (impl_list_ == &impl) - impl_list_ = impl.next_; - if (impl.prev_) - impl.prev_->next_ = impl.next_; - if (impl.next_) - impl.next_->prev_= impl.prev_; - impl.next_ = 0; - impl.prev_ = 0; -} - -boost::system::error_code win_iocp_handle_service::assign( - win_iocp_handle_service::implementation_type& impl, - const native_handle_type& handle, boost::system::error_code& ec) -{ - if (is_open(impl)) - { - ec = boost::asio::error::already_open; - return ec; - } - - if (iocp_service_.register_handle(handle, ec)) - return ec; - - impl.handle_ = handle; - ec = boost::system::error_code(); - return ec; -} - -boost::system::error_code win_iocp_handle_service::close( - win_iocp_handle_service::implementation_type& impl, - boost::system::error_code& ec) -{ - if (is_open(impl)) - { - BOOST_ASIO_HANDLER_OPERATION((iocp_service_.context(), "handle", - &impl, reinterpret_cast<uintmax_t>(impl.handle_), "close")); - - if (!::CloseHandle(impl.handle_)) - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - } - else - { - ec = boost::system::error_code(); - } - - impl.handle_ = INVALID_HANDLE_VALUE; - impl.safe_cancellation_thread_id_ = 0; - } - else - { - ec = boost::system::error_code(); - } - - return ec; -} - -boost::system::error_code win_iocp_handle_service::cancel( - win_iocp_handle_service::implementation_type& impl, - boost::system::error_code& ec) -{ - if (!is_open(impl)) - { - ec = boost::asio::error::bad_descriptor; - return ec; - } - - BOOST_ASIO_HANDLER_OPERATION((iocp_service_.context(), "handle", - &impl, reinterpret_cast<uintmax_t>(impl.handle_), "cancel")); - - if (FARPROC cancel_io_ex_ptr = ::GetProcAddress( - ::GetModuleHandleA("KERNEL32"), "CancelIoEx")) - { - // The version of Windows supports cancellation from any thread. - typedef BOOL (WINAPI* cancel_io_ex_t)(HANDLE, LPOVERLAPPED); - cancel_io_ex_t cancel_io_ex = (cancel_io_ex_t)cancel_io_ex_ptr; - if (!cancel_io_ex(impl.handle_, 0)) - { - DWORD last_error = ::GetLastError(); - if (last_error == ERROR_NOT_FOUND) - { - // ERROR_NOT_FOUND means that there were no operations to be - // cancelled. We swallow this error to match the behaviour on other - // platforms. - ec = boost::system::error_code(); - } - else - { - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - } - } - else - { - ec = boost::system::error_code(); - } - } - else if (impl.safe_cancellation_thread_id_ == 0) - { - // No operations have been started, so there's nothing to cancel. - ec = boost::system::error_code(); - } - else if (impl.safe_cancellation_thread_id_ == ::GetCurrentThreadId()) - { - // Asynchronous operations have been started from the current thread only, - // so it is safe to try to cancel them using CancelIo. - if (!::CancelIo(impl.handle_)) - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - } - else - { - ec = boost::system::error_code(); - } - } - else - { - // Asynchronous operations have been started from more than one thread, - // so cancellation is not safe. - ec = boost::asio::error::operation_not_supported; - } - - return ec; -} - -size_t win_iocp_handle_service::do_write( - win_iocp_handle_service::implementation_type& impl, uint64_t offset, - const boost::asio::const_buffer& buffer, boost::system::error_code& ec) -{ - if (!is_open(impl)) - { - ec = boost::asio::error::bad_descriptor; - return 0; - } - - // A request to write 0 bytes on a handle is a no-op. - if (buffer.size() == 0) - { - ec = boost::system::error_code(); - return 0; - } - - overlapped_wrapper overlapped(ec); - if (ec) - { - return 0; - } - - // Write the data. - overlapped.Offset = offset & 0xFFFFFFFF; - overlapped.OffsetHigh = (offset >> 32) & 0xFFFFFFFF; - BOOL ok = ::WriteFile(impl.handle_, buffer.data(), - static_cast<DWORD>(buffer.size()), 0, &overlapped); - if (!ok) - { - DWORD last_error = ::GetLastError(); - if (last_error != ERROR_IO_PENDING) - { - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return 0; - } - } - - // Wait for the operation to complete. - DWORD bytes_transferred = 0; - ok = ::GetOverlappedResult(impl.handle_, - &overlapped, &bytes_transferred, TRUE); - if (!ok) - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return 0; - } - - ec = boost::system::error_code(); - return bytes_transferred; -} - -void win_iocp_handle_service::start_write_op( - win_iocp_handle_service::implementation_type& impl, uint64_t offset, - const boost::asio::const_buffer& buffer, operation* op) -{ - update_cancellation_thread_id(impl); - iocp_service_.work_started(); - - if (!is_open(impl)) - { - iocp_service_.on_completion(op, boost::asio::error::bad_descriptor); - } - else if (buffer.size() == 0) - { - // A request to write 0 bytes on a handle is a no-op. - iocp_service_.on_completion(op); - } - else - { - DWORD bytes_transferred = 0; - op->Offset = offset & 0xFFFFFFFF; - op->OffsetHigh = (offset >> 32) & 0xFFFFFFFF; - BOOL ok = ::WriteFile(impl.handle_, buffer.data(), - static_cast<DWORD>(buffer.size()), - &bytes_transferred, op); - DWORD last_error = ::GetLastError(); - if (!ok && last_error != ERROR_IO_PENDING - && last_error != ERROR_MORE_DATA) - { - iocp_service_.on_completion(op, last_error, bytes_transferred); - } - else - { - iocp_service_.on_pending(op); - } - } -} - -size_t win_iocp_handle_service::do_read( - win_iocp_handle_service::implementation_type& impl, uint64_t offset, - const boost::asio::mutable_buffer& buffer, boost::system::error_code& ec) -{ - if (!is_open(impl)) - { - ec = boost::asio::error::bad_descriptor; - return 0; - } - - // A request to read 0 bytes on a stream handle is a no-op. - if (buffer.size() == 0) - { - ec = boost::system::error_code(); - return 0; - } - - overlapped_wrapper overlapped(ec); - if (ec) - { - return 0; - } - - // Read some data. - overlapped.Offset = offset & 0xFFFFFFFF; - overlapped.OffsetHigh = (offset >> 32) & 0xFFFFFFFF; - BOOL ok = ::ReadFile(impl.handle_, buffer.data(), - static_cast<DWORD>(buffer.size()), 0, &overlapped); - if (!ok) - { - DWORD last_error = ::GetLastError(); - if (last_error != ERROR_IO_PENDING && last_error != ERROR_MORE_DATA) - { - if (last_error == ERROR_HANDLE_EOF) - { - ec = boost::asio::error::eof; - } - else - { - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - } - return 0; - } - } - - // Wait for the operation to complete. - DWORD bytes_transferred = 0; - ok = ::GetOverlappedResult(impl.handle_, - &overlapped, &bytes_transferred, TRUE); - if (!ok) - { - DWORD last_error = ::GetLastError(); - if (last_error == ERROR_HANDLE_EOF) - { - ec = boost::asio::error::eof; - } - else - { - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - } - return (last_error == ERROR_MORE_DATA) ? bytes_transferred : 0; - } - - ec = boost::system::error_code(); - return bytes_transferred; -} - -void win_iocp_handle_service::start_read_op( - win_iocp_handle_service::implementation_type& impl, uint64_t offset, - const boost::asio::mutable_buffer& buffer, operation* op) -{ - update_cancellation_thread_id(impl); - iocp_service_.work_started(); - - if (!is_open(impl)) - { - iocp_service_.on_completion(op, boost::asio::error::bad_descriptor); - } - else if (buffer.size() == 0) - { - // A request to read 0 bytes on a handle is a no-op. - iocp_service_.on_completion(op); - } - else - { - DWORD bytes_transferred = 0; - op->Offset = offset & 0xFFFFFFFF; - op->OffsetHigh = (offset >> 32) & 0xFFFFFFFF; - BOOL ok = ::ReadFile(impl.handle_, buffer.data(), - static_cast<DWORD>(buffer.size()), - &bytes_transferred, op); - DWORD last_error = ::GetLastError(); - if (!ok && last_error != ERROR_IO_PENDING - && last_error != ERROR_MORE_DATA) - { - iocp_service_.on_completion(op, last_error, bytes_transferred); - } - else - { - iocp_service_.on_pending(op); - } - } -} - -void win_iocp_handle_service::update_cancellation_thread_id( - win_iocp_handle_service::implementation_type& impl) -{ - if (impl.safe_cancellation_thread_id_ == 0) - impl.safe_cancellation_thread_id_ = ::GetCurrentThreadId(); - else if (impl.safe_cancellation_thread_id_ != ::GetCurrentThreadId()) - impl.safe_cancellation_thread_id_ = ~DWORD(0); -} - -void win_iocp_handle_service::close_for_destruction(implementation_type& impl) -{ - if (is_open(impl)) - { - BOOST_ASIO_HANDLER_OPERATION((iocp_service_.context(), "handle", - &impl, reinterpret_cast<uintmax_t>(impl.handle_), "close")); - - ::CloseHandle(impl.handle_); - impl.handle_ = INVALID_HANDLE_VALUE; - impl.safe_cancellation_thread_id_ = 0; - } -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_IOCP) - -#endif // BOOST_ASIO_DETAIL_IMPL_WIN_IOCP_HANDLE_SERVICE_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_serial_port_service.ipp b/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_serial_port_service.ipp deleted file mode 100644 index 7dbf9353ee..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_iocp_serial_port_service.ipp +++ /dev/null @@ -1,183 +0,0 @@ -// -// detail/impl/win_iocp_serial_port_service.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_WIN_IOCP_SERIAL_PORT_SERVICE_IPP -#define BOOST_ASIO_DETAIL_IMPL_WIN_IOCP_SERIAL_PORT_SERVICE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_IOCP) && defined(BOOST_ASIO_HAS_SERIAL_PORT) - -#include <cstring> -#include <boost/asio/detail/win_iocp_serial_port_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -win_iocp_serial_port_service::win_iocp_serial_port_service( - boost::asio::io_context& io_context) - : service_base<win_iocp_serial_port_service>(io_context), - handle_service_(io_context) -{ -} - -void win_iocp_serial_port_service::shutdown() -{ -} - -boost::system::error_code win_iocp_serial_port_service::open( - win_iocp_serial_port_service::implementation_type& impl, - const std::string& device, boost::system::error_code& ec) -{ - if (is_open(impl)) - { - ec = boost::asio::error::already_open; - return ec; - } - - // For convenience, add a leading \\.\ sequence if not already present. - std::string name = (device[0] == '\\') ? device : "\\\\.\\" + device; - - // Open a handle to the serial port. - ::HANDLE handle = ::CreateFileA(name.c_str(), - GENERIC_READ | GENERIC_WRITE, 0, 0, - OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); - if (handle == INVALID_HANDLE_VALUE) - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return ec; - } - - // Determine the initial serial port parameters. - using namespace std; // For memset. - ::DCB dcb; - memset(&dcb, 0, sizeof(DCB)); - dcb.DCBlength = sizeof(DCB); - if (!::GetCommState(handle, &dcb)) - { - DWORD last_error = ::GetLastError(); - ::CloseHandle(handle); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return ec; - } - - // Set some default serial port parameters. This implementation does not - // support changing these, so they might as well be in a known state. - dcb.fBinary = TRUE; // Win32 only supports binary mode. - dcb.fDsrSensitivity = FALSE; - dcb.fNull = FALSE; // Do not ignore NULL characters. - dcb.fAbortOnError = FALSE; // Ignore serial framing errors. - if (!::SetCommState(handle, &dcb)) - { - DWORD last_error = ::GetLastError(); - ::CloseHandle(handle); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return ec; - } - - // Set up timeouts so that the serial port will behave similarly to a - // network socket. Reads wait for at least one byte, then return with - // whatever they have. Writes return once everything is out the door. - ::COMMTIMEOUTS timeouts; - timeouts.ReadIntervalTimeout = 1; - timeouts.ReadTotalTimeoutMultiplier = 0; - timeouts.ReadTotalTimeoutConstant = 0; - timeouts.WriteTotalTimeoutMultiplier = 0; - timeouts.WriteTotalTimeoutConstant = 0; - if (!::SetCommTimeouts(handle, &timeouts)) - { - DWORD last_error = ::GetLastError(); - ::CloseHandle(handle); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return ec; - } - - // We're done. Take ownership of the serial port handle. - if (handle_service_.assign(impl, handle, ec)) - ::CloseHandle(handle); - return ec; -} - -boost::system::error_code win_iocp_serial_port_service::do_set_option( - win_iocp_serial_port_service::implementation_type& impl, - win_iocp_serial_port_service::store_function_type store, - const void* option, boost::system::error_code& ec) -{ - using namespace std; // For memcpy. - - ::DCB dcb; - memset(&dcb, 0, sizeof(DCB)); - dcb.DCBlength = sizeof(DCB); - if (!::GetCommState(handle_service_.native_handle(impl), &dcb)) - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return ec; - } - - if (store(option, dcb, ec)) - return ec; - - if (!::SetCommState(handle_service_.native_handle(impl), &dcb)) - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return ec; - } - - ec = boost::system::error_code(); - return ec; -} - -boost::system::error_code win_iocp_serial_port_service::do_get_option( - const win_iocp_serial_port_service::implementation_type& impl, - win_iocp_serial_port_service::load_function_type load, - void* option, boost::system::error_code& ec) const -{ - using namespace std; // For memset. - - ::DCB dcb; - memset(&dcb, 0, sizeof(DCB)); - dcb.DCBlength = sizeof(DCB); - if (!::GetCommState(handle_service_.native_handle(impl), &dcb)) - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return ec; - } - - return load(option, dcb, ec); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_IOCP) && defined(BOOST_ASIO_HAS_SERIAL_PORT) - -#endif // BOOST_ASIO_DETAIL_IMPL_WIN_IOCP_SERIAL_PORT_SERVICE_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/win_object_handle_service.ipp b/contrib/restricted/boost/boost/asio/detail/impl/win_object_handle_service.ipp deleted file mode 100644 index db56f722f2..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/win_object_handle_service.ipp +++ /dev/null @@ -1,451 +0,0 @@ -// -// detail/impl/win_object_handle_service.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_WIN_OBJECT_HANDLE_SERVICE_IPP -#define BOOST_ASIO_DETAIL_IMPL_WIN_OBJECT_HANDLE_SERVICE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) - -#include <boost/asio/detail/win_object_handle_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -win_object_handle_service::win_object_handle_service( - boost::asio::io_context& io_context) - : service_base<win_object_handle_service>(io_context), - io_context_(boost::asio::use_service<io_context_impl>(io_context)), - mutex_(), - impl_list_(0), - shutdown_(false) -{ -} - -void win_object_handle_service::shutdown() -{ - mutex::scoped_lock lock(mutex_); - - // Setting this flag to true prevents new objects from being registered, and - // new asynchronous wait operations from being started. We only need to worry - // about cleaning up the operations that are currently in progress. - shutdown_ = true; - - op_queue<operation> ops; - for (implementation_type* impl = impl_list_; impl; impl = impl->next_) - ops.push(impl->op_queue_); - - lock.unlock(); - - io_context_.abandon_operations(ops); -} - -void win_object_handle_service::construct( - win_object_handle_service::implementation_type& impl) -{ - impl.handle_ = INVALID_HANDLE_VALUE; - impl.wait_handle_ = INVALID_HANDLE_VALUE; - impl.owner_ = this; - - // Insert implementation into linked list of all implementations. - mutex::scoped_lock lock(mutex_); - if (!shutdown_) - { - impl.next_ = impl_list_; - impl.prev_ = 0; - if (impl_list_) - impl_list_->prev_ = &impl; - impl_list_ = &impl; - } -} - -void win_object_handle_service::move_construct( - win_object_handle_service::implementation_type& impl, - win_object_handle_service::implementation_type& other_impl) -{ - mutex::scoped_lock lock(mutex_); - - // Insert implementation into linked list of all implementations. - if (!shutdown_) - { - impl.next_ = impl_list_; - impl.prev_ = 0; - if (impl_list_) - impl_list_->prev_ = &impl; - impl_list_ = &impl; - } - - impl.handle_ = other_impl.handle_; - other_impl.handle_ = INVALID_HANDLE_VALUE; - impl.wait_handle_ = other_impl.wait_handle_; - other_impl.wait_handle_ = INVALID_HANDLE_VALUE; - impl.op_queue_.push(other_impl.op_queue_); - impl.owner_ = this; - - // We must not hold the lock while calling UnregisterWaitEx. This is because - // the registered callback function might be invoked while we are waiting for - // UnregisterWaitEx to complete. - lock.unlock(); - - if (impl.wait_handle_ != INVALID_HANDLE_VALUE) - ::UnregisterWaitEx(impl.wait_handle_, INVALID_HANDLE_VALUE); - - if (!impl.op_queue_.empty()) - register_wait_callback(impl, lock); -} - -void win_object_handle_service::move_assign( - win_object_handle_service::implementation_type& impl, - win_object_handle_service& other_service, - win_object_handle_service::implementation_type& other_impl) -{ - boost::system::error_code ignored_ec; - close(impl, ignored_ec); - - mutex::scoped_lock lock(mutex_); - - if (this != &other_service) - { - // Remove implementation from linked list of all implementations. - if (impl_list_ == &impl) - impl_list_ = impl.next_; - if (impl.prev_) - impl.prev_->next_ = impl.next_; - if (impl.next_) - impl.next_->prev_= impl.prev_; - impl.next_ = 0; - impl.prev_ = 0; - } - - impl.handle_ = other_impl.handle_; - other_impl.handle_ = INVALID_HANDLE_VALUE; - impl.wait_handle_ = other_impl.wait_handle_; - other_impl.wait_handle_ = INVALID_HANDLE_VALUE; - impl.op_queue_.push(other_impl.op_queue_); - impl.owner_ = this; - - if (this != &other_service) - { - // Insert implementation into linked list of all implementations. - impl.next_ = other_service.impl_list_; - impl.prev_ = 0; - if (other_service.impl_list_) - other_service.impl_list_->prev_ = &impl; - other_service.impl_list_ = &impl; - } - - // We must not hold the lock while calling UnregisterWaitEx. This is because - // the registered callback function might be invoked while we are waiting for - // UnregisterWaitEx to complete. - lock.unlock(); - - if (impl.wait_handle_ != INVALID_HANDLE_VALUE) - ::UnregisterWaitEx(impl.wait_handle_, INVALID_HANDLE_VALUE); - - if (!impl.op_queue_.empty()) - register_wait_callback(impl, lock); -} - -void win_object_handle_service::destroy( - win_object_handle_service::implementation_type& impl) -{ - mutex::scoped_lock lock(mutex_); - - // Remove implementation from linked list of all implementations. - if (impl_list_ == &impl) - impl_list_ = impl.next_; - if (impl.prev_) - impl.prev_->next_ = impl.next_; - if (impl.next_) - impl.next_->prev_= impl.prev_; - impl.next_ = 0; - impl.prev_ = 0; - - if (is_open(impl)) - { - BOOST_ASIO_HANDLER_OPERATION((io_context_.context(), "object_handle", - &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "close")); - - HANDLE wait_handle = impl.wait_handle_; - impl.wait_handle_ = INVALID_HANDLE_VALUE; - - op_queue<operation> ops; - while (wait_op* op = impl.op_queue_.front()) - { - op->ec_ = boost::asio::error::operation_aborted; - impl.op_queue_.pop(); - ops.push(op); - } - - // We must not hold the lock while calling UnregisterWaitEx. This is - // because the registered callback function might be invoked while we are - // waiting for UnregisterWaitEx to complete. - lock.unlock(); - - if (wait_handle != INVALID_HANDLE_VALUE) - ::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE); - - ::CloseHandle(impl.handle_); - impl.handle_ = INVALID_HANDLE_VALUE; - - io_context_.post_deferred_completions(ops); - } -} - -boost::system::error_code win_object_handle_service::assign( - win_object_handle_service::implementation_type& impl, - const native_handle_type& handle, boost::system::error_code& ec) -{ - if (is_open(impl)) - { - ec = boost::asio::error::already_open; - return ec; - } - - impl.handle_ = handle; - ec = boost::system::error_code(); - return ec; -} - -boost::system::error_code win_object_handle_service::close( - win_object_handle_service::implementation_type& impl, - boost::system::error_code& ec) -{ - if (is_open(impl)) - { - BOOST_ASIO_HANDLER_OPERATION((io_context_.context(), "object_handle", - &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "close")); - - mutex::scoped_lock lock(mutex_); - - HANDLE wait_handle = impl.wait_handle_; - impl.wait_handle_ = INVALID_HANDLE_VALUE; - - op_queue<operation> completed_ops; - while (wait_op* op = impl.op_queue_.front()) - { - impl.op_queue_.pop(); - op->ec_ = boost::asio::error::operation_aborted; - completed_ops.push(op); - } - - // We must not hold the lock while calling UnregisterWaitEx. This is - // because the registered callback function might be invoked while we are - // waiting for UnregisterWaitEx to complete. - lock.unlock(); - - if (wait_handle != INVALID_HANDLE_VALUE) - ::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE); - - if (::CloseHandle(impl.handle_)) - { - impl.handle_ = INVALID_HANDLE_VALUE; - ec = boost::system::error_code(); - } - else - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - } - - io_context_.post_deferred_completions(completed_ops); - } - else - { - ec = boost::system::error_code(); - } - - return ec; -} - -boost::system::error_code win_object_handle_service::cancel( - win_object_handle_service::implementation_type& impl, - boost::system::error_code& ec) -{ - if (is_open(impl)) - { - BOOST_ASIO_HANDLER_OPERATION((io_context_.context(), "object_handle", - &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "cancel")); - - mutex::scoped_lock lock(mutex_); - - HANDLE wait_handle = impl.wait_handle_; - impl.wait_handle_ = INVALID_HANDLE_VALUE; - - op_queue<operation> completed_ops; - while (wait_op* op = impl.op_queue_.front()) - { - op->ec_ = boost::asio::error::operation_aborted; - impl.op_queue_.pop(); - completed_ops.push(op); - } - - // We must not hold the lock while calling UnregisterWaitEx. This is - // because the registered callback function might be invoked while we are - // waiting for UnregisterWaitEx to complete. - lock.unlock(); - - if (wait_handle != INVALID_HANDLE_VALUE) - ::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE); - - ec = boost::system::error_code(); - - io_context_.post_deferred_completions(completed_ops); - } - else - { - ec = boost::asio::error::bad_descriptor; - } - - return ec; -} - -void win_object_handle_service::wait( - win_object_handle_service::implementation_type& impl, - boost::system::error_code& ec) -{ - switch (::WaitForSingleObject(impl.handle_, INFINITE)) - { - case WAIT_FAILED: - { - DWORD last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - break; - } - case WAIT_OBJECT_0: - case WAIT_ABANDONED: - default: - ec = boost::system::error_code(); - break; - } -} - -void win_object_handle_service::start_wait_op( - win_object_handle_service::implementation_type& impl, wait_op* op) -{ - io_context_.work_started(); - - if (is_open(impl)) - { - mutex::scoped_lock lock(mutex_); - - if (!shutdown_) - { - impl.op_queue_.push(op); - - // Only the first operation to be queued gets to register a wait callback. - // Subsequent operations have to wait for the first to finish. - if (impl.op_queue_.front() == op) - register_wait_callback(impl, lock); - } - else - { - lock.unlock(); - io_context_.post_deferred_completion(op); - } - } - else - { - op->ec_ = boost::asio::error::bad_descriptor; - io_context_.post_deferred_completion(op); - } -} - -void win_object_handle_service::register_wait_callback( - win_object_handle_service::implementation_type& impl, - mutex::scoped_lock& lock) -{ - lock.lock(); - - if (!RegisterWaitForSingleObject(&impl.wait_handle_, - impl.handle_, &win_object_handle_service::wait_callback, - &impl, INFINITE, WT_EXECUTEONLYONCE)) - { - DWORD last_error = ::GetLastError(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - - op_queue<operation> completed_ops; - while (wait_op* op = impl.op_queue_.front()) - { - op->ec_ = ec; - impl.op_queue_.pop(); - completed_ops.push(op); - } - - lock.unlock(); - io_context_.post_deferred_completions(completed_ops); - } -} - -void win_object_handle_service::wait_callback(PVOID param, BOOLEAN) -{ - implementation_type* impl = static_cast<implementation_type*>(param); - mutex::scoped_lock lock(impl->owner_->mutex_); - - if (impl->wait_handle_ != INVALID_HANDLE_VALUE) - { - ::UnregisterWaitEx(impl->wait_handle_, NULL); - impl->wait_handle_ = INVALID_HANDLE_VALUE; - } - - if (wait_op* op = impl->op_queue_.front()) - { - op_queue<operation> completed_ops; - - op->ec_ = boost::system::error_code(); - impl->op_queue_.pop(); - completed_ops.push(op); - - if (!impl->op_queue_.empty()) - { - if (!RegisterWaitForSingleObject(&impl->wait_handle_, - impl->handle_, &win_object_handle_service::wait_callback, - param, INFINITE, WT_EXECUTEONLYONCE)) - { - DWORD last_error = ::GetLastError(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - - while ((op = impl->op_queue_.front()) != 0) - { - op->ec_ = ec; - impl->op_queue_.pop(); - completed_ops.push(op); - } - } - } - - io_context_impl& ioc = impl->owner_->io_context_; - lock.unlock(); - ioc.post_deferred_completions(completed_ops); - } -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) - -#endif // BOOST_ASIO_DETAIL_IMPL_WIN_OBJECT_HANDLE_SERVICE_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/winrt_timer_scheduler.hpp b/contrib/restricted/boost/boost/asio/detail/impl/winrt_timer_scheduler.hpp deleted file mode 100644 index a475f66640..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/winrt_timer_scheduler.hpp +++ /dev/null @@ -1,94 +0,0 @@ -// -// detail/impl/winrt_timer_scheduler.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_HPP -#define BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename Time_Traits> -void winrt_timer_scheduler::add_timer_queue(timer_queue<Time_Traits>& queue) -{ - do_add_timer_queue(queue); -} - -// Remove a timer queue from the reactor. -template <typename Time_Traits> -void winrt_timer_scheduler::remove_timer_queue(timer_queue<Time_Traits>& queue) -{ - do_remove_timer_queue(queue); -} - -template <typename Time_Traits> -void winrt_timer_scheduler::schedule_timer(timer_queue<Time_Traits>& queue, - const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) -{ - boost::asio::detail::mutex::scoped_lock lock(mutex_); - - if (shutdown_) - { - io_context_.post_immediate_completion(op, false); - return; - } - - bool earliest = queue.enqueue_timer(time, timer, op); - io_context_.work_started(); - if (earliest) - event_.signal(lock); -} - -template <typename Time_Traits> -std::size_t winrt_timer_scheduler::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer, - std::size_t max_cancelled) -{ - boost::asio::detail::mutex::scoped_lock lock(mutex_); - op_queue<operation> ops; - std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); - lock.unlock(); - io_context_.post_deferred_completions(ops); - return n; -} - -template <typename Time_Traits> -void winrt_timer_scheduler::move_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& to, - typename timer_queue<Time_Traits>::per_timer_data& from) -{ - boost::asio::detail::mutex::scoped_lock lock(mutex_); - op_queue<operation> ops; - queue.cancel_timer(to, ops); - queue.move_timer(to, from); - lock.unlock(); - scheduler_.post_deferred_completions(ops); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) - -#endif // BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/impl/winrt_timer_scheduler.ipp b/contrib/restricted/boost/boost/asio/detail/impl/winrt_timer_scheduler.ipp deleted file mode 100644 index c8b77349cd..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/impl/winrt_timer_scheduler.ipp +++ /dev/null @@ -1,124 +0,0 @@ -// -// detail/impl/winrt_timer_scheduler.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_IPP -#define BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/winrt_timer_scheduler.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -winrt_timer_scheduler::winrt_timer_scheduler( - boost::asio::io_context& io_context) - : boost::asio::detail::service_base<winrt_timer_scheduler>(io_context), - io_context_(use_service<io_context_impl>(io_context)), - mutex_(), - event_(), - timer_queues_(), - thread_(0), - stop_thread_(false), - shutdown_(false) -{ - thread_ = new boost::asio::detail::thread( - bind_handler(&winrt_timer_scheduler::call_run_thread, this)); -} - -winrt_timer_scheduler::~winrt_timer_scheduler() -{ - shutdown(); -} - -void winrt_timer_scheduler::shutdown() -{ - boost::asio::detail::mutex::scoped_lock lock(mutex_); - shutdown_ = true; - stop_thread_ = true; - event_.signal(lock); - lock.unlock(); - - if (thread_) - { - thread_->join(); - delete thread_; - thread_ = 0; - } - - op_queue<operation> ops; - timer_queues_.get_all_timers(ops); - io_context_.abandon_operations(ops); -} - -void winrt_timer_scheduler::notify_fork(boost::asio::io_context::fork_event) -{ -} - -void winrt_timer_scheduler::init_task() -{ -} - -void winrt_timer_scheduler::run_thread() -{ - boost::asio::detail::mutex::scoped_lock lock(mutex_); - while (!stop_thread_) - { - const long max_wait_duration = 5 * 60 * 1000000; - long wait_duration = timer_queues_.wait_duration_usec(max_wait_duration); - event_.wait_for_usec(lock, wait_duration); - event_.clear(lock); - op_queue<operation> ops; - timer_queues_.get_ready_timers(ops); - if (!ops.empty()) - { - lock.unlock(); - io_context_.post_deferred_completions(ops); - lock.lock(); - } - } -} - -void winrt_timer_scheduler::call_run_thread(winrt_timer_scheduler* scheduler) -{ - scheduler->run_thread(); -} - -void winrt_timer_scheduler::do_add_timer_queue(timer_queue_base& queue) -{ - mutex::scoped_lock lock(mutex_); - timer_queues_.insert(&queue); -} - -void winrt_timer_scheduler::do_remove_timer_queue(timer_queue_base& queue) -{ - mutex::scoped_lock lock(mutex_); - timer_queues_.erase(&queue); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) - -#endif // BOOST_ASIO_DETAIL_IMPL_WINRT_TIMER_SCHEDULER_IPP diff --git a/contrib/restricted/boost/boost/asio/detail/local_free_on_block_exit.hpp b/contrib/restricted/boost/boost/asio/detail/local_free_on_block_exit.hpp deleted file mode 100644 index 0f1a84108c..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/local_free_on_block_exit.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// -// detail/local_free_on_block_exit.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP -#define BOOST_ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) -#if !defined(BOOST_ASIO_WINDOWS_APP) - -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/socket_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -class local_free_on_block_exit - : private noncopyable -{ -public: - // Constructor blocks all signals for the calling thread. - explicit local_free_on_block_exit(void* p) - : p_(p) - { - } - - // Destructor restores the previous signal mask. - ~local_free_on_block_exit() - { - ::LocalFree(p_); - } - -private: - void* p_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(BOOST_ASIO_WINDOWS_APP) -#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - -#endif // BOOST_ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_descriptor_service.hpp b/contrib/restricted/boost/boost/asio/detail/reactive_descriptor_service.hpp deleted file mode 100644 index ac50a8ccb9..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/reactive_descriptor_service.hpp +++ /dev/null @@ -1,390 +0,0 @@ -// -// detail/reactive_descriptor_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_REACTIVE_DESCRIPTOR_SERVICE_HPP -#define BOOST_ASIO_DETAIL_REACTIVE_DESCRIPTOR_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - -#include <boost/asio/buffer.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/detail/descriptor_ops.hpp> -#include <boost/asio/detail/descriptor_read_op.hpp> -#include <boost/asio/detail/descriptor_write_op.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/reactive_null_buffers_op.hpp> -#include <boost/asio/detail/reactive_wait_op.hpp> -#include <boost/asio/detail/reactor.hpp> -#include <boost/asio/posix/descriptor_base.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -class reactive_descriptor_service : - public service_base<reactive_descriptor_service> -{ -public: - // The native type of a descriptor. - typedef int native_handle_type; - - // The implementation type of the descriptor. - class implementation_type - : private boost::asio::detail::noncopyable - { - public: - // Default constructor. - implementation_type() - : descriptor_(-1), - state_(0) - { - } - - private: - // Only this service will have access to the internal values. - friend class reactive_descriptor_service; - - // The native descriptor representation. - int descriptor_; - - // The current state of the descriptor. - descriptor_ops::state_type state_; - - // Per-descriptor data used by the reactor. - reactor::per_descriptor_data reactor_data_; - }; - - // Constructor. - BOOST_ASIO_DECL reactive_descriptor_service( - boost::asio::io_context& io_context); - - // Destroy all user-defined handler objects owned by the service. - BOOST_ASIO_DECL void shutdown(); - - // Construct a new descriptor implementation. - BOOST_ASIO_DECL void construct(implementation_type& impl); - - // Move-construct a new descriptor implementation. - BOOST_ASIO_DECL void move_construct(implementation_type& impl, - implementation_type& other_impl); - - // Move-assign from another descriptor implementation. - BOOST_ASIO_DECL void move_assign(implementation_type& impl, - reactive_descriptor_service& other_service, - implementation_type& other_impl); - - // Destroy a descriptor implementation. - BOOST_ASIO_DECL void destroy(implementation_type& impl); - - // Assign a native descriptor to a descriptor implementation. - BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, - const native_handle_type& native_descriptor, - boost::system::error_code& ec); - - // Determine whether the descriptor is open. - bool is_open(const implementation_type& impl) const - { - return impl.descriptor_ != -1; - } - - // Destroy a descriptor implementation. - BOOST_ASIO_DECL boost::system::error_code close(implementation_type& impl, - boost::system::error_code& ec); - - // Get the native descriptor representation. - native_handle_type native_handle(const implementation_type& impl) const - { - return impl.descriptor_; - } - - // Release ownership of the native descriptor representation. - BOOST_ASIO_DECL native_handle_type release(implementation_type& impl); - - // Cancel all operations associated with the descriptor. - BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, - boost::system::error_code& ec); - - // Perform an IO control command on the descriptor. - template <typename IO_Control_Command> - boost::system::error_code io_control(implementation_type& impl, - IO_Control_Command& command, boost::system::error_code& ec) - { - descriptor_ops::ioctl(impl.descriptor_, impl.state_, - command.name(), static_cast<ioctl_arg_type*>(command.data()), ec); - return ec; - } - - // Gets the non-blocking mode of the descriptor. - bool non_blocking(const implementation_type& impl) const - { - return (impl.state_ & descriptor_ops::user_set_non_blocking) != 0; - } - - // Sets the non-blocking mode of the descriptor. - boost::system::error_code non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - descriptor_ops::set_user_non_blocking( - impl.descriptor_, impl.state_, mode, ec); - return ec; - } - - // Gets the non-blocking mode of the native descriptor implementation. - bool native_non_blocking(const implementation_type& impl) const - { - return (impl.state_ & descriptor_ops::internal_non_blocking) != 0; - } - - // Sets the non-blocking mode of the native descriptor implementation. - boost::system::error_code native_non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - descriptor_ops::set_internal_non_blocking( - impl.descriptor_, impl.state_, mode, ec); - return ec; - } - - // Wait for the descriptor to become ready to read, ready to write, or to have - // pending error conditions. - boost::system::error_code wait(implementation_type& impl, - posix::descriptor_base::wait_type w, boost::system::error_code& ec) - { - switch (w) - { - case posix::descriptor_base::wait_read: - descriptor_ops::poll_read(impl.descriptor_, impl.state_, ec); - break; - case posix::descriptor_base::wait_write: - descriptor_ops::poll_write(impl.descriptor_, impl.state_, ec); - break; - case posix::descriptor_base::wait_error: - descriptor_ops::poll_error(impl.descriptor_, impl.state_, ec); - break; - default: - ec = boost::asio::error::invalid_argument; - break; - } - - return ec; - } - - // Asynchronously wait for the descriptor to become ready to read, ready to - // write, or to have pending error conditions. - template <typename Handler> - void async_wait(implementation_type& impl, - posix::descriptor_base::wait_type w, Handler& handler) - { - bool is_continuation = - boost_asio_handler_cont_helpers::is_continuation(handler); - - // Allocate and construct an operation to wrap the handler. - typedef reactive_wait_op<Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(handler); - - BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor", - &impl, impl.descriptor_, "async_wait")); - - int op_type; - switch (w) - { - case posix::descriptor_base::wait_read: - op_type = reactor::read_op; - break; - case posix::descriptor_base::wait_write: - op_type = reactor::write_op; - break; - case posix::descriptor_base::wait_error: - op_type = reactor::except_op; - break; - default: - p.p->ec_ = boost::asio::error::invalid_argument; - reactor_.post_immediate_completion(p.p, is_continuation); - p.v = p.p = 0; - return; - } - - start_op(impl, op_type, p.p, is_continuation, false, false); - p.v = p.p = 0; - } - - // Write some data to the descriptor. - template <typename ConstBufferSequence> - size_t write_some(implementation_type& impl, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - buffer_sequence_adapter<boost::asio::const_buffer, - ConstBufferSequence> bufs(buffers); - - return descriptor_ops::sync_write(impl.descriptor_, impl.state_, - bufs.buffers(), bufs.count(), bufs.all_empty(), ec); - } - - // Wait until data can be written without blocking. - size_t write_some(implementation_type& impl, - const null_buffers&, boost::system::error_code& ec) - { - // Wait for descriptor to become ready. - descriptor_ops::poll_write(impl.descriptor_, impl.state_, ec); - - return 0; - } - - // Start an asynchronous write. The data being sent must be valid for the - // lifetime of the asynchronous operation. - template <typename ConstBufferSequence, typename Handler> - void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, Handler& handler) - { - bool is_continuation = - boost_asio_handler_cont_helpers::is_continuation(handler); - - // Allocate and construct an operation to wrap the handler. - typedef descriptor_write_op<ConstBufferSequence, Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(impl.descriptor_, buffers, handler); - - BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor", - &impl, impl.descriptor_, "async_write_some")); - - start_op(impl, reactor::write_op, p.p, is_continuation, true, - buffer_sequence_adapter<boost::asio::const_buffer, - ConstBufferSequence>::all_empty(buffers)); - p.v = p.p = 0; - } - - // Start an asynchronous wait until data can be written without blocking. - template <typename Handler> - void async_write_some(implementation_type& impl, - const null_buffers&, Handler& handler) - { - bool is_continuation = - boost_asio_handler_cont_helpers::is_continuation(handler); - - // Allocate and construct an operation to wrap the handler. - typedef reactive_null_buffers_op<Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(handler); - - BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor", - &impl, impl.descriptor_, "async_write_some(null_buffers)")); - - start_op(impl, reactor::write_op, p.p, is_continuation, false, false); - p.v = p.p = 0; - } - - // Read some data from the stream. Returns the number of bytes read. - template <typename MutableBufferSequence> - size_t read_some(implementation_type& impl, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - buffer_sequence_adapter<boost::asio::mutable_buffer, - MutableBufferSequence> bufs(buffers); - - return descriptor_ops::sync_read(impl.descriptor_, impl.state_, - bufs.buffers(), bufs.count(), bufs.all_empty(), ec); - } - - // Wait until data can be read without blocking. - size_t read_some(implementation_type& impl, - const null_buffers&, boost::system::error_code& ec) - { - // Wait for descriptor to become ready. - descriptor_ops::poll_read(impl.descriptor_, impl.state_, ec); - - return 0; - } - - // Start an asynchronous read. The buffer for the data being read must be - // valid for the lifetime of the asynchronous operation. - template <typename MutableBufferSequence, typename Handler> - void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, Handler& handler) - { - bool is_continuation = - boost_asio_handler_cont_helpers::is_continuation(handler); - - // Allocate and construct an operation to wrap the handler. - typedef descriptor_read_op<MutableBufferSequence, Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(impl.descriptor_, buffers, handler); - - BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor", - &impl, impl.descriptor_, "async_read_some")); - - start_op(impl, reactor::read_op, p.p, is_continuation, true, - buffer_sequence_adapter<boost::asio::mutable_buffer, - MutableBufferSequence>::all_empty(buffers)); - p.v = p.p = 0; - } - - // Wait until data can be read without blocking. - template <typename Handler> - void async_read_some(implementation_type& impl, - const null_buffers&, Handler& handler) - { - bool is_continuation = - boost_asio_handler_cont_helpers::is_continuation(handler); - - // Allocate and construct an operation to wrap the handler. - typedef reactive_null_buffers_op<Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(handler); - - BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor", - &impl, impl.descriptor_, "async_read_some(null_buffers)")); - - start_op(impl, reactor::read_op, p.p, is_continuation, false, false); - p.v = p.p = 0; - } - -private: - // Start the asynchronous operation. - BOOST_ASIO_DECL void start_op(implementation_type& impl, int op_type, - reactor_op* op, bool is_continuation, bool is_non_blocking, bool noop); - - // The selector that performs event demultiplexing for the service. - reactor& reactor_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/reactive_descriptor_service.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - -#endif // BOOST_ASIO_DETAIL_REACTIVE_DESCRIPTOR_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/reactive_serial_port_service.hpp b/contrib/restricted/boost/boost/asio/detail/reactive_serial_port_service.hpp deleted file mode 100644 index 42ff500d2c..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/reactive_serial_port_service.hpp +++ /dev/null @@ -1,238 +0,0 @@ -// -// detail/reactive_serial_port_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_REACTIVE_SERIAL_PORT_SERVICE_HPP -#define BOOST_ASIO_DETAIL_REACTIVE_SERIAL_PORT_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_SERIAL_PORT) -#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - -#include <string> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/serial_port_base.hpp> -#include <boost/asio/detail/descriptor_ops.hpp> -#include <boost/asio/detail/reactive_descriptor_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -// Extend reactive_descriptor_service to provide serial port support. -class reactive_serial_port_service : - public service_base<reactive_serial_port_service> -{ -public: - // The native type of a serial port. - typedef reactive_descriptor_service::native_handle_type native_handle_type; - - // The implementation type of the serial port. - typedef reactive_descriptor_service::implementation_type implementation_type; - - BOOST_ASIO_DECL reactive_serial_port_service( - boost::asio::io_context& io_context); - - // Destroy all user-defined handler objects owned by the service. - BOOST_ASIO_DECL void shutdown(); - - // Construct a new serial port implementation. - void construct(implementation_type& impl) - { - descriptor_service_.construct(impl); - } - - // Move-construct a new serial port implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - descriptor_service_.move_construct(impl, other_impl); - } - - // Move-assign from another serial port implementation. - void move_assign(implementation_type& impl, - reactive_serial_port_service& other_service, - implementation_type& other_impl) - { - descriptor_service_.move_assign(impl, - other_service.descriptor_service_, other_impl); - } - - // Destroy a serial port implementation. - void destroy(implementation_type& impl) - { - descriptor_service_.destroy(impl); - } - - // Open the serial port using the specified device name. - BOOST_ASIO_DECL boost::system::error_code open(implementation_type& impl, - const std::string& device, boost::system::error_code& ec); - - // Assign a native descriptor to a serial port implementation. - boost::system::error_code assign(implementation_type& impl, - const native_handle_type& native_descriptor, - boost::system::error_code& ec) - { - return descriptor_service_.assign(impl, native_descriptor, ec); - } - - // Determine whether the serial port is open. - bool is_open(const implementation_type& impl) const - { - return descriptor_service_.is_open(impl); - } - - // Destroy a serial port implementation. - boost::system::error_code close(implementation_type& impl, - boost::system::error_code& ec) - { - return descriptor_service_.close(impl, ec); - } - - // Get the native serial port representation. - native_handle_type native_handle(implementation_type& impl) - { - return descriptor_service_.native_handle(impl); - } - - // Cancel all operations associated with the serial port. - boost::system::error_code cancel(implementation_type& impl, - boost::system::error_code& ec) - { - return descriptor_service_.cancel(impl, ec); - } - - // Set an option on the serial port. - template <typename SettableSerialPortOption> - boost::system::error_code set_option(implementation_type& impl, - const SettableSerialPortOption& option, boost::system::error_code& ec) - { - return do_set_option(impl, - &reactive_serial_port_service::store_option<SettableSerialPortOption>, - &option, ec); - } - - // Get an option from the serial port. - template <typename GettableSerialPortOption> - boost::system::error_code get_option(const implementation_type& impl, - GettableSerialPortOption& option, boost::system::error_code& ec) const - { - return do_get_option(impl, - &reactive_serial_port_service::load_option<GettableSerialPortOption>, - &option, ec); - } - - // Send a break sequence to the serial port. - boost::system::error_code send_break(implementation_type& impl, - boost::system::error_code& ec) - { - errno = 0; - descriptor_ops::error_wrapper(::tcsendbreak( - descriptor_service_.native_handle(impl), 0), ec); - return ec; - } - - // Write the given data. Returns the number of bytes sent. - template <typename ConstBufferSequence> - size_t write_some(implementation_type& impl, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - return descriptor_service_.write_some(impl, buffers, ec); - } - - // Start an asynchronous write. The data being written must be valid for the - // lifetime of the asynchronous operation. - template <typename ConstBufferSequence, typename Handler> - void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, Handler& handler) - { - descriptor_service_.async_write_some(impl, buffers, handler); - } - - // Read some data. Returns the number of bytes received. - template <typename MutableBufferSequence> - size_t read_some(implementation_type& impl, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - return descriptor_service_.read_some(impl, buffers, ec); - } - - // Start an asynchronous read. The buffer for the data being received must be - // valid for the lifetime of the asynchronous operation. - template <typename MutableBufferSequence, typename Handler> - void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, Handler& handler) - { - descriptor_service_.async_read_some(impl, buffers, handler); - } - -private: - // Function pointer type for storing a serial port option. - typedef boost::system::error_code (*store_function_type)( - const void*, termios&, boost::system::error_code&); - - // Helper function template to store a serial port option. - template <typename SettableSerialPortOption> - static boost::system::error_code store_option(const void* option, - termios& storage, boost::system::error_code& ec) - { - static_cast<const SettableSerialPortOption*>(option)->store(storage, ec); - return ec; - } - - // Helper function to set a serial port option. - BOOST_ASIO_DECL boost::system::error_code do_set_option( - implementation_type& impl, store_function_type store, - const void* option, boost::system::error_code& ec); - - // Function pointer type for loading a serial port option. - typedef boost::system::error_code (*load_function_type)( - void*, const termios&, boost::system::error_code&); - - // Helper function template to load a serial port option. - template <typename GettableSerialPortOption> - static boost::system::error_code load_option(void* option, - const termios& storage, boost::system::error_code& ec) - { - static_cast<GettableSerialPortOption*>(option)->load(storage, ec); - return ec; - } - - // Helper function to get a serial port option. - BOOST_ASIO_DECL boost::system::error_code do_get_option( - const implementation_type& impl, load_function_type load, - void* option, boost::system::error_code& ec) const; - - // The implementation used for initiating asynchronous operations. - reactive_descriptor_service descriptor_service_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/reactive_serial_port_service.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) -#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) - -#endif // BOOST_ASIO_DETAIL_REACTIVE_SERIAL_PORT_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/regex_fwd.hpp b/contrib/restricted/boost/boost/asio/detail/regex_fwd.hpp deleted file mode 100644 index 4d35a68ab9..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/regex_fwd.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// -// detail/regex_fwd.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_REGEX_FWD_HPP -#define BOOST_ASIO_DETAIL_REGEX_FWD_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#if defined(BOOST_ASIO_HAS_BOOST_REGEX) - -#include <boost/regex_fwd.hpp> -#include <boost/regex/v4/match_flags.hpp> - -namespace boost { - -template <class BidiIterator> -struct sub_match; - -template <class BidiIterator, class Allocator> -class match_results; - -} // namespace boost - -#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX) - -#endif // BOOST_ASIO_DETAIL_REGEX_FWD_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/signal_handler.hpp b/contrib/restricted/boost/boost/asio/detail/signal_handler.hpp deleted file mode 100644 index 2045db2188..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/signal_handler.hpp +++ /dev/null @@ -1,88 +0,0 @@ -// -// detail/signal_handler.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP -#define BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/handler_work.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/signal_op.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename Handler> -class signal_handler : public signal_op -{ -public: - BOOST_ASIO_DEFINE_HANDLER_PTR(signal_handler); - - signal_handler(Handler& h) - : signal_op(&signal_handler::do_complete), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)) - { - handler_work<Handler>::start(handler_); - } - - static void do_complete(void* owner, operation* base, - const boost::system::error_code& /*ec*/, - std::size_t /*bytes_transferred*/) - { - // Take ownership of the handler object. - signal_handler* h(static_cast<signal_handler*>(base)); - ptr p = { boost::asio::detail::addressof(h->handler_), h, h }; - handler_work<Handler> w(h->handler_); - - BOOST_ASIO_HANDLER_COMPLETION((*h)); - - // Make a copy of the handler so that the memory can be deallocated before - // the upcall is made. Even if we're not about to make an upcall, a - // sub-object of the handler may be the true owner of the memory associated - // with the handler. Consequently, a local copy of the handler is required - // to ensure that any owning sub-object remains valid until after we have - // deallocated the memory here. - detail::binder2<Handler, boost::system::error_code, int> - handler(h->handler_, h->ec_, h->signal_number_); - p.h = boost::asio::detail::addressof(handler.handler_); - p.reset(); - - // Make the upcall if required. - if (owner) - { - fenced_block b(fenced_block::half); - BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); - w.complete(handler, handler.handler_); - BOOST_ASIO_HANDLER_INVOCATION_END; - } - } - -private: - Handler handler_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/signal_op.hpp b/contrib/restricted/boost/boost/asio/detail/signal_op.hpp deleted file mode 100644 index 74cc68290d..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/signal_op.hpp +++ /dev/null @@ -1,51 +0,0 @@ -// -// detail/signal_op.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_SIGNAL_OP_HPP -#define BOOST_ASIO_DETAIL_SIGNAL_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/operation.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -class signal_op - : public operation -{ -public: - // The error code to be passed to the completion handler. - boost::system::error_code ec_; - - // The signal number to be passed to the completion handler. - int signal_number_; - -protected: - signal_op(func_type func) - : operation(func), - signal_number_(0) - { - } -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_SIGNAL_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/signal_set_service.hpp b/contrib/restricted/boost/boost/asio/detail/signal_set_service.hpp deleted file mode 100644 index 17ae44ea37..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/signal_set_service.hpp +++ /dev/null @@ -1,219 +0,0 @@ -// -// detail/signal_set_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP -#define BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <cstddef> -#include <signal.h> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/op_queue.hpp> -#include <boost/asio/detail/signal_handler.hpp> -#include <boost/asio/detail/signal_op.hpp> -#include <boost/asio/detail/socket_types.hpp> - -#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) -# include <boost/asio/detail/reactor.hpp> -#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -#if defined(NSIG) && (NSIG > 0) -enum { max_signal_number = NSIG }; -#else -enum { max_signal_number = 128 }; -#endif - -extern BOOST_ASIO_DECL struct signal_state* get_signal_state(); - -extern "C" BOOST_ASIO_DECL void boost_asio_signal_handler(int signal_number); - -class signal_set_service : - public service_base<signal_set_service> -{ -public: - // Type used for tracking an individual signal registration. - class registration - { - public: - // Default constructor. - registration() - : signal_number_(0), - queue_(0), - undelivered_(0), - next_in_table_(0), - prev_in_table_(0), - next_in_set_(0) - { - } - - private: - // Only this service will have access to the internal values. - friend class signal_set_service; - - // The signal number that is registered. - int signal_number_; - - // The waiting signal handlers. - op_queue<signal_op>* queue_; - - // The number of undelivered signals. - std::size_t undelivered_; - - // Pointers to adjacent registrations in the registrations_ table. - registration* next_in_table_; - registration* prev_in_table_; - - // Link to next registration in the signal set. - registration* next_in_set_; - }; - - // The implementation type of the signal_set. - class implementation_type - { - public: - // Default constructor. - implementation_type() - : signals_(0) - { - } - - private: - // Only this service will have access to the internal values. - friend class signal_set_service; - - // The pending signal handlers. - op_queue<signal_op> queue_; - - // Linked list of registered signals. - registration* signals_; - }; - - // Constructor. - BOOST_ASIO_DECL signal_set_service(boost::asio::io_context& io_context); - - // Destructor. - BOOST_ASIO_DECL ~signal_set_service(); - - // Destroy all user-defined handler objects owned by the service. - BOOST_ASIO_DECL void shutdown(); - - // Perform fork-related housekeeping. - BOOST_ASIO_DECL void notify_fork( - boost::asio::io_context::fork_event fork_ev); - - // Construct a new signal_set implementation. - BOOST_ASIO_DECL void construct(implementation_type& impl); - - // Destroy a signal_set implementation. - BOOST_ASIO_DECL void destroy(implementation_type& impl); - - // Add a signal to a signal_set. - BOOST_ASIO_DECL boost::system::error_code add(implementation_type& impl, - int signal_number, boost::system::error_code& ec); - - // Remove a signal to a signal_set. - BOOST_ASIO_DECL boost::system::error_code remove(implementation_type& impl, - int signal_number, boost::system::error_code& ec); - - // Remove all signals from a signal_set. - BOOST_ASIO_DECL boost::system::error_code clear(implementation_type& impl, - boost::system::error_code& ec); - - // Cancel all operations associated with the signal set. - BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, - boost::system::error_code& ec); - - // Start an asynchronous operation to wait for a signal to be delivered. - template <typename Handler> - void async_wait(implementation_type& impl, Handler& handler) - { - // Allocate and construct an operation to wrap the handler. - typedef signal_handler<Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(handler); - - BOOST_ASIO_HANDLER_CREATION((io_context_.context(), - *p.p, "signal_set", &impl, 0, "async_wait")); - - start_wait_op(impl, p.p); - p.v = p.p = 0; - } - - // Deliver notification that a particular signal occurred. - BOOST_ASIO_DECL static void deliver_signal(int signal_number); - -private: - // Helper function to add a service to the global signal state. - BOOST_ASIO_DECL static void add_service(signal_set_service* service); - - // Helper function to remove a service from the global signal state. - BOOST_ASIO_DECL static void remove_service(signal_set_service* service); - - // Helper function to create the pipe descriptors. - BOOST_ASIO_DECL static void open_descriptors(); - - // Helper function to close the pipe descriptors. - BOOST_ASIO_DECL static void close_descriptors(); - - // Helper function to start a wait operation. - BOOST_ASIO_DECL void start_wait_op(implementation_type& impl, signal_op* op); - - // The io_context instance used for dispatching handlers. - io_context_impl& io_context_; - -#if !defined(BOOST_ASIO_WINDOWS) \ - && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \ - && !defined(__CYGWIN__) - // The type used for registering for pipe reactor notifications. - class pipe_read_op; - - // The reactor used for waiting for pipe readiness. - reactor& reactor_; - - // The per-descriptor reactor data used for the pipe. - reactor::per_descriptor_data reactor_data_; -#endif // !defined(BOOST_ASIO_WINDOWS) - // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) - // && !defined(__CYGWIN__) - - // A mapping from signal number to the registered signal sets. - registration* registrations_[max_signal_number]; - - // Pointers to adjacent services in linked list. - signal_set_service* next_; - signal_set_service* prev_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/signal_set_service.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/strand_executor_service.hpp b/contrib/restricted/boost/boost/asio/detail/strand_executor_service.hpp deleted file mode 100644 index c3e68408dc..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/strand_executor_service.hpp +++ /dev/null @@ -1,144 +0,0 @@ -// -// detail/strand_executor_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_STRAND_EXECUTOR_SERVICE_HPP -#define BOOST_ASIO_DETAIL_STRAND_EXECUTOR_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/atomic_count.hpp> -#include <boost/asio/detail/executor_op.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/mutex.hpp> -#include <boost/asio/detail/op_queue.hpp> -#include <boost/asio/detail/scheduler_operation.hpp> -#include <boost/asio/detail/scoped_ptr.hpp> -#include <boost/asio/execution_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -// Default service implementation for a strand. -class strand_executor_service - : public execution_context_service_base<strand_executor_service> -{ -public: - // The underlying implementation of a strand. - class strand_impl - { - public: - BOOST_ASIO_DECL ~strand_impl(); - - private: - friend class strand_executor_service; - - // Mutex to protect access to internal data. - mutex* mutex_; - - // Indicates whether the strand is currently "locked" by a handler. This - // means that there is a handler upcall in progress, or that the strand - // itself has been scheduled in order to invoke some pending handlers. - bool locked_; - - // Indicates that the strand has been shut down and will accept no further - // handlers. - bool shutdown_; - - // The handlers that are waiting on the strand but should not be run until - // after the next time the strand is scheduled. This queue must only be - // modified while the mutex is locked. - op_queue<scheduler_operation> waiting_queue_; - - // The handlers that are ready to be run. Logically speaking, these are the - // handlers that hold the strand's lock. The ready queue is only modified - // from within the strand and so may be accessed without locking the mutex. - op_queue<scheduler_operation> ready_queue_; - - // Pointers to adjacent handle implementations in linked list. - strand_impl* next_; - strand_impl* prev_; - - // The strand service in where the implementation is held. - strand_executor_service* service_; - }; - - typedef shared_ptr<strand_impl> implementation_type; - - // Construct a new strand service for the specified context. - BOOST_ASIO_DECL explicit strand_executor_service(execution_context& context); - - // Destroy all user-defined handler objects owned by the service. - BOOST_ASIO_DECL void shutdown(); - - // Create a new strand_executor implementation. - BOOST_ASIO_DECL implementation_type create_implementation(); - - // Request invocation of the given function. - template <typename Executor, typename Function, typename Allocator> - static void dispatch(const implementation_type& impl, Executor& ex, - BOOST_ASIO_MOVE_ARG(Function) function, const Allocator& a); - - // Request invocation of the given function and return immediately. - template <typename Executor, typename Function, typename Allocator> - static void post(const implementation_type& impl, Executor& ex, - BOOST_ASIO_MOVE_ARG(Function) function, const Allocator& a); - - // Request invocation of the given function and return immediately. - template <typename Executor, typename Function, typename Allocator> - static void defer(const implementation_type& impl, Executor& ex, - BOOST_ASIO_MOVE_ARG(Function) function, const Allocator& a); - - // Determine whether the strand is running in the current thread. - BOOST_ASIO_DECL static bool running_in_this_thread( - const implementation_type& impl); - -private: - friend class strand_impl; - template <typename Executor> class invoker; - - // Adds a function to the strand. Returns true if it acquires the lock. - BOOST_ASIO_DECL static bool enqueue(const implementation_type& impl, - scheduler_operation* op); - - // Mutex to protect access to the service-wide state. - mutex mutex_; - - // Number of mutexes shared between all strand objects. - enum { num_mutexes = 193 }; - - // Pool of mutexes. - scoped_ptr<mutex> mutexes_[num_mutexes]; - - // Extra value used when hashing to prevent recycled memory locations from - // getting the same mutex. - std::size_t salt_; - - // The head of a linked list of all implementations. - strand_impl* impl_list_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/detail/impl/strand_executor_service.hpp> -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/strand_executor_service.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_DETAIL_STRAND_EXECUTOR_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/timer_queue.hpp b/contrib/restricted/boost/boost/asio/detail/timer_queue.hpp deleted file mode 100644 index 3b2bcff774..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/timer_queue.hpp +++ /dev/null @@ -1,362 +0,0 @@ -// -// detail/timer_queue.hpp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_TIMER_QUEUE_HPP -#define BOOST_ASIO_DETAIL_TIMER_QUEUE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <vector> -#include <boost/asio/detail/cstdint.hpp> -#include <boost/asio/detail/date_time_fwd.hpp> -#include <boost/asio/detail/limits.hpp> -#include <boost/asio/detail/op_queue.hpp> -#include <boost/asio/detail/timer_queue_base.hpp> -#include <boost/asio/detail/wait_op.hpp> -#include <boost/asio/error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename Time_Traits> -class timer_queue - : public timer_queue_base -{ -public: - // The time type. - typedef typename Time_Traits::time_type time_type; - - // The duration type. - typedef typename Time_Traits::duration_type duration_type; - - // Per-timer data. - class per_timer_data - { - public: - per_timer_data() : - heap_index_((std::numeric_limits<std::size_t>::max)()), - next_(0), prev_(0) - { - } - - private: - friend class timer_queue; - - // The operations waiting on the timer. - op_queue<wait_op> op_queue_; - - // The index of the timer in the heap. - std::size_t heap_index_; - - // Pointers to adjacent timers in a linked list. - per_timer_data* next_; - per_timer_data* prev_; - }; - - // Constructor. - timer_queue() - : timers_(), - heap_() - { - } - - // Add a new timer to the queue. Returns true if this is the timer that is - // earliest in the queue, in which case the reactor's event demultiplexing - // function call may need to be interrupted and restarted. - bool enqueue_timer(const time_type& time, per_timer_data& timer, wait_op* op) - { - // Enqueue the timer object. - if (timer.prev_ == 0 && &timer != timers_) - { - if (this->is_positive_infinity(time)) - { - // No heap entry is required for timers that never expire. - timer.heap_index_ = (std::numeric_limits<std::size_t>::max)(); - } - else - { - // Put the new timer at the correct position in the heap. This is done - // first since push_back() can throw due to allocation failure. - timer.heap_index_ = heap_.size(); - heap_entry entry = { time, &timer }; - heap_.push_back(entry); - up_heap(heap_.size() - 1); - } - - // Insert the new timer into the linked list of active timers. - timer.next_ = timers_; - timer.prev_ = 0; - if (timers_) - timers_->prev_ = &timer; - timers_ = &timer; - } - - // Enqueue the individual timer operation. - timer.op_queue_.push(op); - - // Interrupt reactor only if newly added timer is first to expire. - return timer.heap_index_ == 0 && timer.op_queue_.front() == op; - } - - // Whether there are no timers in the queue. - virtual bool empty() const - { - return timers_ == 0; - } - - // Get the time for the timer that is earliest in the queue. - virtual long wait_duration_msec(long max_duration) const - { - if (heap_.empty()) - return max_duration; - - return this->to_msec( - Time_Traits::to_posix_duration( - Time_Traits::subtract(heap_[0].time_, Time_Traits::now())), - max_duration); - } - - // Get the time for the timer that is earliest in the queue. - virtual long wait_duration_usec(long max_duration) const - { - if (heap_.empty()) - return max_duration; - - return this->to_usec( - Time_Traits::to_posix_duration( - Time_Traits::subtract(heap_[0].time_, Time_Traits::now())), - max_duration); - } - - // Dequeue all timers not later than the current time. - virtual void get_ready_timers(op_queue<operation>& ops) - { - if (!heap_.empty()) - { - const time_type now = Time_Traits::now(); - while (!heap_.empty() && !Time_Traits::less_than(now, heap_[0].time_)) - { - per_timer_data* timer = heap_[0].timer_; - ops.push(timer->op_queue_); - remove_timer(*timer); - } - } - } - - // Dequeue all timers. - virtual void get_all_timers(op_queue<operation>& ops) - { - while (timers_) - { - per_timer_data* timer = timers_; - timers_ = timers_->next_; - ops.push(timer->op_queue_); - timer->next_ = 0; - timer->prev_ = 0; - } - - heap_.clear(); - } - - // Cancel and dequeue operations for the given timer. - std::size_t cancel_timer(per_timer_data& timer, op_queue<operation>& ops, - std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()) - { - std::size_t num_cancelled = 0; - if (timer.prev_ != 0 || &timer == timers_) - { - while (wait_op* op = (num_cancelled != max_cancelled) - ? timer.op_queue_.front() : 0) - { - op->ec_ = boost::asio::error::operation_aborted; - timer.op_queue_.pop(); - ops.push(op); - ++num_cancelled; - } - if (timer.op_queue_.empty()) - remove_timer(timer); - } - return num_cancelled; - } - - // Move operations from one timer to another, empty timer. - void move_timer(per_timer_data& target, per_timer_data& source) - { - target.op_queue_.push(source.op_queue_); - - target.heap_index_ = source.heap_index_; - source.heap_index_ = (std::numeric_limits<std::size_t>::max)(); - - if (target.heap_index_ < heap_.size()) - heap_[target.heap_index_].timer_ = ⌖ - - if (timers_ == &source) - timers_ = ⌖ - if (source.prev_) - source.prev_->next_ = ⌖ - if (source.next_) - source.next_->prev_= ⌖ - target.next_ = source.next_; - target.prev_ = source.prev_; - source.next_ = 0; - source.prev_ = 0; - } - -private: - // Move the item at the given index up the heap to its correct position. - void up_heap(std::size_t index) - { - while (index > 0) - { - std::size_t parent = (index - 1) / 2; - if (!Time_Traits::less_than(heap_[index].time_, heap_[parent].time_)) - break; - swap_heap(index, parent); - index = parent; - } - } - - // Move the item at the given index down the heap to its correct position. - void down_heap(std::size_t index) - { - std::size_t child = index * 2 + 1; - while (child < heap_.size()) - { - std::size_t min_child = (child + 1 == heap_.size() - || Time_Traits::less_than( - heap_[child].time_, heap_[child + 1].time_)) - ? child : child + 1; - if (Time_Traits::less_than(heap_[index].time_, heap_[min_child].time_)) - break; - swap_heap(index, min_child); - index = min_child; - child = index * 2 + 1; - } - } - - // Swap two entries in the heap. - void swap_heap(std::size_t index1, std::size_t index2) - { - heap_entry tmp = heap_[index1]; - heap_[index1] = heap_[index2]; - heap_[index2] = tmp; - heap_[index1].timer_->heap_index_ = index1; - heap_[index2].timer_->heap_index_ = index2; - } - - // Remove a timer from the heap and list of timers. - void remove_timer(per_timer_data& timer) - { - // Remove the timer from the heap. - std::size_t index = timer.heap_index_; - if (!heap_.empty() && index < heap_.size()) - { - if (index == heap_.size() - 1) - { - timer.heap_index_ = (std::numeric_limits<std::size_t>::max)(); - heap_.pop_back(); - } - else - { - swap_heap(index, heap_.size() - 1); - timer.heap_index_ = (std::numeric_limits<std::size_t>::max)(); - heap_.pop_back(); - if (index > 0 && Time_Traits::less_than( - heap_[index].time_, heap_[(index - 1) / 2].time_)) - up_heap(index); - else - down_heap(index); - } - } - - // Remove the timer from the linked list of active timers. - if (timers_ == &timer) - timers_ = timer.next_; - if (timer.prev_) - timer.prev_->next_ = timer.next_; - if (timer.next_) - timer.next_->prev_= timer.prev_; - timer.next_ = 0; - timer.prev_ = 0; - } - - // Determine if the specified absolute time is positive infinity. - template <typename Time_Type> - static bool is_positive_infinity(const Time_Type&) - { - return false; - } - - // Determine if the specified absolute time is positive infinity. - template <typename T, typename TimeSystem> - static bool is_positive_infinity( - const boost::date_time::base_time<T, TimeSystem>& time) - { - return time.is_pos_infinity(); - } - - // Helper function to convert a duration into milliseconds. - template <typename Duration> - long to_msec(const Duration& d, long max_duration) const - { - if (d.ticks() <= 0) - return 0; - int64_t msec = d.total_milliseconds(); - if (msec == 0) - return 1; - if (msec > max_duration) - return max_duration; - return static_cast<long>(msec); - } - - // Helper function to convert a duration into microseconds. - template <typename Duration> - long to_usec(const Duration& d, long max_duration) const - { - if (d.ticks() <= 0) - return 0; - int64_t usec = d.total_microseconds(); - if (usec == 0) - return 1; - if (usec > max_duration) - return max_duration; - return static_cast<long>(usec); - } - - // The head of a linked list of all active timers. - per_timer_data* timers_; - - struct heap_entry - { - // The time when the timer should fire. - time_type time_; - - // The associated timer with enqueued operations. - per_timer_data* timer_; - }; - - // The heap of timers, with the earliest timer at the front. - std::vector<heap_entry> heap_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_TIMER_QUEUE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/timer_queue_ptime.hpp b/contrib/restricted/boost/boost/asio/detail/timer_queue_ptime.hpp deleted file mode 100644 index cc053bff9d..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/timer_queue_ptime.hpp +++ /dev/null @@ -1,101 +0,0 @@ -// -// detail/timer_queue_ptime.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP -#define BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - -#include <boost/asio/time_traits.hpp> -#include <boost/asio/detail/timer_queue.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -struct forwarding_posix_time_traits : time_traits<boost::posix_time::ptime> {}; - -// Template specialisation for the commonly used instantation. -template <> -class timer_queue<time_traits<boost::posix_time::ptime> > - : public timer_queue_base -{ -public: - // The time type. - typedef boost::posix_time::ptime time_type; - - // The duration type. - typedef boost::posix_time::time_duration duration_type; - - // Per-timer data. - typedef timer_queue<forwarding_posix_time_traits>::per_timer_data - per_timer_data; - - // Constructor. - BOOST_ASIO_DECL timer_queue(); - - // Destructor. - BOOST_ASIO_DECL virtual ~timer_queue(); - - // Add a new timer to the queue. Returns true if this is the timer that is - // earliest in the queue, in which case the reactor's event demultiplexing - // function call may need to be interrupted and restarted. - BOOST_ASIO_DECL bool enqueue_timer(const time_type& time, - per_timer_data& timer, wait_op* op); - - // Whether there are no timers in the queue. - BOOST_ASIO_DECL virtual bool empty() const; - - // Get the time for the timer that is earliest in the queue. - BOOST_ASIO_DECL virtual long wait_duration_msec(long max_duration) const; - - // Get the time for the timer that is earliest in the queue. - BOOST_ASIO_DECL virtual long wait_duration_usec(long max_duration) const; - - // Dequeue all timers not later than the current time. - BOOST_ASIO_DECL virtual void get_ready_timers(op_queue<operation>& ops); - - // Dequeue all timers. - BOOST_ASIO_DECL virtual void get_all_timers(op_queue<operation>& ops); - - // Cancel and dequeue operations for the given timer. - BOOST_ASIO_DECL std::size_t cancel_timer( - per_timer_data& timer, op_queue<operation>& ops, - std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); - - // Move operations from one timer to another, empty timer. - BOOST_ASIO_DECL void move_timer(per_timer_data& target, - per_timer_data& source); - -private: - timer_queue<forwarding_posix_time_traits> impl_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/timer_queue_ptime.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - -#endif // BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/timer_scheduler.hpp b/contrib/restricted/boost/boost/asio/detail/timer_scheduler.hpp deleted file mode 100644 index dc6e8d890c..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/timer_scheduler.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// -// detail/timer_scheduler.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_TIMER_SCHEDULER_HPP -#define BOOST_ASIO_DETAIL_TIMER_SCHEDULER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/timer_scheduler_fwd.hpp> - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) -# include <boost/asio/detail/winrt_timer_scheduler.hpp> -#elif defined(BOOST_ASIO_HAS_IOCP) -# include <boost/asio/detail/win_iocp_io_context.hpp> -#elif defined(BOOST_ASIO_HAS_EPOLL) -# include <boost/asio/detail/epoll_reactor.hpp> -#elif defined(BOOST_ASIO_HAS_KQUEUE) -# include <boost/asio/detail/kqueue_reactor.hpp> -#elif defined(BOOST_ASIO_HAS_DEV_POLL) -# include <boost/asio/detail/dev_poll_reactor.hpp> -#else -# include <boost/asio/detail/select_reactor.hpp> -#endif - -#endif // BOOST_ASIO_DETAIL_TIMER_SCHEDULER_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/timer_scheduler_fwd.hpp b/contrib/restricted/boost/boost/asio/detail/timer_scheduler_fwd.hpp deleted file mode 100644 index c3656c66a0..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/timer_scheduler_fwd.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// detail/timer_scheduler_fwd.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_TIMER_SCHEDULER_FWD_HPP -#define BOOST_ASIO_DETAIL_TIMER_SCHEDULER_FWD_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -namespace boost { -namespace asio { -namespace detail { - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) -typedef class winrt_timer_scheduler timer_scheduler; -#elif defined(BOOST_ASIO_HAS_IOCP) -typedef class win_iocp_io_context timer_scheduler; -#elif defined(BOOST_ASIO_HAS_EPOLL) -typedef class epoll_reactor timer_scheduler; -#elif defined(BOOST_ASIO_HAS_KQUEUE) -typedef class kqueue_reactor timer_scheduler; -#elif defined(BOOST_ASIO_HAS_DEV_POLL) -typedef class dev_poll_reactor timer_scheduler; -#else -typedef class select_reactor timer_scheduler; -#endif - -} // namespace detail -} // namespace asio -} // namespace boost - -#endif // BOOST_ASIO_DETAIL_TIMER_SCHEDULER_FWD_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/wait_handler.hpp b/contrib/restricted/boost/boost/asio/detail/wait_handler.hpp deleted file mode 100644 index a9341244f8..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/wait_handler.hpp +++ /dev/null @@ -1,87 +0,0 @@ -// -// detail/wait_handler.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_WAIT_HANDLER_HPP -#define BOOST_ASIO_DETAIL_WAIT_HANDLER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/wait_op.hpp> -#include <boost/asio/io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename Handler> -class wait_handler : public wait_op -{ -public: - BOOST_ASIO_DEFINE_HANDLER_PTR(wait_handler); - - wait_handler(Handler& h) - : wait_op(&wait_handler::do_complete), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)) - { - handler_work<Handler>::start(handler_); - } - - static void do_complete(void* owner, operation* base, - const boost::system::error_code& /*ec*/, - std::size_t /*bytes_transferred*/) - { - // Take ownership of the handler object. - wait_handler* h(static_cast<wait_handler*>(base)); - ptr p = { boost::asio::detail::addressof(h->handler_), h, h }; - handler_work<Handler> w(h->handler_); - - BOOST_ASIO_HANDLER_COMPLETION((*h)); - - // Make a copy of the handler so that the memory can be deallocated before - // the upcall is made. Even if we're not about to make an upcall, a - // sub-object of the handler may be the true owner of the memory associated - // with the handler. Consequently, a local copy of the handler is required - // to ensure that any owning sub-object remains valid until after we have - // deallocated the memory here. - detail::binder1<Handler, boost::system::error_code> - handler(h->handler_, h->ec_); - p.h = boost::asio::detail::addressof(handler.handler_); - p.reset(); - - // Make the upcall if required. - if (owner) - { - fenced_block b(fenced_block::half); - BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); - w.complete(handler, handler.handler_); - BOOST_ASIO_HANDLER_INVOCATION_END; - } - } - -private: - Handler handler_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_WAIT_HANDLER_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_handle_read_op.hpp b/contrib/restricted/boost/boost/asio/detail/win_iocp_handle_read_op.hpp deleted file mode 100644 index 842ed80b73..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_handle_read_op.hpp +++ /dev/null @@ -1,113 +0,0 @@ -// -// detail/win_iocp_handle_read_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_HANDLE_READ_OP_HPP -#define BOOST_ASIO_DETAIL_WIN_IOCP_HANDLE_READ_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_IOCP) - -#include <boost/asio/error.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/operation.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename MutableBufferSequence, typename Handler> -class win_iocp_handle_read_op : public operation -{ -public: - BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_read_op); - - win_iocp_handle_read_op( - const MutableBufferSequence& buffers, Handler& handler) - : operation(&win_iocp_handle_read_op::do_complete), - buffers_(buffers), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) - { - handler_work<Handler>::start(handler_); - } - - static void do_complete(void* owner, operation* base, - const boost::system::error_code& result_ec, - std::size_t bytes_transferred) - { - boost::system::error_code ec(result_ec); - - // Take ownership of the operation object. - win_iocp_handle_read_op* o(static_cast<win_iocp_handle_read_op*>(base)); - ptr p = { boost::asio::detail::addressof(o->handler_), o, o }; - handler_work<Handler> w(o->handler_); - - BOOST_ASIO_HANDLER_COMPLETION((*o)); - -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - if (owner) - { - // Check whether buffers are still valid. - buffer_sequence_adapter<boost::asio::mutable_buffer, - MutableBufferSequence>::validate(o->buffers_); - } -#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - - // Map non-portable errors to their portable counterparts. - if (ec.value() == ERROR_HANDLE_EOF) - ec = boost::asio::error::eof; - - // Make a copy of the handler so that the memory can be deallocated before - // the upcall is made. Even if we're not about to make an upcall, a - // sub-object of the handler may be the true owner of the memory associated - // with the handler. Consequently, a local copy of the handler is required - // to ensure that any owning sub-object remains valid until after we have - // deallocated the memory here. - detail::binder2<Handler, boost::system::error_code, std::size_t> - handler(o->handler_, ec, bytes_transferred); - p.h = boost::asio::detail::addressof(handler.handler_); - p.reset(); - - // Make the upcall if required. - if (owner) - { - fenced_block b(fenced_block::half); - BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); - w.complete(handler, handler.handler_); - BOOST_ASIO_HANDLER_INVOCATION_END; - } - } - -private: - MutableBufferSequence buffers_; - Handler handler_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_IOCP) - -#endif // BOOST_ASIO_DETAIL_WIN_IOCP_HANDLE_READ_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_handle_service.hpp b/contrib/restricted/boost/boost/asio/detail/win_iocp_handle_service.hpp deleted file mode 100644 index 4d5aadeef5..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_handle_service.hpp +++ /dev/null @@ -1,325 +0,0 @@ -// -// detail/win_iocp_handle_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_HANDLE_SERVICE_HPP -#define BOOST_ASIO_DETAIL_WIN_IOCP_HANDLE_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_IOCP) - -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/detail/cstdint.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/mutex.hpp> -#include <boost/asio/detail/operation.hpp> -#include <boost/asio/detail/win_iocp_handle_read_op.hpp> -#include <boost/asio/detail/win_iocp_handle_write_op.hpp> -#include <boost/asio/detail/win_iocp_io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -class win_iocp_handle_service : - public service_base<win_iocp_handle_service> -{ -public: - // The native type of a stream handle. - typedef HANDLE native_handle_type; - - // The implementation type of the stream handle. - class implementation_type - { - public: - // Default constructor. - implementation_type() - : handle_(INVALID_HANDLE_VALUE), - safe_cancellation_thread_id_(0), - next_(0), - prev_(0) - { - } - - private: - // Only this service will have access to the internal values. - friend class win_iocp_handle_service; - - // The native stream handle representation. - native_handle_type handle_; - - // The ID of the thread from which it is safe to cancel asynchronous - // operations. 0 means no asynchronous operations have been started yet. - // ~0 means asynchronous operations have been started from more than one - // thread, and cancellation is not supported for the handle. - DWORD safe_cancellation_thread_id_; - - // Pointers to adjacent handle implementations in linked list. - implementation_type* next_; - implementation_type* prev_; - }; - - BOOST_ASIO_DECL win_iocp_handle_service(boost::asio::io_context& io_context); - - // Destroy all user-defined handler objects owned by the service. - BOOST_ASIO_DECL void shutdown(); - - // Construct a new handle implementation. - BOOST_ASIO_DECL void construct(implementation_type& impl); - - // Move-construct a new handle implementation. - BOOST_ASIO_DECL void move_construct(implementation_type& impl, - implementation_type& other_impl); - - // Move-assign from another handle implementation. - BOOST_ASIO_DECL void move_assign(implementation_type& impl, - win_iocp_handle_service& other_service, - implementation_type& other_impl); - - // Destroy a handle implementation. - BOOST_ASIO_DECL void destroy(implementation_type& impl); - - // Assign a native handle to a handle implementation. - BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, - const native_handle_type& handle, boost::system::error_code& ec); - - // Determine whether the handle is open. - bool is_open(const implementation_type& impl) const - { - return impl.handle_ != INVALID_HANDLE_VALUE; - } - - // Destroy a handle implementation. - BOOST_ASIO_DECL boost::system::error_code close(implementation_type& impl, - boost::system::error_code& ec); - - // Get the native handle representation. - native_handle_type native_handle(const implementation_type& impl) const - { - return impl.handle_; - } - - // Cancel all operations associated with the handle. - BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, - boost::system::error_code& ec); - - // Write the given data. Returns the number of bytes written. - template <typename ConstBufferSequence> - size_t write_some(implementation_type& impl, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - return write_some_at(impl, 0, buffers, ec); - } - - // Write the given data at the specified offset. Returns the number of bytes - // written. - template <typename ConstBufferSequence> - size_t write_some_at(implementation_type& impl, uint64_t offset, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - boost::asio::const_buffer buffer = - buffer_sequence_adapter<boost::asio::const_buffer, - ConstBufferSequence>::first(buffers); - - return do_write(impl, offset, buffer, ec); - } - - // Start an asynchronous write. The data being written must be valid for the - // lifetime of the asynchronous operation. - template <typename ConstBufferSequence, typename Handler> - void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, Handler& handler) - { - // Allocate and construct an operation to wrap the handler. - typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(buffers, handler); - - BOOST_ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl, - reinterpret_cast<uintmax_t>(impl.handle_), "async_write_some")); - - start_write_op(impl, 0, - buffer_sequence_adapter<boost::asio::const_buffer, - ConstBufferSequence>::first(buffers), p.p); - p.v = p.p = 0; - } - - // Start an asynchronous write at a specified offset. The data being written - // must be valid for the lifetime of the asynchronous operation. - template <typename ConstBufferSequence, typename Handler> - void async_write_some_at(implementation_type& impl, uint64_t offset, - const ConstBufferSequence& buffers, Handler& handler) - { - // Allocate and construct an operation to wrap the handler. - typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(buffers, handler); - - BOOST_ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl, - reinterpret_cast<uintmax_t>(impl.handle_), "async_write_some_at")); - - start_write_op(impl, offset, - buffer_sequence_adapter<boost::asio::const_buffer, - ConstBufferSequence>::first(buffers), p.p); - p.v = p.p = 0; - } - - // Read some data. Returns the number of bytes received. - template <typename MutableBufferSequence> - size_t read_some(implementation_type& impl, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - return read_some_at(impl, 0, buffers, ec); - } - - // Read some data at a specified offset. Returns the number of bytes received. - template <typename MutableBufferSequence> - size_t read_some_at(implementation_type& impl, uint64_t offset, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - boost::asio::mutable_buffer buffer = - buffer_sequence_adapter<boost::asio::mutable_buffer, - MutableBufferSequence>::first(buffers); - - return do_read(impl, offset, buffer, ec); - } - - // Start an asynchronous read. The buffer for the data being received must be - // valid for the lifetime of the asynchronous operation. - template <typename MutableBufferSequence, typename Handler> - void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, Handler& handler) - { - // Allocate and construct an operation to wrap the handler. - typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(buffers, handler); - - BOOST_ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl, - reinterpret_cast<uintmax_t>(impl.handle_), "async_read_some")); - - start_read_op(impl, 0, - buffer_sequence_adapter<boost::asio::mutable_buffer, - MutableBufferSequence>::first(buffers), p.p); - p.v = p.p = 0; - } - - // Start an asynchronous read at a specified offset. The buffer for the data - // being received must be valid for the lifetime of the asynchronous - // operation. - template <typename MutableBufferSequence, typename Handler> - void async_read_some_at(implementation_type& impl, uint64_t offset, - const MutableBufferSequence& buffers, Handler& handler) - { - // Allocate and construct an operation to wrap the handler. - typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(buffers, handler); - - BOOST_ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl, - reinterpret_cast<uintmax_t>(impl.handle_), "async_read_some_at")); - - start_read_op(impl, offset, - buffer_sequence_adapter<boost::asio::mutable_buffer, - MutableBufferSequence>::first(buffers), p.p); - p.v = p.p = 0; - } - -private: - // Prevent the use of the null_buffers type with this service. - size_t write_some(implementation_type& impl, - const null_buffers& buffers, boost::system::error_code& ec); - size_t write_some_at(implementation_type& impl, uint64_t offset, - const null_buffers& buffers, boost::system::error_code& ec); - template <typename Handler> - void async_write_some(implementation_type& impl, - const null_buffers& buffers, Handler& handler); - template <typename Handler> - void async_write_some_at(implementation_type& impl, uint64_t offset, - const null_buffers& buffers, Handler& handler); - size_t read_some(implementation_type& impl, - const null_buffers& buffers, boost::system::error_code& ec); - size_t read_some_at(implementation_type& impl, uint64_t offset, - const null_buffers& buffers, boost::system::error_code& ec); - template <typename Handler> - void async_read_some(implementation_type& impl, - const null_buffers& buffers, Handler& handler); - template <typename Handler> - void async_read_some_at(implementation_type& impl, uint64_t offset, - const null_buffers& buffers, Handler& handler); - - // Helper class for waiting for synchronous operations to complete. - class overlapped_wrapper; - - // Helper function to perform a synchronous write operation. - BOOST_ASIO_DECL size_t do_write(implementation_type& impl, - uint64_t offset, const boost::asio::const_buffer& buffer, - boost::system::error_code& ec); - - // Helper function to start a write operation. - BOOST_ASIO_DECL void start_write_op(implementation_type& impl, - uint64_t offset, const boost::asio::const_buffer& buffer, - operation* op); - - // Helper function to perform a synchronous write operation. - BOOST_ASIO_DECL size_t do_read(implementation_type& impl, - uint64_t offset, const boost::asio::mutable_buffer& buffer, - boost::system::error_code& ec); - - // Helper function to start a read operation. - BOOST_ASIO_DECL void start_read_op(implementation_type& impl, - uint64_t offset, const boost::asio::mutable_buffer& buffer, - operation* op); - - // Update the ID of the thread from which cancellation is safe. - BOOST_ASIO_DECL void update_cancellation_thread_id(implementation_type& impl); - - // Helper function to close a handle when the associated object is being - // destroyed. - BOOST_ASIO_DECL void close_for_destruction(implementation_type& impl); - - // The IOCP service used for running asynchronous operations and dispatching - // handlers. - win_iocp_io_context& iocp_service_; - - // Mutex to protect access to the linked list of implementations. - mutex mutex_; - - // The head of a linked list of all implementations. - implementation_type* impl_list_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/win_iocp_handle_service.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // defined(BOOST_ASIO_HAS_IOCP) - -#endif // BOOST_ASIO_DETAIL_WIN_IOCP_HANDLE_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_handle_write_op.hpp b/contrib/restricted/boost/boost/asio/detail/win_iocp_handle_write_op.hpp deleted file mode 100644 index 582b3f2b82..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_handle_write_op.hpp +++ /dev/null @@ -1,105 +0,0 @@ -// -// detail/win_iocp_handle_write_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_HANDLE_WRITE_OP_HPP -#define BOOST_ASIO_DETAIL_WIN_IOCP_HANDLE_WRITE_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_IOCP) - -#include <boost/asio/error.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/operation.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename ConstBufferSequence, typename Handler> -class win_iocp_handle_write_op : public operation -{ -public: - BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_write_op); - - win_iocp_handle_write_op(const ConstBufferSequence& buffers, Handler& handler) - : operation(&win_iocp_handle_write_op::do_complete), - buffers_(buffers), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) - { - handler_work<Handler>::start(handler_); - } - - static void do_complete(void* owner, operation* base, - const boost::system::error_code& ec, std::size_t bytes_transferred) - { - // Take ownership of the operation object. - win_iocp_handle_write_op* o(static_cast<win_iocp_handle_write_op*>(base)); - ptr p = { boost::asio::detail::addressof(o->handler_), o, o }; - handler_work<Handler> w(o->handler_); - - BOOST_ASIO_HANDLER_COMPLETION((*o)); - -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - if (owner) - { - // Check whether buffers are still valid. - buffer_sequence_adapter<boost::asio::const_buffer, - ConstBufferSequence>::validate(o->buffers_); - } -#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - - // Make a copy of the handler so that the memory can be deallocated before - // the upcall is made. Even if we're not about to make an upcall, a - // sub-object of the handler may be the true owner of the memory associated - // with the handler. Consequently, a local copy of the handler is required - // to ensure that any owning sub-object remains valid until after we have - // deallocated the memory here. - detail::binder2<Handler, boost::system::error_code, std::size_t> - handler(o->handler_, ec, bytes_transferred); - p.h = boost::asio::detail::addressof(handler.handler_); - p.reset(); - - // Make the upcall if required. - if (owner) - { - fenced_block b(fenced_block::half); - BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); - w.complete(handler, handler.handler_); - BOOST_ASIO_HANDLER_INVOCATION_END; - } - } - -private: - ConstBufferSequence buffers_; - Handler handler_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_IOCP) - -#endif // BOOST_ASIO_DETAIL_WIN_IOCP_HANDLE_WRITE_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_overlapped_op.hpp b/contrib/restricted/boost/boost/asio/detail/win_iocp_overlapped_op.hpp deleted file mode 100644 index 18f0d63173..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_overlapped_op.hpp +++ /dev/null @@ -1,92 +0,0 @@ -// -// detail/win_iocp_overlapped_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_OVERLAPPED_OP_HPP -#define BOOST_ASIO_DETAIL_WIN_IOCP_OVERLAPPED_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_IOCP) - -#include <boost/asio/error.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/operation.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename Handler> -class win_iocp_overlapped_op : public operation -{ -public: - BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_overlapped_op); - - win_iocp_overlapped_op(Handler& handler) - : operation(&win_iocp_overlapped_op::do_complete), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) - { - handler_work<Handler>::start(handler_); - } - - static void do_complete(void* owner, operation* base, - const boost::system::error_code& ec, std::size_t bytes_transferred) - { - // Take ownership of the operation object. - win_iocp_overlapped_op* o(static_cast<win_iocp_overlapped_op*>(base)); - ptr p = { boost::asio::detail::addressof(o->handler_), o, o }; - handler_work<Handler> w(o->handler_); - - BOOST_ASIO_HANDLER_COMPLETION((*o)); - - // Make a copy of the handler so that the memory can be deallocated before - // the upcall is made. Even if we're not about to make an upcall, a - // sub-object of the handler may be the true owner of the memory associated - // with the handler. Consequently, a local copy of the handler is required - // to ensure that any owning sub-object remains valid until after we have - // deallocated the memory here. - detail::binder2<Handler, boost::system::error_code, std::size_t> - handler(o->handler_, ec, bytes_transferred); - p.h = boost::asio::detail::addressof(handler.handler_); - p.reset(); - - // Make the upcall if required. - if (owner) - { - fenced_block b(fenced_block::half); - BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); - w.complete(handler, handler.handler_); - BOOST_ASIO_HANDLER_INVOCATION_END; - } - } - -private: - Handler handler_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_IOCP) - -#endif // BOOST_ASIO_DETAIL_WIN_IOCP_OVERLAPPED_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp b/contrib/restricted/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp deleted file mode 100644 index 6cff7ae1d4..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp +++ /dev/null @@ -1,145 +0,0 @@ -// -// detail/win_iocp_overlapped_ptr.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_OVERLAPPED_PTR_HPP -#define BOOST_ASIO_DETAIL_WIN_IOCP_OVERLAPPED_PTR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_IOCP) - -#include <boost/asio/io_context.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/win_iocp_overlapped_op.hpp> -#include <boost/asio/detail/win_iocp_io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -// Wraps a handler to create an OVERLAPPED object for use with overlapped I/O. -class win_iocp_overlapped_ptr - : private noncopyable -{ -public: - // Construct an empty win_iocp_overlapped_ptr. - win_iocp_overlapped_ptr() - : ptr_(0), - iocp_service_(0) - { - } - - // Construct an win_iocp_overlapped_ptr to contain the specified handler. - template <typename Handler> - explicit win_iocp_overlapped_ptr( - boost::asio::io_context& io_context, BOOST_ASIO_MOVE_ARG(Handler) handler) - : ptr_(0), - iocp_service_(0) - { - this->reset(io_context, BOOST_ASIO_MOVE_CAST(Handler)(handler)); - } - - // Destructor automatically frees the OVERLAPPED object unless released. - ~win_iocp_overlapped_ptr() - { - reset(); - } - - // Reset to empty. - void reset() - { - if (ptr_) - { - ptr_->destroy(); - ptr_ = 0; - iocp_service_->work_finished(); - iocp_service_ = 0; - } - } - - // Reset to contain the specified handler, freeing any current OVERLAPPED - // object. - template <typename Handler> - void reset(boost::asio::io_context& io_context, Handler handler) - { - typedef win_iocp_overlapped_op<Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(handler); - - BOOST_ASIO_HANDLER_CREATION((io_context, *p.p, - "io_context", &io_context.impl_, 0, "overlapped")); - - io_context.impl_.work_started(); - reset(); - ptr_ = p.p; - p.v = p.p = 0; - iocp_service_ = &io_context.impl_; - } - - // Get the contained OVERLAPPED object. - OVERLAPPED* get() - { - return ptr_; - } - - // Get the contained OVERLAPPED object. - const OVERLAPPED* get() const - { - return ptr_; - } - - // Release ownership of the OVERLAPPED object. - OVERLAPPED* release() - { - if (ptr_) - iocp_service_->on_pending(ptr_); - - OVERLAPPED* tmp = ptr_; - ptr_ = 0; - iocp_service_ = 0; - return tmp; - } - - // Post completion notification for overlapped operation. Releases ownership. - void complete(const boost::system::error_code& ec, - std::size_t bytes_transferred) - { - if (ptr_) - { - iocp_service_->on_completion(ptr_, ec, - static_cast<DWORD>(bytes_transferred)); - ptr_ = 0; - iocp_service_ = 0; - } - } - -private: - win_iocp_operation* ptr_; - win_iocp_io_context* iocp_service_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_IOCP) - -#endif // BOOST_ASIO_DETAIL_WIN_IOCP_OVERLAPPED_PTR_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/win_iocp_serial_port_service.hpp b/contrib/restricted/boost/boost/asio/detail/win_iocp_serial_port_service.hpp deleted file mode 100644 index 3da2537295..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/win_iocp_serial_port_service.hpp +++ /dev/null @@ -1,232 +0,0 @@ -// -// detail/win_iocp_serial_port_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_SERIAL_PORT_SERVICE_HPP -#define BOOST_ASIO_DETAIL_WIN_IOCP_SERIAL_PORT_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_IOCP) && defined(BOOST_ASIO_HAS_SERIAL_PORT) - -#include <string> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/detail/win_iocp_handle_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -// Extend win_iocp_handle_service to provide serial port support. -class win_iocp_serial_port_service : - public service_base<win_iocp_serial_port_service> -{ -public: - // The native type of a serial port. - typedef win_iocp_handle_service::native_handle_type native_handle_type; - - // The implementation type of the serial port. - typedef win_iocp_handle_service::implementation_type implementation_type; - - // Constructor. - BOOST_ASIO_DECL win_iocp_serial_port_service( - boost::asio::io_context& io_context); - - // Destroy all user-defined handler objects owned by the service. - BOOST_ASIO_DECL void shutdown(); - - // Construct a new serial port implementation. - void construct(implementation_type& impl) - { - handle_service_.construct(impl); - } - - // Move-construct a new serial port implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - handle_service_.move_construct(impl, other_impl); - } - - // Move-assign from another serial port implementation. - void move_assign(implementation_type& impl, - win_iocp_serial_port_service& other_service, - implementation_type& other_impl) - { - handle_service_.move_assign(impl, - other_service.handle_service_, other_impl); - } - - // Destroy a serial port implementation. - void destroy(implementation_type& impl) - { - handle_service_.destroy(impl); - } - - // Open the serial port using the specified device name. - BOOST_ASIO_DECL boost::system::error_code open(implementation_type& impl, - const std::string& device, boost::system::error_code& ec); - - // Assign a native handle to a serial port implementation. - boost::system::error_code assign(implementation_type& impl, - const native_handle_type& handle, boost::system::error_code& ec) - { - return handle_service_.assign(impl, handle, ec); - } - - // Determine whether the serial port is open. - bool is_open(const implementation_type& impl) const - { - return handle_service_.is_open(impl); - } - - // Destroy a serial port implementation. - boost::system::error_code close(implementation_type& impl, - boost::system::error_code& ec) - { - return handle_service_.close(impl, ec); - } - - // Get the native serial port representation. - native_handle_type native_handle(implementation_type& impl) - { - return handle_service_.native_handle(impl); - } - - // Cancel all operations associated with the handle. - boost::system::error_code cancel(implementation_type& impl, - boost::system::error_code& ec) - { - return handle_service_.cancel(impl, ec); - } - - // Set an option on the serial port. - template <typename SettableSerialPortOption> - boost::system::error_code set_option(implementation_type& impl, - const SettableSerialPortOption& option, boost::system::error_code& ec) - { - return do_set_option(impl, - &win_iocp_serial_port_service::store_option<SettableSerialPortOption>, - &option, ec); - } - - // Get an option from the serial port. - template <typename GettableSerialPortOption> - boost::system::error_code get_option(const implementation_type& impl, - GettableSerialPortOption& option, boost::system::error_code& ec) const - { - return do_get_option(impl, - &win_iocp_serial_port_service::load_option<GettableSerialPortOption>, - &option, ec); - } - - // Send a break sequence to the serial port. - boost::system::error_code send_break(implementation_type&, - boost::system::error_code& ec) - { - ec = boost::asio::error::operation_not_supported; - return ec; - } - - // Write the given data. Returns the number of bytes sent. - template <typename ConstBufferSequence> - size_t write_some(implementation_type& impl, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - return handle_service_.write_some(impl, buffers, ec); - } - - // Start an asynchronous write. The data being written must be valid for the - // lifetime of the asynchronous operation. - template <typename ConstBufferSequence, typename Handler> - void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, Handler& handler) - { - handle_service_.async_write_some(impl, buffers, handler); - } - - // Read some data. Returns the number of bytes received. - template <typename MutableBufferSequence> - size_t read_some(implementation_type& impl, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - return handle_service_.read_some(impl, buffers, ec); - } - - // Start an asynchronous read. The buffer for the data being received must be - // valid for the lifetime of the asynchronous operation. - template <typename MutableBufferSequence, typename Handler> - void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, Handler& handler) - { - handle_service_.async_read_some(impl, buffers, handler); - } - -private: - // Function pointer type for storing a serial port option. - typedef boost::system::error_code (*store_function_type)( - const void*, ::DCB&, boost::system::error_code&); - - // Helper function template to store a serial port option. - template <typename SettableSerialPortOption> - static boost::system::error_code store_option(const void* option, - ::DCB& storage, boost::system::error_code& ec) - { - static_cast<const SettableSerialPortOption*>(option)->store(storage, ec); - return ec; - } - - // Helper function to set a serial port option. - BOOST_ASIO_DECL boost::system::error_code do_set_option( - implementation_type& impl, store_function_type store, - const void* option, boost::system::error_code& ec); - - // Function pointer type for loading a serial port option. - typedef boost::system::error_code (*load_function_type)( - void*, const ::DCB&, boost::system::error_code&); - - // Helper function template to load a serial port option. - template <typename GettableSerialPortOption> - static boost::system::error_code load_option(void* option, - const ::DCB& storage, boost::system::error_code& ec) - { - static_cast<GettableSerialPortOption*>(option)->load(storage, ec); - return ec; - } - - // Helper function to get a serial port option. - BOOST_ASIO_DECL boost::system::error_code do_get_option( - const implementation_type& impl, load_function_type load, - void* option, boost::system::error_code& ec) const; - - // The implementation used for initiating asynchronous operations. - win_iocp_handle_service handle_service_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/win_iocp_serial_port_service.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // defined(BOOST_ASIO_HAS_IOCP) && defined(BOOST_ASIO_HAS_SERIAL_PORT) - -#endif // BOOST_ASIO_DETAIL_WIN_IOCP_SERIAL_PORT_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/win_object_handle_service.hpp b/contrib/restricted/boost/boost/asio/detail/win_object_handle_service.hpp deleted file mode 100644 index 03fb634888..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/win_object_handle_service.hpp +++ /dev/null @@ -1,186 +0,0 @@ -// -// detail/win_object_handle_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_WIN_OBJECT_HANDLE_SERVICE_HPP -#define BOOST_ASIO_DETAIL_WIN_OBJECT_HANDLE_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) - -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/wait_handler.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -class win_object_handle_service : - public service_base<win_object_handle_service> -{ -public: - // The native type of an object handle. - typedef HANDLE native_handle_type; - - // The implementation type of the object handle. - class implementation_type - { - public: - // Default constructor. - implementation_type() - : handle_(INVALID_HANDLE_VALUE), - wait_handle_(INVALID_HANDLE_VALUE), - owner_(0), - next_(0), - prev_(0) - { - } - - private: - // Only this service will have access to the internal values. - friend class win_object_handle_service; - - // The native object handle representation. May be accessed or modified - // without locking the mutex. - native_handle_type handle_; - - // The handle used to unregister the wait operation. The mutex must be - // locked when accessing or modifying this member. - HANDLE wait_handle_; - - // The operations waiting on the object handle. If there is a registered - // wait then the mutex must be locked when accessing or modifying this - // member - op_queue<wait_op> op_queue_; - - // The service instance that owns the object handle implementation. - win_object_handle_service* owner_; - - // Pointers to adjacent handle implementations in linked list. The mutex - // must be locked when accessing or modifying these members. - implementation_type* next_; - implementation_type* prev_; - }; - - // Constructor. - BOOST_ASIO_DECL win_object_handle_service( - boost::asio::io_context& io_context); - - // Destroy all user-defined handler objects owned by the service. - BOOST_ASIO_DECL void shutdown(); - - // Construct a new handle implementation. - BOOST_ASIO_DECL void construct(implementation_type& impl); - - // Move-construct a new handle implementation. - BOOST_ASIO_DECL void move_construct(implementation_type& impl, - implementation_type& other_impl); - - // Move-assign from another handle implementation. - BOOST_ASIO_DECL void move_assign(implementation_type& impl, - win_object_handle_service& other_service, - implementation_type& other_impl); - - // Destroy a handle implementation. - BOOST_ASIO_DECL void destroy(implementation_type& impl); - - // Assign a native handle to a handle implementation. - BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, - const native_handle_type& handle, boost::system::error_code& ec); - - // Determine whether the handle is open. - bool is_open(const implementation_type& impl) const - { - return impl.handle_ != INVALID_HANDLE_VALUE && impl.handle_ != 0; - } - - // Destroy a handle implementation. - BOOST_ASIO_DECL boost::system::error_code close(implementation_type& impl, - boost::system::error_code& ec); - - // Get the native handle representation. - native_handle_type native_handle(const implementation_type& impl) const - { - return impl.handle_; - } - - // Cancel all operations associated with the handle. - BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, - boost::system::error_code& ec); - - // Perform a synchronous wait for the object to enter a signalled state. - BOOST_ASIO_DECL void wait(implementation_type& impl, - boost::system::error_code& ec); - - /// Start an asynchronous wait. - template <typename Handler> - void async_wait(implementation_type& impl, Handler& handler) - { - // Allocate and construct an operation to wrap the handler. - typedef wait_handler<Handler> op; - typename op::ptr p = { boost::asio::detail::addressof(handler), - op::ptr::allocate(handler), 0 }; - p.p = new (p.v) op(handler); - - BOOST_ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "object_handle", - &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "async_wait")); - - start_wait_op(impl, p.p); - p.v = p.p = 0; - } - -private: - // Helper function to start an asynchronous wait operation. - BOOST_ASIO_DECL void start_wait_op(implementation_type& impl, wait_op* op); - - // Helper function to register a wait operation. - BOOST_ASIO_DECL void register_wait_callback( - implementation_type& impl, mutex::scoped_lock& lock); - - // Callback function invoked when the registered wait completes. - static BOOST_ASIO_DECL VOID CALLBACK wait_callback( - PVOID param, BOOLEAN timeout); - - // The io_context implementation used to post completions. - io_context_impl& io_context_; - - // Mutex to protect access to internal state. - mutex mutex_; - - // The head of a linked list of all implementations. - implementation_type* impl_list_; - - // Flag to indicate that the dispatcher has been shut down. - bool shutdown_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/win_object_handle_service.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) - -#endif // BOOST_ASIO_DETAIL_WIN_OBJECT_HANDLE_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/detail/winrt_timer_scheduler.hpp b/contrib/restricted/boost/boost/asio/detail/winrt_timer_scheduler.hpp deleted file mode 100644 index 8f61ad843e..0000000000 --- a/contrib/restricted/boost/boost/asio/detail/winrt_timer_scheduler.hpp +++ /dev/null @@ -1,139 +0,0 @@ -// -// detail/winrt_timer_scheduler.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_WINRT_TIMER_SCHEDULER_HPP -#define BOOST_ASIO_DETAIL_WINRT_TIMER_SCHEDULER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - -#include <cstddef> -#include <boost/asio/detail/event.hpp> -#include <boost/asio/detail/limits.hpp> -#include <boost/asio/detail/mutex.hpp> -#include <boost/asio/detail/op_queue.hpp> -#include <boost/asio/detail/thread.hpp> -#include <boost/asio/detail/timer_queue_base.hpp> -#include <boost/asio/detail/timer_queue_set.hpp> -#include <boost/asio/detail/wait_op.hpp> -#include <boost/asio/io_context.hpp> - -#if defined(BOOST_ASIO_HAS_IOCP) -# include <boost/asio/detail/thread.hpp> -#endif // defined(BOOST_ASIO_HAS_IOCP) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -class winrt_timer_scheduler - : public boost::asio::detail::service_base<winrt_timer_scheduler> -{ -public: - // Constructor. - BOOST_ASIO_DECL winrt_timer_scheduler(boost::asio::io_context& io_context); - - // Destructor. - BOOST_ASIO_DECL ~winrt_timer_scheduler(); - - // Destroy all user-defined handler objects owned by the service. - BOOST_ASIO_DECL void shutdown(); - - // Recreate internal descriptors following a fork. - BOOST_ASIO_DECL void notify_fork( - boost::asio::io_context::fork_event fork_ev); - - // Initialise the task. No effect as this class uses its own thread. - BOOST_ASIO_DECL void init_task(); - - // Add a new timer queue to the reactor. - template <typename Time_Traits> - void add_timer_queue(timer_queue<Time_Traits>& queue); - - // Remove a timer queue from the reactor. - template <typename Time_Traits> - void remove_timer_queue(timer_queue<Time_Traits>& queue); - - // Schedule a new operation in the given timer queue to expire at the - // specified absolute time. - template <typename Time_Traits> - void schedule_timer(timer_queue<Time_Traits>& queue, - const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); - - // Cancel the timer operations associated with the given token. Returns the - // number of operations that have been posted or dispatched. - template <typename Time_Traits> - std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer, - std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); - - // Move the timer operations associated with the given timer. - template <typename Time_Traits> - void move_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& to, - typename timer_queue<Time_Traits>::per_timer_data& from); - -private: - // Run the select loop in the thread. - BOOST_ASIO_DECL void run_thread(); - - // Entry point for the select loop thread. - BOOST_ASIO_DECL static void call_run_thread(winrt_timer_scheduler* reactor); - - // Helper function to add a new timer queue. - BOOST_ASIO_DECL void do_add_timer_queue(timer_queue_base& queue); - - // Helper function to remove a timer queue. - BOOST_ASIO_DECL void do_remove_timer_queue(timer_queue_base& queue); - - // The io_context implementation used to post completions. - io_context_impl& io_context_; - - // Mutex used to protect internal variables. - boost::asio::detail::mutex mutex_; - - // Event used to wake up background thread. - boost::asio::detail::event event_; - - // The timer queues. - timer_queue_set timer_queues_; - - // The background thread that is waiting for timers to expire. - boost::asio::detail::thread* thread_; - - // Does the background thread need to stop. - bool stop_thread_; - - // Whether the service has been shut down. - bool shutdown_; -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/detail/impl/winrt_timer_scheduler.hpp> -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/detail/impl/winrt_timer_scheduler.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) - -#endif // BOOST_ASIO_DETAIL_WINRT_TIMER_SCHEDULER_HPP diff --git a/contrib/restricted/boost/boost/asio/dispatch.hpp b/contrib/restricted/boost/boost/asio/dispatch.hpp deleted file mode 100644 index 4136eda64f..0000000000 --- a/contrib/restricted/boost/boost/asio/dispatch.hpp +++ /dev/null @@ -1,110 +0,0 @@ -// -// dispatch.hpp -// ~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DISPATCH_HPP -#define BOOST_ASIO_DISPATCH_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/execution_context.hpp> -#include <boost/asio/is_executor.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Submits a completion token or function object for execution. -/** - * This function submits an object for execution using the object's associated - * executor. The function object is queued for execution, and is never called - * from the current thread prior to returning from <tt>dispatch()</tt>. - * - * This function has the following effects: - * - * @li Constructs a function object handler of type @c Handler, initialized - * with <tt>handler(forward<CompletionToken>(token))</tt>. - * - * @li Constructs an object @c result of type <tt>async_result<Handler></tt>, - * initializing the object as <tt>result(handler)</tt>. - * - * @li Obtains the handler's associated executor object @c ex by performing - * <tt>get_associated_executor(handler)</tt>. - * - * @li Obtains the handler's associated allocator object @c alloc by performing - * <tt>get_associated_allocator(handler)</tt>. - * - * @li Performs <tt>ex.dispatch(std::move(handler), alloc)</tt>. - * - * @li Returns <tt>result.get()</tt>. - */ -template <typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch( - BOOST_ASIO_MOVE_ARG(CompletionToken) token); - -/// Submits a completion token or function object for execution. -/** - * This function submits an object for execution using the specified executor. - * The function object is queued for execution, and is never called from the - * current thread prior to returning from <tt>dispatch()</tt>. - * - * This function has the following effects: - * - * @li Constructs a function object handler of type @c Handler, initialized - * with <tt>handler(forward<CompletionToken>(token))</tt>. - * - * @li Constructs an object @c result of type <tt>async_result<Handler></tt>, - * initializing the object as <tt>result(handler)</tt>. - * - * @li Obtains the handler's associated executor object @c ex1 by performing - * <tt>get_associated_executor(handler)</tt>. - * - * @li Creates a work object @c w by performing <tt>make_work(ex1)</tt>. - * - * @li Obtains the handler's associated allocator object @c alloc by performing - * <tt>get_associated_allocator(handler)</tt>. - * - * @li Constructs a function object @c f with a function call operator that - * performs <tt>ex1.dispatch(std::move(handler), alloc)</tt> followed by - * <tt>w.reset()</tt>. - * - * @li Performs <tt>Executor(ex).dispatch(std::move(f), alloc)</tt>. - * - * @li Returns <tt>result.get()</tt>. - */ -template <typename Executor, typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch( - const Executor& ex, BOOST_ASIO_MOVE_ARG(CompletionToken) token, - typename enable_if<is_executor<Executor>::value>::type* = 0); - -/// Submits a completion token or function object for execution. -/** - * @returns <tt>dispatch(ctx.get_executor(), - * forward<CompletionToken>(token))</tt>. - */ -template <typename ExecutionContext, typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch( - ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(CompletionToken) token, - typename enable_if<is_convertible< - ExecutionContext&, execution_context&>::value>::type* = 0); - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/dispatch.hpp> - -#endif // BOOST_ASIO_DISPATCH_HPP diff --git a/contrib/restricted/boost/boost/asio/executor.hpp b/contrib/restricted/boost/boost/asio/executor.hpp deleted file mode 100644 index 43a5a2c105..0000000000 --- a/contrib/restricted/boost/boost/asio/executor.hpp +++ /dev/null @@ -1,343 +0,0 @@ -// -// executor.hpp -// ~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_EXECUTOR_HPP -#define BOOST_ASIO_EXECUTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <typeinfo> -#include <boost/asio/detail/cstddef.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/throw_exception.hpp> -#include <boost/asio/execution_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Exception thrown when trying to access an empty polymorphic executor. -class bad_executor - : public std::exception -{ -public: - /// Constructor. - BOOST_ASIO_DECL bad_executor() BOOST_ASIO_NOEXCEPT; - - /// Obtain message associated with exception. - BOOST_ASIO_DECL virtual const char* what() const - BOOST_ASIO_NOEXCEPT_OR_NOTHROW; -}; - -/// Polymorphic wrapper for executors. -class executor -{ -public: - /// Default constructor. - executor() BOOST_ASIO_NOEXCEPT - : impl_(0) - { - } - - /// Construct from nullptr. - executor(nullptr_t) BOOST_ASIO_NOEXCEPT - : impl_(0) - { - } - - /// Copy constructor. - executor(const executor& other) BOOST_ASIO_NOEXCEPT - : impl_(other.clone()) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move constructor. - executor(executor&& other) BOOST_ASIO_NOEXCEPT - : impl_(other.impl_) - { - other.impl_ = 0; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Construct a polymorphic wrapper for the specified executor. - template <typename Executor> - executor(Executor e); - - /// Allocator-aware constructor to create a polymorphic wrapper for the - /// specified executor. - template <typename Executor, typename Allocator> - executor(allocator_arg_t, const Allocator& a, Executor e); - - /// Destructor. - ~executor() - { - destroy(); - } - - /// Assignment operator. - executor& operator=(const executor& other) BOOST_ASIO_NOEXCEPT - { - destroy(); - impl_ = other.clone(); - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - // Move assignment operator. - executor& operator=(executor&& other) BOOST_ASIO_NOEXCEPT - { - destroy(); - impl_ = other.impl_; - other.impl_ = 0; - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Assignment operator for nullptr_t. - executor& operator=(nullptr_t) BOOST_ASIO_NOEXCEPT - { - destroy(); - impl_ = 0; - return *this; - } - - /// Assignment operator to create a polymorphic wrapper for the specified - /// executor. - template <typename Executor> - executor& operator=(BOOST_ASIO_MOVE_ARG(Executor) e) BOOST_ASIO_NOEXCEPT - { - executor tmp(BOOST_ASIO_MOVE_CAST(Executor)(e)); - destroy(); - impl_ = tmp.impl_; - tmp.impl_ = 0; - return *this; - } - - /// Obtain the underlying execution context. - execution_context& context() const BOOST_ASIO_NOEXCEPT - { - return get_impl()->context(); - } - - /// Inform the executor that it has some outstanding work to do. - void on_work_started() const BOOST_ASIO_NOEXCEPT - { - get_impl()->on_work_started(); - } - - /// Inform the executor that some work is no longer outstanding. - void on_work_finished() const BOOST_ASIO_NOEXCEPT - { - get_impl()->on_work_finished(); - } - - /// Request the executor to invoke the given function object. - /** - * This function is used to ask the executor to execute the given function - * object. The function object is executed according to the rules of the - * target executor object. - * - * @param f The function object to be called. The executor will make a copy - * of the handler object as required. The function signature of the function - * object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template <typename Function, typename Allocator> - void dispatch(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const; - - /// Request the executor to invoke the given function object. - /** - * This function is used to ask the executor to execute the given function - * object. The function object is executed according to the rules of the - * target executor object. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template <typename Function, typename Allocator> - void post(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const; - - /// Request the executor to invoke the given function object. - /** - * This function is used to ask the executor to execute the given function - * object. The function object is executed according to the rules of the - * target executor object. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template <typename Function, typename Allocator> - void defer(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const; - - struct unspecified_bool_type_t {}; - typedef void (*unspecified_bool_type)(unspecified_bool_type_t); - static void unspecified_bool_true(unspecified_bool_type_t) {} - - /// Operator to test if the executor contains a valid target. - operator unspecified_bool_type() const BOOST_ASIO_NOEXCEPT - { - return impl_ ? &executor::unspecified_bool_true : 0; - } - - /// Obtain type information for the target executor object. - /** - * @returns If @c *this has a target type of type @c T, <tt>typeid(T)</tt>; - * otherwise, <tt>typeid(void)</tt>. - */ -#if !defined(BOOST_ASIO_NO_TYPEID) || defined(GENERATING_DOCUMENTATION) - const std::type_info& target_type() const BOOST_ASIO_NOEXCEPT - { - return impl_ ? impl_->target_type() : typeid(void); - } -#else // !defined(BOOST_ASIO_NO_TYPEID) || defined(GENERATING_DOCUMENTATION) - const void* target_type() const BOOST_ASIO_NOEXCEPT - { - return impl_ ? impl_->target_type() : 0; - } -#endif // !defined(BOOST_ASIO_NO_TYPEID) || defined(GENERATING_DOCUMENTATION) - - /// Obtain a pointer to the target executor object. - /** - * @returns If <tt>target_type() == typeid(T)</tt>, a pointer to the stored - * executor target; otherwise, a null pointer. - */ - template <typename Executor> - Executor* target() BOOST_ASIO_NOEXCEPT; - - /// Obtain a pointer to the target executor object. - /** - * @returns If <tt>target_type() == typeid(T)</tt>, a pointer to the stored - * executor target; otherwise, a null pointer. - */ - template <typename Executor> - const Executor* target() const BOOST_ASIO_NOEXCEPT; - - /// Compare two executors for equality. - friend bool operator==(const executor& a, - const executor& b) BOOST_ASIO_NOEXCEPT - { - if (a.impl_ == b.impl_) - return true; - if (!a.impl_ || !b.impl_) - return false; - return a.impl_->equals(b.impl_); - } - - /// Compare two executors for inequality. - friend bool operator!=(const executor& a, - const executor& b) BOOST_ASIO_NOEXCEPT - { - return !(a == b); - } - -private: -#if !defined(GENERATING_DOCUMENTATION) - class function; - template <typename, typename> class impl; - -#if !defined(BOOST_ASIO_NO_TYPEID) - typedef const std::type_info& type_id_result_type; -#else // !defined(BOOST_ASIO_NO_TYPEID) - typedef const void* type_id_result_type; -#endif // !defined(BOOST_ASIO_NO_TYPEID) - - template <typename T> - static type_id_result_type type_id() - { -#if !defined(BOOST_ASIO_NO_TYPEID) - return typeid(T); -#else // !defined(BOOST_ASIO_NO_TYPEID) - static int unique_id; - return &unique_id; -#endif // !defined(BOOST_ASIO_NO_TYPEID) - } - - // Base class for all polymorphic executor implementations. - class impl_base - { - public: - virtual impl_base* clone() const BOOST_ASIO_NOEXCEPT = 0; - virtual void destroy() BOOST_ASIO_NOEXCEPT = 0; - virtual execution_context& context() BOOST_ASIO_NOEXCEPT = 0; - virtual void on_work_started() BOOST_ASIO_NOEXCEPT = 0; - virtual void on_work_finished() BOOST_ASIO_NOEXCEPT = 0; - virtual void dispatch(BOOST_ASIO_MOVE_ARG(function)) = 0; - virtual void post(BOOST_ASIO_MOVE_ARG(function)) = 0; - virtual void defer(BOOST_ASIO_MOVE_ARG(function)) = 0; - virtual type_id_result_type target_type() const BOOST_ASIO_NOEXCEPT = 0; - virtual void* target() BOOST_ASIO_NOEXCEPT = 0; - virtual const void* target() const BOOST_ASIO_NOEXCEPT = 0; - virtual bool equals(const impl_base* e) const BOOST_ASIO_NOEXCEPT = 0; - - protected: - impl_base(bool fast_dispatch) : fast_dispatch_(fast_dispatch) {} - virtual ~impl_base() {} - - private: - friend class executor; - const bool fast_dispatch_; - }; - - // Helper function to check and return the implementation pointer. - impl_base* get_impl() const - { - if (!impl_) - { - bad_executor ex; - boost::asio::detail::throw_exception(ex); - } - return impl_; - } - - // Helper function to clone another implementation. - impl_base* clone() const BOOST_ASIO_NOEXCEPT - { - return impl_ ? impl_->clone() : 0; - } - - // Helper function to destroy an implementation. - void destroy() BOOST_ASIO_NOEXCEPT - { - if (impl_) - impl_->destroy(); - } - - impl_base* impl_; -#endif // !defined(GENERATING_DOCUMENTATION) -}; - -} // namespace asio -} // namespace boost - -BOOST_ASIO_USES_ALLOCATOR(boost::asio::executor) - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/executor.hpp> -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/impl/executor.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_EXECUTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/experimental.hpp b/contrib/restricted/boost/boost/asio/experimental.hpp deleted file mode 100644 index 0ca0a9658f..0000000000 --- a/contrib/restricted/boost/boost/asio/experimental.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// -// experimental.hpp -// ~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_EXPERIMENTAL_HPP -#define BOOST_ASIO_EXPERIMENTAL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/experimental/co_spawn.hpp> -#include <boost/asio/experimental/detached.hpp> -#include <boost/asio/experimental/redirect_error.hpp> - -#endif // BOOST_ASIO_EXPERIMENTAL_HPP diff --git a/contrib/restricted/boost/boost/asio/experimental/co_spawn.hpp b/contrib/restricted/boost/boost/asio/experimental/co_spawn.hpp deleted file mode 100644 index c900da11f0..0000000000 --- a/contrib/restricted/boost/boost/asio/experimental/co_spawn.hpp +++ /dev/null @@ -1,228 +0,0 @@ -// -// experimental/co_spawn.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_EXPERIMENTAL_CO_SPAWN_HPP -#define BOOST_ASIO_EXPERIMENTAL_CO_SPAWN_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_CO_AWAIT) || defined(GENERATING_DOCUMENTATION) - -#include <experimental/coroutine> -#include <boost/asio/executor.hpp> -#include <boost/asio/strand.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace experimental { -namespace detail { - -using std::experimental::coroutine_handle; - -template <typename> class awaiter; -template <typename> class awaitee_base; -template <typename, typename> class awaitee; -template <typename, typename> class await_handler_base; -template <typename Executor, typename F, typename CompletionToken> -auto co_spawn(const Executor& ex, F&& f, CompletionToken&& token); - -} // namespace detail - -namespace this_coro { - -/// Awaitable type that returns a completion token for the current coroutine. -struct token_t {}; - -/// Awaitable object that returns a completion token for the current coroutine. -constexpr inline token_t token() { return {}; } - -/// Awaitable type that returns the executor of the current coroutine. -struct executor_t {}; - -/// Awaitable object that returns the executor of the current coroutine. -constexpr inline executor_t executor() { return {}; } - -} // namespace this_coro - -/// A completion token that represents the currently executing coroutine. -/** - * The await_token class is used to represent the currently executing - * coroutine. An await_token may be passed as a handler to an asynchronous - * operation. For example: - * - * @code awaitable<void> my_coroutine() - * { - * await_token token = co_await this_coro::token(); - * ... - * std::size_t n = co_await my_socket.async_read_some(buffer, token); - * ... - * } @endcode - * - * The initiating function (async_read_some in the above example) suspends the - * current coroutine. The coroutine is resumed when the asynchronous operation - * completes, and the result of the operation is returned. - */ -template <typename Executor> -class await_token -{ -public: - /// The associated executor type. - typedef Executor executor_type; - - /// Copy constructor. - await_token(const await_token& other) noexcept - : awaiter_(other.awaiter_) - { - } - - /// Move constructor. - await_token(await_token&& other) noexcept - : awaiter_(std::exchange(other.awaiter_, nullptr)) - { - } - - /// Get the associated executor. - executor_type get_executor() const noexcept - { - return awaiter_->get_executor(); - } - -private: - // No assignment allowed. - await_token& operator=(const await_token&) = delete; - - template <typename> friend class detail::awaitee_base; - template <typename, typename> friend class detail::await_handler_base; - - // Private constructor used by awaitee_base. - explicit await_token(detail::awaiter<Executor>* a) - : awaiter_(a) - { - } - - detail::awaiter<Executor>* awaiter_; -}; - -/// The return type of a coroutine or asynchronous operation. -template <typename T, typename Executor = strand<executor>> -class awaitable -{ -public: - /// The type of the awaited value. - typedef T value_type; - - /// The executor type that will be used for the coroutine. - typedef Executor executor_type; - - /// Move constructor. - awaitable(awaitable&& other) noexcept - : awaitee_(std::exchange(other.awaitee_, nullptr)) - { - } - - /// Destructor - ~awaitable() - { - if (awaitee_) - { - detail::coroutine_handle< - detail::awaitee<T, Executor>>::from_promise( - *awaitee_).destroy(); - } - } - -#if !defined(GENERATING_DOCUMENTATION) - - // Support for co_await keyword. - bool await_ready() const noexcept - { - return awaitee_->ready(); - } - - // Support for co_await keyword. - void await_suspend(detail::coroutine_handle<detail::awaiter<Executor>> h) - { - awaitee_->attach_caller(h); - } - - // Support for co_await keyword. - template <class U> - void await_suspend(detail::coroutine_handle<detail::awaitee<U, Executor>> h) - { - awaitee_->attach_caller(h); - } - - // Support for co_await keyword. - T await_resume() - { - return awaitee_->get(); - } - -#endif // !defined(GENERATING_DOCUMENTATION) - -private: - template <typename, typename> friend class detail::awaitee; - template <typename, typename> friend class detail::await_handler_base; - - // Not copy constructible or copy assignable. - awaitable(const awaitable&) = delete; - awaitable& operator=(const awaitable&) = delete; - - // Construct the awaitable from a coroutine's promise object. - explicit awaitable(detail::awaitee<T, Executor>* a) : awaitee_(a) {} - - detail::awaitee<T, Executor>* awaitee_; -}; - -/// Spawn a new thread of execution. -template <typename Executor, typename F, typename CompletionToken, - typename = typename enable_if<is_executor<Executor>::value>::type> -inline auto co_spawn(const Executor& ex, F&& f, CompletionToken&& token) -{ - return detail::co_spawn(ex, std::forward<F>(f), - std::forward<CompletionToken>(token)); -} - -/// Spawn a new thread of execution. -template <typename ExecutionContext, typename F, typename CompletionToken, - typename = typename enable_if< - is_convertible<ExecutionContext&, execution_context&>::value>::type> -inline auto co_spawn(ExecutionContext& ctx, F&& f, CompletionToken&& token) -{ - return detail::co_spawn(ctx.get_executor(), std::forward<F>(f), - std::forward<CompletionToken>(token)); -} - -/// Spawn a new thread of execution. -template <typename Executor, typename F, typename CompletionToken> -inline auto co_spawn(const await_token<Executor>& parent, - F&& f, CompletionToken&& token) -{ - return detail::co_spawn(parent.get_executor(), std::forward<F>(f), - std::forward<CompletionToken>(token)); -} - -} // namespace experimental -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/experimental/impl/co_spawn.hpp> - -#endif // defined(BOOST_ASIO_HAS_CO_AWAIT) || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_EXPERIMENTAL_CO_SPAWN_HPP diff --git a/contrib/restricted/boost/boost/asio/experimental/detached.hpp b/contrib/restricted/boost/boost/asio/experimental/detached.hpp deleted file mode 100644 index c3e7adafac..0000000000 --- a/contrib/restricted/boost/boost/asio/experimental/detached.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// -// experimental/detached.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_EXPERIMENTAL_DETACHED_HPP -#define BOOST_ASIO_EXPERIMENTAL_DETACHED_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <memory> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace experimental { - -/// Class used to specify that an asynchronous operation is detached. -/** - - * The detached_t class is used to indicate that an asynchronous operation is - * detached. That is, there is no completion handler waiting for the - * operation's result. A detached_t object may be passed as a handler to an - * asynchronous operation, typically using the special value - * @c boost::asio::experimental::detached. For example: - - * @code my_socket.async_send(my_buffer, boost::asio::experimental::detached); - * @endcode - */ -class detached_t -{ -public: - /// Constructor. - BOOST_ASIO_CONSTEXPR detached_t() - { - } -}; - -/// A special value, similar to std::nothrow. -/** - * See the documentation for boost::asio::experimental::detached_t for a usage - * example. - */ -#if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION) -constexpr detached_t detached; -#elif defined(BOOST_ASIO_MSVC) -__declspec(selectany) detached_t detached; -#endif - -} // namespace experimental -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/experimental/impl/detached.hpp> - -#endif // BOOST_ASIO_EXPERIMENTAL_DETACHED_HPP diff --git a/contrib/restricted/boost/boost/asio/experimental/impl/co_spawn.hpp b/contrib/restricted/boost/boost/asio/experimental/impl/co_spawn.hpp deleted file mode 100644 index ea1961a470..0000000000 --- a/contrib/restricted/boost/boost/asio/experimental/impl/co_spawn.hpp +++ /dev/null @@ -1,878 +0,0 @@ -// -// experimental/impl/co_spawn.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_EXPERIMENTAL_IMPL_CO_SPAWN_HPP -#define BOOST_ASIO_EXPERIMENTAL_IMPL_CO_SPAWN_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <exception> -#include <functional> -#include <memory> -#include <new> -#include <tuple> -#include <utility> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/thread_context.hpp> -#include <boost/asio/detail/thread_info_base.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/dispatch.hpp> -#include <boost/asio/post.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace experimental { -namespace detail { - -// Promise object for coroutine at top of thread-of-execution "stack". -template <typename Executor> -class awaiter -{ -public: - struct deleter - { - void operator()(awaiter* a) - { - if (a) - a->release(); - } - }; - - typedef std::unique_ptr<awaiter, deleter> ptr; - - typedef Executor executor_type; - - ~awaiter() - { - if (has_executor_) - static_cast<Executor*>(static_cast<void*>(executor_))->~Executor(); - } - - void set_executor(const Executor& ex) - { - new (&executor_) Executor(ex); - has_executor_ = true; - } - - executor_type get_executor() const noexcept - { - return *static_cast<const Executor*>(static_cast<const void*>(executor_)); - } - - awaiter* get_return_object() - { - return this; - } - - auto initial_suspend() - { - return std::experimental::suspend_always(); - } - - auto final_suspend() noexcept - { - return std::experimental::suspend_always(); - } - - void return_void() - { - } - - awaiter* add_ref() - { - ++ref_count_; - return this; - } - - void release() - { - if (--ref_count_ == 0) - coroutine_handle<awaiter>::from_promise(*this).destroy(); - } - - void unhandled_exception() - { - pending_exception_ = std::current_exception(); - } - - void rethrow_unhandled_exception() - { - if (pending_exception_) - { - std::exception_ptr ex = std::exchange(pending_exception_, nullptr); - std::rethrow_exception(ex); - } - } - -private: - std::size_t ref_count_ = 0; - std::exception_ptr pending_exception_ = nullptr; - alignas(Executor) unsigned char executor_[sizeof(Executor)]; - bool has_executor_ = false; -}; - -// Base promise for coroutines further down the thread-of-execution "stack". -template <typename Executor> -class awaitee_base -{ -public: -#if !defined(BOOST_ASIO_DISABLE_AWAITEE_RECYCLING) - void* operator new(std::size_t size) - { - return boost::asio::detail::thread_info_base::allocate( - boost::asio::detail::thread_info_base::awaitee_tag(), - boost::asio::detail::thread_context::thread_call_stack::top(), - size); - } - - void operator delete(void* pointer, std::size_t size) - { - boost::asio::detail::thread_info_base::deallocate( - boost::asio::detail::thread_info_base::awaitee_tag(), - boost::asio::detail::thread_context::thread_call_stack::top(), - pointer, size); - } -#endif // !defined(BOOST_ASIO_DISABLE_AWAITEE_RECYCLING) - - auto initial_suspend() noexcept - { - return std::experimental::suspend_never(); - } - - struct final_suspender - { - awaitee_base* this_; - - bool await_ready() const noexcept - { - return false; - } - - void await_suspend(coroutine_handle<void>) noexcept - { - this_->wake_caller(); - } - - void await_resume() const noexcept - { - } - }; - - auto final_suspend() noexcept - { - return final_suspender{this}; - } - - void set_except(std::exception_ptr e) noexcept - { - pending_exception_ = e; - } - - void unhandled_exception() - { - set_except(std::current_exception()); - } - - void rethrow_exception() - { - if (pending_exception_) - { - std::exception_ptr ex = std::exchange(pending_exception_, nullptr); - std::rethrow_exception(ex); - } - } - - awaiter<Executor>* top() - { - return awaiter_; - } - - coroutine_handle<void> caller() - { - return caller_; - } - - bool ready() const - { - return ready_; - } - - void wake_caller() - { - if (caller_) - caller_.resume(); - else - ready_ = true; - } - - class awaitable_executor - { - public: - explicit awaitable_executor(awaitee_base* a) - : this_(a) - { - } - - bool await_ready() const noexcept - { - return this_->awaiter_ != nullptr; - } - - template <typename U, typename Ex> - void await_suspend(coroutine_handle<detail::awaitee<U, Ex>> h) noexcept - { - this_->resume_on_attach_ = h; - } - - Executor await_resume() - { - return this_->awaiter_->get_executor(); - } - - private: - awaitee_base* this_; - }; - - awaitable_executor await_transform(this_coro::executor_t) noexcept - { - return awaitable_executor(this); - } - - class awaitable_token - { - public: - explicit awaitable_token(awaitee_base* a) - : this_(a) - { - } - - bool await_ready() const noexcept - { - return this_->awaiter_ != nullptr; - } - - template <typename U, typename Ex> - void await_suspend(coroutine_handle<detail::awaitee<U, Ex>> h) noexcept - { - this_->resume_on_attach_ = h; - } - - await_token<Executor> await_resume() - { - return await_token<Executor>(this_->awaiter_); - } - - private: - awaitee_base* this_; - }; - - awaitable_token await_transform(this_coro::token_t) noexcept - { - return awaitable_token(this); - } - - template <typename T> - awaitable<T, Executor> await_transform(awaitable<T, Executor>& t) const - { - return std::move(t); - } - - template <typename T> - awaitable<T, Executor> await_transform(awaitable<T, Executor>&& t) const - { - return std::move(t); - } - - std::experimental::suspend_always await_transform( - std::experimental::suspend_always) const - { - return std::experimental::suspend_always(); - } - - void attach_caller(coroutine_handle<awaiter<Executor>> h) - { - this->caller_ = h; - this->attach_callees(&h.promise()); - } - - template <typename U> - void attach_caller(coroutine_handle<awaitee<U, Executor>> h) - { - this->caller_ = h; - if (h.promise().awaiter_) - this->attach_callees(h.promise().awaiter_); - else - h.promise().unattached_callee_ = this; - } - - void attach_callees(awaiter<Executor>* a) - { - for (awaitee_base* curr = this; curr != nullptr; - curr = std::exchange(curr->unattached_callee_, nullptr)) - { - curr->awaiter_ = a; - if (curr->resume_on_attach_) - return std::exchange(curr->resume_on_attach_, nullptr).resume(); - } - } - -protected: - awaiter<Executor>* awaiter_ = nullptr; - coroutine_handle<void> caller_ = nullptr; - awaitee_base<Executor>* unattached_callee_ = nullptr; - std::exception_ptr pending_exception_ = nullptr; - coroutine_handle<void> resume_on_attach_ = nullptr; - bool ready_ = false; -}; - -// Promise object for coroutines further down the thread-of-execution "stack". -template <typename T, typename Executor> -class awaitee - : public awaitee_base<Executor> -{ -public: - awaitee() - { - } - - awaitee(awaitee&& other) noexcept - : awaitee_base<Executor>(std::move(other)) - { - } - - ~awaitee() - { - if (has_result_) - static_cast<T*>(static_cast<void*>(result_))->~T(); - } - - awaitable<T, Executor> get_return_object() - { - return awaitable<T, Executor>(this); - }; - - template <typename U> - void return_value(U&& u) - { - new (&result_) T(std::forward<U>(u)); - has_result_ = true; - } - - T get() - { - this->caller_ = nullptr; - this->rethrow_exception(); - return std::move(*static_cast<T*>(static_cast<void*>(result_))); - } - -private: - alignas(T) unsigned char result_[sizeof(T)]; - bool has_result_ = false; -}; - -// Promise object for coroutines further down the thread-of-execution "stack". -template <typename Executor> -class awaitee<void, Executor> - : public awaitee_base<Executor> -{ -public: - awaitable<void, Executor> get_return_object() - { - return awaitable<void, Executor>(this); - }; - - void return_void() - { - } - - void get() - { - this->caller_ = nullptr; - this->rethrow_exception(); - } -}; - -template <typename Executor> -class awaiter_task -{ -public: - typedef Executor executor_type; - - awaiter_task(awaiter<Executor>* a) - : awaiter_(a->add_ref()) - { - } - - awaiter_task(awaiter_task&& other) noexcept - : awaiter_(std::exchange(other.awaiter_, nullptr)) - { - } - - ~awaiter_task() - { - if (awaiter_) - { - // Coroutine "stack unwinding" must be performed through the executor. - executor_type ex(awaiter_->get_executor()); - (post)(ex, - [a = std::move(awaiter_)]() mutable - { - typename awaiter<Executor>::ptr(std::move(a)); - }); - } - } - - executor_type get_executor() const noexcept - { - return awaiter_->get_executor(); - } - -protected: - typename awaiter<Executor>::ptr awaiter_; -}; - -template <typename Executor> -class co_spawn_handler : public awaiter_task<Executor> -{ -public: - using awaiter_task<Executor>::awaiter_task; - - void operator()() - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - coroutine_handle<awaiter<Executor>>::from_promise(*ptr.get()).resume(); - } -}; - -template <typename Executor, typename T> -class await_handler_base : public awaiter_task<Executor> -{ -public: - typedef awaitable<T, Executor> awaitable_type; - - await_handler_base(await_token<Executor> token) - : awaiter_task<Executor>(token.awaiter_), - awaitee_(nullptr) - { - } - - await_handler_base(await_handler_base&& other) noexcept - : awaiter_task<Executor>(std::move(other)), - awaitee_(std::exchange(other.awaitee_, nullptr)) - { - } - - void attach_awaitee(const awaitable<T, Executor>& a) - { - awaitee_ = a.awaitee_; - } - -protected: - awaitee<T, Executor>* awaitee_; -}; - -template <typename, typename...> class await_handler; - -template <typename Executor> -class await_handler<Executor, void> - : public await_handler_base<Executor, void> -{ -public: - using await_handler_base<Executor, void>::await_handler_base; - - void operator()() - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - this->awaitee_->return_void(); - this->awaitee_->wake_caller(); - ptr->rethrow_unhandled_exception(); - } -}; - -template <typename Executor> -class await_handler<Executor, boost::system::error_code> - : public await_handler_base<Executor, void> -{ -public: - typedef void return_type; - - using await_handler_base<Executor, void>::await_handler_base; - - void operator()(const boost::system::error_code& ec) - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - if (ec) - { - this->awaitee_->set_except( - std::make_exception_ptr(boost::system::system_error(ec))); - } - else - this->awaitee_->return_void(); - this->awaitee_->wake_caller(); - ptr->rethrow_unhandled_exception(); - } -}; - -template <typename Executor> -class await_handler<Executor, std::exception_ptr> - : public await_handler_base<Executor, void> -{ -public: - using await_handler_base<Executor, void>::await_handler_base; - - void operator()(std::exception_ptr ex) - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - if (ex) - this->awaitee_->set_except(ex); - else - this->awaitee_->return_void(); - this->awaitee_->wake_caller(); - ptr->rethrow_unhandled_exception(); - } -}; - -template <typename Executor, typename T> -class await_handler<Executor, T> - : public await_handler_base<Executor, T> -{ -public: - using await_handler_base<Executor, T>::await_handler_base; - - template <typename Arg> - void operator()(Arg&& arg) - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - this->awaitee_->return_value(std::forward<Arg>(arg)); - this->awaitee_->wake_caller(); - ptr->rethrow_unhandled_exception(); - } -}; - -template <typename Executor, typename T> -class await_handler<Executor, boost::system::error_code, T> - : public await_handler_base<Executor, T> -{ -public: - using await_handler_base<Executor, T>::await_handler_base; - - template <typename Arg> - void operator()(const boost::system::error_code& ec, Arg&& arg) - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - if (ec) - { - this->awaitee_->set_except( - std::make_exception_ptr(boost::system::system_error(ec))); - } - else - this->awaitee_->return_value(std::forward<Arg>(arg)); - this->awaitee_->wake_caller(); - ptr->rethrow_unhandled_exception(); - } -}; - -template <typename Executor, typename T> -class await_handler<Executor, std::exception_ptr, T> - : public await_handler_base<Executor, T> -{ -public: - using await_handler_base<Executor, T>::await_handler_base; - - template <typename Arg> - void operator()(std::exception_ptr ex, Arg&& arg) - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - if (ex) - this->awaitee_->set_except(ex); - else - this->awaitee_->return_value(std::forward<Arg>(arg)); - this->awaitee_->wake_caller(); - ptr->rethrow_unhandled_exception(); - } -}; - -template <typename Executor, typename... Ts> -class await_handler - : public await_handler_base<Executor, std::tuple<Ts...>> -{ -public: - using await_handler_base<Executor, std::tuple<Ts...>>::await_handler_base; - - template <typename... Args> - void operator()(Args&&... args) - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - this->awaitee_->return_value( - std::forward_as_tuple(std::forward<Args>(args)...)); - this->awaitee_->wake_caller(); - ptr->rethrow_unhandled_exception(); - } -}; - -template <typename Executor, typename... Ts> -class await_handler<Executor, boost::system::error_code, Ts...> - : public await_handler_base<Executor, std::tuple<Ts...>> -{ -public: - using await_handler_base<Executor, std::tuple<Ts...>>::await_handler_base; - - template <typename... Args> - void operator()(const boost::system::error_code& ec, Args&&... args) - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - if (ec) - { - this->awaitee_->set_except( - std::make_exception_ptr(boost::system::system_error(ec))); - } - else - { - this->awaitee_->return_value( - std::forward_as_tuple(std::forward<Args>(args)...)); - } - this->awaitee_->wake_caller(); - ptr->rethrow_unhandled_exception(); - } -}; - -template <typename Executor, typename... Ts> -class await_handler<Executor, std::exception_ptr, Ts...> - : public await_handler_base<Executor, std::tuple<Ts...>> -{ -public: - using await_handler_base<Executor, std::tuple<Ts...>>::await_handler_base; - - template <typename... Args> - void operator()(std::exception_ptr ex, Args&&... args) - { - typename awaiter<Executor>::ptr ptr(std::move(this->awaiter_)); - if (ex) - this->awaitee_->set_except(ex); - else - { - this->awaitee_->return_value( - std::forward_as_tuple(std::forward<Args>(args)...)); - } - this->awaitee_->wake_caller(); - ptr->rethrow_unhandled_exception(); - } -}; - -template <typename T> -struct awaitable_signature; - -template <typename T, typename Executor> -struct awaitable_signature<awaitable<T, Executor>> -{ - typedef void type(std::exception_ptr, T); -}; - -template <typename Executor> -struct awaitable_signature<awaitable<void, Executor>> -{ - typedef void type(std::exception_ptr); -}; - -template <typename T, typename Executor, typename F, typename Handler> -awaiter<Executor>* co_spawn_entry_point(awaitable<T, Executor>*, - executor_work_guard<Executor> work_guard, F f, Handler handler) -{ - bool done = false; - - try - { - T t = co_await f(); - - done = true; - - (dispatch)(work_guard.get_executor(), - [handler = std::move(handler), t = std::move(t)]() mutable - { - handler(std::exception_ptr(), std::move(t)); - }); - } - catch (...) - { - if (done) - throw; - - (dispatch)(work_guard.get_executor(), - [handler = std::move(handler), e = std::current_exception()]() mutable - { - handler(e, T()); - }); - } -} - -template <typename Executor, typename F, typename Handler> -awaiter<Executor>* co_spawn_entry_point(awaitable<void, Executor>*, - executor_work_guard<Executor> work_guard, F f, Handler handler) -{ - std::exception_ptr e = nullptr; - - try - { - co_await f(); - } - catch (...) - { - e = std::current_exception(); - } - - (dispatch)(work_guard.get_executor(), - [handler = std::move(handler), e]() mutable - { - handler(e); - }); -} - -template <typename Executor, typename F, typename CompletionToken> -auto co_spawn(const Executor& ex, F&& f, CompletionToken&& token) -{ - typedef typename result_of<F()>::type awaitable_type; - typedef typename awaitable_type::executor_type executor_type; - typedef typename awaitable_signature<awaitable_type>::type signature_type; - - async_completion<CompletionToken, signature_type> completion(token); - - executor_type ex2(ex); - auto work_guard = make_work_guard(completion.completion_handler, ex2); - - auto* a = (co_spawn_entry_point)( - static_cast<awaitable_type*>(nullptr), std::move(work_guard), - std::forward<F>(f), std::move(completion.completion_handler)); - - a->set_executor(ex2); - (post)(co_spawn_handler<executor_type>(a)); - - return completion.result.get(); -} - -#if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable:4033) -#endif // defined(_MSC_VER) - -#if defined(_MSC_VER) -template <typename T> T dummy_return() -{ - return std::move(*static_cast<T*>(nullptr)); -} - -template <> -inline void dummy_return() -{ -} -#endif // defined(_MSC_VER) - -template <typename Awaitable> -inline Awaitable make_dummy_awaitable() -{ - for (;;) co_await std::experimental::suspend_always(); -#if defined(_MSC_VER) - co_return dummy_return<typename Awaitable::value_type>(); -#endif // defined(_MSC_VER) -} - -#if defined(_MSC_VER) -# pragma warning(pop) -#endif // defined(_MSC_VER) - -} // namespace detail -} // namespace experimental - -template <typename Executor, typename R, typename... Args> -class async_result<experimental::await_token<Executor>, R(Args...)> -{ -public: - typedef experimental::detail::await_handler< - Executor, typename decay<Args>::type...> completion_handler_type; - - typedef typename experimental::detail::await_handler< - Executor, Args...>::awaitable_type return_type; - - async_result(completion_handler_type& h) - : awaitable_(experimental::detail::make_dummy_awaitable<return_type>()) - { - h.attach_awaitee(awaitable_); - } - - return_type get() - { - return std::move(awaitable_); - } - -private: - return_type awaitable_; -}; - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Executor, typename R, typename... Args> -struct handler_type<experimental::await_token<Executor>, R(Args...)> -{ - typedef experimental::detail::await_handler< - Executor, typename decay<Args>::type...> type; -}; - -template <typename Executor, typename... Args> -class async_result<experimental::detail::await_handler<Executor, Args...>> -{ -public: - typedef typename experimental::detail::await_handler< - Executor, Args...>::awaitable_type type; - - async_result(experimental::detail::await_handler<Executor, Args...>& h) - : awaitable_(experimental::detail::make_dummy_awaitable<type>()) - { - h.attach_awaitee(awaitable_); - } - - type get() - { - return std::move(awaitable_); - } - -private: - type awaitable_; -}; - -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -} // namespace asio -} // namespace boost - -namespace std { namespace experimental { - -template <typename Executor, typename... Args> -struct coroutine_traits< - boost::asio::experimental::detail::awaiter<Executor>*, Args...> -{ - typedef boost::asio::experimental::detail::awaiter<Executor> promise_type; -}; - -template <typename T, typename Executor, typename... Args> -struct coroutine_traits< - boost::asio::experimental::awaitable<T, Executor>, Args...> -{ - typedef boost::asio::experimental::detail::awaitee<T, Executor> promise_type; -}; - -}} // namespace std::experimental - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_EXPERIMENTAL_IMPL_CO_SPAWN_HPP diff --git a/contrib/restricted/boost/boost/asio/experimental/impl/detached.hpp b/contrib/restricted/boost/boost/asio/experimental/impl/detached.hpp deleted file mode 100644 index c3baf20299..0000000000 --- a/contrib/restricted/boost/boost/asio/experimental/impl/detached.hpp +++ /dev/null @@ -1,93 +0,0 @@ -// -// experimental/impl/detached.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_EXPERIMENTAL_IMPL_DETACHED_HPP -#define BOOST_ASIO_EXPERIMENTAL_IMPL_DETACHED_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/variadic_templates.hpp> -#include <boost/asio/handler_type.hpp> -#include <boost/system/system_error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace experimental { -namespace detail { - - // Class to adapt a detached_t as a completion handler. - class detached_handler - { - public: - detached_handler(detached_t) - { - } - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename... Args> - void operator()(Args...) - { - } - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - void operator()() - { - } - -#define BOOST_ASIO_PRIVATE_DETACHED_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - void operator()(BOOST_ASIO_VARIADIC_BYVAL_PARAMS(n)) \ - { \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_DETACHED_DEF) -#undef BOOST_ASIO_PRIVATE_DETACHED_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - }; - -} // namespace detail -} // namespace experimental - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename Signature> -struct async_result<experimental::detached_t, Signature> -{ - typedef boost::asio::experimental::detail::detached_handler - completion_handler_type; - - typedef void return_type; - - explicit async_result(completion_handler_type&) - { - } - - void get() - { - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_EXPERIMENTAL_IMPL_DETACHED_HPP diff --git a/contrib/restricted/boost/boost/asio/experimental/impl/redirect_error.hpp b/contrib/restricted/boost/boost/asio/experimental/impl/redirect_error.hpp deleted file mode 100644 index 00ffcc7848..0000000000 --- a/contrib/restricted/boost/boost/asio/experimental/impl/redirect_error.hpp +++ /dev/null @@ -1,296 +0,0 @@ -// -// experimental/impl/redirect_error.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_EXPERIMENTAL_IMPL_REDIRECT_ERROR_HPP -#define BOOST_ASIO_EXPERIMENTAL_IMPL_REDIRECT_ERROR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/detail/variadic_templates.hpp> -#include <boost/asio/handler_type.hpp> -#include <boost/system/system_error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace experimental { -namespace detail { - -// Class to adapt a redirect_error_t as a completion handler. -template <typename Handler> -class redirect_error_handler -{ -public: - template <typename CompletionToken> - redirect_error_handler(redirect_error_t<CompletionToken> e) - : ec_(e.ec_), - handler_(BOOST_ASIO_MOVE_CAST(CompletionToken)(e.token_)) - { - } - - void operator()() - { - handler_(); - } - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename Arg, typename... Args> - typename enable_if< - !is_same<typename decay<Arg>::type, boost::system::error_code>::value - >::type - operator()(BOOST_ASIO_MOVE_ARG(Arg) arg, BOOST_ASIO_MOVE_ARG(Args)... args) - { - handler_(BOOST_ASIO_MOVE_CAST(Arg)(arg), - BOOST_ASIO_MOVE_CAST(Args)(args)...); - } - - template <typename... Args> - void operator()(const boost::system::error_code& ec, - BOOST_ASIO_MOVE_ARG(Args)... args) - { - ec_ = ec; - handler_(BOOST_ASIO_MOVE_CAST(Args)(args)...); - } - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename Arg> - typename enable_if< - !is_same<typename decay<Arg>::type, boost::system::error_code>::value - >::type - operator()(BOOST_ASIO_MOVE_ARG(Arg) arg) - { - handler_(BOOST_ASIO_MOVE_CAST(Arg)(arg)); - } - - void operator()(const boost::system::error_code& ec) - { - ec_ = ec; - handler_(); - } - -#define BOOST_ASIO_PRIVATE_REDIRECT_ERROR_DEF(n) \ - template <typename Arg, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - typename enable_if< \ - !is_same<typename decay<Arg>::type, boost::system::error_code>::value \ - >::type \ - operator()(BOOST_ASIO_MOVE_ARG(Arg) arg, BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - handler_(BOOST_ASIO_MOVE_CAST(Arg)(arg), \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - void operator()(const boost::system::error_code& ec, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - ec_ = ec; \ - handler_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_REDIRECT_ERROR_DEF) -#undef BOOST_ASIO_PRIVATE_REDIRECT_ERROR_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -//private: - boost::system::error_code& ec_; - Handler handler_; -}; - -template <typename Handler> -inline void* asio_handler_allocate(std::size_t size, - redirect_error_handler<Handler>* this_handler) -{ - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); -} - -template <typename Handler> -inline void asio_handler_deallocate(void* pointer, std::size_t size, - redirect_error_handler<Handler>* this_handler) -{ - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); -} - -template <typename Handler> -inline bool asio_handler_is_continuation( - redirect_error_handler<Handler>* this_handler) -{ - return boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); -} - -template <typename Function, typename Handler> -inline void asio_handler_invoke(Function& function, - redirect_error_handler<Handler>* this_handler) -{ - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); -} - -template <typename Function, typename Handler> -inline void asio_handler_invoke(const Function& function, - redirect_error_handler<Handler>* this_handler) -{ - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); -} - -template <typename Signature> -struct redirect_error_signature -{ - typedef Signature type; -}; - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename R, typename... Args> -struct redirect_error_signature<R(boost::system::error_code, Args...)> -{ - typedef R type(Args...); -}; - -template <typename R, typename... Args> -struct redirect_error_signature<R(const boost::system::error_code&, Args...)> -{ - typedef R type(Args...); -}; - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename R> -struct redirect_error_signature<R(boost::system::error_code)> -{ - typedef R type(); -}; - -template <typename R> -struct redirect_error_signature<R(const boost::system::error_code&)> -{ - typedef R type(); -}; - -#define BOOST_ASIO_PRIVATE_REDIRECT_ERROR_DEF(n) \ - template <typename R, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - struct redirect_error_signature< \ - R(boost::system::error_code, BOOST_ASIO_VARIADIC_TARGS(n))> \ - { \ - typedef R type(BOOST_ASIO_VARIADIC_TARGS(n)); \ - }; \ - \ - template <typename R, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - struct redirect_error_signature< \ - R(const boost::system::error_code&, BOOST_ASIO_VARIADIC_TARGS(n))> \ - { \ - typedef R type(BOOST_ASIO_VARIADIC_TARGS(n)); \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_REDIRECT_ERROR_DEF) -#undef BOOST_ASIO_PRIVATE_REDIRECT_ERROR_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -} // namespace detail -} // namespace experimental - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename CompletionToken, typename Signature> -struct async_result<experimental::redirect_error_t<CompletionToken>, Signature> - : async_result<CompletionToken, - typename experimental::detail::redirect_error_signature<Signature>::type> -{ - typedef experimental::detail::redirect_error_handler< - typename async_result<CompletionToken, - typename experimental::detail::redirect_error_signature<Signature>::type> - ::completion_handler_type> completion_handler_type; - - explicit async_result(completion_handler_type& h) - : async_result<CompletionToken, - typename experimental::detail::redirect_error_signature< - Signature>::type>(h.handler_) - { - } -}; - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename CompletionToken, typename Signature> -struct handler_type<experimental::redirect_error_t<CompletionToken>, Signature> -{ - typedef experimental::detail::redirect_error_handler< - typename async_result<CompletionToken, - typename experimental::detail::redirect_error_signature<Signature>::type> - ::completion_handler_type> type; -}; - -template <typename Handler> -struct async_result<experimental::detail::redirect_error_handler<Handler> > - : async_result<Handler> -{ - explicit async_result( - experimental::detail::redirect_error_handler<Handler>& h) - : async_result<Handler>(h.handler_) - { - } -}; - -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Handler, typename Executor> -struct associated_executor< - experimental::detail::redirect_error_handler<Handler>, Executor> -{ - typedef typename associated_executor<Handler, Executor>::type type; - - static type get( - const experimental::detail::redirect_error_handler<Handler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<Handler, Executor>::get(h.handler_, ex); - } -}; - -template <typename Handler, typename Allocator> -struct associated_allocator< - experimental::detail::redirect_error_handler<Handler>, Allocator> -{ - typedef typename associated_allocator<Handler, Allocator>::type type; - - static type get( - const experimental::detail::redirect_error_handler<Handler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<Handler, Allocator>::get(h.handler_, a); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_EXPERIMENTAL_IMPL_REDIRECT_ERROR_HPP diff --git a/contrib/restricted/boost/boost/asio/experimental/redirect_error.hpp b/contrib/restricted/boost/boost/asio/experimental/redirect_error.hpp deleted file mode 100644 index a138854521..0000000000 --- a/contrib/restricted/boost/boost/asio/experimental/redirect_error.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// -// experimental/redirect_error.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_EXPERIMENTAL_REDIRECT_ERROR_HPP -#define BOOST_ASIO_EXPERIMENTAL_REDIRECT_ERROR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/system/error_code.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace experimental { - -/// Completion token type used to specify that an error produced by an -/// asynchronous operation is captured to an error_code variable. -/** - * The redirect_error_t class is used to indicate that any error_code produced - * by an asynchronous operation is captured to a specified variable. - */ -template <typename CompletionToken> -class redirect_error_t -{ -public: - /// Constructor. - template <typename T> - redirect_error_t(BOOST_ASIO_MOVE_ARG(T) completion_token, - boost::system::error_code& ec) - : token_(BOOST_ASIO_MOVE_CAST(T)(completion_token)), - ec_(ec) - { - } - -//private: - CompletionToken token_; - boost::system::error_code& ec_; -}; - -/// Create a completion token to capture error_code values to a variable. -template <typename CompletionToken> -inline redirect_error_t<typename decay<CompletionToken>::type> redirect_error( - CompletionToken&& completion_token, boost::system::error_code& ec) -{ - return redirect_error_t<typename decay<CompletionToken>::type>( - BOOST_ASIO_MOVE_CAST(CompletionToken)(completion_token), ec); -} - -} // namespace experimental -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/experimental/impl/redirect_error.hpp> - -#endif // BOOST_ASIO_EXPERIMENTAL_REDIRECT_ERROR_HPP diff --git a/contrib/restricted/boost/boost/asio/generic/basic_endpoint.hpp b/contrib/restricted/boost/boost/asio/generic/basic_endpoint.hpp deleted file mode 100644 index fc1c0ba290..0000000000 --- a/contrib/restricted/boost/boost/asio/generic/basic_endpoint.hpp +++ /dev/null @@ -1,195 +0,0 @@ -// -// generic/basic_endpoint.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_GENERIC_BASIC_ENDPOINT_HPP -#define BOOST_ASIO_GENERIC_BASIC_ENDPOINT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/generic/detail/endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace generic { - -/// Describes an endpoint for any socket type. -/** - * The boost::asio::generic::basic_endpoint class template describes an endpoint - * that may be associated with any socket type. - * - * @note The socket types sockaddr type must be able to fit into a - * @c sockaddr_storage structure. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * Endpoint. - */ -template <typename Protocol> -class basic_endpoint -{ -public: - /// The protocol type associated with the endpoint. - typedef Protocol protocol_type; - - /// The type of the endpoint structure. This type is dependent on the - /// underlying implementation of the socket layer. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined data_type; -#else - typedef boost::asio::detail::socket_addr_type data_type; -#endif - - /// Default constructor. - basic_endpoint() - { - } - - /// Construct an endpoint from the specified socket address. - basic_endpoint(const void* socket_address, - std::size_t socket_address_size, int socket_protocol = 0) - : impl_(socket_address, socket_address_size, socket_protocol) - { - } - - /// Construct an endpoint from the specific endpoint type. - template <typename Endpoint> - basic_endpoint(const Endpoint& endpoint) - : impl_(endpoint.data(), endpoint.size(), endpoint.protocol().protocol()) - { - } - - /// Copy constructor. - basic_endpoint(const basic_endpoint& other) - : impl_(other.impl_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move constructor. - basic_endpoint(basic_endpoint&& other) - : impl_(other.impl_) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Assign from another endpoint. - basic_endpoint& operator=(const basic_endpoint& other) - { - impl_ = other.impl_; - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move-assign from another endpoint. - basic_endpoint& operator=(basic_endpoint&& other) - { - impl_ = other.impl_; - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// The protocol associated with the endpoint. - protocol_type protocol() const - { - return protocol_type(impl_.family(), impl_.protocol()); - } - - /// Get the underlying endpoint in the native type. - data_type* data() - { - return impl_.data(); - } - - /// Get the underlying endpoint in the native type. - const data_type* data() const - { - return impl_.data(); - } - - /// Get the underlying size of the endpoint in the native type. - std::size_t size() const - { - return impl_.size(); - } - - /// Set the underlying size of the endpoint in the native type. - void resize(std::size_t new_size) - { - impl_.resize(new_size); - } - - /// Get the capacity of the endpoint in the native type. - std::size_t capacity() const - { - return impl_.capacity(); - } - - /// Compare two endpoints for equality. - friend bool operator==(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return e1.impl_ == e2.impl_; - } - - /// Compare two endpoints for inequality. - friend bool operator!=(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return !(e1.impl_ == e2.impl_); - } - - /// Compare endpoints for ordering. - friend bool operator<(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return e1.impl_ < e2.impl_; - } - - /// Compare endpoints for ordering. - friend bool operator>(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return e2.impl_ < e1.impl_; - } - - /// Compare endpoints for ordering. - friend bool operator<=(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return !(e2 < e1); - } - - /// Compare endpoints for ordering. - friend bool operator>=(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return !(e1 < e2); - } - -private: - // The underlying generic endpoint. - boost::asio::generic::detail::endpoint impl_; -}; - -} // namespace generic -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_GENERIC_BASIC_ENDPOINT_HPP diff --git a/contrib/restricted/boost/boost/asio/generic/datagram_protocol.hpp b/contrib/restricted/boost/boost/asio/generic/datagram_protocol.hpp deleted file mode 100644 index e9ef54f530..0000000000 --- a/contrib/restricted/boost/boost/asio/generic/datagram_protocol.hpp +++ /dev/null @@ -1,125 +0,0 @@ -// -// generic/datagram_protocol.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_GENERIC_DATAGRAM_PROTOCOL_HPP -#define BOOST_ASIO_GENERIC_DATAGRAM_PROTOCOL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <typeinfo> -#include <boost/asio/basic_datagram_socket.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/throw_exception.hpp> -#include <boost/asio/generic/basic_endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace generic { - -/// Encapsulates the flags needed for a generic datagram-oriented socket. -/** - * The boost::asio::generic::datagram_protocol class contains flags necessary - * for datagram-oriented sockets of any address family and protocol. - * - * @par Examples - * Constructing using a native address family and socket protocol: - * @code datagram_protocol p(AF_INET, IPPROTO_UDP); @endcode - * Constructing from a specific protocol type: - * @code datagram_protocol p(boost::asio::ip::udp::v4()); @endcode - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe. - * - * @par Concepts: - * Protocol. - */ -class datagram_protocol -{ -public: - /// Construct a protocol object for a specific address family and protocol. - datagram_protocol(int address_family, int socket_protocol) - : family_(address_family), - protocol_(socket_protocol) - { - } - - /// Construct a generic protocol object from a specific protocol. - /** - * @throws @c bad_cast Thrown if the source protocol is not datagram-oriented. - */ - template <typename Protocol> - datagram_protocol(const Protocol& source_protocol) - : family_(source_protocol.family()), - protocol_(source_protocol.protocol()) - { - if (source_protocol.type() != type()) - { - std::bad_cast ex; - boost::asio::detail::throw_exception(ex); - } - } - - /// Obtain an identifier for the type of the protocol. - int type() const - { - return BOOST_ASIO_OS_DEF(SOCK_DGRAM); - } - - /// Obtain an identifier for the protocol. - int protocol() const - { - return protocol_; - } - - /// Obtain an identifier for the protocol family. - int family() const - { - return family_; - } - - /// Compare two protocols for equality. - friend bool operator==(const datagram_protocol& p1, - const datagram_protocol& p2) - { - return p1.family_ == p2.family_ && p1.protocol_ == p2.protocol_; - } - - /// Compare two protocols for inequality. - friend bool operator!=(const datagram_protocol& p1, - const datagram_protocol& p2) - { - return !(p1 == p2); - } - - /// The type of an endpoint. - typedef basic_endpoint<datagram_protocol> endpoint; - - /// The generic socket type. - typedef basic_datagram_socket<datagram_protocol> socket; - -private: - int family_; - int protocol_; -}; - -} // namespace generic -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_GENERIC_DATAGRAM_PROTOCOL_HPP diff --git a/contrib/restricted/boost/boost/asio/generic/detail/endpoint.hpp b/contrib/restricted/boost/boost/asio/generic/detail/endpoint.hpp deleted file mode 100644 index c338d78da2..0000000000 --- a/contrib/restricted/boost/boost/asio/generic/detail/endpoint.hpp +++ /dev/null @@ -1,135 +0,0 @@ -// -// generic/detail/endpoint.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_GENERIC_DETAIL_ENDPOINT_HPP -#define BOOST_ASIO_GENERIC_DETAIL_ENDPOINT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <cstddef> -#include <boost/asio/detail/socket_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace generic { -namespace detail { - -// Helper class for implementing a generic socket endpoint. -class endpoint -{ -public: - // Default constructor. - BOOST_ASIO_DECL endpoint(); - - // Construct an endpoint from the specified raw bytes. - BOOST_ASIO_DECL endpoint(const void* sock_addr, - std::size_t sock_addr_size, int sock_protocol); - - // Copy constructor. - endpoint(const endpoint& other) - : data_(other.data_), - size_(other.size_), - protocol_(other.protocol_) - { - } - - // Assign from another endpoint. - endpoint& operator=(const endpoint& other) - { - data_ = other.data_; - size_ = other.size_; - protocol_ = other.protocol_; - return *this; - } - - // Get the address family associated with the endpoint. - int family() const - { - return data_.base.sa_family; - } - - // Get the socket protocol associated with the endpoint. - int protocol() const - { - return protocol_; - } - - // Get the underlying endpoint in the native type. - boost::asio::detail::socket_addr_type* data() - { - return &data_.base; - } - - // Get the underlying endpoint in the native type. - const boost::asio::detail::socket_addr_type* data() const - { - return &data_.base; - } - - // Get the underlying size of the endpoint in the native type. - std::size_t size() const - { - return size_; - } - - // Set the underlying size of the endpoint in the native type. - BOOST_ASIO_DECL void resize(std::size_t size); - - // Get the capacity of the endpoint in the native type. - std::size_t capacity() const - { - return sizeof(boost::asio::detail::sockaddr_storage_type); - } - - // Compare two endpoints for equality. - BOOST_ASIO_DECL friend bool operator==( - const endpoint& e1, const endpoint& e2); - - // Compare endpoints for ordering. - BOOST_ASIO_DECL friend bool operator<( - const endpoint& e1, const endpoint& e2); - -private: - // The underlying socket address. - union data_union - { - boost::asio::detail::socket_addr_type base; - boost::asio::detail::sockaddr_storage_type generic; - } data_; - - // The length of the socket address stored in the endpoint. - std::size_t size_; - - // The socket protocol associated with the endpoint. - int protocol_; - - // Initialise with a specified memory. - BOOST_ASIO_DECL void init(const void* sock_addr, - std::size_t sock_addr_size, int sock_protocol); -}; - -} // namespace detail -} // namespace generic -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/generic/detail/impl/endpoint.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_GENERIC_DETAIL_ENDPOINT_HPP diff --git a/contrib/restricted/boost/boost/asio/generic/detail/impl/endpoint.ipp b/contrib/restricted/boost/boost/asio/generic/detail/impl/endpoint.ipp deleted file mode 100644 index 97db811f2e..0000000000 --- a/contrib/restricted/boost/boost/asio/generic/detail/impl/endpoint.ipp +++ /dev/null @@ -1,112 +0,0 @@ -// -// generic/detail/impl/endpoint.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_GENERIC_DETAIL_IMPL_ENDPOINT_IPP -#define BOOST_ASIO_GENERIC_DETAIL_IMPL_ENDPOINT_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <cstring> -#include <typeinfo> -#include <boost/asio/detail/socket_ops.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/detail/throw_exception.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/generic/detail/endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace generic { -namespace detail { - -endpoint::endpoint() -{ - init(0, 0, 0); -} - -endpoint::endpoint(const void* sock_addr, - std::size_t sock_addr_size, int sock_protocol) -{ - init(sock_addr, sock_addr_size, sock_protocol); -} - -void endpoint::resize(std::size_t new_size) -{ - if (new_size > sizeof(boost::asio::detail::sockaddr_storage_type)) - { - boost::system::error_code ec(boost::asio::error::invalid_argument); - boost::asio::detail::throw_error(ec); - } - else - { - size_ = new_size; - protocol_ = 0; - } -} - -bool operator==(const endpoint& e1, const endpoint& e2) -{ - using namespace std; // For memcmp. - return e1.size() == e2.size() && memcmp(e1.data(), e2.data(), e1.size()) == 0; -} - -bool operator<(const endpoint& e1, const endpoint& e2) -{ - if (e1.protocol() < e2.protocol()) - return true; - - if (e1.protocol() > e2.protocol()) - return false; - - using namespace std; // For memcmp. - std::size_t compare_size = e1.size() < e2.size() ? e1.size() : e2.size(); - int compare_result = memcmp(e1.data(), e2.data(), compare_size); - - if (compare_result < 0) - return true; - - if (compare_result > 0) - return false; - - return e1.size() < e2.size(); -} - -void endpoint::init(const void* sock_addr, - std::size_t sock_addr_size, int sock_protocol) -{ - if (sock_addr_size > sizeof(boost::asio::detail::sockaddr_storage_type)) - { - boost::system::error_code ec(boost::asio::error::invalid_argument); - boost::asio::detail::throw_error(ec); - } - - using namespace std; // For memset and memcpy. - memset(&data_.generic, 0, sizeof(boost::asio::detail::sockaddr_storage_type)); - if (sock_addr_size > 0) - memcpy(&data_.generic, sock_addr, sock_addr_size); - - size_ = sock_addr_size; - protocol_ = sock_protocol; -} - -} // namespace detail -} // namespace generic -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_GENERIC_DETAIL_IMPL_ENDPOINT_IPP diff --git a/contrib/restricted/boost/boost/asio/generic/raw_protocol.hpp b/contrib/restricted/boost/boost/asio/generic/raw_protocol.hpp deleted file mode 100644 index dca84e73f7..0000000000 --- a/contrib/restricted/boost/boost/asio/generic/raw_protocol.hpp +++ /dev/null @@ -1,123 +0,0 @@ -// -// generic/raw_protocol.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_GENERIC_RAW_PROTOCOL_HPP -#define BOOST_ASIO_GENERIC_RAW_PROTOCOL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <typeinfo> -#include <boost/asio/basic_raw_socket.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/throw_exception.hpp> -#include <boost/asio/generic/basic_endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace generic { - -/// Encapsulates the flags needed for a generic raw socket. -/** - * The boost::asio::generic::raw_protocol class contains flags necessary for - * raw sockets of any address family and protocol. - * - * @par Examples - * Constructing using a native address family and socket protocol: - * @code raw_protocol p(AF_INET, IPPROTO_ICMP); @endcode - * Constructing from a specific protocol type: - * @code raw_protocol p(boost::asio::ip::icmp::v4()); @endcode - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe. - * - * @par Concepts: - * Protocol. - */ -class raw_protocol -{ -public: - /// Construct a protocol object for a specific address family and protocol. - raw_protocol(int address_family, int socket_protocol) - : family_(address_family), - protocol_(socket_protocol) - { - } - - /// Construct a generic protocol object from a specific protocol. - /** - * @throws @c bad_cast Thrown if the source protocol is not raw-oriented. - */ - template <typename Protocol> - raw_protocol(const Protocol& source_protocol) - : family_(source_protocol.family()), - protocol_(source_protocol.protocol()) - { - if (source_protocol.type() != type()) - { - std::bad_cast ex; - boost::asio::detail::throw_exception(ex); - } - } - - /// Obtain an identifier for the type of the protocol. - int type() const - { - return BOOST_ASIO_OS_DEF(SOCK_RAW); - } - - /// Obtain an identifier for the protocol. - int protocol() const - { - return protocol_; - } - - /// Obtain an identifier for the protocol family. - int family() const - { - return family_; - } - - /// Compare two protocols for equality. - friend bool operator==(const raw_protocol& p1, const raw_protocol& p2) - { - return p1.family_ == p2.family_ && p1.protocol_ == p2.protocol_; - } - - /// Compare two protocols for inequality. - friend bool operator!=(const raw_protocol& p1, const raw_protocol& p2) - { - return !(p1 == p2); - } - - /// The type of an endpoint. - typedef basic_endpoint<raw_protocol> endpoint; - - /// The generic socket type. - typedef basic_raw_socket<raw_protocol> socket; - -private: - int family_; - int protocol_; -}; - -} // namespace generic -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_GENERIC_RAW_PROTOCOL_HPP diff --git a/contrib/restricted/boost/boost/asio/generic/seq_packet_protocol.hpp b/contrib/restricted/boost/boost/asio/generic/seq_packet_protocol.hpp deleted file mode 100644 index e54f23e6d9..0000000000 --- a/contrib/restricted/boost/boost/asio/generic/seq_packet_protocol.hpp +++ /dev/null @@ -1,124 +0,0 @@ -// -// generic/seq_packet_protocol.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_GENERIC_SEQ_PACKET_PROTOCOL_HPP -#define BOOST_ASIO_GENERIC_SEQ_PACKET_PROTOCOL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <typeinfo> -#include <boost/asio/basic_seq_packet_socket.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/throw_exception.hpp> -#include <boost/asio/generic/basic_endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace generic { - -/// Encapsulates the flags needed for a generic sequenced packet socket. -/** - * The boost::asio::generic::seq_packet_protocol class contains flags necessary - * for seq_packet-oriented sockets of any address family and protocol. - * - * @par Examples - * Constructing using a native address family and socket protocol: - * @code seq_packet_protocol p(AF_INET, IPPROTO_SCTP); @endcode - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe. - * - * @par Concepts: - * Protocol. - */ -class seq_packet_protocol -{ -public: - /// Construct a protocol object for a specific address family and protocol. - seq_packet_protocol(int address_family, int socket_protocol) - : family_(address_family), - protocol_(socket_protocol) - { - } - - /// Construct a generic protocol object from a specific protocol. - /** - * @throws @c bad_cast Thrown if the source protocol is not based around - * sequenced packets. - */ - template <typename Protocol> - seq_packet_protocol(const Protocol& source_protocol) - : family_(source_protocol.family()), - protocol_(source_protocol.protocol()) - { - if (source_protocol.type() != type()) - { - std::bad_cast ex; - boost::asio::detail::throw_exception(ex); - } - } - - /// Obtain an identifier for the type of the protocol. - int type() const - { - return BOOST_ASIO_OS_DEF(SOCK_SEQPACKET); - } - - /// Obtain an identifier for the protocol. - int protocol() const - { - return protocol_; - } - - /// Obtain an identifier for the protocol family. - int family() const - { - return family_; - } - - /// Compare two protocols for equality. - friend bool operator==(const seq_packet_protocol& p1, - const seq_packet_protocol& p2) - { - return p1.family_ == p2.family_ && p1.protocol_ == p2.protocol_; - } - - /// Compare two protocols for inequality. - friend bool operator!=(const seq_packet_protocol& p1, - const seq_packet_protocol& p2) - { - return !(p1 == p2); - } - - /// The type of an endpoint. - typedef basic_endpoint<seq_packet_protocol> endpoint; - - /// The generic socket type. - typedef basic_seq_packet_socket<seq_packet_protocol> socket; - -private: - int family_; - int protocol_; -}; - -} // namespace generic -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_GENERIC_SEQ_PACKET_PROTOCOL_HPP diff --git a/contrib/restricted/boost/boost/asio/generic/stream_protocol.hpp b/contrib/restricted/boost/boost/asio/generic/stream_protocol.hpp deleted file mode 100644 index 599f095dd0..0000000000 --- a/contrib/restricted/boost/boost/asio/generic/stream_protocol.hpp +++ /dev/null @@ -1,129 +0,0 @@ -// -// generic/stream_protocol.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_GENERIC_STREAM_PROTOCOL_HPP -#define BOOST_ASIO_GENERIC_STREAM_PROTOCOL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <typeinfo> -#include <boost/asio/basic_socket_iostream.hpp> -#include <boost/asio/basic_stream_socket.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/throw_exception.hpp> -#include <boost/asio/generic/basic_endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace generic { - -/// Encapsulates the flags needed for a generic stream-oriented socket. -/** - * The boost::asio::generic::stream_protocol class contains flags necessary for - * stream-oriented sockets of any address family and protocol. - * - * @par Examples - * Constructing using a native address family and socket protocol: - * @code stream_protocol p(AF_INET, IPPROTO_TCP); @endcode - * Constructing from a specific protocol type: - * @code stream_protocol p(boost::asio::ip::tcp::v4()); @endcode - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe. - * - * @par Concepts: - * Protocol. - */ -class stream_protocol -{ -public: - /// Construct a protocol object for a specific address family and protocol. - stream_protocol(int address_family, int socket_protocol) - : family_(address_family), - protocol_(socket_protocol) - { - } - - /// Construct a generic protocol object from a specific protocol. - /** - * @throws @c bad_cast Thrown if the source protocol is not stream-oriented. - */ - template <typename Protocol> - stream_protocol(const Protocol& source_protocol) - : family_(source_protocol.family()), - protocol_(source_protocol.protocol()) - { - if (source_protocol.type() != type()) - { - std::bad_cast ex; - boost::asio::detail::throw_exception(ex); - } - } - - /// Obtain an identifier for the type of the protocol. - int type() const - { - return BOOST_ASIO_OS_DEF(SOCK_STREAM); - } - - /// Obtain an identifier for the protocol. - int protocol() const - { - return protocol_; - } - - /// Obtain an identifier for the protocol family. - int family() const - { - return family_; - } - - /// Compare two protocols for equality. - friend bool operator==(const stream_protocol& p1, const stream_protocol& p2) - { - return p1.family_ == p2.family_ && p1.protocol_ == p2.protocol_; - } - - /// Compare two protocols for inequality. - friend bool operator!=(const stream_protocol& p1, const stream_protocol& p2) - { - return !(p1 == p2); - } - - /// The type of an endpoint. - typedef basic_endpoint<stream_protocol> endpoint; - - /// The generic socket type. - typedef basic_stream_socket<stream_protocol> socket; - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - /// The generic socket iostream type. - typedef basic_socket_iostream<stream_protocol> iostream; -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -private: - int family_; - int protocol_; -}; - -} // namespace generic -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_GENERIC_STREAM_PROTOCOL_HPP diff --git a/contrib/restricted/boost/boost/asio/high_resolution_timer.hpp b/contrib/restricted/boost/boost/asio/high_resolution_timer.hpp deleted file mode 100644 index f7383b7cc9..0000000000 --- a/contrib/restricted/boost/boost/asio/high_resolution_timer.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// -// high_resolution_timer.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_HIGH_RESOLUTION_TIMER_HPP -#define BOOST_ASIO_HIGH_RESOLUTION_TIMER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/basic_waitable_timer.hpp> -#include <boost/asio/detail/chrono.hpp> - -namespace boost { -namespace asio { - -/// Typedef for a timer based on the high resolution clock. -/** - * This typedef uses the C++11 @c <chrono> standard library facility, if - * available. Otherwise, it may use the Boost.Chrono library. To explicitly - * utilise Boost.Chrono, use the basic_waitable_timer template directly: - * @code - * typedef basic_waitable_timer<boost::chrono::high_resolution_clock> timer; - * @endcode - */ -typedef basic_waitable_timer< - chrono::high_resolution_clock> - high_resolution_timer; - -} // namespace asio -} // namespace boost - -#endif // defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_HIGH_RESOLUTION_TIMER_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/buffered_read_stream.hpp b/contrib/restricted/boost/boost/asio/impl/buffered_read_stream.hpp deleted file mode 100644 index 2e1c55842b..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/buffered_read_stream.hpp +++ /dev/null @@ -1,431 +0,0 @@ -// -// impl/buffered_read_stream.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_BUFFERED_READ_STREAM_HPP -#define BOOST_ASIO_IMPL_BUFFERED_READ_STREAM_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -template <typename Stream> -std::size_t buffered_read_stream<Stream>::fill() -{ - detail::buffer_resize_guard<detail::buffered_stream_storage> - resize_guard(storage_); - std::size_t previous_size = storage_.size(); - storage_.resize(storage_.capacity()); - storage_.resize(previous_size + next_layer_.read_some(buffer( - storage_.data() + previous_size, - storage_.size() - previous_size))); - resize_guard.commit(); - return storage_.size() - previous_size; -} - -template <typename Stream> -std::size_t buffered_read_stream<Stream>::fill(boost::system::error_code& ec) -{ - detail::buffer_resize_guard<detail::buffered_stream_storage> - resize_guard(storage_); - std::size_t previous_size = storage_.size(); - storage_.resize(storage_.capacity()); - storage_.resize(previous_size + next_layer_.read_some(buffer( - storage_.data() + previous_size, - storage_.size() - previous_size), - ec)); - resize_guard.commit(); - return storage_.size() - previous_size; -} - -namespace detail -{ - template <typename ReadHandler> - class buffered_fill_handler - { - public: - buffered_fill_handler(detail::buffered_stream_storage& storage, - std::size_t previous_size, ReadHandler& handler) - : storage_(storage), - previous_size_(previous_size), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - buffered_fill_handler(const buffered_fill_handler& other) - : storage_(other.storage_), - previous_size_(other.previous_size_), - handler_(other.handler_) - { - } - - buffered_fill_handler(buffered_fill_handler&& other) - : storage_(other.storage_), - previous_size_(other.previous_size_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - const std::size_t bytes_transferred) - { - storage_.resize(previous_size_ + bytes_transferred); - handler_(ec, bytes_transferred); - } - - //private: - detail::buffered_stream_storage& storage_; - std::size_t previous_size_; - ReadHandler handler_; - }; - - template <typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - buffered_fill_handler<ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - buffered_fill_handler<ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename ReadHandler> - inline bool asio_handler_is_continuation( - buffered_fill_handler<ReadHandler>* this_handler) - { - return boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename ReadHandler> - inline void asio_handler_invoke(Function& function, - buffered_fill_handler<ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - buffered_fill_handler<ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename ReadHandler, typename Allocator> -struct associated_allocator< - detail::buffered_fill_handler<ReadHandler>, Allocator> -{ - typedef typename associated_allocator<ReadHandler, Allocator>::type type; - - static type get(const detail::buffered_fill_handler<ReadHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename ReadHandler, typename Executor> -struct associated_executor< - detail::buffered_fill_handler<ReadHandler>, Executor> -{ - typedef typename associated_executor<ReadHandler, Executor>::type type; - - static type get(const detail::buffered_fill_handler<ReadHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename Stream> -template <typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -buffered_read_stream<Stream>::async_fill( - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - std::size_t previous_size = storage_.size(); - storage_.resize(storage_.capacity()); - next_layer_.async_read_some( - buffer( - storage_.data() + previous_size, - storage_.size() - previous_size), - detail::buffered_fill_handler<BOOST_ASIO_HANDLER_TYPE( - ReadHandler, void (boost::system::error_code, std::size_t))>( - storage_, previous_size, init.completion_handler)); - - return init.result.get(); -} - -template <typename Stream> -template <typename MutableBufferSequence> -std::size_t buffered_read_stream<Stream>::read_some( - const MutableBufferSequence& buffers) -{ - using boost::asio::buffer_size; - if (buffer_size(buffers) == 0) - return 0; - - if (storage_.empty()) - this->fill(); - - return this->copy(buffers); -} - -template <typename Stream> -template <typename MutableBufferSequence> -std::size_t buffered_read_stream<Stream>::read_some( - const MutableBufferSequence& buffers, boost::system::error_code& ec) -{ - ec = boost::system::error_code(); - - using boost::asio::buffer_size; - if (buffer_size(buffers) == 0) - return 0; - - if (storage_.empty() && !this->fill(ec)) - return 0; - - return this->copy(buffers); -} - -namespace detail -{ - template <typename MutableBufferSequence, typename ReadHandler> - class buffered_read_some_handler - { - public: - buffered_read_some_handler(detail::buffered_stream_storage& storage, - const MutableBufferSequence& buffers, ReadHandler& handler) - : storage_(storage), - buffers_(buffers), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - buffered_read_some_handler(const buffered_read_some_handler& other) - : storage_(other.storage_), - buffers_(other.buffers_), - handler_(other.handler_) - { - } - - buffered_read_some_handler(buffered_read_some_handler&& other) - : storage_(other.storage_), - buffers_(other.buffers_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, std::size_t) - { - if (ec || storage_.empty()) - { - const std::size_t length = 0; - handler_(ec, length); - } - else - { - const std::size_t bytes_copied = boost::asio::buffer_copy( - buffers_, storage_.data(), storage_.size()); - storage_.consume(bytes_copied); - handler_(ec, bytes_copied); - } - } - - //private: - detail::buffered_stream_storage& storage_; - MutableBufferSequence buffers_; - ReadHandler handler_; - }; - - template <typename MutableBufferSequence, typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - buffered_read_some_handler< - MutableBufferSequence, ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename MutableBufferSequence, typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - buffered_read_some_handler< - MutableBufferSequence, ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename MutableBufferSequence, typename ReadHandler> - inline bool asio_handler_is_continuation( - buffered_read_some_handler< - MutableBufferSequence, ReadHandler>* this_handler) - { - return boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename MutableBufferSequence, - typename ReadHandler> - inline void asio_handler_invoke(Function& function, - buffered_read_some_handler< - MutableBufferSequence, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename MutableBufferSequence, - typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - buffered_read_some_handler< - MutableBufferSequence, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename MutableBufferSequence, - typename ReadHandler, typename Allocator> -struct associated_allocator< - detail::buffered_read_some_handler<MutableBufferSequence, ReadHandler>, - Allocator> -{ - typedef typename associated_allocator<ReadHandler, Allocator>::type type; - - static type get( - const detail::buffered_read_some_handler< - MutableBufferSequence, ReadHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename MutableBufferSequence, - typename ReadHandler, typename Executor> -struct associated_executor< - detail::buffered_read_some_handler<MutableBufferSequence, ReadHandler>, - Executor> -{ - typedef typename associated_executor<ReadHandler, Executor>::type type; - - static type get( - const detail::buffered_read_some_handler< - MutableBufferSequence, ReadHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename Stream> -template <typename MutableBufferSequence, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -buffered_read_stream<Stream>::async_read_some( - const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - using boost::asio::buffer_size; - if (buffer_size(buffers) == 0 || !storage_.empty()) - { - next_layer_.async_read_some(BOOST_ASIO_MUTABLE_BUFFER(0, 0), - detail::buffered_read_some_handler< - MutableBufferSequence, BOOST_ASIO_HANDLER_TYPE( - ReadHandler, void (boost::system::error_code, std::size_t))>( - storage_, buffers, init.completion_handler)); - } - else - { - this->async_fill(detail::buffered_read_some_handler< - MutableBufferSequence, BOOST_ASIO_HANDLER_TYPE( - ReadHandler, void (boost::system::error_code, std::size_t))>( - storage_, buffers, init.completion_handler)); - } - - return init.result.get(); -} - -template <typename Stream> -template <typename MutableBufferSequence> -std::size_t buffered_read_stream<Stream>::peek( - const MutableBufferSequence& buffers) -{ - if (storage_.empty()) - this->fill(); - return this->peek_copy(buffers); -} - -template <typename Stream> -template <typename MutableBufferSequence> -std::size_t buffered_read_stream<Stream>::peek( - const MutableBufferSequence& buffers, boost::system::error_code& ec) -{ - ec = boost::system::error_code(); - if (storage_.empty() && !this->fill(ec)) - return 0; - return this->peek_copy(buffers); -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_BUFFERED_READ_STREAM_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/buffered_write_stream.hpp b/contrib/restricted/boost/boost/asio/impl/buffered_write_stream.hpp deleted file mode 100644 index c5ebf7537b..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/buffered_write_stream.hpp +++ /dev/null @@ -1,413 +0,0 @@ -// -// impl/buffered_write_stream.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_BUFFERED_WRITE_STREAM_HPP -#define BOOST_ASIO_IMPL_BUFFERED_WRITE_STREAM_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -template <typename Stream> -std::size_t buffered_write_stream<Stream>::flush() -{ - std::size_t bytes_written = write(next_layer_, - buffer(storage_.data(), storage_.size())); - storage_.consume(bytes_written); - return bytes_written; -} - -template <typename Stream> -std::size_t buffered_write_stream<Stream>::flush(boost::system::error_code& ec) -{ - std::size_t bytes_written = write(next_layer_, - buffer(storage_.data(), storage_.size()), - transfer_all(), ec); - storage_.consume(bytes_written); - return bytes_written; -} - -namespace detail -{ - template <typename WriteHandler> - class buffered_flush_handler - { - public: - buffered_flush_handler(detail::buffered_stream_storage& storage, - WriteHandler& handler) - : storage_(storage), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - buffered_flush_handler(const buffered_flush_handler& other) - : storage_(other.storage_), - handler_(other.handler_) - { - } - - buffered_flush_handler(buffered_flush_handler&& other) - : storage_(other.storage_), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - const std::size_t bytes_written) - { - storage_.consume(bytes_written); - handler_(ec, bytes_written); - } - - //private: - detail::buffered_stream_storage& storage_; - WriteHandler handler_; - }; - - template <typename WriteHandler> - inline void* asio_handler_allocate(std::size_t size, - buffered_flush_handler<WriteHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename WriteHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - buffered_flush_handler<WriteHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename WriteHandler> - inline bool asio_handler_is_continuation( - buffered_flush_handler<WriteHandler>* this_handler) - { - return boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename WriteHandler> - inline void asio_handler_invoke(Function& function, - buffered_flush_handler<WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename WriteHandler> - inline void asio_handler_invoke(const Function& function, - buffered_flush_handler<WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename WriteHandler, typename Allocator> -struct associated_allocator< - detail::buffered_flush_handler<WriteHandler>, Allocator> -{ - typedef typename associated_allocator<WriteHandler, Allocator>::type type; - - static type get(const detail::buffered_flush_handler<WriteHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<WriteHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename WriteHandler, typename Executor> -struct associated_executor< - detail::buffered_flush_handler<WriteHandler>, Executor> -{ - typedef typename associated_executor<WriteHandler, Executor>::type type; - - static type get(const detail::buffered_flush_handler<WriteHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<WriteHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename Stream> -template <typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -buffered_write_stream<Stream>::async_flush( - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - async_write(next_layer_, buffer(storage_.data(), storage_.size()), - detail::buffered_flush_handler<BOOST_ASIO_HANDLER_TYPE( - WriteHandler, void (boost::system::error_code, std::size_t))>( - storage_, init.completion_handler)); - - return init.result.get(); -} - -template <typename Stream> -template <typename ConstBufferSequence> -std::size_t buffered_write_stream<Stream>::write_some( - const ConstBufferSequence& buffers) -{ - using boost::asio::buffer_size; - if (buffer_size(buffers) == 0) - return 0; - - if (storage_.size() == storage_.capacity()) - this->flush(); - - return this->copy(buffers); -} - -template <typename Stream> -template <typename ConstBufferSequence> -std::size_t buffered_write_stream<Stream>::write_some( - const ConstBufferSequence& buffers, boost::system::error_code& ec) -{ - ec = boost::system::error_code(); - - using boost::asio::buffer_size; - if (buffer_size(buffers) == 0) - return 0; - - if (storage_.size() == storage_.capacity() && !flush(ec)) - return 0; - - return this->copy(buffers); -} - -namespace detail -{ - template <typename ConstBufferSequence, typename WriteHandler> - class buffered_write_some_handler - { - public: - buffered_write_some_handler(detail::buffered_stream_storage& storage, - const ConstBufferSequence& buffers, WriteHandler& handler) - : storage_(storage), - buffers_(buffers), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - buffered_write_some_handler(const buffered_write_some_handler& other) - : storage_(other.storage_), - buffers_(other.buffers_), - handler_(other.handler_) - { - } - - buffered_write_some_handler(buffered_write_some_handler&& other) - : storage_(other.storage_), - buffers_(other.buffers_), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, std::size_t) - { - if (ec) - { - const std::size_t length = 0; - handler_(ec, length); - } - else - { - using boost::asio::buffer_size; - std::size_t orig_size = storage_.size(); - std::size_t space_avail = storage_.capacity() - orig_size; - std::size_t bytes_avail = buffer_size(buffers_); - std::size_t length = bytes_avail < space_avail - ? bytes_avail : space_avail; - storage_.resize(orig_size + length); - const std::size_t bytes_copied = boost::asio::buffer_copy( - storage_.data() + orig_size, buffers_, length); - handler_(ec, bytes_copied); - } - } - - //private: - detail::buffered_stream_storage& storage_; - ConstBufferSequence buffers_; - WriteHandler handler_; - }; - - template <typename ConstBufferSequence, typename WriteHandler> - inline void* asio_handler_allocate(std::size_t size, - buffered_write_some_handler< - ConstBufferSequence, WriteHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename ConstBufferSequence, typename WriteHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - buffered_write_some_handler< - ConstBufferSequence, WriteHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename ConstBufferSequence, typename WriteHandler> - inline bool asio_handler_is_continuation( - buffered_write_some_handler< - ConstBufferSequence, WriteHandler>* this_handler) - { - return boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename ConstBufferSequence, - typename WriteHandler> - inline void asio_handler_invoke(Function& function, - buffered_write_some_handler< - ConstBufferSequence, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename ConstBufferSequence, - typename WriteHandler> - inline void asio_handler_invoke(const Function& function, - buffered_write_some_handler< - ConstBufferSequence, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename ConstBufferSequence, - typename WriteHandler, typename Allocator> -struct associated_allocator< - detail::buffered_write_some_handler<ConstBufferSequence, WriteHandler>, - Allocator> -{ - typedef typename associated_allocator<WriteHandler, Allocator>::type type; - - static type get( - const detail::buffered_write_some_handler< - ConstBufferSequence, WriteHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<WriteHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename ConstBufferSequence, - typename WriteHandler, typename Executor> -struct associated_executor< - detail::buffered_write_some_handler<ConstBufferSequence, WriteHandler>, - Executor> -{ - typedef typename associated_executor<WriteHandler, Executor>::type type; - - static type get( - const detail::buffered_write_some_handler< - ConstBufferSequence, WriteHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<WriteHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename Stream> -template <typename ConstBufferSequence, typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -buffered_write_stream<Stream>::async_write_some( - const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - using boost::asio::buffer_size; - if (buffer_size(buffers) == 0 - || storage_.size() < storage_.capacity()) - { - next_layer_.async_write_some(BOOST_ASIO_CONST_BUFFER(0, 0), - detail::buffered_write_some_handler< - ConstBufferSequence, BOOST_ASIO_HANDLER_TYPE( - WriteHandler, void (boost::system::error_code, std::size_t))>( - storage_, buffers, init.completion_handler)); - } - else - { - this->async_flush(detail::buffered_write_some_handler< - ConstBufferSequence, BOOST_ASIO_HANDLER_TYPE( - WriteHandler, void (boost::system::error_code, std::size_t))>( - storage_, buffers, init.completion_handler)); - } - - return init.result.get(); -} - -template <typename Stream> -template <typename ConstBufferSequence> -std::size_t buffered_write_stream<Stream>::copy( - const ConstBufferSequence& buffers) -{ - using boost::asio::buffer_size; - std::size_t orig_size = storage_.size(); - std::size_t space_avail = storage_.capacity() - orig_size; - std::size_t bytes_avail = buffer_size(buffers); - std::size_t length = bytes_avail < space_avail ? bytes_avail : space_avail; - storage_.resize(orig_size + length); - return boost::asio::buffer_copy( - storage_.data() + orig_size, buffers, length); -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_BUFFERED_WRITE_STREAM_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/connect.hpp b/contrib/restricted/boost/boost/asio/impl/connect.hpp deleted file mode 100644 index 497f25884c..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/connect.hpp +++ /dev/null @@ -1,862 +0,0 @@ -// -// impl/connect.hpp -// ~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_CONNECT_HPP -#define BOOST_ASIO_IMPL_CONNECT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <algorithm> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/post.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail -{ - struct default_connect_condition - { - template <typename Endpoint> - bool operator()(const boost::system::error_code&, const Endpoint&) - { - return true; - } - }; - - template <typename Protocol, typename Iterator> - inline typename Protocol::endpoint deref_connect_result( - Iterator iter, boost::system::error_code& ec) - { - return ec ? typename Protocol::endpoint() : *iter; - } - - template <typename T, typename Iterator> - struct legacy_connect_condition_helper : T - { - typedef char (*fallback_func_type)(...); - operator fallback_func_type() const; - }; - - template <typename R, typename Arg1, typename Arg2, typename Iterator> - struct legacy_connect_condition_helper<R (*)(Arg1, Arg2), Iterator> - { - R operator()(Arg1, Arg2) const; - char operator()(...) const; - }; - - template <typename T, typename Iterator> - struct is_legacy_connect_condition - { - static char asio_connect_condition_check(char); - static char (&asio_connect_condition_check(Iterator))[2]; - - static const bool value = - sizeof(asio_connect_condition_check( - (*static_cast<legacy_connect_condition_helper<T, Iterator>*>(0))( - *static_cast<const boost::system::error_code*>(0), - *static_cast<const Iterator*>(0)))) != 1; - }; - - template <typename ConnectCondition, typename Iterator> - inline Iterator call_connect_condition(ConnectCondition& connect_condition, - const boost::system::error_code& ec, Iterator next, Iterator end, - typename enable_if<is_legacy_connect_condition< - ConnectCondition, Iterator>::value>::type* = 0) - { - if (next != end) - return connect_condition(ec, next); - return end; - } - - template <typename ConnectCondition, typename Iterator> - inline Iterator call_connect_condition(ConnectCondition& connect_condition, - const boost::system::error_code& ec, Iterator next, Iterator end, - typename enable_if<!is_legacy_connect_condition< - ConnectCondition, Iterator>::value>::type* = 0) - { - for (;next != end; ++next) - if (connect_condition(ec, *next)) - return next; - return end; - } -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename EndpointSequence> -typename Protocol::endpoint connect( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type*) -{ - boost::system::error_code ec; - typename Protocol::endpoint result = connect(s, endpoints, ec); - boost::asio::detail::throw_error(ec, "connect"); - return result; -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename EndpointSequence> -typename Protocol::endpoint connect( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, boost::system::error_code& ec, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type*) -{ - return detail::deref_connect_result<Protocol>( - connect(s, endpoints.begin(), endpoints.end(), - detail::default_connect_condition(), ec), ec); -} - -#if !defined(BOOST_ASIO_NO_DEPRECATED) -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, Iterator begin, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type*) -{ - boost::system::error_code ec; - Iterator result = connect(s, begin, ec); - boost::asio::detail::throw_error(ec, "connect"); - return result; -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator> -inline Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, boost::system::error_code& ec, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type*) -{ - return connect(s, begin, Iterator(), detail::default_connect_condition(), ec); -} -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end) -{ - boost::system::error_code ec; - Iterator result = connect(s, begin, end, ec); - boost::asio::detail::throw_error(ec, "connect"); - return result; -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator> -inline Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end, boost::system::error_code& ec) -{ - return connect(s, begin, end, detail::default_connect_condition(), ec); -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition> -typename Protocol::endpoint connect( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, ConnectCondition connect_condition, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type*) -{ - boost::system::error_code ec; - typename Protocol::endpoint result = connect( - s, endpoints, connect_condition, ec); - boost::asio::detail::throw_error(ec, "connect"); - return result; -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition> -typename Protocol::endpoint connect( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, ConnectCondition connect_condition, - boost::system::error_code& ec, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type*) -{ - return detail::deref_connect_result<Protocol>( - connect(s, endpoints.begin(), endpoints.end(), - connect_condition, ec), ec); -} - -#if !defined(BOOST_ASIO_NO_DEPRECATED) -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, ConnectCondition connect_condition, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type*) -{ - boost::system::error_code ec; - Iterator result = connect(s, begin, connect_condition, ec); - boost::asio::detail::throw_error(ec, "connect"); - return result; -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition> -inline Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, ConnectCondition connect_condition, - boost::system::error_code& ec, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type*) -{ - return connect(s, begin, Iterator(), connect_condition, ec); -} -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end, ConnectCondition connect_condition) -{ - boost::system::error_code ec; - Iterator result = connect(s, begin, end, connect_condition, ec); - boost::asio::detail::throw_error(ec, "connect"); - return result; -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition> -Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end, ConnectCondition connect_condition, - boost::system::error_code& ec) -{ - ec = boost::system::error_code(); - - for (Iterator iter = begin; iter != end; ++iter) - { - iter = (detail::call_connect_condition(connect_condition, ec, iter, end)); - if (iter != end) - { - s.close(ec); - s.connect(*iter, ec); - if (!ec) - return iter; - } - else - break; - } - - if (!ec) - ec = boost::asio::error::not_found; - - return end; -} - -namespace detail -{ - // Enable the empty base class optimisation for the connect condition. - template <typename ConnectCondition> - class base_from_connect_condition - { - protected: - explicit base_from_connect_condition( - const ConnectCondition& connect_condition) - : connect_condition_(connect_condition) - { - } - - template <typename Iterator> - void check_condition(const boost::system::error_code& ec, - Iterator& iter, Iterator& end) - { - iter = detail::call_connect_condition(connect_condition_, ec, iter, end); - } - - private: - ConnectCondition connect_condition_; - }; - - // The default_connect_condition implementation is essentially a no-op. This - // template specialisation lets us eliminate all costs associated with it. - template <> - class base_from_connect_condition<default_connect_condition> - { - protected: - explicit base_from_connect_condition(const default_connect_condition&) - { - } - - template <typename Iterator> - void check_condition(const boost::system::error_code&, Iterator&, Iterator&) - { - } - }; - - template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition, - typename RangeConnectHandler> - class range_connect_op : base_from_connect_condition<ConnectCondition> - { - public: - range_connect_op(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& sock, - const EndpointSequence& endpoints, - const ConnectCondition& connect_condition, - RangeConnectHandler& handler) - : base_from_connect_condition<ConnectCondition>(connect_condition), - socket_(sock), - endpoints_(endpoints), - index_(0), - start_(0), - handler_(BOOST_ASIO_MOVE_CAST(RangeConnectHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - range_connect_op(const range_connect_op& other) - : base_from_connect_condition<ConnectCondition>(other), - socket_(other.socket_), - endpoints_(other.endpoints_), - index_(other.index_), - start_(other.start_), - handler_(other.handler_) - { - } - - range_connect_op(range_connect_op&& other) - : base_from_connect_condition<ConnectCondition>(other), - socket_(other.socket_), - endpoints_(other.endpoints_), - index_(other.index_), - start_(other.start_), - handler_(BOOST_ASIO_MOVE_CAST(RangeConnectHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(boost::system::error_code ec, int start = 0) - { - typename EndpointSequence::const_iterator begin = endpoints_.begin(); - typename EndpointSequence::const_iterator iter = begin; - std::advance(iter, index_); - typename EndpointSequence::const_iterator end = endpoints_.end(); - - switch (start_ = start) - { - case 1: - for (;;) - { - this->check_condition(ec, iter, end); - index_ = std::distance(begin, iter); - - if (iter != end) - { - socket_.close(ec); - socket_.async_connect(*iter, - BOOST_ASIO_MOVE_CAST(range_connect_op)(*this)); - return; - } - - if (start) - { - ec = boost::asio::error::not_found; - boost::asio::post(socket_.get_executor(), - detail::bind_handler( - BOOST_ASIO_MOVE_CAST(range_connect_op)(*this), ec)); - return; - } - - default: - - if (iter == end) - break; - - if (!socket_.is_open()) - { - ec = boost::asio::error::operation_aborted; - break; - } - - if (!ec) - break; - - ++iter; - ++index_; - } - - handler_(static_cast<const boost::system::error_code&>(ec), - static_cast<const typename Protocol::endpoint&>( - ec || iter == end ? typename Protocol::endpoint() : *iter)); - } - } - - //private: - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& socket_; - EndpointSequence endpoints_; - std::size_t index_; - int start_; - RangeConnectHandler handler_; - }; - - template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition, - typename RangeConnectHandler> - inline void* asio_handler_allocate(std::size_t size, - range_connect_op<Protocol BOOST_ASIO_SVC_TARG, EndpointSequence, - ConnectCondition, RangeConnectHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition, - typename RangeConnectHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - range_connect_op<Protocol BOOST_ASIO_SVC_TARG, EndpointSequence, - ConnectCondition, RangeConnectHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition, - typename RangeConnectHandler> - inline bool asio_handler_is_continuation( - range_connect_op<Protocol BOOST_ASIO_SVC_TARG, EndpointSequence, - ConnectCondition, RangeConnectHandler>* this_handler) - { - return boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename Protocol - BOOST_ASIO_SVC_TPARAM, typename EndpointSequence, - typename ConnectCondition, typename RangeConnectHandler> - inline void asio_handler_invoke(Function& function, - range_connect_op<Protocol BOOST_ASIO_SVC_TARG, EndpointSequence, - ConnectCondition, RangeConnectHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename Protocol - BOOST_ASIO_SVC_TPARAM, typename EndpointSequence, - typename ConnectCondition, typename RangeConnectHandler> - inline void asio_handler_invoke(const Function& function, - range_connect_op<Protocol BOOST_ASIO_SVC_TARG, EndpointSequence, - ConnectCondition, RangeConnectHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> - class iterator_connect_op : base_from_connect_condition<ConnectCondition> - { - public: - iterator_connect_op(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& sock, - const Iterator& begin, const Iterator& end, - const ConnectCondition& connect_condition, - IteratorConnectHandler& handler) - : base_from_connect_condition<ConnectCondition>(connect_condition), - socket_(sock), - iter_(begin), - end_(end), - start_(0), - handler_(BOOST_ASIO_MOVE_CAST(IteratorConnectHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - iterator_connect_op(const iterator_connect_op& other) - : base_from_connect_condition<ConnectCondition>(other), - socket_(other.socket_), - iter_(other.iter_), - end_(other.end_), - start_(other.start_), - handler_(other.handler_) - { - } - - iterator_connect_op(iterator_connect_op&& other) - : base_from_connect_condition<ConnectCondition>(other), - socket_(other.socket_), - iter_(other.iter_), - end_(other.end_), - start_(other.start_), - handler_(BOOST_ASIO_MOVE_CAST(IteratorConnectHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(boost::system::error_code ec, int start = 0) - { - switch (start_ = start) - { - case 1: - for (;;) - { - this->check_condition(ec, iter_, end_); - - if (iter_ != end_) - { - socket_.close(ec); - socket_.async_connect(*iter_, - BOOST_ASIO_MOVE_CAST(iterator_connect_op)(*this)); - return; - } - - if (start) - { - ec = boost::asio::error::not_found; - boost::asio::post(socket_.get_executor(), - detail::bind_handler( - BOOST_ASIO_MOVE_CAST(iterator_connect_op)(*this), ec)); - return; - } - - default: - - if (iter_ == end_) - break; - - if (!socket_.is_open()) - { - ec = boost::asio::error::operation_aborted; - break; - } - - if (!ec) - break; - - ++iter_; - } - - handler_(static_cast<const boost::system::error_code&>(ec), - static_cast<const Iterator&>(iter_)); - } - } - - //private: - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& socket_; - Iterator iter_; - Iterator end_; - int start_; - IteratorConnectHandler handler_; - }; - - template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> - inline void* asio_handler_allocate(std::size_t size, - iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - ConnectCondition, IteratorConnectHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - ConnectCondition, IteratorConnectHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> - inline bool asio_handler_is_continuation( - iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - ConnectCondition, IteratorConnectHandler>* this_handler) - { - return boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename Protocol - BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> - inline void asio_handler_invoke(Function& function, - iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - ConnectCondition, IteratorConnectHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename Protocol - BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> - inline void asio_handler_invoke(const Function& function, - iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - ConnectCondition, IteratorConnectHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition, - typename RangeConnectHandler, typename Allocator> -struct associated_allocator< - detail::range_connect_op<Protocol BOOST_ASIO_SVC_TARG, - EndpointSequence, ConnectCondition, RangeConnectHandler>, - Allocator> -{ - typedef typename associated_allocator< - RangeConnectHandler, Allocator>::type type; - - static type get( - const detail::range_connect_op<Protocol BOOST_ASIO_SVC_TARG, - EndpointSequence, ConnectCondition, RangeConnectHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<RangeConnectHandler, - Allocator>::get(h.handler_, a); - } -}; - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename ConnectCondition, - typename RangeConnectHandler, typename Executor> -struct associated_executor< - detail::range_connect_op<Protocol BOOST_ASIO_SVC_TARG, - EndpointSequence, ConnectCondition, RangeConnectHandler>, - Executor> -{ - typedef typename associated_executor< - RangeConnectHandler, Executor>::type type; - - static type get( - const detail::range_connect_op<Protocol BOOST_ASIO_SVC_TARG, - EndpointSequence, ConnectCondition, RangeConnectHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<RangeConnectHandler, - Executor>::get(h.handler_, ex); - } -}; - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition, - typename IteratorConnectHandler, typename Allocator> -struct associated_allocator< - detail::iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - ConnectCondition, IteratorConnectHandler>, - Allocator> -{ - typedef typename associated_allocator< - IteratorConnectHandler, Allocator>::type type; - - static type get( - const detail::iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, - Iterator, ConnectCondition, IteratorConnectHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<IteratorConnectHandler, - Allocator>::get(h.handler_, a); - } -}; - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename ConnectCondition, - typename IteratorConnectHandler, typename Executor> -struct associated_executor< - detail::iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - ConnectCondition, IteratorConnectHandler>, - Executor> -{ - typedef typename associated_executor< - IteratorConnectHandler, Executor>::type type; - - static type get( - const detail::iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, - Iterator, ConnectCondition, IteratorConnectHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<IteratorConnectHandler, - Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename EndpointSequence, typename RangeConnectHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler, - void (boost::system::error_code, typename Protocol::endpoint)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, - BOOST_ASIO_MOVE_ARG(RangeConnectHandler) handler, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a RangeConnectHandler. - BOOST_ASIO_RANGE_CONNECT_HANDLER_CHECK( - RangeConnectHandler, handler, typename Protocol::endpoint) type_check; - - async_completion<RangeConnectHandler, - void (boost::system::error_code, typename Protocol::endpoint)> - init(handler); - - detail::range_connect_op<Protocol BOOST_ASIO_SVC_TARG, EndpointSequence, - detail::default_connect_condition, - BOOST_ASIO_HANDLER_TYPE(RangeConnectHandler, - void (boost::system::error_code, typename Protocol::endpoint))>(s, - endpoints, detail::default_connect_condition(), - init.completion_handler)(boost::system::error_code(), 1); - - return init.result.get(); -} - -#if !defined(BOOST_ASIO_NO_DEPRECATED) -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename IteratorConnectHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler, - void (boost::system::error_code, Iterator)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a IteratorConnectHandler. - BOOST_ASIO_ITERATOR_CONNECT_HANDLER_CHECK( - IteratorConnectHandler, handler, Iterator) type_check; - - async_completion<IteratorConnectHandler, - void (boost::system::error_code, Iterator)> init(handler); - - detail::iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - detail::default_connect_condition, BOOST_ASIO_HANDLER_TYPE( - IteratorConnectHandler, void (boost::system::error_code, Iterator))>(s, - begin, Iterator(), detail::default_connect_condition(), - init.completion_handler)(boost::system::error_code(), 1); - - return init.result.get(); -} -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, - typename Iterator, typename IteratorConnectHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler, - void (boost::system::error_code, Iterator)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end, - BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a IteratorConnectHandler. - BOOST_ASIO_ITERATOR_CONNECT_HANDLER_CHECK( - IteratorConnectHandler, handler, Iterator) type_check; - - async_completion<IteratorConnectHandler, - void (boost::system::error_code, Iterator)> init(handler); - - detail::iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - detail::default_connect_condition, BOOST_ASIO_HANDLER_TYPE( - IteratorConnectHandler, void (boost::system::error_code, Iterator))>(s, - begin, end, detail::default_connect_condition(), - init.completion_handler)(boost::system::error_code(), 1); - - return init.result.get(); -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename EndpointSequence, - typename ConnectCondition, typename RangeConnectHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler, - void (boost::system::error_code, typename Protocol::endpoint)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - const EndpointSequence& endpoints, ConnectCondition connect_condition, - BOOST_ASIO_MOVE_ARG(RangeConnectHandler) handler, - typename enable_if<is_endpoint_sequence< - EndpointSequence>::value>::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a RangeConnectHandler. - BOOST_ASIO_RANGE_CONNECT_HANDLER_CHECK( - RangeConnectHandler, handler, typename Protocol::endpoint) type_check; - - async_completion<RangeConnectHandler, - void (boost::system::error_code, typename Protocol::endpoint)> - init(handler); - - detail::range_connect_op<Protocol BOOST_ASIO_SVC_TARG, EndpointSequence, - ConnectCondition, BOOST_ASIO_HANDLER_TYPE(RangeConnectHandler, - void (boost::system::error_code, typename Protocol::endpoint))>(s, - endpoints, connect_condition, init.completion_handler)( - boost::system::error_code(), 1); - - return init.result.get(); -} - -#if !defined(BOOST_ASIO_NO_DEPRECATED) -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler, - void (boost::system::error_code, Iterator)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, ConnectCondition connect_condition, - BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler, - typename enable_if<!is_endpoint_sequence<Iterator>::value>::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a IteratorConnectHandler. - BOOST_ASIO_ITERATOR_CONNECT_HANDLER_CHECK( - IteratorConnectHandler, handler, Iterator) type_check; - - async_completion<IteratorConnectHandler, - void (boost::system::error_code, Iterator)> init(handler); - - detail::iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - ConnectCondition, BOOST_ASIO_HANDLER_TYPE( - IteratorConnectHandler, void (boost::system::error_code, Iterator))>(s, - begin, Iterator(), connect_condition, init.completion_handler)( - boost::system::error_code(), 1); - - return init.result.get(); -} -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator, - typename ConnectCondition, typename IteratorConnectHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler, - void (boost::system::error_code, Iterator)) -async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, - Iterator begin, Iterator end, ConnectCondition connect_condition, - BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a IteratorConnectHandler. - BOOST_ASIO_ITERATOR_CONNECT_HANDLER_CHECK( - IteratorConnectHandler, handler, Iterator) type_check; - - async_completion<IteratorConnectHandler, - void (boost::system::error_code, Iterator)> init(handler); - - detail::iterator_connect_op<Protocol BOOST_ASIO_SVC_TARG, Iterator, - ConnectCondition, BOOST_ASIO_HANDLER_TYPE( - IteratorConnectHandler, void (boost::system::error_code, Iterator))>(s, - begin, end, connect_condition, init.completion_handler)( - boost::system::error_code(), 1); - - return init.result.get(); -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_CONNECT_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/defer.hpp b/contrib/restricted/boost/boost/asio/impl/defer.hpp deleted file mode 100644 index 7cc86da45c..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/defer.hpp +++ /dev/null @@ -1,79 +0,0 @@ -// -// impl/defer.hpp -// ~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_DEFER_HPP -#define BOOST_ASIO_IMPL_DEFER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/detail/work_dispatcher.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -template <typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer( - BOOST_ASIO_MOVE_ARG(CompletionToken) token) -{ - typedef BOOST_ASIO_HANDLER_TYPE(CompletionToken, void()) handler; - - async_completion<CompletionToken, void()> init(token); - - typename associated_executor<handler>::type ex( - (get_associated_executor)(init.completion_handler)); - - typename associated_allocator<handler>::type alloc( - (get_associated_allocator)(init.completion_handler)); - - ex.defer(BOOST_ASIO_MOVE_CAST(handler)(init.completion_handler), alloc); - - return init.result.get(); -} - -template <typename Executor, typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer( - const Executor& ex, BOOST_ASIO_MOVE_ARG(CompletionToken) token, - typename enable_if<is_executor<Executor>::value>::type*) -{ - typedef BOOST_ASIO_HANDLER_TYPE(CompletionToken, void()) handler; - - async_completion<CompletionToken, void()> init(token); - - typename associated_allocator<handler>::type alloc( - (get_associated_allocator)(init.completion_handler)); - - ex.defer(detail::work_dispatcher<handler>(init.completion_handler), alloc); - - return init.result.get(); -} - -template <typename ExecutionContext, typename CompletionToken> -inline BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer( - ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(CompletionToken) token, - typename enable_if<is_convertible< - ExecutionContext&, execution_context&>::value>::type*) -{ - return (defer)(ctx.get_executor(), - BOOST_ASIO_MOVE_CAST(CompletionToken)(token)); -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_DEFER_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/dispatch.hpp b/contrib/restricted/boost/boost/asio/impl/dispatch.hpp deleted file mode 100644 index 8bdce85180..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/dispatch.hpp +++ /dev/null @@ -1,80 +0,0 @@ -// -// impl/dispatch.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_DISPATCH_HPP -#define BOOST_ASIO_IMPL_DISPATCH_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/detail/work_dispatcher.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -template <typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch( - BOOST_ASIO_MOVE_ARG(CompletionToken) token) -{ - typedef BOOST_ASIO_HANDLER_TYPE(CompletionToken, void()) handler; - - async_completion<CompletionToken, void()> init(token); - - typename associated_executor<handler>::type ex( - (get_associated_executor)(init.completion_handler)); - - typename associated_allocator<handler>::type alloc( - (get_associated_allocator)(init.completion_handler)); - - ex.dispatch(BOOST_ASIO_MOVE_CAST(handler)(init.completion_handler), alloc); - - return init.result.get(); -} - -template <typename Executor, typename CompletionToken> -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch( - const Executor& ex, BOOST_ASIO_MOVE_ARG(CompletionToken) token, - typename enable_if<is_executor<Executor>::value>::type*) -{ - typedef BOOST_ASIO_HANDLER_TYPE(CompletionToken, void()) handler; - - async_completion<CompletionToken, void()> init(token); - - typename associated_allocator<handler>::type alloc( - (get_associated_allocator)(init.completion_handler)); - - ex.dispatch(detail::work_dispatcher<handler>( - init.completion_handler), alloc); - - return init.result.get(); -} - -template <typename ExecutionContext, typename CompletionToken> -inline BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch( - ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(CompletionToken) token, - typename enable_if<is_convertible< - ExecutionContext&, execution_context&>::value>::type*) -{ - return (dispatch)(ctx.get_executor(), - BOOST_ASIO_MOVE_CAST(CompletionToken)(token)); -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_DISPATCH_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/executor.hpp b/contrib/restricted/boost/boost/asio/impl/executor.hpp deleted file mode 100644 index 106763b042..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/executor.hpp +++ /dev/null @@ -1,388 +0,0 @@ -// -// impl/executor.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_EXECUTOR_HPP -#define BOOST_ASIO_IMPL_EXECUTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/atomic_count.hpp> -#include <boost/asio/detail/executor_op.hpp> -#include <boost/asio/detail/global.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/recycling_allocator.hpp> -#include <boost/asio/executor.hpp> -#include <boost/asio/system_executor.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -#if !defined(GENERATING_DOCUMENTATION) - -#if defined(BOOST_ASIO_HAS_MOVE) - -// Lightweight, move-only function object wrapper. -class executor::function -{ -public: - template <typename F, typename Alloc> - explicit function(F f, const Alloc& a) - { - // Allocate and construct an operation to wrap the function. - typedef detail::executor_op<F, Alloc> op; - typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; - op_ = new (p.v) op(BOOST_ASIO_MOVE_CAST(F)(f), a); - p.v = 0; - } - - function(function&& other) - : op_(other.op_) - { - other.op_ = 0; - } - - ~function() - { - if (op_) - op_->destroy(); - } - - void operator()() - { - if (op_) - { - detail::scheduler_operation* op = op_; - op_ = 0; - op->complete(this, boost::system::error_code(), 0); - } - } - -private: - detail::scheduler_operation* op_; -}; - -#else // defined(BOOST_ASIO_HAS_MOVE) - -// Not so lightweight, copyable function object wrapper. -class executor::function -{ -public: - template <typename F, typename Alloc> - explicit function(const F& f, const Alloc&) - : impl_(new impl<F>(f)) - { - } - - void operator()() - { - impl_->invoke_(impl_.get()); - } - -private: - // Base class for polymorphic function implementations. - struct impl_base - { - void (*invoke_)(impl_base*); - }; - - // Polymorphic function implementation. - template <typename F> - struct impl : impl_base - { - impl(const F& f) - : function_(f) - { - invoke_ = &function::invoke<F>; - } - - F function_; - }; - - // Helper to invoke a function. - template <typename F> - static void invoke(impl_base* i) - { - static_cast<impl<F>*>(i)->function_(); - } - - detail::shared_ptr<impl_base> impl_; -}; - -#endif // defined(BOOST_ASIO_HAS_MOVE) - -// Default polymorphic allocator implementation. -template <typename Executor, typename Allocator> -class executor::impl - : public executor::impl_base -{ -public: - typedef BOOST_ASIO_REBIND_ALLOC(Allocator, impl) allocator_type; - - static impl_base* create(const Executor& e, Allocator a = Allocator()) - { - raw_mem mem(a); - impl* p = new (mem.ptr_) impl(e, a); - mem.ptr_ = 0; - return p; - } - - impl(const Executor& e, const Allocator& a) BOOST_ASIO_NOEXCEPT - : impl_base(false), - ref_count_(1), - executor_(e), - allocator_(a) - { - } - - impl_base* clone() const BOOST_ASIO_NOEXCEPT - { - ++ref_count_; - return const_cast<impl_base*>(static_cast<const impl_base*>(this)); - } - - void destroy() BOOST_ASIO_NOEXCEPT - { - if (--ref_count_ == 0) - { - allocator_type alloc(allocator_); - impl* p = this; - p->~impl(); - alloc.deallocate(p, 1); - } - } - - void on_work_started() BOOST_ASIO_NOEXCEPT - { - executor_.on_work_started(); - } - - void on_work_finished() BOOST_ASIO_NOEXCEPT - { - executor_.on_work_finished(); - } - - execution_context& context() BOOST_ASIO_NOEXCEPT - { - return executor_.context(); - } - - void dispatch(BOOST_ASIO_MOVE_ARG(function) f) - { - executor_.dispatch(BOOST_ASIO_MOVE_CAST(function)(f), allocator_); - } - - void post(BOOST_ASIO_MOVE_ARG(function) f) - { - executor_.post(BOOST_ASIO_MOVE_CAST(function)(f), allocator_); - } - - void defer(BOOST_ASIO_MOVE_ARG(function) f) - { - executor_.defer(BOOST_ASIO_MOVE_CAST(function)(f), allocator_); - } - - type_id_result_type target_type() const BOOST_ASIO_NOEXCEPT - { - return type_id<Executor>(); - } - - void* target() BOOST_ASIO_NOEXCEPT - { - return &executor_; - } - - const void* target() const BOOST_ASIO_NOEXCEPT - { - return &executor_; - } - - bool equals(const impl_base* e) const BOOST_ASIO_NOEXCEPT - { - if (this == e) - return true; - if (target_type() != e->target_type()) - return false; - return executor_ == *static_cast<const Executor*>(e->target()); - } - -private: - mutable detail::atomic_count ref_count_; - Executor executor_; - Allocator allocator_; - - struct raw_mem - { - allocator_type allocator_; - impl* ptr_; - - explicit raw_mem(const Allocator& a) - : allocator_(a), - ptr_(allocator_.allocate(1)) - { - } - - ~raw_mem() - { - if (ptr_) - allocator_.deallocate(ptr_, 1); - } - - private: - // Disallow copying and assignment. - raw_mem(const raw_mem&); - raw_mem operator=(const raw_mem&); - }; -}; - -// Polymorphic allocator specialisation for system_executor. -template <typename Allocator> -class executor::impl<system_executor, Allocator> - : public executor::impl_base -{ -public: - static impl_base* create(const system_executor&, - const Allocator& = Allocator()) - { - return &detail::global<impl<system_executor, std::allocator<void> > >(); - } - - impl() - : impl_base(true) - { - } - - impl_base* clone() const BOOST_ASIO_NOEXCEPT - { - return const_cast<impl_base*>(static_cast<const impl_base*>(this)); - } - - void destroy() BOOST_ASIO_NOEXCEPT - { - } - - void on_work_started() BOOST_ASIO_NOEXCEPT - { - executor_.on_work_started(); - } - - void on_work_finished() BOOST_ASIO_NOEXCEPT - { - executor_.on_work_finished(); - } - - execution_context& context() BOOST_ASIO_NOEXCEPT - { - return executor_.context(); - } - - void dispatch(BOOST_ASIO_MOVE_ARG(function) f) - { - executor_.dispatch(BOOST_ASIO_MOVE_CAST(function)(f), allocator_); - } - - void post(BOOST_ASIO_MOVE_ARG(function) f) - { - executor_.post(BOOST_ASIO_MOVE_CAST(function)(f), allocator_); - } - - void defer(BOOST_ASIO_MOVE_ARG(function) f) - { - executor_.defer(BOOST_ASIO_MOVE_CAST(function)(f), allocator_); - } - - type_id_result_type target_type() const BOOST_ASIO_NOEXCEPT - { - return type_id<system_executor>(); - } - - void* target() BOOST_ASIO_NOEXCEPT - { - return &executor_; - } - - const void* target() const BOOST_ASIO_NOEXCEPT - { - return &executor_; - } - - bool equals(const impl_base* e) const BOOST_ASIO_NOEXCEPT - { - return this == e; - } - -private: - system_executor executor_; - Allocator allocator_; -}; - -template <typename Executor> -executor::executor(Executor e) - : impl_(impl<Executor, std::allocator<void> >::create(e)) -{ -} - -template <typename Executor, typename Allocator> -executor::executor(allocator_arg_t, const Allocator& a, Executor e) - : impl_(impl<Executor, Allocator>::create(e, a)) -{ -} - -template <typename Function, typename Allocator> -void executor::dispatch(BOOST_ASIO_MOVE_ARG(Function) f, - const Allocator& a) const -{ - impl_base* i = get_impl(); - if (i->fast_dispatch_) - system_executor().dispatch(BOOST_ASIO_MOVE_CAST(Function)(f), a); - else - i->dispatch(function(BOOST_ASIO_MOVE_CAST(Function)(f), a)); -} - -template <typename Function, typename Allocator> -void executor::post(BOOST_ASIO_MOVE_ARG(Function) f, - const Allocator& a) const -{ - get_impl()->post(function(BOOST_ASIO_MOVE_CAST(Function)(f), a)); -} - -template <typename Function, typename Allocator> -void executor::defer(BOOST_ASIO_MOVE_ARG(Function) f, - const Allocator& a) const -{ - get_impl()->defer(function(BOOST_ASIO_MOVE_CAST(Function)(f), a)); -} - -template <typename Executor> -Executor* executor::target() BOOST_ASIO_NOEXCEPT -{ - return impl_ && impl_->target_type() == type_id<Executor>() - ? static_cast<Executor*>(impl_->target()) : 0; -} - -template <typename Executor> -const Executor* executor::target() const BOOST_ASIO_NOEXCEPT -{ - return impl_ && impl_->target_type() == type_id<Executor>() - ? static_cast<Executor*>(impl_->target()) : 0; -} - -#endif // !defined(GENERATING_DOCUMENTATION) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_EXECUTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/executor.ipp b/contrib/restricted/boost/boost/asio/impl/executor.ipp deleted file mode 100644 index 86114d93f1..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/executor.ipp +++ /dev/null @@ -1,40 +0,0 @@ -// -// impl/executor.ipp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_EXECUTOR_IPP -#define BOOST_ASIO_IMPL_EXECUTOR_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/executor.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -bad_executor::bad_executor() BOOST_ASIO_NOEXCEPT -{ -} - -const char* bad_executor::what() const BOOST_ASIO_NOEXCEPT_OR_NOTHROW -{ - return "bad executor"; -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_EXECUTOR_IPP diff --git a/contrib/restricted/boost/boost/asio/impl/read.hpp b/contrib/restricted/boost/boost/asio/impl/read.hpp deleted file mode 100644 index 9fbddc964e..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/read.hpp +++ /dev/null @@ -1,717 +0,0 @@ -// -// impl/read.hpp -// ~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_READ_HPP -#define BOOST_ASIO_IMPL_READ_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <algorithm> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/completion_condition.hpp> -#include <boost/asio/detail/array_fwd.hpp> -#include <boost/asio/detail/base_from_completion_cond.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/consuming_buffers.hpp> -#include <boost/asio/detail/dependent_type.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail -{ - template <typename SyncReadStream, typename MutableBufferSequence, - typename MutableBufferIterator, typename CompletionCondition> - std::size_t read_buffer_sequence(SyncReadStream& s, - const MutableBufferSequence& buffers, const MutableBufferIterator&, - CompletionCondition completion_condition, boost::system::error_code& ec) - { - ec = boost::system::error_code(); - boost::asio::detail::consuming_buffers<mutable_buffer, - MutableBufferSequence, MutableBufferIterator> tmp(buffers); - while (!tmp.empty()) - { - if (std::size_t max_size = detail::adapt_completion_condition_result( - completion_condition(ec, tmp.total_consumed()))) - tmp.consume(s.read_some(tmp.prepare(max_size), ec)); - else - break; - } - return tmp.total_consumed();; - } -} // namespace detail - -template <typename SyncReadStream, typename MutableBufferSequence, - typename CompletionCondition> -std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, boost::system::error_code& ec, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type*) -{ - return detail::read_buffer_sequence(s, buffers, - boost::asio::buffer_sequence_begin(buffers), completion_condition, ec); -} - -template <typename SyncReadStream, typename MutableBufferSequence> -inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type*) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read(s, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec, "read"); - return bytes_transferred; -} - -template <typename SyncReadStream, typename MutableBufferSequence> -inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, - boost::system::error_code& ec, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type*) -{ - return read(s, buffers, transfer_all(), ec); -} - -template <typename SyncReadStream, typename MutableBufferSequence, - typename CompletionCondition> -inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type*) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read(s, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec, "read"); - return bytes_transferred; -} - -template <typename SyncReadStream, typename DynamicBuffer, - typename CompletionCondition> -std::size_t read(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, boost::system::error_code& ec, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - typename decay<DynamicBuffer>::type b( - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers)); - - ec = boost::system::error_code(); - std::size_t total_transferred = 0; - std::size_t max_size = detail::adapt_completion_condition_result( - completion_condition(ec, total_transferred)); - std::size_t bytes_available = std::min<std::size_t>( - std::max<std::size_t>(512, b.capacity() - b.size()), - std::min<std::size_t>(max_size, b.max_size() - b.size())); - while (bytes_available > 0) - { - std::size_t bytes_transferred = s.read_some(b.prepare(bytes_available), ec); - b.commit(bytes_transferred); - total_transferred += bytes_transferred; - max_size = detail::adapt_completion_condition_result( - completion_condition(ec, total_transferred)); - bytes_available = std::min<std::size_t>( - std::max<std::size_t>(512, b.capacity() - b.size()), - std::min<std::size_t>(max_size, b.max_size() - b.size())); - } - return total_transferred; -} - -template <typename SyncReadStream, typename DynamicBuffer> -inline std::size_t read(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), transfer_all(), ec); - boost::asio::detail::throw_error(ec, "read"); - return bytes_transferred; -} - -template <typename SyncReadStream, typename DynamicBuffer> -inline std::size_t read(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - boost::system::error_code& ec, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - return read(s, BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - transfer_all(), ec); -} - -template <typename SyncReadStream, typename DynamicBuffer, - typename CompletionCondition> -inline std::size_t read(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - completion_condition, ec); - boost::asio::detail::throw_error(ec, "read"); - return bytes_transferred; -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -template <typename SyncReadStream, typename Allocator, - typename CompletionCondition> -inline std::size_t read(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, boost::system::error_code& ec) -{ - return read(s, basic_streambuf_ref<Allocator>(b), completion_condition, ec); -} - -template <typename SyncReadStream, typename Allocator> -inline std::size_t read(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b) -{ - return read(s, basic_streambuf_ref<Allocator>(b)); -} - -template <typename SyncReadStream, typename Allocator> -inline std::size_t read(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - boost::system::error_code& ec) -{ - return read(s, basic_streambuf_ref<Allocator>(b), ec); -} - -template <typename SyncReadStream, typename Allocator, - typename CompletionCondition> -inline std::size_t read(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition) -{ - return read(s, basic_streambuf_ref<Allocator>(b), completion_condition); -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -namespace detail -{ - template <typename AsyncReadStream, typename MutableBufferSequence, - typename MutableBufferIterator, typename CompletionCondition, - typename ReadHandler> - class read_op - : detail::base_from_completion_cond<CompletionCondition> - { - public: - read_op(AsyncReadStream& stream, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler& handler) - : detail::base_from_completion_cond< - CompletionCondition>(completion_condition), - stream_(stream), - buffers_(buffers), - start_(0), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - read_op(const read_op& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - stream_(other.stream_), - buffers_(other.buffers_), - start_(other.start_), - handler_(other.handler_) - { - } - - read_op(read_op&& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - stream_(other.stream_), - buffers_(other.buffers_), - start_(other.start_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - std::size_t max_size; - switch (start_ = start) - { - case 1: - max_size = this->check_for_completion(ec, buffers_.total_consumed()); - do - { - stream_.async_read_some(buffers_.prepare(max_size), - BOOST_ASIO_MOVE_CAST(read_op)(*this)); - return; default: - buffers_.consume(bytes_transferred); - if ((!ec && bytes_transferred == 0) || buffers_.empty()) - break; - max_size = this->check_for_completion(ec, buffers_.total_consumed()); - } while (max_size > 0); - - handler_(ec, buffers_.total_consumed()); - } - } - - //private: - AsyncReadStream& stream_; - boost::asio::detail::consuming_buffers<mutable_buffer, - MutableBufferSequence, MutableBufferIterator> buffers_; - int start_; - ReadHandler handler_; - }; - - template <typename AsyncReadStream, typename MutableBufferSequence, - typename MutableBufferIterator, typename CompletionCondition, - typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - read_op<AsyncReadStream, MutableBufferSequence, MutableBufferIterator, - CompletionCondition, ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncReadStream, typename MutableBufferSequence, - typename MutableBufferIterator, typename CompletionCondition, - typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - read_op<AsyncReadStream, MutableBufferSequence, MutableBufferIterator, - CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncReadStream, typename MutableBufferSequence, - typename MutableBufferIterator, typename CompletionCondition, - typename ReadHandler> - inline bool asio_handler_is_continuation( - read_op<AsyncReadStream, MutableBufferSequence, MutableBufferIterator, - CompletionCondition, ReadHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler> - inline void asio_handler_invoke(Function& function, - read_op<AsyncReadStream, MutableBufferSequence, MutableBufferIterator, - CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - read_op<AsyncReadStream, MutableBufferSequence, MutableBufferIterator, - CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename AsyncReadStream, typename MutableBufferSequence, - typename MutableBufferIterator, typename CompletionCondition, - typename ReadHandler> - inline void start_read_buffer_sequence_op(AsyncReadStream& stream, - const MutableBufferSequence& buffers, const MutableBufferIterator&, - CompletionCondition completion_condition, ReadHandler& handler) - { - detail::read_op<AsyncReadStream, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>( - stream, buffers, completion_condition, handler)( - boost::system::error_code(), 0, 1); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, typename MutableBufferSequence, - typename MutableBufferIterator, typename CompletionCondition, - typename ReadHandler, typename Allocator> -struct associated_allocator< - detail::read_op<AsyncReadStream, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>, - Allocator> -{ - typedef typename associated_allocator<ReadHandler, Allocator>::type type; - - static type get( - const detail::read_op<AsyncReadStream, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncReadStream, typename MutableBufferSequence, - typename MutableBufferIterator, typename CompletionCondition, - typename ReadHandler, typename Executor> -struct associated_executor< - detail::read_op<AsyncReadStream, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>, - Executor> -{ - typedef typename associated_executor<ReadHandler, Executor>::type type; - - static type get( - const detail::read_op<AsyncReadStream, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, typename MutableBufferSequence, - typename CompletionCondition, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::start_read_buffer_sequence_op(s, buffers, - boost::asio::buffer_sequence_begin(buffers), completion_condition, - init.completion_handler); - - return init.result.get(); -} - -template <typename AsyncReadStream, typename MutableBufferSequence, - typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::start_read_buffer_sequence_op(s, buffers, - boost::asio::buffer_sequence_begin(buffers), transfer_all(), - init.completion_handler); - - return init.result.get(); -} - -namespace detail -{ - template <typename AsyncReadStream, typename DynamicBuffer, - typename CompletionCondition, typename ReadHandler> - class read_dynbuf_op - : detail::base_from_completion_cond<CompletionCondition> - { - public: - template <typename BufferSequence> - read_dynbuf_op(AsyncReadStream& stream, - BOOST_ASIO_MOVE_ARG(BufferSequence) buffers, - CompletionCondition completion_condition, ReadHandler& handler) - : detail::base_from_completion_cond< - CompletionCondition>(completion_condition), - stream_(stream), - buffers_(BOOST_ASIO_MOVE_CAST(BufferSequence)(buffers)), - start_(0), - total_transferred_(0), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - read_dynbuf_op(const read_dynbuf_op& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - stream_(other.stream_), - buffers_(other.buffers_), - start_(other.start_), - total_transferred_(other.total_transferred_), - handler_(other.handler_) - { - } - - read_dynbuf_op(read_dynbuf_op&& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - stream_(other.stream_), - buffers_(BOOST_ASIO_MOVE_CAST(DynamicBuffer)(other.buffers_)), - start_(other.start_), - total_transferred_(other.total_transferred_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - std::size_t max_size, bytes_available; - switch (start_ = start) - { - case 1: - max_size = this->check_for_completion(ec, total_transferred_); - bytes_available = std::min<std::size_t>( - std::max<std::size_t>(512, - buffers_.capacity() - buffers_.size()), - std::min<std::size_t>(max_size, - buffers_.max_size() - buffers_.size())); - for (;;) - { - stream_.async_read_some(buffers_.prepare(bytes_available), - BOOST_ASIO_MOVE_CAST(read_dynbuf_op)(*this)); - return; default: - total_transferred_ += bytes_transferred; - buffers_.commit(bytes_transferred); - max_size = this->check_for_completion(ec, total_transferred_); - bytes_available = std::min<std::size_t>( - std::max<std::size_t>(512, - buffers_.capacity() - buffers_.size()), - std::min<std::size_t>(max_size, - buffers_.max_size() - buffers_.size())); - if ((!ec && bytes_transferred == 0) || bytes_available == 0) - break; - } - - handler_(ec, static_cast<const std::size_t&>(total_transferred_)); - } - } - - //private: - AsyncReadStream& stream_; - DynamicBuffer buffers_; - int start_; - std::size_t total_transferred_; - ReadHandler handler_; - }; - - template <typename AsyncReadStream, typename DynamicBuffer, - typename CompletionCondition, typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - read_dynbuf_op<AsyncReadStream, DynamicBuffer, - CompletionCondition, ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncReadStream, typename DynamicBuffer, - typename CompletionCondition, typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - read_dynbuf_op<AsyncReadStream, DynamicBuffer, - CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncReadStream, typename DynamicBuffer, - typename CompletionCondition, typename ReadHandler> - inline bool asio_handler_is_continuation( - read_dynbuf_op<AsyncReadStream, DynamicBuffer, - CompletionCondition, ReadHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename CompletionCondition, - typename ReadHandler> - inline void asio_handler_invoke(Function& function, - read_dynbuf_op<AsyncReadStream, DynamicBuffer, - CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename CompletionCondition, - typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - read_dynbuf_op<AsyncReadStream, DynamicBuffer, - CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, typename DynamicBuffer, - typename CompletionCondition, typename ReadHandler, typename Allocator> -struct associated_allocator< - detail::read_dynbuf_op<AsyncReadStream, - DynamicBuffer, CompletionCondition, ReadHandler>, - Allocator> -{ - typedef typename associated_allocator<ReadHandler, Allocator>::type type; - - static type get( - const detail::read_dynbuf_op<AsyncReadStream, - DynamicBuffer, CompletionCondition, ReadHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncReadStream, typename DynamicBuffer, - typename CompletionCondition, typename ReadHandler, typename Executor> -struct associated_executor< - detail::read_dynbuf_op<AsyncReadStream, - DynamicBuffer, CompletionCondition, ReadHandler>, - Executor> -{ - typedef typename associated_executor<ReadHandler, Executor>::type type; - - static type get( - const detail::read_dynbuf_op<AsyncReadStream, - DynamicBuffer, CompletionCondition, ReadHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - return async_read(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -} - -template <typename AsyncReadStream, typename DynamicBuffer, - typename CompletionCondition, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::read_dynbuf_op<AsyncReadStream, - typename decay<DynamicBuffer>::type, - CompletionCondition, BOOST_ASIO_HANDLER_TYPE( - ReadHandler, void (boost::system::error_code, std::size_t))>( - s, BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - completion_condition, init.completion_handler)( - boost::system::error_code(), 0, 1); - - return init.result.get(); -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -template <typename AsyncReadStream, typename Allocator, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - return async_read(s, basic_streambuf_ref<Allocator>(b), - BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -} - -template <typename AsyncReadStream, typename Allocator, - typename CompletionCondition, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - return async_read(s, basic_streambuf_ref<Allocator>(b), - completion_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_READ_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/read_at.hpp b/contrib/restricted/boost/boost/asio/impl/read_at.hpp deleted file mode 100644 index e3c31c543e..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/read_at.hpp +++ /dev/null @@ -1,642 +0,0 @@ -// -// impl/read_at.hpp -// ~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_READ_AT_HPP -#define BOOST_ASIO_IMPL_READ_AT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <algorithm> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/completion_condition.hpp> -#include <boost/asio/detail/array_fwd.hpp> -#include <boost/asio/detail/base_from_completion_cond.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/consuming_buffers.hpp> -#include <boost/asio/detail/dependent_type.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail -{ - template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, - typename MutableBufferIterator, typename CompletionCondition> - std::size_t read_at_buffer_sequence(SyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - const MutableBufferIterator&, CompletionCondition completion_condition, - boost::system::error_code& ec) - { - ec = boost::system::error_code(); - boost::asio::detail::consuming_buffers<mutable_buffer, - MutableBufferSequence, MutableBufferIterator> tmp(buffers); - while (!tmp.empty()) - { - if (std::size_t max_size = detail::adapt_completion_condition_result( - completion_condition(ec, tmp.total_consumed()))) - { - tmp.consume(d.read_some_at(offset + tmp.total_consumed(), - tmp.prepare(max_size), ec)); - } - else - break; - } - return tmp.total_consumed();; - } -} // namespace detail - -template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, - typename CompletionCondition> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, boost::system::error_code& ec) -{ - return detail::read_at_buffer_sequence(d, offset, buffers, - boost::asio::buffer_sequence_begin(buffers), completion_condition, ec); -} - -template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> -inline std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read_at( - d, offset, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec, "read_at"); - return bytes_transferred; -} - -template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> -inline std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - boost::system::error_code& ec) -{ - return read_at(d, offset, buffers, transfer_all(), ec); -} - -template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, - typename CompletionCondition> -inline std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read_at( - d, offset, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec, "read_at"); - return bytes_transferred; -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -template <typename SyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, boost::system::error_code& ec) -{ - ec = boost::system::error_code(); - std::size_t total_transferred = 0; - std::size_t max_size = detail::adapt_completion_condition_result( - completion_condition(ec, total_transferred)); - std::size_t bytes_available = read_size_helper(b, max_size); - while (bytes_available > 0) - { - std::size_t bytes_transferred = d.read_some_at( - offset + total_transferred, b.prepare(bytes_available), ec); - b.commit(bytes_transferred); - total_transferred += bytes_transferred; - max_size = detail::adapt_completion_condition_result( - completion_condition(ec, total_transferred)); - bytes_available = read_size_helper(b, max_size); - } - return total_transferred; -} - -template <typename SyncRandomAccessReadDevice, typename Allocator> -inline std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read_at( - d, offset, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec, "read_at"); - return bytes_transferred; -} - -template <typename SyncRandomAccessReadDevice, typename Allocator> -inline std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - boost::system::error_code& ec) -{ - return read_at(d, offset, b, transfer_all(), ec); -} - -template <typename SyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition> -inline std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read_at( - d, offset, b, completion_condition, ec); - boost::asio::detail::throw_error(ec, "read_at"); - return bytes_transferred; -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -namespace detail -{ - template <typename AsyncRandomAccessReadDevice, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler> - class read_at_op - : detail::base_from_completion_cond<CompletionCondition> - { - public: - read_at_op(AsyncRandomAccessReadDevice& device, - uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler& handler) - : detail::base_from_completion_cond< - CompletionCondition>(completion_condition), - device_(device), - offset_(offset), - buffers_(buffers), - start_(0), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - read_at_op(const read_at_op& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - device_(other.device_), - offset_(other.offset_), - buffers_(other.buffers_), - start_(other.start_), - handler_(other.handler_) - { - } - - read_at_op(read_at_op&& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - device_(other.device_), - offset_(other.offset_), - buffers_(other.buffers_), - start_(other.start_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - std::size_t max_size; - switch (start_ = start) - { - case 1: - max_size = this->check_for_completion(ec, buffers_.total_consumed()); - do - { - device_.async_read_some_at( - offset_ + buffers_.total_consumed(), buffers_.prepare(max_size), - BOOST_ASIO_MOVE_CAST(read_at_op)(*this)); - return; default: - buffers_.consume(bytes_transferred); - if ((!ec && bytes_transferred == 0) || buffers_.empty()) - break; - max_size = this->check_for_completion(ec, buffers_.total_consumed()); - } while (max_size > 0); - - handler_(ec, buffers_.total_consumed()); - } - } - - //private: - AsyncRandomAccessReadDevice& device_; - uint64_t offset_; - boost::asio::detail::consuming_buffers<mutable_buffer, - MutableBufferSequence, MutableBufferIterator> buffers_; - int start_; - ReadHandler handler_; - }; - - template <typename AsyncRandomAccessReadDevice, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncRandomAccessReadDevice, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncRandomAccessReadDevice, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler> - inline bool asio_handler_is_continuation( - read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncRandomAccessReadDevice, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler> - inline void asio_handler_invoke(Function& function, - read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncRandomAccessReadDevice, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename AsyncRandomAccessReadDevice, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler> - inline void start_read_at_buffer_sequence_op(AsyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - const MutableBufferIterator&, CompletionCondition completion_condition, - ReadHandler& handler) - { - detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>( - d, offset, buffers, completion_condition, handler)( - boost::system::error_code(), 0, 1); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncRandomAccessReadDevice, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler, typename Allocator> -struct associated_allocator< - detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>, - Allocator> -{ - typedef typename associated_allocator<ReadHandler, Allocator>::type type; - - static type get( - const detail::read_at_op<AsyncRandomAccessReadDevice, - MutableBufferSequence, MutableBufferIterator, - CompletionCondition, ReadHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncRandomAccessReadDevice, - typename MutableBufferSequence, typename MutableBufferIterator, - typename CompletionCondition, typename ReadHandler, typename Executor> -struct associated_executor< - detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, - MutableBufferIterator, CompletionCondition, ReadHandler>, - Executor> -{ - typedef typename associated_executor<ReadHandler, Executor>::type type; - - static type get( - const detail::read_at_op<AsyncRandomAccessReadDevice, - MutableBufferSequence, MutableBufferIterator, - CompletionCondition, ReadHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, - typename CompletionCondition, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_at(AsyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::start_read_at_buffer_sequence_op(d, offset, buffers, - boost::asio::buffer_sequence_begin(buffers), completion_condition, - init.completion_handler); - - return init.result.get(); -} - -template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, - typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_at(AsyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::start_read_at_buffer_sequence_op(d, offset, buffers, - boost::asio::buffer_sequence_begin(buffers), transfer_all(), - init.completion_handler); - - return init.result.get(); -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -namespace detail -{ - template <typename AsyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition, typename ReadHandler> - class read_at_streambuf_op - : detail::base_from_completion_cond<CompletionCondition> - { - public: - read_at_streambuf_op(AsyncRandomAccessReadDevice& device, - uint64_t offset, basic_streambuf<Allocator>& streambuf, - CompletionCondition completion_condition, ReadHandler& handler) - : detail::base_from_completion_cond< - CompletionCondition>(completion_condition), - device_(device), - offset_(offset), - streambuf_(streambuf), - start_(0), - total_transferred_(0), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - read_at_streambuf_op(const read_at_streambuf_op& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - device_(other.device_), - offset_(other.offset_), - streambuf_(other.streambuf_), - start_(other.start_), - total_transferred_(other.total_transferred_), - handler_(other.handler_) - { - } - - read_at_streambuf_op(read_at_streambuf_op&& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - device_(other.device_), - offset_(other.offset_), - streambuf_(other.streambuf_), - start_(other.start_), - total_transferred_(other.total_transferred_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - std::size_t max_size, bytes_available; - switch (start_ = start) - { - case 1: - max_size = this->check_for_completion(ec, total_transferred_); - bytes_available = read_size_helper(streambuf_, max_size); - for (;;) - { - device_.async_read_some_at(offset_ + total_transferred_, - streambuf_.prepare(bytes_available), - BOOST_ASIO_MOVE_CAST(read_at_streambuf_op)(*this)); - return; default: - total_transferred_ += bytes_transferred; - streambuf_.commit(bytes_transferred); - max_size = this->check_for_completion(ec, total_transferred_); - bytes_available = read_size_helper(streambuf_, max_size); - if ((!ec && bytes_transferred == 0) || bytes_available == 0) - break; - } - - handler_(ec, static_cast<const std::size_t&>(total_transferred_)); - } - } - - //private: - AsyncRandomAccessReadDevice& device_; - uint64_t offset_; - boost::asio::basic_streambuf<Allocator>& streambuf_; - int start_; - std::size_t total_transferred_; - ReadHandler handler_; - }; - - template <typename AsyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition, typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, - CompletionCondition, ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition, typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, - CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition, typename ReadHandler> - inline bool asio_handler_is_continuation( - read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, - CompletionCondition, ReadHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncRandomAccessReadDevice, - typename Allocator, typename CompletionCondition, typename ReadHandler> - inline void asio_handler_invoke(Function& function, - read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, - CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncRandomAccessReadDevice, - typename Allocator, typename CompletionCondition, typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, - CompletionCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition, typename ReadHandler, typename Allocator1> -struct associated_allocator< - detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, - Allocator, CompletionCondition, ReadHandler>, - Allocator1> -{ - typedef typename associated_allocator<ReadHandler, Allocator1>::type type; - - static type get( - const detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, - Allocator, CompletionCondition, ReadHandler>& h, - const Allocator1& a = Allocator1()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator1>::get(h.handler_, a); - } -}; - -template <typename AsyncRandomAccessReadDevice, typename Executor, - typename CompletionCondition, typename ReadHandler, typename Executor1> -struct associated_executor< - detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, - Executor, CompletionCondition, ReadHandler>, - Executor1> -{ - typedef typename associated_executor<ReadHandler, Executor1>::type type; - - static type get( - const detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, - Executor, CompletionCondition, ReadHandler>& h, - const Executor1& ex = Executor1()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor1>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_at(AsyncRandomAccessReadDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, - CompletionCondition, BOOST_ASIO_HANDLER_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t))>( - d, offset, b, completion_condition, init.completion_handler)( - boost::system::error_code(), 0, 1); - - return init.result.get(); -} - -template <typename AsyncRandomAccessReadDevice, typename Allocator, - typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_at(AsyncRandomAccessReadDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, - detail::transfer_all_t, BOOST_ASIO_HANDLER_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t))>( - d, offset, b, transfer_all(), init.completion_handler)( - boost::system::error_code(), 0, 1); - - return init.result.get(); -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_READ_AT_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/read_until.hpp b/contrib/restricted/boost/boost/asio/impl/read_until.hpp deleted file mode 100644 index 704a97946b..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/read_until.hpp +++ /dev/null @@ -1,1502 +0,0 @@ -// -// impl/read_until.hpp -// ~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_READ_UNTIL_HPP -#define BOOST_ASIO_IMPL_READ_UNTIL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <algorithm> -#include <string> -#include <vector> -#include <utility> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/buffers_iterator.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/limits.hpp> -#include <boost/asio/detail/throw_error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -template <typename SyncReadStream, typename DynamicBuffer> -inline std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, char delim) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read_until(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), delim, ec); - boost::asio::detail::throw_error(ec, "read_until"); - return bytes_transferred; -} - -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - char delim, boost::system::error_code& ec) -{ - typename decay<DynamicBuffer>::type b( - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers)); - - std::size_t search_position = 0; - for (;;) - { - // Determine the range of the data to be searched. - typedef typename DynamicBuffer::const_buffers_type buffers_type; - typedef buffers_iterator<buffers_type> iterator; - buffers_type data_buffers = b.data(); - iterator begin = iterator::begin(data_buffers); - iterator start_pos = begin + search_position; - iterator end = iterator::end(data_buffers); - - // Look for a match. - iterator iter = std::find(start_pos, end, delim); - if (iter != end) - { - // Found a match. We're done. - ec = boost::system::error_code(); - return iter - begin + 1; - } - else - { - // No match. Next search can start with the new data. - search_position = end - begin; - } - - // Check if buffer is full. - if (b.size() == b.max_size()) - { - ec = error::not_found; - return 0; - } - - // Need more data. - std::size_t bytes_to_read = std::min<std::size_t>( - std::max<std::size_t>(512, b.capacity() - b.size()), - std::min<std::size_t>(65536, b.max_size() - b.size())); - b.commit(s.read_some(b.prepare(bytes_to_read), ec)); - if (ec) - return 0; - } -} - -template <typename SyncReadStream, typename DynamicBuffer> -inline std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_STRING_VIEW_PARAM delim) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read_until(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), delim, ec); - boost::asio::detail::throw_error(ec, "read_until"); - return bytes_transferred; -} - -namespace detail -{ - // Algorithm that finds a subsequence of equal values in a sequence. Returns - // (iterator,true) if a full match was found, in which case the iterator - // points to the beginning of the match. Returns (iterator,false) if a - // partial match was found at the end of the first sequence, in which case - // the iterator points to the beginning of the partial match. Returns - // (last1,false) if no full or partial match was found. - template <typename Iterator1, typename Iterator2> - std::pair<Iterator1, bool> partial_search( - Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) - { - for (Iterator1 iter1 = first1; iter1 != last1; ++iter1) - { - Iterator1 test_iter1 = iter1; - Iterator2 test_iter2 = first2; - for (;; ++test_iter1, ++test_iter2) - { - if (test_iter2 == last2) - return std::make_pair(iter1, true); - if (test_iter1 == last1) - { - if (test_iter2 != first2) - return std::make_pair(iter1, false); - else - break; - } - if (*test_iter1 != *test_iter2) - break; - } - } - return std::make_pair(last1, false); - } -} // namespace detail - -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_STRING_VIEW_PARAM delim, boost::system::error_code& ec) -{ - typename decay<DynamicBuffer>::type b( - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers)); - - std::size_t search_position = 0; - for (;;) - { - // Determine the range of the data to be searched. - typedef typename DynamicBuffer::const_buffers_type buffers_type; - typedef buffers_iterator<buffers_type> iterator; - buffers_type data_buffers = b.data(); - iterator begin = iterator::begin(data_buffers); - iterator start_pos = begin + search_position; - iterator end = iterator::end(data_buffers); - - // Look for a match. - std::pair<iterator, bool> result = detail::partial_search( - start_pos, end, delim.begin(), delim.end()); - if (result.first != end) - { - if (result.second) - { - // Full match. We're done. - ec = boost::system::error_code(); - return result.first - begin + delim.length(); - } - else - { - // Partial match. Next search needs to start from beginning of match. - search_position = result.first - begin; - } - } - else - { - // No match. Next search can start with the new data. - search_position = end - begin; - } - - // Check if buffer is full. - if (b.size() == b.max_size()) - { - ec = error::not_found; - return 0; - } - - // Need more data. - std::size_t bytes_to_read = std::min<std::size_t>( - std::max<std::size_t>(512, b.capacity() - b.size()), - std::min<std::size_t>(65536, b.max_size() - b.size())); - b.commit(s.read_some(b.prepare(bytes_to_read), ec)); - if (ec) - return 0; - } -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if defined(BOOST_ASIO_HAS_BOOST_REGEX) - -template <typename SyncReadStream, typename DynamicBuffer> -inline std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - const boost::regex& expr) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read_until(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), expr, ec); - boost::asio::detail::throw_error(ec, "read_until"); - return bytes_transferred; -} - -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - const boost::regex& expr, boost::system::error_code& ec) -{ - typename decay<DynamicBuffer>::type b( - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers)); - - std::size_t search_position = 0; - for (;;) - { - // Determine the range of the data to be searched. - typedef typename DynamicBuffer::const_buffers_type buffers_type; - typedef buffers_iterator<buffers_type> iterator; - buffers_type data_buffers = b.data(); - iterator begin = iterator::begin(data_buffers); - iterator start_pos = begin + search_position; - iterator end = iterator::end(data_buffers); - - // Look for a match. - boost::match_results<iterator, - typename std::vector<boost::sub_match<iterator> >::allocator_type> - match_results; - if (regex_search(start_pos, end, match_results, expr, - boost::match_default | boost::match_partial)) - { - if (match_results[0].matched) - { - // Full match. We're done. - ec = boost::system::error_code(); - return match_results[0].second - begin; - } - else - { - // Partial match. Next search needs to start from beginning of match. - search_position = match_results[0].first - begin; - } - } - else - { - // No match. Next search can start with the new data. - search_position = end - begin; - } - - // Check if buffer is full. - if (b.size() == b.max_size()) - { - ec = error::not_found; - return 0; - } - - // Need more data. - std::size_t bytes_to_read = read_size_helper(b, 65536); - b.commit(s.read_some(b.prepare(bytes_to_read), ec)); - if (ec) - return 0; - } -} - -#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX) - -template <typename SyncReadStream, - typename DynamicBuffer, typename MatchCondition> -inline std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - MatchCondition match_condition, - typename enable_if<is_match_condition<MatchCondition>::value>::type*) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = read_until(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - match_condition, ec); - boost::asio::detail::throw_error(ec, "read_until"); - return bytes_transferred; -} - -template <typename SyncReadStream, - typename DynamicBuffer, typename MatchCondition> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - MatchCondition match_condition, boost::system::error_code& ec, - typename enable_if<is_match_condition<MatchCondition>::value>::type*) -{ - typename decay<DynamicBuffer>::type b( - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers)); - - std::size_t search_position = 0; - for (;;) - { - // Determine the range of the data to be searched. - typedef typename DynamicBuffer::const_buffers_type buffers_type; - typedef buffers_iterator<buffers_type> iterator; - buffers_type data_buffers = b.data(); - iterator begin = iterator::begin(data_buffers); - iterator start_pos = begin + search_position; - iterator end = iterator::end(data_buffers); - - // Look for a match. - std::pair<iterator, bool> result = match_condition(start_pos, end); - if (result.second) - { - // Full match. We're done. - ec = boost::system::error_code(); - return result.first - begin; - } - else if (result.first != end) - { - // Partial match. Next search needs to start from beginning of match. - search_position = result.first - begin; - } - else - { - // No match. Next search can start with the new data. - search_position = end - begin; - } - - // Check if buffer is full. - if (b.size() == b.max_size()) - { - ec = error::not_found; - return 0; - } - - // Need more data. - std::size_t bytes_to_read = std::min<std::size_t>( - std::max<std::size_t>(512, b.capacity() - b.size()), - std::min<std::size_t>(65536, b.max_size() - b.size())); - b.commit(s.read_some(b.prepare(bytes_to_read), ec)); - if (ec) - return 0; - } -} - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -template <typename SyncReadStream, typename Allocator> -inline std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, char delim) -{ - return read_until(s, basic_streambuf_ref<Allocator>(b), delim); -} - -template <typename SyncReadStream, typename Allocator> -inline std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, char delim, - boost::system::error_code& ec) -{ - return read_until(s, basic_streambuf_ref<Allocator>(b), delim, ec); -} - -template <typename SyncReadStream, typename Allocator> -inline std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - BOOST_ASIO_STRING_VIEW_PARAM delim) -{ - return read_until(s, basic_streambuf_ref<Allocator>(b), delim); -} - -template <typename SyncReadStream, typename Allocator> -inline std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - BOOST_ASIO_STRING_VIEW_PARAM delim, boost::system::error_code& ec) -{ - return read_until(s, basic_streambuf_ref<Allocator>(b), delim, ec); -} - -#if defined(BOOST_ASIO_HAS_BOOST_REGEX) - -template <typename SyncReadStream, typename Allocator> -inline std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr) -{ - return read_until(s, basic_streambuf_ref<Allocator>(b), expr); -} - -template <typename SyncReadStream, typename Allocator> -inline std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr, - boost::system::error_code& ec) -{ - return read_until(s, basic_streambuf_ref<Allocator>(b), expr, ec); -} - -#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX) - -template <typename SyncReadStream, typename Allocator, typename MatchCondition> -inline std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, MatchCondition match_condition, - typename enable_if<is_match_condition<MatchCondition>::value>::type*) -{ - return read_until(s, basic_streambuf_ref<Allocator>(b), match_condition); -} - -template <typename SyncReadStream, typename Allocator, typename MatchCondition> -inline std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - MatchCondition match_condition, boost::system::error_code& ec, - typename enable_if<is_match_condition<MatchCondition>::value>::type*) -{ - return read_until(s, basic_streambuf_ref<Allocator>(b), match_condition, ec); -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -namespace detail -{ - template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - class read_until_delim_op - { - public: - template <typename BufferSequence> - read_until_delim_op(AsyncReadStream& stream, - BOOST_ASIO_MOVE_ARG(BufferSequence) buffers, - char delim, ReadHandler& handler) - : stream_(stream), - buffers_(BOOST_ASIO_MOVE_CAST(BufferSequence)(buffers)), - delim_(delim), - start_(0), - search_position_(0), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - read_until_delim_op(const read_until_delim_op& other) - : stream_(other.stream_), - buffers_(other.buffers_), - delim_(other.delim_), - start_(other.start_), - search_position_(other.search_position_), - handler_(other.handler_) - { - } - - read_until_delim_op(read_until_delim_op&& other) - : stream_(other.stream_), - buffers_(BOOST_ASIO_MOVE_CAST(DynamicBuffer)(other.buffers_)), - delim_(other.delim_), - start_(other.start_), - search_position_(other.search_position_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - const std::size_t not_found = (std::numeric_limits<std::size_t>::max)(); - std::size_t bytes_to_read; - switch (start_ = start) - { - case 1: - for (;;) - { - { - // Determine the range of the data to be searched. - typedef typename DynamicBuffer::const_buffers_type - buffers_type; - typedef buffers_iterator<buffers_type> iterator; - buffers_type data_buffers = buffers_.data(); - iterator begin = iterator::begin(data_buffers); - iterator start_pos = begin + search_position_; - iterator end = iterator::end(data_buffers); - - // Look for a match. - iterator iter = std::find(start_pos, end, delim_); - if (iter != end) - { - // Found a match. We're done. - search_position_ = iter - begin + 1; - bytes_to_read = 0; - } - - // No match yet. Check if buffer is full. - else if (buffers_.size() == buffers_.max_size()) - { - search_position_ = not_found; - bytes_to_read = 0; - } - - // Need to read some more data. - else - { - // Next search can start with the new data. - search_position_ = end - begin; - bytes_to_read = std::min<std::size_t>( - std::max<std::size_t>(512, - buffers_.capacity() - buffers_.size()), - std::min<std::size_t>(65536, - buffers_.max_size() - buffers_.size())); - } - } - - // Check if we're done. - if (!start && bytes_to_read == 0) - break; - - // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(buffers_.prepare(bytes_to_read), - BOOST_ASIO_MOVE_CAST(read_until_delim_op)(*this)); - return; default: - buffers_.commit(bytes_transferred); - if (ec || bytes_transferred == 0) - break; - } - - const boost::system::error_code result_ec = - (search_position_ == not_found) - ? error::not_found : ec; - - const std::size_t result_n = - (ec || search_position_ == not_found) - ? 0 : search_position_; - - handler_(result_ec, result_n); - } - } - - //private: - AsyncReadStream& stream_; - DynamicBuffer buffers_; - char delim_; - int start_; - std::size_t search_position_; - ReadHandler handler_; - }; - - template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - read_until_delim_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - read_until_delim_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline bool asio_handler_is_continuation( - read_until_delim_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline void asio_handler_invoke(Function& function, - read_until_delim_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - read_until_delim_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, typename DynamicBuffer, - typename ReadHandler, typename Allocator> -struct associated_allocator< - detail::read_until_delim_op<AsyncReadStream, - DynamicBuffer, ReadHandler>, - Allocator> -{ - typedef typename associated_allocator<ReadHandler, Allocator>::type type; - - static type get( - const detail::read_until_delim_op<AsyncReadStream, - DynamicBuffer, ReadHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncReadStream, typename DynamicBuffer, - typename ReadHandler, typename Executor> -struct associated_executor< - detail::read_until_delim_op<AsyncReadStream, - DynamicBuffer, ReadHandler>, - Executor> -{ - typedef typename associated_executor<ReadHandler, Executor>::type type; - - static type get( - const detail::read_until_delim_op<AsyncReadStream, - DynamicBuffer, ReadHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - char delim, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::read_until_delim_op<AsyncReadStream, - typename decay<DynamicBuffer>::type, - BOOST_ASIO_HANDLER_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t))>( - s, BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - delim, init.completion_handler)(boost::system::error_code(), 0, 1); - - return init.result.get(); -} - -namespace detail -{ - template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - class read_until_delim_string_op - { - public: - template <typename BufferSequence> - read_until_delim_string_op(AsyncReadStream& stream, - BOOST_ASIO_MOVE_ARG(BufferSequence) buffers, - const std::string& delim, ReadHandler& handler) - : stream_(stream), - buffers_(BOOST_ASIO_MOVE_CAST(BufferSequence)(buffers)), - delim_(delim), - start_(0), - search_position_(0), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - read_until_delim_string_op(const read_until_delim_string_op& other) - : stream_(other.stream_), - buffers_(other.buffers_), - delim_(other.delim_), - start_(other.start_), - search_position_(other.search_position_), - handler_(other.handler_) - { - } - - read_until_delim_string_op(read_until_delim_string_op&& other) - : stream_(other.stream_), - buffers_(BOOST_ASIO_MOVE_CAST(DynamicBuffer)(other.buffers_)), - delim_(BOOST_ASIO_MOVE_CAST(std::string)(other.delim_)), - start_(other.start_), - search_position_(other.search_position_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - const std::size_t not_found = (std::numeric_limits<std::size_t>::max)(); - std::size_t bytes_to_read; - switch (start_ = start) - { - case 1: - for (;;) - { - { - // Determine the range of the data to be searched. - typedef typename DynamicBuffer::const_buffers_type - buffers_type; - typedef buffers_iterator<buffers_type> iterator; - buffers_type data_buffers = buffers_.data(); - iterator begin = iterator::begin(data_buffers); - iterator start_pos = begin + search_position_; - iterator end = iterator::end(data_buffers); - - // Look for a match. - std::pair<iterator, bool> result = detail::partial_search( - start_pos, end, delim_.begin(), delim_.end()); - if (result.first != end && result.second) - { - // Full match. We're done. - search_position_ = result.first - begin + delim_.length(); - bytes_to_read = 0; - } - - // No match yet. Check if buffer is full. - else if (buffers_.size() == buffers_.max_size()) - { - search_position_ = not_found; - bytes_to_read = 0; - } - - // Need to read some more data. - else - { - if (result.first != end) - { - // Partial match. Next search needs to start from beginning of - // match. - search_position_ = result.first - begin; - } - else - { - // Next search can start with the new data. - search_position_ = end - begin; - } - - bytes_to_read = std::min<std::size_t>( - std::max<std::size_t>(512, - buffers_.capacity() - buffers_.size()), - std::min<std::size_t>(65536, - buffers_.max_size() - buffers_.size())); - } - } - - // Check if we're done. - if (!start && bytes_to_read == 0) - break; - - // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(buffers_.prepare(bytes_to_read), - BOOST_ASIO_MOVE_CAST(read_until_delim_string_op)(*this)); - return; default: - buffers_.commit(bytes_transferred); - if (ec || bytes_transferred == 0) - break; - } - - const boost::system::error_code result_ec = - (search_position_ == not_found) - ? error::not_found : ec; - - const std::size_t result_n = - (ec || search_position_ == not_found) - ? 0 : search_position_; - - handler_(result_ec, result_n); - } - } - - //private: - AsyncReadStream& stream_; - DynamicBuffer buffers_; - std::string delim_; - int start_; - std::size_t search_position_; - ReadHandler handler_; - }; - - template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - read_until_delim_string_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - read_until_delim_string_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline bool asio_handler_is_continuation( - read_until_delim_string_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline void asio_handler_invoke(Function& function, - read_until_delim_string_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - read_until_delim_string_op<AsyncReadStream, - DynamicBuffer, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, typename DynamicBuffer, - typename ReadHandler, typename Allocator> -struct associated_allocator< - detail::read_until_delim_string_op<AsyncReadStream, - DynamicBuffer, ReadHandler>, - Allocator> -{ - typedef typename associated_allocator<ReadHandler, Allocator>::type type; - - static type get( - const detail::read_until_delim_string_op<AsyncReadStream, - DynamicBuffer, ReadHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncReadStream, typename DynamicBuffer, - typename ReadHandler, typename Executor> -struct associated_executor< - detail::read_until_delim_string_op<AsyncReadStream, - DynamicBuffer, ReadHandler>, - Executor> -{ - typedef typename associated_executor<ReadHandler, Executor>::type type; - - static type get( - const detail::read_until_delim_string_op<AsyncReadStream, - DynamicBuffer, ReadHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_STRING_VIEW_PARAM delim, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::read_until_delim_string_op<AsyncReadStream, - typename decay<DynamicBuffer>::type, - BOOST_ASIO_HANDLER_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t))>( - s, BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - static_cast<std::string>(delim), - init.completion_handler)(boost::system::error_code(), 0, 1); - - return init.result.get(); -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if defined(BOOST_ASIO_HAS_BOOST_REGEX) - -namespace detail -{ - template <typename AsyncReadStream, typename DynamicBuffer, - typename RegEx, typename ReadHandler> - class read_until_expr_op - { - public: - template <typename BufferSequence> - read_until_expr_op(AsyncReadStream& stream, - BOOST_ASIO_MOVE_ARG(BufferSequence) buffers, - const boost::regex& expr, ReadHandler& handler) - : stream_(stream), - buffers_(BOOST_ASIO_MOVE_CAST(BufferSequence)(buffers)), - expr_(expr), - start_(0), - search_position_(0), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - read_until_expr_op(const read_until_expr_op& other) - : stream_(other.stream_), - buffers_(other.buffers_), - expr_(other.expr_), - start_(other.start_), - search_position_(other.search_position_), - handler_(other.handler_) - { - } - - read_until_expr_op(read_until_expr_op&& other) - : stream_(other.stream_), - buffers_(BOOST_ASIO_MOVE_CAST(DynamicBuffer)(other.buffers_)), - expr_(other.expr_), - start_(other.start_), - search_position_(other.search_position_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - const std::size_t not_found = (std::numeric_limits<std::size_t>::max)(); - std::size_t bytes_to_read; - switch (start_ = start) - { - case 1: - for (;;) - { - { - // Determine the range of the data to be searched. - typedef typename DynamicBuffer::const_buffers_type - buffers_type; - typedef buffers_iterator<buffers_type> iterator; - buffers_type data_buffers = buffers_.data(); - iterator begin = iterator::begin(data_buffers); - iterator start_pos = begin + search_position_; - iterator end = iterator::end(data_buffers); - - // Look for a match. - boost::match_results<iterator, - typename std::vector<boost::sub_match<iterator> >::allocator_type> - match_results; - bool match = regex_search(start_pos, end, match_results, expr_, - boost::match_default | boost::match_partial); - if (match && match_results[0].matched) - { - // Full match. We're done. - search_position_ = match_results[0].second - begin; - bytes_to_read = 0; - } - - // No match yet. Check if buffer is full. - else if (buffers_.size() == buffers_.max_size()) - { - search_position_ = not_found; - bytes_to_read = 0; - } - - // Need to read some more data. - else - { - if (match) - { - // Partial match. Next search needs to start from beginning of - // match. - search_position_ = match_results[0].first - begin; - } - else - { - // Next search can start with the new data. - search_position_ = end - begin; - } - - bytes_to_read = std::min<std::size_t>( - std::max<std::size_t>(512, - buffers_.capacity() - buffers_.size()), - std::min<std::size_t>(65536, - buffers_.max_size() - buffers_.size())); - } - } - - // Check if we're done. - if (!start && bytes_to_read == 0) - break; - - // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(buffers_.prepare(bytes_to_read), - BOOST_ASIO_MOVE_CAST(read_until_expr_op)(*this)); - return; default: - buffers_.commit(bytes_transferred); - if (ec || bytes_transferred == 0) - break; - } - - const boost::system::error_code result_ec = - (search_position_ == not_found) - ? error::not_found : ec; - - const std::size_t result_n = - (ec || search_position_ == not_found) - ? 0 : search_position_; - - handler_(result_ec, result_n); - } - } - - //private: - AsyncReadStream& stream_; - DynamicBuffer buffers_; - RegEx expr_; - int start_; - std::size_t search_position_; - ReadHandler handler_; - }; - - template <typename AsyncReadStream, typename DynamicBuffer, - typename RegEx, typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - read_until_expr_op<AsyncReadStream, - DynamicBuffer, RegEx, ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncReadStream, typename DynamicBuffer, - typename RegEx, typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - read_until_expr_op<AsyncReadStream, - DynamicBuffer, RegEx, ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncReadStream, typename DynamicBuffer, - typename RegEx, typename ReadHandler> - inline bool asio_handler_is_continuation( - read_until_expr_op<AsyncReadStream, - DynamicBuffer, RegEx, ReadHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename RegEx, typename ReadHandler> - inline void asio_handler_invoke(Function& function, - read_until_expr_op<AsyncReadStream, - DynamicBuffer, RegEx, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename RegEx, typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - read_until_expr_op<AsyncReadStream, - DynamicBuffer, RegEx, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, typename DynamicBuffer, - typename RegEx, typename ReadHandler, typename Allocator> -struct associated_allocator< - detail::read_until_expr_op<AsyncReadStream, - DynamicBuffer, RegEx, ReadHandler>, - Allocator> -{ - typedef typename associated_allocator<ReadHandler, Allocator>::type type; - - static type get( - const detail::read_until_expr_op<AsyncReadStream, - DynamicBuffer, RegEx, ReadHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncReadStream, typename DynamicBuffer, - typename RegEx, typename ReadHandler, typename Executor> -struct associated_executor< - detail::read_until_expr_op<AsyncReadStream, - DynamicBuffer, RegEx, ReadHandler>, - Executor> -{ - typedef typename associated_executor<ReadHandler, Executor>::type type; - - static type get( - const detail::read_until_expr_op<AsyncReadStream, - DynamicBuffer, RegEx, ReadHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - const boost::regex& expr, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::read_until_expr_op<AsyncReadStream, - typename decay<DynamicBuffer>::type, - boost::regex, BOOST_ASIO_HANDLER_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t))>( - s, BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - expr, init.completion_handler)(boost::system::error_code(), 0, 1); - - return init.result.get(); -} - -#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX) - -namespace detail -{ - template <typename AsyncReadStream, typename DynamicBuffer, - typename MatchCondition, typename ReadHandler> - class read_until_match_op - { - public: - template <typename BufferSequence> - read_until_match_op(AsyncReadStream& stream, - BOOST_ASIO_MOVE_ARG(BufferSequence) buffers, - MatchCondition match_condition, ReadHandler& handler) - : stream_(stream), - buffers_(BOOST_ASIO_MOVE_CAST(BufferSequence)(buffers)), - match_condition_(match_condition), - start_(0), - search_position_(0), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - read_until_match_op(const read_until_match_op& other) - : stream_(other.stream_), - buffers_(other.buffers_), - match_condition_(other.match_condition_), - start_(other.start_), - search_position_(other.search_position_), - handler_(other.handler_) - { - } - - read_until_match_op(read_until_match_op&& other) - : stream_(other.stream_), - buffers_(BOOST_ASIO_MOVE_CAST(DynamicBuffer)(other.buffers_)), - match_condition_(other.match_condition_), - start_(other.start_), - search_position_(other.search_position_), - handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - const std::size_t not_found = (std::numeric_limits<std::size_t>::max)(); - std::size_t bytes_to_read; - switch (start_ = start) - { - case 1: - for (;;) - { - { - // Determine the range of the data to be searched. - typedef typename DynamicBuffer::const_buffers_type - buffers_type; - typedef buffers_iterator<buffers_type> iterator; - buffers_type data_buffers = buffers_.data(); - iterator begin = iterator::begin(data_buffers); - iterator start_pos = begin + search_position_; - iterator end = iterator::end(data_buffers); - - // Look for a match. - std::pair<iterator, bool> result = match_condition_(start_pos, end); - if (result.second) - { - // Full match. We're done. - search_position_ = result.first - begin; - bytes_to_read = 0; - } - - // No match yet. Check if buffer is full. - else if (buffers_.size() == buffers_.max_size()) - { - search_position_ = not_found; - bytes_to_read = 0; - } - - // Need to read some more data. - else - { - if (result.first != end) - { - // Partial match. Next search needs to start from beginning of - // match. - search_position_ = result.first - begin; - } - else - { - // Next search can start with the new data. - search_position_ = end - begin; - } - - bytes_to_read = std::min<std::size_t>( - std::max<std::size_t>(512, - buffers_.capacity() - buffers_.size()), - std::min<std::size_t>(65536, - buffers_.max_size() - buffers_.size())); - } - } - - // Check if we're done. - if (!start && bytes_to_read == 0) - break; - - // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(buffers_.prepare(bytes_to_read), - BOOST_ASIO_MOVE_CAST(read_until_match_op)(*this)); - return; default: - buffers_.commit(bytes_transferred); - if (ec || bytes_transferred == 0) - break; - } - - const boost::system::error_code result_ec = - (search_position_ == not_found) - ? error::not_found : ec; - - const std::size_t result_n = - (ec || search_position_ == not_found) - ? 0 : search_position_; - - handler_(result_ec, result_n); - } - } - - //private: - AsyncReadStream& stream_; - DynamicBuffer buffers_; - MatchCondition match_condition_; - int start_; - std::size_t search_position_; - ReadHandler handler_; - }; - - template <typename AsyncReadStream, typename DynamicBuffer, - typename MatchCondition, typename ReadHandler> - inline void* asio_handler_allocate(std::size_t size, - read_until_match_op<AsyncReadStream, DynamicBuffer, - MatchCondition, ReadHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncReadStream, typename DynamicBuffer, - typename MatchCondition, typename ReadHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - read_until_match_op<AsyncReadStream, DynamicBuffer, - MatchCondition, ReadHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncReadStream, typename DynamicBuffer, - typename MatchCondition, typename ReadHandler> - inline bool asio_handler_is_continuation( - read_until_match_op<AsyncReadStream, DynamicBuffer, - MatchCondition, ReadHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename MatchCondition, - typename ReadHandler> - inline void asio_handler_invoke(Function& function, - read_until_match_op<AsyncReadStream, DynamicBuffer, - MatchCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncReadStream, - typename DynamicBuffer, typename MatchCondition, - typename ReadHandler> - inline void asio_handler_invoke(const Function& function, - read_until_match_op<AsyncReadStream, DynamicBuffer, - MatchCondition, ReadHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, typename DynamicBuffer, - typename MatchCondition, typename ReadHandler, typename Allocator> -struct associated_allocator< - detail::read_until_match_op<AsyncReadStream, - DynamicBuffer, MatchCondition, ReadHandler>, - Allocator> -{ - typedef typename associated_allocator<ReadHandler, Allocator>::type type; - - static type get( - const detail::read_until_match_op<AsyncReadStream, - DynamicBuffer, MatchCondition, ReadHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<ReadHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncReadStream, typename DynamicBuffer, - typename MatchCondition, typename ReadHandler, typename Executor> -struct associated_executor< - detail::read_until_match_op<AsyncReadStream, - DynamicBuffer, MatchCondition, ReadHandler>, - Executor> -{ - typedef typename associated_executor<ReadHandler, Executor>::type type; - - static type get( - const detail::read_until_match_op<AsyncReadStream, - DynamicBuffer, MatchCondition, ReadHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<ReadHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncReadStream, typename DynamicBuffer, - typename MatchCondition, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if<is_match_condition<MatchCondition>::value>::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::read_until_match_op<AsyncReadStream, - typename decay<DynamicBuffer>::type, - MatchCondition, BOOST_ASIO_HANDLER_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t))>( - s, BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - match_condition, init.completion_handler)( - boost::system::error_code(), 0, 1); - - return init.result.get(); -} - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -template <typename AsyncReadStream, typename Allocator, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - char delim, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - return async_read_until(s, basic_streambuf_ref<Allocator>(b), - delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -} - -template <typename AsyncReadStream, typename Allocator, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - BOOST_ASIO_STRING_VIEW_PARAM delim, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - return async_read_until(s, basic_streambuf_ref<Allocator>(b), - delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -} - -#if defined(BOOST_ASIO_HAS_BOOST_REGEX) - -template <typename AsyncReadStream, typename Allocator, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) -{ - return async_read_until(s, basic_streambuf_ref<Allocator>(b), - expr, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -} - -#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX) - -template <typename AsyncReadStream, typename Allocator, - typename MatchCondition, typename ReadHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if<is_match_condition<MatchCondition>::value>::type*) -{ - return async_read_until(s, basic_streambuf_ref<Allocator>(b), - match_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_READ_UNTIL_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/serial_port_base.hpp b/contrib/restricted/boost/boost/asio/impl/serial_port_base.hpp deleted file mode 100644 index 7f2dfe88df..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/serial_port_base.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// -// impl/serial_port_base.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_SERIAL_PORT_BASE_HPP -#define BOOST_ASIO_IMPL_SERIAL_PORT_BASE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -inline serial_port_base::baud_rate::baud_rate(unsigned int rate) - : value_(rate) -{ -} - -inline unsigned int serial_port_base::baud_rate::value() const -{ - return value_; -} - -inline serial_port_base::flow_control::type -serial_port_base::flow_control::value() const -{ - return value_; -} - -inline serial_port_base::parity::type serial_port_base::parity::value() const -{ - return value_; -} - -inline serial_port_base::stop_bits::type -serial_port_base::stop_bits::value() const -{ - return value_; -} - -inline unsigned int serial_port_base::character_size::value() const -{ - return value_; -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_SERIAL_PORT_BASE_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/serial_port_base.ipp b/contrib/restricted/boost/boost/asio/impl/serial_port_base.ipp deleted file mode 100644 index 5db8be64fd..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/serial_port_base.ipp +++ /dev/null @@ -1,556 +0,0 @@ -// -// impl/serial_port_base.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_SERIAL_PORT_BASE_IPP -#define BOOST_ASIO_IMPL_SERIAL_PORT_BASE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_SERIAL_PORT) - -#include <stdexcept> -#include <boost/asio/error.hpp> -#include <boost/asio/serial_port_base.hpp> -#include <boost/asio/detail/throw_exception.hpp> - -#if defined(GENERATING_DOCUMENTATION) -# define BOOST_ASIO_OPTION_STORAGE implementation_defined -#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) -# define BOOST_ASIO_OPTION_STORAGE DCB -#else -# define BOOST_ASIO_OPTION_STORAGE termios -#endif - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::baud_rate::store( - BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - storage.BaudRate = value_; -#else - speed_t baud; - switch (value_) - { - // Do POSIX-specified rates first. - case 0: baud = B0; break; - case 50: baud = B50; break; - case 75: baud = B75; break; - case 110: baud = B110; break; - case 134: baud = B134; break; - case 150: baud = B150; break; - case 200: baud = B200; break; - case 300: baud = B300; break; - case 600: baud = B600; break; - case 1200: baud = B1200; break; - case 1800: baud = B1800; break; - case 2400: baud = B2400; break; - case 4800: baud = B4800; break; - case 9600: baud = B9600; break; - case 19200: baud = B19200; break; - case 38400: baud = B38400; break; - // And now the extended ones conditionally. -# ifdef B7200 - case 7200: baud = B7200; break; -# endif -# ifdef B14400 - case 14400: baud = B14400; break; -# endif -# ifdef B57600 - case 57600: baud = B57600; break; -# endif -# ifdef B115200 - case 115200: baud = B115200; break; -# endif -# ifdef B230400 - case 230400: baud = B230400; break; -# endif -# ifdef B460800 - case 460800: baud = B460800; break; -# endif -# ifdef B500000 - case 500000: baud = B500000; break; -# endif -# ifdef B576000 - case 576000: baud = B576000; break; -# endif -# ifdef B921600 - case 921600: baud = B921600; break; -# endif -# ifdef B1000000 - case 1000000: baud = B1000000; break; -# endif -# ifdef B1152000 - case 1152000: baud = B1152000; break; -# endif -# ifdef B2000000 - case 2000000: baud = B2000000; break; -# endif -# ifdef B3000000 - case 3000000: baud = B3000000; break; -# endif -# ifdef B3500000 - case 3500000: baud = B3500000; break; -# endif -# ifdef B4000000 - case 4000000: baud = B4000000; break; -# endif - default: - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } -# if (defined(_BSD_SOURCE) || defined(_DEFAULT_SOURCE)) && (!defined(__ANDROID__) || __ANDROID__API__ >= 21) - ::cfsetspeed(&storage, baud); -# else - ::cfsetispeed(&storage, baud); - ::cfsetospeed(&storage, baud); -# endif -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::baud_rate::load( - const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - value_ = storage.BaudRate; -#else - speed_t baud = ::cfgetospeed(&storage); - switch (baud) - { - // First do those specified by POSIX. - case B0: value_ = 0; break; - case B50: value_ = 50; break; - case B75: value_ = 75; break; - case B110: value_ = 110; break; - case B134: value_ = 134; break; - case B150: value_ = 150; break; - case B200: value_ = 200; break; - case B300: value_ = 300; break; - case B600: value_ = 600; break; - case B1200: value_ = 1200; break; - case B1800: value_ = 1800; break; - case B2400: value_ = 2400; break; - case B4800: value_ = 4800; break; - case B9600: value_ = 9600; break; - case B19200: value_ = 19200; break; - case B38400: value_ = 38400; break; - // Now conditionally handle a bunch of extended rates. -# ifdef B7200 - case B7200: value_ = 7200; break; -# endif -# ifdef B14400 - case B14400: value_ = 14400; break; -# endif -# ifdef B57600 - case B57600: value_ = 57600; break; -# endif -# ifdef B115200 - case B115200: value_ = 115200; break; -# endif -# ifdef B230400 - case B230400: value_ = 230400; break; -# endif -# ifdef B460800 - case B460800: value_ = 460800; break; -# endif -# ifdef B500000 - case B500000: value_ = 500000; break; -# endif -# ifdef B576000 - case B576000: value_ = 576000; break; -# endif -# ifdef B921600 - case B921600: value_ = 921600; break; -# endif -# ifdef B1000000 - case B1000000: value_ = 1000000; break; -# endif -# ifdef B1152000 - case B1152000: value_ = 1152000; break; -# endif -# ifdef B2000000 - case B2000000: value_ = 2000000; break; -# endif -# ifdef B3000000 - case B3000000: value_ = 3000000; break; -# endif -# ifdef B3500000 - case B3500000: value_ = 3500000; break; -# endif -# ifdef B4000000 - case B4000000: value_ = 4000000; break; -# endif - default: - value_ = 0; - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -serial_port_base::flow_control::flow_control( - serial_port_base::flow_control::type t) - : value_(t) -{ - if (t != none && t != software && t != hardware) - { - std::out_of_range ex("invalid flow_control value"); - boost::asio::detail::throw_exception(ex); - } -} - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::flow_control::store( - BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - storage.fOutxCtsFlow = FALSE; - storage.fOutxDsrFlow = FALSE; - storage.fTXContinueOnXoff = TRUE; - storage.fDtrControl = DTR_CONTROL_ENABLE; - storage.fDsrSensitivity = FALSE; - storage.fOutX = FALSE; - storage.fInX = FALSE; - storage.fRtsControl = RTS_CONTROL_ENABLE; - switch (value_) - { - case none: - break; - case software: - storage.fOutX = TRUE; - storage.fInX = TRUE; - break; - case hardware: - storage.fOutxCtsFlow = TRUE; - storage.fRtsControl = RTS_CONTROL_HANDSHAKE; - break; - default: - break; - } -#else - switch (value_) - { - case none: - storage.c_iflag &= ~(IXOFF | IXON); -# if defined(_BSD_SOURCE) || defined(_DEFAULT_SOURCE) - storage.c_cflag &= ~CRTSCTS; -# elif defined(__QNXNTO__) - storage.c_cflag &= ~(IHFLOW | OHFLOW); -# endif - break; - case software: - storage.c_iflag |= IXOFF | IXON; -# if defined(_BSD_SOURCE) || defined(_DEFAULT_SOURCE) - storage.c_cflag &= ~CRTSCTS; -# elif defined(__QNXNTO__) - storage.c_cflag &= ~(IHFLOW | OHFLOW); -# endif - break; - case hardware: -# if defined(_BSD_SOURCE) || defined(_DEFAULT_SOURCE) - storage.c_iflag &= ~(IXOFF | IXON); - storage.c_cflag |= CRTSCTS; - break; -# elif defined(__QNXNTO__) - storage.c_iflag &= ~(IXOFF | IXON); - storage.c_cflag |= (IHFLOW | OHFLOW); - break; -# else - ec = boost::asio::error::operation_not_supported; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -# endif - default: - break; - } -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::flow_control::load( - const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - if (storage.fOutX && storage.fInX) - { - value_ = software; - } - else if (storage.fOutxCtsFlow && storage.fRtsControl == RTS_CONTROL_HANDSHAKE) - { - value_ = hardware; - } - else - { - value_ = none; - } -#else - if (storage.c_iflag & (IXOFF | IXON)) - { - value_ = software; - } -# if defined(_BSD_SOURCE) || defined(_DEFAULT_SOURCE) - else if (storage.c_cflag & CRTSCTS) - { - value_ = hardware; - } -# elif defined(__QNXNTO__) - else if (storage.c_cflag & IHFLOW && storage.c_cflag & OHFLOW) - { - value_ = hardware; - } -# endif - else - { - value_ = none; - } -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -serial_port_base::parity::parity(serial_port_base::parity::type t) - : value_(t) -{ - if (t != none && t != odd && t != even) - { - std::out_of_range ex("invalid parity value"); - boost::asio::detail::throw_exception(ex); - } -} - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::parity::store( - BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - switch (value_) - { - case none: - storage.fParity = FALSE; - storage.Parity = NOPARITY; - break; - case odd: - storage.fParity = TRUE; - storage.Parity = ODDPARITY; - break; - case even: - storage.fParity = TRUE; - storage.Parity = EVENPARITY; - break; - default: - break; - } -#else - switch (value_) - { - case none: - storage.c_iflag |= IGNPAR; - storage.c_cflag &= ~(PARENB | PARODD); - break; - case even: - storage.c_iflag &= ~(IGNPAR | PARMRK); - storage.c_iflag |= INPCK; - storage.c_cflag |= PARENB; - storage.c_cflag &= ~PARODD; - break; - case odd: - storage.c_iflag &= ~(IGNPAR | PARMRK); - storage.c_iflag |= INPCK; - storage.c_cflag |= (PARENB | PARODD); - break; - default: - break; - } -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::parity::load( - const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - if (storage.Parity == EVENPARITY) - { - value_ = even; - } - else if (storage.Parity == ODDPARITY) - { - value_ = odd; - } - else - { - value_ = none; - } -#else - if (storage.c_cflag & PARENB) - { - if (storage.c_cflag & PARODD) - { - value_ = odd; - } - else - { - value_ = even; - } - } - else - { - value_ = none; - } -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -serial_port_base::stop_bits::stop_bits( - serial_port_base::stop_bits::type t) - : value_(t) -{ - if (t != one && t != onepointfive && t != two) - { - std::out_of_range ex("invalid stop_bits value"); - boost::asio::detail::throw_exception(ex); - } -} - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::stop_bits::store( - BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - switch (value_) - { - case one: - storage.StopBits = ONESTOPBIT; - break; - case onepointfive: - storage.StopBits = ONE5STOPBITS; - break; - case two: - storage.StopBits = TWOSTOPBITS; - break; - default: - break; - } -#else - switch (value_) - { - case one: - storage.c_cflag &= ~CSTOPB; - break; - case two: - storage.c_cflag |= CSTOPB; - break; - default: - ec = boost::asio::error::operation_not_supported; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::stop_bits::load( - const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - if (storage.StopBits == ONESTOPBIT) - { - value_ = one; - } - else if (storage.StopBits == ONE5STOPBITS) - { - value_ = onepointfive; - } - else if (storage.StopBits == TWOSTOPBITS) - { - value_ = two; - } - else - { - value_ = one; - } -#else - value_ = (storage.c_cflag & CSTOPB) ? two : one; -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -serial_port_base::character_size::character_size(unsigned int t) - : value_(t) -{ - if (t < 5 || t > 8) - { - std::out_of_range ex("invalid character_size value"); - boost::asio::detail::throw_exception(ex); - } -} - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::character_size::store( - BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - storage.ByteSize = value_; -#else - storage.c_cflag &= ~CSIZE; - switch (value_) - { - case 5: storage.c_cflag |= CS5; break; - case 6: storage.c_cflag |= CS6; break; - case 7: storage.c_cflag |= CS7; break; - case 8: storage.c_cflag |= CS8; break; - default: break; - } -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -BOOST_ASIO_SYNC_OP_VOID serial_port_base::character_size::load( - const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) -{ -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - value_ = storage.ByteSize; -#else - if ((storage.c_cflag & CSIZE) == CS5) { value_ = 5; } - else if ((storage.c_cflag & CSIZE) == CS6) { value_ = 6; } - else if ((storage.c_cflag & CSIZE) == CS7) { value_ = 7; } - else if ((storage.c_cflag & CSIZE) == CS8) { value_ = 8; } - else - { - // Hmmm, use 8 for now. - value_ = 8; - } -#endif - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#undef BOOST_ASIO_OPTION_STORAGE - -#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) - -#endif // BOOST_ASIO_IMPL_SERIAL_PORT_BASE_IPP diff --git a/contrib/restricted/boost/boost/asio/impl/spawn.hpp b/contrib/restricted/boost/boost/asio/impl/spawn.hpp deleted file mode 100644 index c2da5ce09a..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/spawn.hpp +++ /dev/null @@ -1,537 +0,0 @@ -// -// impl/spawn.hpp -// ~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_SPAWN_HPP -#define BOOST_ASIO_IMPL_SPAWN_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/async_result.hpp> -#include <boost/asio/bind_executor.hpp> -#include <boost/asio/detail/atomic_count.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/system/system_error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - - template <typename Handler, typename T> - class coro_handler - { - public: - coro_handler(basic_yield_context<Handler> ctx) - : coro_(ctx.coro_.lock()), - ca_(ctx.ca_), - handler_(ctx.handler_), - ready_(0), - ec_(ctx.ec_), - value_(0) - { - } - - void operator()(T value) - { - *ec_ = boost::system::error_code(); - *value_ = BOOST_ASIO_MOVE_CAST(T)(value); - if (--*ready_ == 0) - (*coro_)(); - } - - void operator()(boost::system::error_code ec, T value) - { - *ec_ = ec; - *value_ = BOOST_ASIO_MOVE_CAST(T)(value); - if (--*ready_ == 0) - (*coro_)(); - } - - //private: - shared_ptr<typename basic_yield_context<Handler>::callee_type> coro_; - typename basic_yield_context<Handler>::caller_type& ca_; - Handler handler_; - atomic_count* ready_; - boost::system::error_code* ec_; - T* value_; - }; - - template <typename Handler> - class coro_handler<Handler, void> - { - public: - coro_handler(basic_yield_context<Handler> ctx) - : coro_(ctx.coro_.lock()), - ca_(ctx.ca_), - handler_(ctx.handler_), - ready_(0), - ec_(ctx.ec_) - { - } - - void operator()() - { - *ec_ = boost::system::error_code(); - if (--*ready_ == 0) - (*coro_)(); - } - - void operator()(boost::system::error_code ec) - { - *ec_ = ec; - if (--*ready_ == 0) - (*coro_)(); - } - - //private: - shared_ptr<typename basic_yield_context<Handler>::callee_type> coro_; - typename basic_yield_context<Handler>::caller_type& ca_; - Handler handler_; - atomic_count* ready_; - boost::system::error_code* ec_; - }; - - template <typename Handler, typename T> - inline void* asio_handler_allocate(std::size_t size, - coro_handler<Handler, T>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename Handler, typename T> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - coro_handler<Handler, T>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename Handler, typename T> - inline bool asio_handler_is_continuation(coro_handler<Handler, T>*) - { - return true; - } - - template <typename Function, typename Handler, typename T> - inline void asio_handler_invoke(Function& function, - coro_handler<Handler, T>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename Handler, typename T> - inline void asio_handler_invoke(const Function& function, - coro_handler<Handler, T>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Handler, typename T> - class coro_async_result - { - public: - typedef coro_handler<Handler, T> completion_handler_type; - typedef T return_type; - - explicit coro_async_result(completion_handler_type& h) - : handler_(h), - ca_(h.ca_), - ready_(2) - { - h.ready_ = &ready_; - out_ec_ = h.ec_; - if (!out_ec_) h.ec_ = &ec_; - h.value_ = &value_; - } - - return_type get() - { - // Must not hold shared_ptr to coro while suspended. - handler_.coro_.reset(); - - if (--ready_ != 0) - ca_(); - if (!out_ec_ && ec_) throw boost::system::system_error(ec_); - return BOOST_ASIO_MOVE_CAST(return_type)(value_); - } - - private: - completion_handler_type& handler_; - typename basic_yield_context<Handler>::caller_type& ca_; - atomic_count ready_; - boost::system::error_code* out_ec_; - boost::system::error_code ec_; - return_type value_; - }; - - template <typename Handler> - class coro_async_result<Handler, void> - { - public: - typedef coro_handler<Handler, void> completion_handler_type; - typedef void return_type; - - explicit coro_async_result(completion_handler_type& h) - : handler_(h), - ca_(h.ca_), - ready_(2) - { - h.ready_ = &ready_; - out_ec_ = h.ec_; - if (!out_ec_) h.ec_ = &ec_; - } - - void get() - { - // Must not hold shared_ptr to coro while suspended. - handler_.coro_.reset(); - - if (--ready_ != 0) - ca_(); - if (!out_ec_ && ec_) throw boost::system::system_error(ec_); - } - - private: - completion_handler_type& handler_; - typename basic_yield_context<Handler>::caller_type& ca_; - atomic_count ready_; - boost::system::error_code* out_ec_; - boost::system::error_code ec_; - }; - -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename Handler, typename ReturnType> -class async_result<basic_yield_context<Handler>, ReturnType()> - : public detail::coro_async_result<Handler, void> -{ -public: - explicit async_result( - typename detail::coro_async_result<Handler, - void>::completion_handler_type& h) - : detail::coro_async_result<Handler, void>(h) - { - } -}; - -template <typename Handler, typename ReturnType, typename Arg1> -class async_result<basic_yield_context<Handler>, ReturnType(Arg1)> - : public detail::coro_async_result<Handler, typename decay<Arg1>::type> -{ -public: - explicit async_result( - typename detail::coro_async_result<Handler, - typename decay<Arg1>::type>::completion_handler_type& h) - : detail::coro_async_result<Handler, typename decay<Arg1>::type>(h) - { - } -}; - -template <typename Handler, typename ReturnType> -class async_result<basic_yield_context<Handler>, - ReturnType(boost::system::error_code)> - : public detail::coro_async_result<Handler, void> -{ -public: - explicit async_result( - typename detail::coro_async_result<Handler, - void>::completion_handler_type& h) - : detail::coro_async_result<Handler, void>(h) - { - } -}; - -template <typename Handler, typename ReturnType, typename Arg2> -class async_result<basic_yield_context<Handler>, - ReturnType(boost::system::error_code, Arg2)> - : public detail::coro_async_result<Handler, typename decay<Arg2>::type> -{ -public: - explicit async_result( - typename detail::coro_async_result<Handler, - typename decay<Arg2>::type>::completion_handler_type& h) - : detail::coro_async_result<Handler, typename decay<Arg2>::type>(h) - { - } -}; - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Handler, typename ReturnType> -struct handler_type<basic_yield_context<Handler>, ReturnType()> -{ - typedef detail::coro_handler<Handler, void> type; -}; - -template <typename Handler, typename ReturnType, typename Arg1> -struct handler_type<basic_yield_context<Handler>, ReturnType(Arg1)> -{ - typedef detail::coro_handler<Handler, typename decay<Arg1>::type> type; -}; - -template <typename Handler, typename ReturnType> -struct handler_type<basic_yield_context<Handler>, - ReturnType(boost::system::error_code)> -{ - typedef detail::coro_handler<Handler, void> type; -}; - -template <typename Handler, typename ReturnType, typename Arg2> -struct handler_type<basic_yield_context<Handler>, - ReturnType(boost::system::error_code, Arg2)> -{ - typedef detail::coro_handler<Handler, typename decay<Arg2>::type> type; -}; - -template <typename Handler, typename T> -class async_result<detail::coro_handler<Handler, T> > - : public detail::coro_async_result<Handler, T> -{ -public: - typedef typename detail::coro_async_result<Handler, T>::return_type type; - - explicit async_result( - typename detail::coro_async_result<Handler, - T>::completion_handler_type& h) - : detail::coro_async_result<Handler, T>(h) - { - } -}; - -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Handler, typename T, typename Allocator> -struct associated_allocator<detail::coro_handler<Handler, T>, Allocator> -{ - typedef typename associated_allocator<Handler, Allocator>::type type; - - static type get(const detail::coro_handler<Handler, T>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<Handler, Allocator>::get(h.handler_, a); - } -}; - -template <typename Handler, typename T, typename Executor> -struct associated_executor<detail::coro_handler<Handler, T>, Executor> -{ - typedef typename associated_executor<Handler, Executor>::type type; - - static type get(const detail::coro_handler<Handler, T>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<Handler, Executor>::get(h.handler_, ex); - } -}; - -namespace detail { - - template <typename Handler, typename Function> - struct spawn_data : private noncopyable - { - template <typename Hand, typename Func> - spawn_data(BOOST_ASIO_MOVE_ARG(Hand) handler, - bool call_handler, BOOST_ASIO_MOVE_ARG(Func) function) - : handler_(BOOST_ASIO_MOVE_CAST(Hand)(handler)), - call_handler_(call_handler), - function_(BOOST_ASIO_MOVE_CAST(Func)(function)) - { - } - - weak_ptr<typename basic_yield_context<Handler>::callee_type> coro_; - Handler handler_; - bool call_handler_; - Function function_; - }; - - template <typename Handler, typename Function> - struct coro_entry_point - { - void operator()(typename basic_yield_context<Handler>::caller_type& ca) - { - shared_ptr<spawn_data<Handler, Function> > data(data_); -#if !defined(BOOST_COROUTINES_UNIDIRECT) && !defined(BOOST_COROUTINES_V2) - ca(); // Yield until coroutine pointer has been initialised. -#endif // !defined(BOOST_COROUTINES_UNIDIRECT) && !defined(BOOST_COROUTINES_V2) - const basic_yield_context<Handler> yield( - data->coro_, ca, data->handler_); - - (data->function_)(yield); - if (data->call_handler_) - (data->handler_)(); - } - - shared_ptr<spawn_data<Handler, Function> > data_; - }; - - template <typename Handler, typename Function> - struct spawn_helper - { - void operator()() - { - typedef typename basic_yield_context<Handler>::callee_type callee_type; - coro_entry_point<Handler, Function> entry_point = { data_ }; - shared_ptr<callee_type> coro(new callee_type(entry_point, attributes_)); - data_->coro_ = coro; - (*coro)(); - } - - shared_ptr<spawn_data<Handler, Function> > data_; - boost::coroutines::attributes attributes_; - }; - - template <typename Function, typename Handler, typename Function1> - inline void asio_handler_invoke(Function& function, - spawn_helper<Handler, Function1>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->data_->handler_); - } - - template <typename Function, typename Handler, typename Function1> - inline void asio_handler_invoke(const Function& function, - spawn_helper<Handler, Function1>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->data_->handler_); - } - - inline void default_spawn_handler() {} - -} // namespace detail - -template <typename Function> -inline void spawn(BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes) -{ - typedef typename decay<Function>::type function_type; - - typename associated_executor<function_type>::type ex( - (get_associated_executor)(function)); - - boost::asio::spawn(ex, BOOST_ASIO_MOVE_CAST(Function)(function), attributes); -} - -template <typename Handler, typename Function> -void spawn(BOOST_ASIO_MOVE_ARG(Handler) handler, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes, - typename enable_if<!is_executor<typename decay<Handler>::type>::value && - !is_convertible<Handler&, execution_context&>::value>::type*) -{ - typedef typename decay<Handler>::type handler_type; - typedef typename decay<Function>::type function_type; - - typename associated_executor<handler_type>::type ex( - (get_associated_executor)(handler)); - - typename associated_allocator<handler_type>::type a( - (get_associated_allocator)(handler)); - - detail::spawn_helper<handler_type, function_type> helper; - helper.data_.reset( - new detail::spawn_data<handler_type, function_type>( - BOOST_ASIO_MOVE_CAST(Handler)(handler), true, - BOOST_ASIO_MOVE_CAST(Function)(function))); - helper.attributes_ = attributes; - - ex.dispatch(helper, a); -} - -template <typename Handler, typename Function> -void spawn(basic_yield_context<Handler> ctx, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes) -{ - typedef typename decay<Function>::type function_type; - - Handler handler(ctx.handler_); // Explicit copy that might be moved from. - - typename associated_executor<Handler>::type ex( - (get_associated_executor)(handler)); - - typename associated_allocator<Handler>::type a( - (get_associated_allocator)(handler)); - - detail::spawn_helper<Handler, function_type> helper; - helper.data_.reset( - new detail::spawn_data<Handler, function_type>( - BOOST_ASIO_MOVE_CAST(Handler)(handler), false, - BOOST_ASIO_MOVE_CAST(Function)(function))); - helper.attributes_ = attributes; - - ex.dispatch(helper, a); -} - -template <typename Function, typename Executor> -inline void spawn(const Executor& ex, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes, - typename enable_if<is_executor<Executor>::value>::type*) -{ - boost::asio::spawn(boost::asio::strand<Executor>(ex), - BOOST_ASIO_MOVE_CAST(Function)(function), attributes); -} - -template <typename Function, typename Executor> -inline void spawn(const strand<Executor>& ex, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes) -{ - boost::asio::spawn(boost::asio::bind_executor( - ex, &detail::default_spawn_handler), - BOOST_ASIO_MOVE_CAST(Function)(function), attributes); -} - -template <typename Function> -inline void spawn(const boost::asio::io_context::strand& s, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes) -{ - boost::asio::spawn(boost::asio::bind_executor( - s, &detail::default_spawn_handler), - BOOST_ASIO_MOVE_CAST(Function)(function), attributes); -} - -template <typename Function, typename ExecutionContext> -inline void spawn(ExecutionContext& ctx, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes, - typename enable_if<is_convertible< - ExecutionContext&, execution_context&>::value>::type*) -{ - boost::asio::spawn(ctx.get_executor(), - BOOST_ASIO_MOVE_CAST(Function)(function), attributes); -} - -#endif // !defined(GENERATING_DOCUMENTATION) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_SPAWN_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/src.cpp b/contrib/restricted/boost/boost/asio/impl/src.cpp deleted file mode 100644 index 3823acfaf3..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/src.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -// impl/src.cpp -// ~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#if defined(_MSC_VER) \ - || defined(__BORLANDC__) \ - || defined(__DMC__) -# pragma message ( \ - "This file is deprecated. " \ - "Please #include <boost/asio/impl/src.hpp> instead.") -#elif defined(__GNUC__) \ - || defined(__HP_aCC) \ - || defined(__SUNPRO_CC) \ - || defined(__IBMCPP__) -# warning "This file is deprecated." -# warning "Please #include <boost/asio/impl/src.hpp> instead." -#endif - -#include <boost/asio/impl/src.hpp> diff --git a/contrib/restricted/boost/boost/asio/impl/src.hpp b/contrib/restricted/boost/boost/asio/impl/src.hpp deleted file mode 100644 index b891a453fe..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/src.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// -// impl/src.hpp -// ~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_SRC_HPP -#define BOOST_ASIO_IMPL_SRC_HPP - -#define BOOST_ASIO_SOURCE - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# error Do not compile Asio library source with BOOST_ASIO_HEADER_ONLY defined -#endif - -#include <boost/asio/impl/error.ipp> -#include <boost/asio/impl/execution_context.ipp> -#include <boost/asio/impl/executor.ipp> -#include <boost/asio/impl/handler_alloc_hook.ipp> -#include <boost/asio/impl/io_context.ipp> -#include <boost/asio/impl/serial_port_base.ipp> -#include <boost/asio/impl/system_context.ipp> -#include <boost/asio/impl/thread_pool.ipp> -#include <boost/asio/detail/impl/buffer_sequence_adapter.ipp> -#include <boost/asio/detail/impl/descriptor_ops.ipp> -#include <boost/asio/detail/impl/dev_poll_reactor.ipp> -#include <boost/asio/detail/impl/epoll_reactor.ipp> -#include <boost/asio/detail/impl/eventfd_select_interrupter.ipp> -#include <boost/asio/detail/impl/handler_tracking.ipp> -#include <boost/asio/detail/impl/kqueue_reactor.ipp> -#include <boost/asio/detail/impl/null_event.ipp> -#include <boost/asio/detail/impl/pipe_select_interrupter.ipp> -#include <boost/asio/detail/impl/posix_event.ipp> -#include <boost/asio/detail/impl/posix_mutex.ipp> -#include <boost/asio/detail/impl/posix_thread.ipp> -#include <boost/asio/detail/impl/posix_tss_ptr.ipp> -#include <boost/asio/detail/impl/reactive_descriptor_service.ipp> -#include <boost/asio/detail/impl/reactive_serial_port_service.ipp> -#include <boost/asio/detail/impl/reactive_socket_service_base.ipp> -#include <boost/asio/detail/impl/resolver_service_base.ipp> -#include <boost/asio/detail/impl/scheduler.ipp> -#include <boost/asio/detail/impl/select_reactor.ipp> -#include <boost/asio/detail/impl/service_registry.ipp> -#include <boost/asio/detail/impl/signal_set_service.ipp> -#include <boost/asio/detail/impl/socket_ops.ipp> -#include <boost/asio/detail/impl/socket_select_interrupter.ipp> -#include <boost/asio/detail/impl/strand_executor_service.ipp> -#include <boost/asio/detail/impl/strand_service.ipp> -#include <boost/asio/detail/impl/throw_error.ipp> -#include <boost/asio/detail/impl/timer_queue_ptime.ipp> -#include <boost/asio/detail/impl/timer_queue_set.ipp> -#include <boost/asio/detail/impl/win_iocp_handle_service.ipp> -#include <boost/asio/detail/impl/win_iocp_io_context.ipp> -#include <boost/asio/detail/impl/win_iocp_serial_port_service.ipp> -#include <boost/asio/detail/impl/win_iocp_socket_service_base.ipp> -#include <boost/asio/detail/impl/win_event.ipp> -#include <boost/asio/detail/impl/win_mutex.ipp> -#include <boost/asio/detail/impl/win_object_handle_service.ipp> -#include <boost/asio/detail/impl/win_static_mutex.ipp> -#include <boost/asio/detail/impl/win_thread.ipp> -#include <boost/asio/detail/impl/win_tss_ptr.ipp> -#include <boost/asio/detail/impl/winrt_ssocket_service_base.ipp> -#include <boost/asio/detail/impl/winrt_timer_scheduler.ipp> -#include <boost/asio/detail/impl/winsock_init.ipp> -#include <boost/asio/generic/detail/impl/endpoint.ipp> -#include <boost/asio/ip/impl/address.ipp> -#include <boost/asio/ip/impl/address_v4.ipp> -#include <boost/asio/ip/impl/address_v6.ipp> -#include <boost/asio/ip/impl/host_name.ipp> -#include <boost/asio/ip/impl/network_v4.ipp> -#include <boost/asio/ip/impl/network_v6.ipp> -#include <boost/asio/ip/detail/impl/endpoint.ipp> -#include <boost/asio/local/detail/impl/endpoint.ipp> - -#endif // BOOST_ASIO_IMPL_SRC_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/thread_pool.hpp b/contrib/restricted/boost/boost/asio/impl/thread_pool.hpp deleted file mode 100644 index ed8d768cd0..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/thread_pool.hpp +++ /dev/null @@ -1,129 +0,0 @@ -// -// impl/thread_pool.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_THREAD_POOL_HPP -#define BOOST_ASIO_IMPL_THREAD_POOL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/executor_op.hpp> -#include <boost/asio/detail/fenced_block.hpp> -#include <boost/asio/detail/recycling_allocator.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/execution_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -inline thread_pool::executor_type -thread_pool::get_executor() BOOST_ASIO_NOEXCEPT -{ - return executor_type(*this); -} - -inline thread_pool& -thread_pool::executor_type::context() const BOOST_ASIO_NOEXCEPT -{ - return pool_; -} - -inline void -thread_pool::executor_type::on_work_started() const BOOST_ASIO_NOEXCEPT -{ - pool_.scheduler_.work_started(); -} - -inline void thread_pool::executor_type::on_work_finished() -const BOOST_ASIO_NOEXCEPT -{ - pool_.scheduler_.work_finished(); -} - -template <typename Function, typename Allocator> -void thread_pool::executor_type::dispatch( - BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const -{ - typedef typename decay<Function>::type function_type; - - // Invoke immediately if we are already inside the thread pool. - if (pool_.scheduler_.can_dispatch()) - { - // Make a local, non-const copy of the function. - function_type tmp(BOOST_ASIO_MOVE_CAST(Function)(f)); - - detail::fenced_block b(detail::fenced_block::full); - boost_asio_handler_invoke_helpers::invoke(tmp, tmp); - return; - } - - // Allocate and construct an operation to wrap the function. - typedef detail::executor_op<function_type, Allocator> op; - typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; - p.p = new (p.v) op(BOOST_ASIO_MOVE_CAST(Function)(f), a); - - BOOST_ASIO_HANDLER_CREATION((pool_, *p.p, - "thread_pool", &this->context(), 0, "dispatch")); - - pool_.scheduler_.post_immediate_completion(p.p, false); - p.v = p.p = 0; -} - -template <typename Function, typename Allocator> -void thread_pool::executor_type::post( - BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const -{ - typedef typename decay<Function>::type function_type; - - // Allocate and construct an operation to wrap the function. - typedef detail::executor_op<function_type, Allocator> op; - typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; - p.p = new (p.v) op(BOOST_ASIO_MOVE_CAST(Function)(f), a); - - BOOST_ASIO_HANDLER_CREATION((pool_, *p.p, - "thread_pool", &this->context(), 0, "post")); - - pool_.scheduler_.post_immediate_completion(p.p, false); - p.v = p.p = 0; -} - -template <typename Function, typename Allocator> -void thread_pool::executor_type::defer( - BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const -{ - typedef typename decay<Function>::type function_type; - - // Allocate and construct an operation to wrap the function. - typedef detail::executor_op<function_type, Allocator> op; - typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; - p.p = new (p.v) op(BOOST_ASIO_MOVE_CAST(Function)(f), a); - - BOOST_ASIO_HANDLER_CREATION((pool_, *p.p, - "thread_pool", &this->context(), 0, "defer")); - - pool_.scheduler_.post_immediate_completion(p.p, true); - p.v = p.p = 0; -} - -inline bool -thread_pool::executor_type::running_in_this_thread() const BOOST_ASIO_NOEXCEPT -{ - return pool_.scheduler_.can_dispatch(); -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_THREAD_POOL_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/thread_pool.ipp b/contrib/restricted/boost/boost/asio/impl/thread_pool.ipp deleted file mode 100644 index e0952eb657..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/thread_pool.ipp +++ /dev/null @@ -1,78 +0,0 @@ -// -// impl/thread_pool.ipp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_THREAD_POOL_IPP -#define BOOST_ASIO_IMPL_THREAD_POOL_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/thread_pool.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -struct thread_pool::thread_function -{ - detail::scheduler* scheduler_; - - void operator()() - { - boost::system::error_code ec; - scheduler_->run(ec); - } -}; - -thread_pool::thread_pool() - : scheduler_(use_service<detail::scheduler>(*this)) -{ - scheduler_.work_started(); - - thread_function f = { &scheduler_ }; - std::size_t num_threads = detail::thread::hardware_concurrency() * 2; - threads_.create_threads(f, num_threads ? num_threads : 2); -} - -thread_pool::thread_pool(std::size_t num_threads) - : scheduler_(use_service<detail::scheduler>(*this)) -{ - scheduler_.work_started(); - - thread_function f = { &scheduler_ }; - threads_.create_threads(f, num_threads); -} - -thread_pool::~thread_pool() -{ - stop(); - join(); -} - -void thread_pool::stop() -{ - scheduler_.stop(); -} - -void thread_pool::join() -{ - scheduler_.work_finished(); - threads_.join(); -} - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_THREAD_POOL_IPP diff --git a/contrib/restricted/boost/boost/asio/impl/use_future.hpp b/contrib/restricted/boost/boost/asio/impl/use_future.hpp deleted file mode 100644 index a0e22acad3..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/use_future.hpp +++ /dev/null @@ -1,940 +0,0 @@ -// -// impl/use_future.hpp -// ~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_USE_FUTURE_HPP -#define BOOST_ASIO_IMPL_USE_FUTURE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <future> -#include <tuple> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/system/error_code.hpp> -#include <boost/asio/packaged_task.hpp> -#include <boost/system/system_error.hpp> -#include <boost/asio/system_executor.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename T, typename F, typename... Args> -inline void promise_invoke_and_set(std::promise<T>& p, - F& f, BOOST_ASIO_MOVE_ARG(Args)... args) -{ -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - try -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) - { - p.set_value(f(BOOST_ASIO_MOVE_CAST(Args)(args)...)); - } -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - catch (...) - { - p.set_exception(std::current_exception()); - } -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) -} - -template <typename F, typename... Args> -inline void promise_invoke_and_set(std::promise<void>& p, - F& f, BOOST_ASIO_MOVE_ARG(Args)... args) -{ -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - try -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) - { - f(BOOST_ASIO_MOVE_CAST(Args)(args)...); - p.set_value(); - } -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - catch (...) - { - p.set_exception(std::current_exception()); - } -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) -} - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename T, typename F> -inline void promise_invoke_and_set(std::promise<T>& p, F& f) -{ -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - try -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) - { - p.set_value(f()); - } -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - catch (...) - { - p.set_exception(std::current_exception()); - } -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) -} - -template <typename F, typename Args> -inline void promise_invoke_and_set(std::promise<void>& p, F& f) -{ -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - try -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) - { - f(); - p.set_value(); -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - } - catch (...) - { - p.set_exception(std::current_exception()); - } -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) -} - -#if defined(BOOST_ASIO_NO_EXCEPTIONS) - -#define BOOST_ASIO_PRIVATE_PROMISE_INVOKE_DEF(n) \ - template <typename T, typename F, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - inline void promise_invoke_and_set(std::promise<T>& p, \ - F& f, BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - p.set_value(f(BOOST_ASIO_VARIADIC_MOVE_ARGS(n))); \ - } \ - \ - template <typename F, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - inline void promise_invoke_and_set(std::promise<void>& p, \ - F& f, BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - f(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - p.set_value(); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_PROMISE_INVOKE_DEF) -#undef BOOST_ASIO_PRIVATE_PROMISE_INVOKE_DEF - -#else // defined(BOOST_ASIO_NO_EXCEPTIONS) - -#define BOOST_ASIO_PRIVATE_PROMISE_INVOKE_DEF(n) \ - template <typename T, typename F, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - inline void promise_invoke_and_set(std::promise<T>& p, \ - F& f, BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - try \ - { \ - p.set_value(f(BOOST_ASIO_VARIADIC_MOVE_ARGS(n))); \ - } \ - catch (...) \ - { \ - p.set_exception(std::current_exception()); \ - } \ - } \ - \ - template <typename F, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - inline void promise_invoke_and_set(std::promise<void>& p, \ - F& f, BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - try \ - { \ - f(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - p.set_value(); \ - } \ - catch (...) \ - { \ - p.set_exception(std::current_exception()); \ - } \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_PROMISE_INVOKE_DEF) -#undef BOOST_ASIO_PRIVATE_PROMISE_INVOKE_DEF - -#endif // defined(BOOST_ASIO_NO_EXCEPTIONS) - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -// A function object adapter to invoke a nullary function object and capture -// any exception thrown into a promise. -template <typename T, typename F> -class promise_invoker -{ -public: - promise_invoker(const shared_ptr<std::promise<T> >& p, - BOOST_ASIO_MOVE_ARG(F) f) - : p_(p), f_(BOOST_ASIO_MOVE_CAST(F)(f)) - { - } - - void operator()() - { -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - try -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) - { - f_(); - } -#if !defined(BOOST_ASIO_NO_EXCEPTIONS) - catch (...) - { - p_->set_exception(std::current_exception()); - } -#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) - } - -private: - shared_ptr<std::promise<T> > p_; - typename decay<F>::type f_; -}; - -// An executor that adapts the system_executor to capture any exeption thrown -// by a submitted function object and save it into a promise. -template <typename T> -class promise_executor -{ -public: - explicit promise_executor(const shared_ptr<std::promise<T> >& p) - : p_(p) - { - } - - execution_context& context() const BOOST_ASIO_NOEXCEPT - { - return system_executor().context(); - } - - void on_work_started() const BOOST_ASIO_NOEXCEPT {} - void on_work_finished() const BOOST_ASIO_NOEXCEPT {} - - template <typename F, typename A> - void dispatch(BOOST_ASIO_MOVE_ARG(F) f, const A&) const - { - promise_invoker<T, F>(p_, BOOST_ASIO_MOVE_CAST(F)(f))(); - } - - template <typename F, typename A> - void post(BOOST_ASIO_MOVE_ARG(F) f, const A& a) const - { - system_executor().post( - promise_invoker<T, F>(p_, BOOST_ASIO_MOVE_CAST(F)(f)), a); - } - - template <typename F, typename A> - void defer(BOOST_ASIO_MOVE_ARG(F) f, const A& a) const - { - system_executor().defer( - promise_invoker<T, F>(p_, BOOST_ASIO_MOVE_CAST(F)(f)), a); - } - - friend bool operator==(const promise_executor& a, - const promise_executor& b) BOOST_ASIO_NOEXCEPT - { - return a.p_ == b.p_; - } - - friend bool operator!=(const promise_executor& a, - const promise_executor& b) BOOST_ASIO_NOEXCEPT - { - return a.p_ != b.p_; - } - -private: - shared_ptr<std::promise<T> > p_; -}; - -// The base class for all completion handlers that create promises. -template <typename T> -class promise_creator -{ -public: - typedef promise_executor<T> executor_type; - - executor_type get_executor() const BOOST_ASIO_NOEXCEPT - { - return executor_type(p_); - } - - typedef std::future<T> future_type; - - future_type get_future() - { - return p_->get_future(); - } - -protected: - template <typename Allocator> - void create_promise(const Allocator& a) - { - BOOST_ASIO_REBIND_ALLOC(Allocator, char) b(a); - p_ = std::allocate_shared<std::promise<T>>(b, std::allocator_arg, b); - } - - shared_ptr<std::promise<T> > p_; -}; - -// For completion signature void(). -class promise_handler_0 - : public promise_creator<void> -{ -public: - void operator()() - { - this->p_->set_value(); - } -}; - -// For completion signature void(error_code). -class promise_handler_ec_0 - : public promise_creator<void> -{ -public: - void operator()(const boost::system::error_code& ec) - { - if (ec) - { - this->p_->set_exception( - std::make_exception_ptr( - boost::system::system_error(ec))); - } - else - { - this->p_->set_value(); - } - } -}; - -// For completion signature void(exception_ptr). -class promise_handler_ex_0 - : public promise_creator<void> -{ -public: - void operator()(const std::exception_ptr& ex) - { - if (ex) - { - this->p_->set_exception(ex); - } - else - { - this->p_->set_value(); - } - } -}; - -// For completion signature void(T). -template <typename T> -class promise_handler_1 - : public promise_creator<T> -{ -public: - template <typename Arg> - void operator()(BOOST_ASIO_MOVE_ARG(Arg) arg) - { - this->p_->set_value(BOOST_ASIO_MOVE_CAST(Arg)(arg)); - } -}; - -// For completion signature void(error_code, T). -template <typename T> -class promise_handler_ec_1 - : public promise_creator<T> -{ -public: - template <typename Arg> - void operator()(const boost::system::error_code& ec, - BOOST_ASIO_MOVE_ARG(Arg) arg) - { - if (ec) - { - this->p_->set_exception( - std::make_exception_ptr( - boost::system::system_error(ec))); - } - else - this->p_->set_value(BOOST_ASIO_MOVE_CAST(Arg)(arg)); - } -}; - -// For completion signature void(exception_ptr, T). -template <typename T> -class promise_handler_ex_1 - : public promise_creator<T> -{ -public: - template <typename Arg> - void operator()(const std::exception_ptr& ex, - BOOST_ASIO_MOVE_ARG(Arg) arg) - { - if (ex) - this->p_->set_exception(ex); - else - this->p_->set_value(BOOST_ASIO_MOVE_CAST(Arg)(arg)); - } -}; - -// For completion signature void(T1, ..., Tn); -template <typename T> -class promise_handler_n - : public promise_creator<T> -{ -public: -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename... Args> - void operator()(BOOST_ASIO_MOVE_ARG(Args)... args) - { - this->p_->set_value( - std::forward_as_tuple( - BOOST_ASIO_MOVE_CAST(Args)(args)...)); - } - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#define BOOST_ASIO_PRIVATE_CALL_OP_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - void operator()(BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - {\ - this->p_->set_value( \ - std::forward_as_tuple( \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n))); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CALL_OP_DEF) -#undef BOOST_ASIO_PRIVATE_CALL_OP_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) -}; - -// For completion signature void(error_code, T1, ..., Tn); -template <typename T> -class promise_handler_ec_n - : public promise_creator<T> -{ -public: -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename... Args> - void operator()(const boost::system::error_code& ec, - BOOST_ASIO_MOVE_ARG(Args)... args) - { - if (ec) - { - this->p_->set_exception( - std::make_exception_ptr( - boost::system::system_error(ec))); - } - else - { - this->p_->set_value( - std::forward_as_tuple( - BOOST_ASIO_MOVE_CAST(Args)(args)...)); - } - } - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#define BOOST_ASIO_PRIVATE_CALL_OP_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - void operator()(const boost::system::error_code& ec, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - {\ - if (ec) \ - { \ - this->p_->set_exception( \ - std::make_exception_ptr( \ - boost::system::system_error(ec))); \ - } \ - else \ - { \ - this->p_->set_value( \ - std::forward_as_tuple( \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n))); \ - } \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CALL_OP_DEF) -#undef BOOST_ASIO_PRIVATE_CALL_OP_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) -}; - -// For completion signature void(exception_ptr, T1, ..., Tn); -template <typename T> -class promise_handler_ex_n - : public promise_creator<T> -{ -public: -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename... Args> - void operator()(const std::exception_ptr& ex, - BOOST_ASIO_MOVE_ARG(Args)... args) - { - if (ex) - this->p_->set_exception(ex); - else - { - this->p_->set_value( - std::forward_as_tuple( - BOOST_ASIO_MOVE_CAST(Args)(args)...)); - } - } - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#define BOOST_ASIO_PRIVATE_CALL_OP_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - void operator()(const std::exception_ptr& ex, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - {\ - if (ex) \ - this->p_->set_exception(ex); \ - else \ - { \ - this->p_->set_value( \ - std::forward_as_tuple( \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n))); \ - } \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CALL_OP_DEF) -#undef BOOST_ASIO_PRIVATE_CALL_OP_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) -}; - -// Helper template to choose the appropriate concrete promise handler -// implementation based on the supplied completion signature. -template <typename> class promise_handler_selector; - -template <> -class promise_handler_selector<void()> - : public promise_handler_0 {}; - -template <> -class promise_handler_selector<void(boost::system::error_code)> - : public promise_handler_ec_0 {}; - -template <> -class promise_handler_selector<void(std::exception_ptr)> - : public promise_handler_ex_0 {}; - -template <typename Arg> -class promise_handler_selector<void(Arg)> - : public promise_handler_1<Arg> {}; - -template <typename Arg> -class promise_handler_selector<void(boost::system::error_code, Arg)> - : public promise_handler_ec_1<Arg> {}; - -template <typename Arg> -class promise_handler_selector<void(std::exception_ptr, Arg)> - : public promise_handler_ex_1<Arg> {}; - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename... Arg> -class promise_handler_selector<void(Arg...)> - : public promise_handler_n<std::tuple<Arg...> > {}; - -template <typename... Arg> -class promise_handler_selector<void(boost::system::error_code, Arg...)> - : public promise_handler_ec_n<std::tuple<Arg...> > {}; - -template <typename... Arg> -class promise_handler_selector<void(std::exception_ptr, Arg...)> - : public promise_handler_ex_n<std::tuple<Arg...> > {}; - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#define BOOST_ASIO_PRIVATE_PROMISE_SELECTOR_DEF(n) \ - template <typename Arg, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - class promise_handler_selector< \ - void(Arg, BOOST_ASIO_VARIADIC_TARGS(n))> \ - : public promise_handler_n< \ - std::tuple<Arg, BOOST_ASIO_VARIADIC_TARGS(n)> > {}; \ - \ - template <typename Arg, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - class promise_handler_selector< \ - void(boost::system::error_code, Arg, BOOST_ASIO_VARIADIC_TARGS(n))> \ - : public promise_handler_ec_n< \ - std::tuple<Arg, BOOST_ASIO_VARIADIC_TARGS(n)> > {}; \ - \ - template <typename Arg, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - class promise_handler_selector< \ - void(std::exception_ptr, Arg, BOOST_ASIO_VARIADIC_TARGS(n))> \ - : public promise_handler_ex_n< \ - std::tuple<Arg, BOOST_ASIO_VARIADIC_TARGS(n)> > {}; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_PROMISE_SELECTOR_DEF) -#undef BOOST_ASIO_PRIVATE_PROMISE_SELECTOR_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -// Completion handlers produced from the use_future completion token, when not -// using use_future::operator(). -template <typename Signature, typename Allocator> -class promise_handler - : public promise_handler_selector<Signature> -{ -public: - typedef Allocator allocator_type; - typedef void result_type; - - promise_handler(use_future_t<Allocator> u) - : allocator_(u.get_allocator()) - { - this->create_promise(allocator_); - } - - allocator_type get_allocator() const BOOST_ASIO_NOEXCEPT - { - return allocator_; - } - -private: - Allocator allocator_; -}; - -template <typename Function, typename Signature, typename Allocator> -inline void asio_handler_invoke(Function& f, - promise_handler<Signature, Allocator>* h) -{ - typename promise_handler<Signature, Allocator>::executor_type - ex(h->get_executor()); - ex.dispatch(BOOST_ASIO_MOVE_CAST(Function)(f), std::allocator<void>()); -} - -template <typename Function, typename Signature, typename Allocator> -inline void asio_handler_invoke(const Function& f, - promise_handler<Signature, Allocator>* h) -{ - typename promise_handler<Signature, Allocator>::executor_type - ex(h->get_executor()); - ex.dispatch(f, std::allocator<void>()); -} - -// Helper base class for async_result specialisation. -template <typename Signature, typename Allocator> -class promise_async_result -{ -public: - typedef promise_handler<Signature, Allocator> completion_handler_type; - typedef typename completion_handler_type::future_type return_type; - - explicit promise_async_result(completion_handler_type& h) - : future_(h.get_future()) - { - } - - return_type get() - { - return BOOST_ASIO_MOVE_CAST(return_type)(future_); - } - -private: - return_type future_; -}; - -// Return value from use_future::operator(). -template <typename Function, typename Allocator> -class packaged_token -{ -public: - packaged_token(Function f, const Allocator& a) - : function_(BOOST_ASIO_MOVE_CAST(Function)(f)), - allocator_(a) - { - } - -//private: - Function function_; - Allocator allocator_; -}; - -// Completion handlers produced from the use_future completion token, when -// using use_future::operator(). -template <typename Function, typename Allocator, typename Result> -class packaged_handler - : public promise_creator<Result> -{ -public: - typedef Allocator allocator_type; - typedef void result_type; - - packaged_handler(packaged_token<Function, Allocator> t) - : function_(BOOST_ASIO_MOVE_CAST(Function)(t.function_)), - allocator_(t.allocator_) - { - this->create_promise(allocator_); - } - - allocator_type get_allocator() const BOOST_ASIO_NOEXCEPT - { - return allocator_; - } - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename... Args> - void operator()(BOOST_ASIO_MOVE_ARG(Args)... args) - { - (promise_invoke_and_set)(*this->p_, - function_, BOOST_ASIO_MOVE_CAST(Args)(args)...); - } - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - void operator()() - { - (promise_invoke_and_set)(*this->p_, function_); - } - -#define BOOST_ASIO_PRIVATE_CALL_OP_DEF(n) \ - template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - void operator()(BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - {\ - (promise_invoke_and_set)(*this->p_, \ - function_, BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CALL_OP_DEF) -#undef BOOST_ASIO_PRIVATE_CALL_OP_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -private: - Function function_; - Allocator allocator_; -}; - -template <typename Function, - typename Function1, typename Allocator, typename Result> -inline void asio_handler_invoke(Function& f, - packaged_handler<Function1, Allocator, Result>* h) -{ - typename packaged_handler<Function1, Allocator, Result>::executor_type - ex(h->get_executor()); - ex.dispatch(BOOST_ASIO_MOVE_CAST(Function)(f), std::allocator<void>()); -} - -template <typename Function, - typename Function1, typename Allocator, typename Result> -inline void asio_handler_invoke(const Function& f, - packaged_handler<Function1, Allocator, Result>* h) -{ - typename packaged_handler<Function1, Allocator, Result>::executor_type - ex(h->get_executor()); - ex.dispatch(f, std::allocator<void>()); -} - -// Helper base class for async_result specialisation. -template <typename Function, typename Allocator, typename Result> -class packaged_async_result -{ -public: - typedef packaged_handler<Function, Allocator, Result> completion_handler_type; - typedef typename completion_handler_type::future_type return_type; - - explicit packaged_async_result(completion_handler_type& h) - : future_(h.get_future()) - { - } - - return_type get() - { - return BOOST_ASIO_MOVE_CAST(return_type)(future_); - } - -private: - return_type future_; -}; - -} // namespace detail - -template <typename Allocator> template <typename Function> -inline detail::packaged_token<typename decay<Function>::type, Allocator> -use_future_t<Allocator>::operator()(BOOST_ASIO_MOVE_ARG(Function) f) const -{ - return detail::packaged_token<typename decay<Function>::type, Allocator>( - BOOST_ASIO_MOVE_CAST(Function)(f), allocator_); -} - -#if !defined(GENERATING_DOCUMENTATION) - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename Allocator, typename Result, typename... Args> -class async_result<use_future_t<Allocator>, Result(Args...)> - : public detail::promise_async_result< - void(typename decay<Args>::type...), Allocator> -{ -public: - explicit async_result( - typename detail::promise_async_result<void(typename decay<Args>::type...), - Allocator>::completion_handler_type& h) - : detail::promise_async_result< - void(typename decay<Args>::type...), Allocator>(h) - { - } -}; - -template <typename Function, typename Allocator, - typename Result, typename... Args> -class async_result<detail::packaged_token<Function, Allocator>, Result(Args...)> - : public detail::packaged_async_result<Function, Allocator, - typename result_of<Function(Args...)>::type> -{ -public: - explicit async_result( - typename detail::packaged_async_result<Function, Allocator, - typename result_of<Function(Args...)>::type>::completion_handler_type& h) - : detail::packaged_async_result<Function, Allocator, - typename result_of<Function(Args...)>::type>(h) - { - } -}; - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename Allocator, typename Result> -class async_result<use_future_t<Allocator>, Result()> - : public detail::promise_async_result<void(), Allocator> -{ -public: - explicit async_result( - typename detail::promise_async_result< - void(), Allocator>::completion_handler_type& h) - : detail::promise_async_result<void(), Allocator>(h) - { - } -}; - -template <typename Function, typename Allocator, typename Result> -class async_result<detail::packaged_token<Function, Allocator>, Result()> - : public detail::packaged_async_result<Function, Allocator, - typename result_of<Function()>::type> -{ -public: - explicit async_result( - typename detail::packaged_async_result<Function, Allocator, - typename result_of<Function()>::type>::completion_handler_type& h) - : detail::packaged_async_result<Function, Allocator, - typename result_of<Function()>::type>(h) - { - } -}; - -#define BOOST_ASIO_PRIVATE_ASYNC_RESULT_DEF(n) \ - template <typename Allocator, \ - typename Result, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - class async_result<use_future_t<Allocator>, \ - Result(BOOST_ASIO_VARIADIC_TARGS(n))> \ - : public detail::promise_async_result< \ - void(BOOST_ASIO_VARIADIC_DECAY(n)), Allocator> \ - { \ - public: \ - explicit async_result( \ - typename detail::promise_async_result< \ - void(BOOST_ASIO_VARIADIC_DECAY(n)), \ - Allocator>::completion_handler_type& h) \ - : detail::promise_async_result< \ - void(BOOST_ASIO_VARIADIC_DECAY(n)), Allocator>(h) \ - { \ - } \ - }; \ - \ - template <typename Function, typename Allocator, \ - typename Result, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - class async_result<detail::packaged_token<Function, Allocator>, \ - Result(BOOST_ASIO_VARIADIC_TARGS(n))> \ - : public detail::packaged_async_result<Function, Allocator, \ - typename result_of<Function(BOOST_ASIO_VARIADIC_TARGS(n))>::type> \ - { \ - public: \ - explicit async_result( \ - typename detail::packaged_async_result<Function, Allocator, \ - typename result_of<Function(BOOST_ASIO_VARIADIC_TARGS(n))>::type \ - >::completion_handler_type& h) \ - : detail::packaged_async_result<Function, Allocator, \ - typename result_of<Function(BOOST_ASIO_VARIADIC_TARGS(n))>::type>(h) \ - { \ - } \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_ASYNC_RESULT_DEF) -#undef BOOST_ASIO_PRIVATE_ASYNC_RESULT_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - -template <typename Allocator, typename Signature> -struct handler_type<use_future_t<Allocator>, Signature> -{ - typedef typename async_result<use_future_t<Allocator>, - Signature>::completion_handler_type type; -}; - -template <typename Signature, typename Allocator> -class async_result<detail::promise_handler<Signature, Allocator> > - : public detail::promise_async_result<Signature, Allocator> -{ -public: - typedef typename detail::promise_async_result< - Signature, Allocator>::return_type type; - - explicit async_result( - typename detail::promise_async_result< - Signature, Allocator>::completion_handler_type& h) - : detail::promise_async_result<Signature, Allocator>(h) - { - } -}; - -template <typename Function, typename Allocator, typename Signature> -struct handler_type<detail::packaged_token<Function, Allocator>, Signature> -{ - typedef typename async_result<detail::packaged_token<Function, Allocator>, - Signature>::completion_handler_type type; -}; - -template <typename Function, typename Allocator, typename Result> -class async_result<detail::packaged_handler<Function, Allocator, Result> > - : public detail::packaged_async_result<Function, Allocator, Result> -{ -public: - typedef typename detail::packaged_async_result< - Function, Allocator, Result>::return_type type; - - explicit async_result( - typename detail::packaged_async_result< - Function, Allocator, Result>::completion_handler_type& h) - : detail::packaged_async_result<Function, Allocator, Result>(h) - { - } -}; - -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - -#endif // !defined(GENERATING_DOCUMENTATION) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_USE_FUTURE_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/write.hpp b/contrib/restricted/boost/boost/asio/impl/write.hpp deleted file mode 100644 index 0be48b89f4..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/write.hpp +++ /dev/null @@ -1,676 +0,0 @@ -// -// impl/write.hpp -// ~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_WRITE_HPP -#define BOOST_ASIO_IMPL_WRITE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/completion_condition.hpp> -#include <boost/asio/detail/array_fwd.hpp> -#include <boost/asio/detail/base_from_completion_cond.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/consuming_buffers.hpp> -#include <boost/asio/detail/dependent_type.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail -{ - template <typename SyncWriteStream, typename ConstBufferSequence, - typename ConstBufferIterator, typename CompletionCondition> - std::size_t write_buffer_sequence(SyncWriteStream& s, - const ConstBufferSequence& buffers, const ConstBufferIterator&, - CompletionCondition completion_condition, boost::system::error_code& ec) - { - ec = boost::system::error_code(); - boost::asio::detail::consuming_buffers<const_buffer, - ConstBufferSequence, ConstBufferIterator> tmp(buffers); - while (!tmp.empty()) - { - if (std::size_t max_size = detail::adapt_completion_condition_result( - completion_condition(ec, tmp.total_consumed()))) - tmp.consume(s.write_some(tmp.prepare(max_size), ec)); - else - break; - } - return tmp.total_consumed();; - } -} // namespace detail - -template <typename SyncWriteStream, typename ConstBufferSequence, - typename CompletionCondition> -inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, boost::system::error_code& ec, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type*) -{ - return detail::write_buffer_sequence(s, buffers, - boost::asio::buffer_sequence_begin(buffers), completion_condition, ec); -} - -template <typename SyncWriteStream, typename ConstBufferSequence> -inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type*) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = write(s, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec, "write"); - return bytes_transferred; -} - -template <typename SyncWriteStream, typename ConstBufferSequence> -inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, - boost::system::error_code& ec, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type*) -{ - return write(s, buffers, transfer_all(), ec); -} - -template <typename SyncWriteStream, typename ConstBufferSequence, - typename CompletionCondition> -inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type*) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = write(s, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec, "write"); - return bytes_transferred; -} - -template <typename SyncWriteStream, typename DynamicBuffer, - typename CompletionCondition> -std::size_t write(SyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, boost::system::error_code& ec, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - typename decay<DynamicBuffer>::type b( - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers)); - - std::size_t bytes_transferred = write(s, b.data(), completion_condition, ec); - b.consume(bytes_transferred); - return bytes_transferred; -} - -template <typename SyncWriteStream, typename DynamicBuffer> -inline std::size_t write(SyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = write(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - transfer_all(), ec); - boost::asio::detail::throw_error(ec, "write"); - return bytes_transferred; -} - -template <typename SyncWriteStream, typename DynamicBuffer> -inline std::size_t write(SyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - boost::system::error_code& ec, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - return write(s, BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - transfer_all(), ec); -} - -template <typename SyncWriteStream, typename DynamicBuffer, - typename CompletionCondition> -inline std::size_t write(SyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = write(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - completion_condition, ec); - boost::asio::detail::throw_error(ec, "write"); - return bytes_transferred; -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -template <typename SyncWriteStream, typename Allocator, - typename CompletionCondition> -inline std::size_t write(SyncWriteStream& s, - boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, boost::system::error_code& ec) -{ - return write(s, basic_streambuf_ref<Allocator>(b), completion_condition, ec); -} - -template <typename SyncWriteStream, typename Allocator> -inline std::size_t write(SyncWriteStream& s, - boost::asio::basic_streambuf<Allocator>& b) -{ - return write(s, basic_streambuf_ref<Allocator>(b)); -} - -template <typename SyncWriteStream, typename Allocator> -inline std::size_t write(SyncWriteStream& s, - boost::asio::basic_streambuf<Allocator>& b, - boost::system::error_code& ec) -{ - return write(s, basic_streambuf_ref<Allocator>(b), ec); -} - -template <typename SyncWriteStream, typename Allocator, - typename CompletionCondition> -inline std::size_t write(SyncWriteStream& s, - boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition) -{ - return write(s, basic_streambuf_ref<Allocator>(b), completion_condition); -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -namespace detail -{ - template <typename AsyncWriteStream, typename ConstBufferSequence, - typename ConstBufferIterator, typename CompletionCondition, - typename WriteHandler> - class write_op - : detail::base_from_completion_cond<CompletionCondition> - { - public: - write_op(AsyncWriteStream& stream, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler& handler) - : detail::base_from_completion_cond< - CompletionCondition>(completion_condition), - stream_(stream), - buffers_(buffers), - start_(0), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - write_op(const write_op& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - stream_(other.stream_), - buffers_(other.buffers_), - start_(other.start_), - handler_(other.handler_) - { - } - - write_op(write_op&& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - stream_(other.stream_), - buffers_(other.buffers_), - start_(other.start_), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - std::size_t max_size; - switch (start_ = start) - { - case 1: - max_size = this->check_for_completion(ec, buffers_.total_consumed()); - do - { - stream_.async_write_some(buffers_.prepare(max_size), - BOOST_ASIO_MOVE_CAST(write_op)(*this)); - return; default: - buffers_.consume(bytes_transferred); - if ((!ec && bytes_transferred == 0) || buffers_.empty()) - break; - max_size = this->check_for_completion(ec, buffers_.total_consumed()); - } while (max_size > 0); - - handler_(ec, buffers_.total_consumed()); - } - } - - //private: - AsyncWriteStream& stream_; - boost::asio::detail::consuming_buffers<const_buffer, - ConstBufferSequence, ConstBufferIterator> buffers_; - int start_; - WriteHandler handler_; - }; - - template <typename AsyncWriteStream, typename ConstBufferSequence, - typename ConstBufferIterator, typename CompletionCondition, - typename WriteHandler> - inline void* asio_handler_allocate(std::size_t size, - write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, - CompletionCondition, WriteHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncWriteStream, typename ConstBufferSequence, - typename ConstBufferIterator, typename CompletionCondition, - typename WriteHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, - CompletionCondition, WriteHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncWriteStream, typename ConstBufferSequence, - typename ConstBufferIterator, typename CompletionCondition, - typename WriteHandler> - inline bool asio_handler_is_continuation( - write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, - CompletionCondition, WriteHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncWriteStream, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler> - inline void asio_handler_invoke(Function& function, - write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, - CompletionCondition, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncWriteStream, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler> - inline void asio_handler_invoke(const Function& function, - write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, - CompletionCondition, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename AsyncWriteStream, typename ConstBufferSequence, - typename ConstBufferIterator, typename CompletionCondition, - typename WriteHandler> - inline void start_write_buffer_sequence_op(AsyncWriteStream& stream, - const ConstBufferSequence& buffers, const ConstBufferIterator&, - CompletionCondition completion_condition, WriteHandler& handler) - { - detail::write_op<AsyncWriteStream, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>( - stream, buffers, completion_condition, handler)( - boost::system::error_code(), 0, 1); - } - -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncWriteStream, typename ConstBufferSequence, - typename ConstBufferIterator, typename CompletionCondition, - typename WriteHandler, typename Allocator> -struct associated_allocator< - detail::write_op<AsyncWriteStream, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>, - Allocator> -{ - typedef typename associated_allocator<WriteHandler, Allocator>::type type; - - static type get( - const detail::write_op<AsyncWriteStream, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<WriteHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncWriteStream, typename ConstBufferSequence, - typename ConstBufferIterator, typename CompletionCondition, - typename WriteHandler, typename Executor> -struct associated_executor< - detail::write_op<AsyncWriteStream, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>, - Executor> -{ - typedef typename associated_executor<WriteHandler, Executor>::type type; - - static type get( - const detail::write_op<AsyncWriteStream, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<WriteHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncWriteStream, typename ConstBufferSequence, - typename CompletionCondition, typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::start_write_buffer_sequence_op(s, buffers, - boost::asio::buffer_sequence_begin(buffers), completion_condition, - init.completion_handler); - - return init.result.get(); -} - -template <typename AsyncWriteStream, typename ConstBufferSequence, - typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::start_write_buffer_sequence_op(s, buffers, - boost::asio::buffer_sequence_begin(buffers), transfer_all(), - init.completion_handler); - - return init.result.get(); -} - -namespace detail -{ - template <typename AsyncWriteStream, typename DynamicBuffer, - typename CompletionCondition, typename WriteHandler> - class write_dynbuf_op - { - public: - template <typename BufferSequence> - write_dynbuf_op(AsyncWriteStream& stream, - BOOST_ASIO_MOVE_ARG(BufferSequence) buffers, - CompletionCondition completion_condition, WriteHandler& handler) - : stream_(stream), - buffers_(BOOST_ASIO_MOVE_CAST(BufferSequence)(buffers)), - completion_condition_( - BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition)), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - write_dynbuf_op(const write_dynbuf_op& other) - : stream_(other.stream_), - buffers_(other.buffers_), - completion_condition_(other.completion_condition_), - handler_(other.handler_) - { - } - - write_dynbuf_op(write_dynbuf_op&& other) - : stream_(other.stream_), - buffers_(BOOST_ASIO_MOVE_CAST(DynamicBuffer)(other.buffers_)), - completion_condition_( - BOOST_ASIO_MOVE_CAST(CompletionCondition)( - other.completion_condition_)), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - switch (start) - { - case 1: - async_write(stream_, buffers_.data(), completion_condition_, - BOOST_ASIO_MOVE_CAST(write_dynbuf_op)(*this)); - return; default: - buffers_.consume(bytes_transferred); - handler_(ec, static_cast<const std::size_t&>(bytes_transferred)); - } - } - - //private: - AsyncWriteStream& stream_; - DynamicBuffer buffers_; - CompletionCondition completion_condition_; - WriteHandler handler_; - }; - - template <typename AsyncWriteStream, typename DynamicBuffer, - typename CompletionCondition, typename WriteHandler> - inline void* asio_handler_allocate(std::size_t size, - write_dynbuf_op<AsyncWriteStream, DynamicBuffer, - CompletionCondition, WriteHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncWriteStream, typename DynamicBuffer, - typename CompletionCondition, typename WriteHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - write_dynbuf_op<AsyncWriteStream, DynamicBuffer, - CompletionCondition, WriteHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncWriteStream, typename DynamicBuffer, - typename CompletionCondition, typename WriteHandler> - inline bool asio_handler_is_continuation( - write_dynbuf_op<AsyncWriteStream, DynamicBuffer, - CompletionCondition, WriteHandler>* this_handler) - { - return boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncWriteStream, - typename DynamicBuffer, typename CompletionCondition, - typename WriteHandler> - inline void asio_handler_invoke(Function& function, - write_dynbuf_op<AsyncWriteStream, DynamicBuffer, - CompletionCondition, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncWriteStream, - typename DynamicBuffer, typename CompletionCondition, - typename WriteHandler> - inline void asio_handler_invoke(const Function& function, - write_dynbuf_op<AsyncWriteStream, DynamicBuffer, - CompletionCondition, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncWriteStream, typename DynamicBuffer, - typename CompletionCondition, typename WriteHandler, typename Allocator> -struct associated_allocator< - detail::write_dynbuf_op<AsyncWriteStream, - DynamicBuffer, CompletionCondition, WriteHandler>, - Allocator> -{ - typedef typename associated_allocator<WriteHandler, Allocator>::type type; - - static type get( - const detail::write_dynbuf_op<AsyncWriteStream, - DynamicBuffer, CompletionCondition, WriteHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<WriteHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncWriteStream, typename DynamicBuffer, - typename CompletionCondition, typename WriteHandler, typename Executor> -struct associated_executor< - detail::write_dynbuf_op<AsyncWriteStream, - DynamicBuffer, CompletionCondition, WriteHandler>, - Executor> -{ - typedef typename associated_executor<WriteHandler, Executor>::type type; - - static type get( - const detail::write_dynbuf_op<AsyncWriteStream, - DynamicBuffer, CompletionCondition, WriteHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<WriteHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncWriteStream, - typename DynamicBuffer, typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - return async_write(s, - BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -} - -template <typename AsyncWriteStream, typename DynamicBuffer, - typename CompletionCondition, typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type*) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::write_dynbuf_op<AsyncWriteStream, - typename decay<DynamicBuffer>::type, - CompletionCondition, BOOST_ASIO_HANDLER_TYPE( - WriteHandler, void (boost::system::error_code, std::size_t))>( - s, BOOST_ASIO_MOVE_CAST(DynamicBuffer)(buffers), - completion_condition, init.completion_handler)( - boost::system::error_code(), 0, 1); - - return init.result.get(); -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -template <typename AsyncWriteStream, typename Allocator, typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, - boost::asio::basic_streambuf<Allocator>& b, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) -{ - return async_write(s, basic_streambuf_ref<Allocator>(b), - BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -} - -template <typename AsyncWriteStream, typename Allocator, - typename CompletionCondition, typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, - boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) -{ - return async_write(s, basic_streambuf_ref<Allocator>(b), - completion_condition, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_WRITE_HPP diff --git a/contrib/restricted/boost/boost/asio/impl/write_at.hpp b/contrib/restricted/boost/boost/asio/impl/write_at.hpp deleted file mode 100644 index 6b597d2085..0000000000 --- a/contrib/restricted/boost/boost/asio/impl/write_at.hpp +++ /dev/null @@ -1,574 +0,0 @@ -// -// impl/write_at.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IMPL_WRITE_AT_HPP -#define BOOST_ASIO_IMPL_WRITE_AT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/completion_condition.hpp> -#include <boost/asio/detail/array_fwd.hpp> -#include <boost/asio/detail/base_from_completion_cond.hpp> -#include <boost/asio/detail/bind_handler.hpp> -#include <boost/asio/detail/consuming_buffers.hpp> -#include <boost/asio/detail/dependent_type.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail -{ - template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, - typename ConstBufferIterator, typename CompletionCondition> - std::size_t write_at_buffer_sequence(SyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - const ConstBufferIterator&, CompletionCondition completion_condition, - boost::system::error_code& ec) - { - ec = boost::system::error_code(); - boost::asio::detail::consuming_buffers<const_buffer, - ConstBufferSequence, ConstBufferIterator> tmp(buffers); - while (!tmp.empty()) - { - if (std::size_t max_size = detail::adapt_completion_condition_result( - completion_condition(ec, tmp.total_consumed()))) - { - tmp.consume(d.write_some_at(offset + tmp.total_consumed(), - tmp.prepare(max_size), ec)); - } - else - break; - } - return tmp.total_consumed();; - } -} // namespace detail - -template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, - typename CompletionCondition> -std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, boost::system::error_code& ec) -{ - return detail::write_at_buffer_sequence(d, offset, buffers, - boost::asio::buffer_sequence_begin(buffers), completion_condition, ec); -} - -template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> -inline std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = write_at( - d, offset, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec, "write_at"); - return bytes_transferred; -} - -template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> -inline std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - boost::system::error_code& ec) -{ - return write_at(d, offset, buffers, transfer_all(), ec); -} - -template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, - typename CompletionCondition> -inline std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = write_at( - d, offset, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec, "write_at"); - return bytes_transferred; -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -template <typename SyncRandomAccessWriteDevice, typename Allocator, - typename CompletionCondition> -std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, boost::system::error_code& ec) -{ - std::size_t bytes_transferred = write_at( - d, offset, b.data(), completion_condition, ec); - b.consume(bytes_transferred); - return bytes_transferred; -} - -template <typename SyncRandomAccessWriteDevice, typename Allocator> -inline std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = write_at(d, offset, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec, "write_at"); - return bytes_transferred; -} - -template <typename SyncRandomAccessWriteDevice, typename Allocator> -inline std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - boost::system::error_code& ec) -{ - return write_at(d, offset, b, transfer_all(), ec); -} - -template <typename SyncRandomAccessWriteDevice, typename Allocator, - typename CompletionCondition> -inline std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition) -{ - boost::system::error_code ec; - std::size_t bytes_transferred = write_at( - d, offset, b, completion_condition, ec); - boost::asio::detail::throw_error(ec, "write_at"); - return bytes_transferred; -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -namespace detail -{ - template <typename AsyncRandomAccessWriteDevice, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler> - class write_at_op - : detail::base_from_completion_cond<CompletionCondition> - { - public: - write_at_op(AsyncRandomAccessWriteDevice& device, - uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler& handler) - : detail::base_from_completion_cond< - CompletionCondition>(completion_condition), - device_(device), - offset_(offset), - buffers_(buffers), - start_(0), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - write_at_op(const write_at_op& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - device_(other.device_), - offset_(other.offset_), - buffers_(other.buffers_), - start_(other.start_), - handler_(other.handler_) - { - } - - write_at_op(write_at_op&& other) - : detail::base_from_completion_cond<CompletionCondition>(other), - device_(other.device_), - offset_(other.offset_), - buffers_(other.buffers_), - start_(other.start_), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - std::size_t bytes_transferred, int start = 0) - { - std::size_t max_size; - switch (start_ = start) - { - case 1: - max_size = this->check_for_completion(ec, buffers_.total_consumed()); - do - { - device_.async_write_some_at( - offset_ + buffers_.total_consumed(), buffers_.prepare(max_size), - BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); - return; default: - buffers_.consume(bytes_transferred); - if ((!ec && bytes_transferred == 0) || buffers_.empty()) - break; - max_size = this->check_for_completion(ec, buffers_.total_consumed()); - } while (max_size > 0); - - handler_(ec, buffers_.total_consumed()); - } - } - - //private: - AsyncRandomAccessWriteDevice& device_; - uint64_t offset_; - boost::asio::detail::consuming_buffers<const_buffer, - ConstBufferSequence, ConstBufferIterator> buffers_; - int start_; - WriteHandler handler_; - }; - - template <typename AsyncRandomAccessWriteDevice, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler> - inline void* asio_handler_allocate(std::size_t size, - write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename AsyncRandomAccessWriteDevice, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename AsyncRandomAccessWriteDevice, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler> - inline bool asio_handler_is_continuation( - write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>* this_handler) - { - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename AsyncRandomAccessWriteDevice, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler> - inline void asio_handler_invoke(Function& function, - write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename AsyncRandomAccessWriteDevice, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler> - inline void asio_handler_invoke(const Function& function, - write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename AsyncRandomAccessWriteDevice, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler> - inline void start_write_at_buffer_sequence_op(AsyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - const ConstBufferIterator&, CompletionCondition completion_condition, - WriteHandler& handler) - { - detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>( - d, offset, buffers, completion_condition, handler)( - boost::system::error_code(), 0, 1); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncRandomAccessWriteDevice, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler, typename Allocator> -struct associated_allocator< - detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>, - Allocator> -{ - typedef typename associated_allocator<WriteHandler, Allocator>::type type; - - static type get( - const detail::write_at_op<AsyncRandomAccessWriteDevice, - ConstBufferSequence, ConstBufferIterator, - CompletionCondition, WriteHandler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<WriteHandler, Allocator>::get(h.handler_, a); - } -}; - -template <typename AsyncRandomAccessWriteDevice, - typename ConstBufferSequence, typename ConstBufferIterator, - typename CompletionCondition, typename WriteHandler, typename Executor> -struct associated_executor< - detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, - ConstBufferIterator, CompletionCondition, WriteHandler>, - Executor> -{ - typedef typename associated_executor<WriteHandler, Executor>::type type; - - static type get( - const detail::write_at_op<AsyncRandomAccessWriteDevice, - ConstBufferSequence, ConstBufferIterator, - CompletionCondition, WriteHandler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<WriteHandler, Executor>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, - typename CompletionCondition, typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write_at(AsyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::start_write_at_buffer_sequence_op(d, offset, buffers, - boost::asio::buffer_sequence_begin(buffers), completion_condition, - init.completion_handler); - - return init.result.get(); -} - -template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, - typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write_at(AsyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::start_write_at_buffer_sequence_op(d, offset, buffers, - boost::asio::buffer_sequence_begin(buffers), transfer_all(), - init.completion_handler); - - return init.result.get(); -} - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -namespace detail -{ - template <typename Allocator, typename WriteHandler> - class write_at_streambuf_op - { - public: - write_at_streambuf_op( - boost::asio::basic_streambuf<Allocator>& streambuf, - WriteHandler& handler) - : streambuf_(streambuf), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - write_at_streambuf_op(const write_at_streambuf_op& other) - : streambuf_(other.streambuf_), - handler_(other.handler_) - { - } - - write_at_streambuf_op(write_at_streambuf_op&& other) - : streambuf_(other.streambuf_), - handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(const boost::system::error_code& ec, - const std::size_t bytes_transferred) - { - streambuf_.consume(bytes_transferred); - handler_(ec, bytes_transferred); - } - - //private: - boost::asio::basic_streambuf<Allocator>& streambuf_; - WriteHandler handler_; - }; - - template <typename Allocator, typename WriteHandler> - inline void* asio_handler_allocate(std::size_t size, - write_at_streambuf_op<Allocator, WriteHandler>* this_handler) - { - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); - } - - template <typename Allocator, typename WriteHandler> - inline void asio_handler_deallocate(void* pointer, std::size_t size, - write_at_streambuf_op<Allocator, WriteHandler>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); - } - - template <typename Allocator, typename WriteHandler> - inline bool asio_handler_is_continuation( - write_at_streambuf_op<Allocator, WriteHandler>* this_handler) - { - return boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename Allocator, typename WriteHandler> - inline void asio_handler_invoke(Function& function, - write_at_streambuf_op<Allocator, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Function, typename Allocator, typename WriteHandler> - inline void asio_handler_invoke(const Function& function, - write_at_streambuf_op<Allocator, WriteHandler>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); - } - - template <typename Allocator, typename WriteHandler> - inline write_at_streambuf_op<Allocator, WriteHandler> - make_write_at_streambuf_op( - boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler) - { - return write_at_streambuf_op<Allocator, WriteHandler>(b, handler); - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <typename Allocator, typename WriteHandler, typename Allocator1> -struct associated_allocator< - detail::write_at_streambuf_op<Allocator, WriteHandler>, - Allocator1> -{ - typedef typename associated_allocator<WriteHandler, Allocator1>::type type; - - static type get( - const detail::write_at_streambuf_op<Allocator, WriteHandler>& h, - const Allocator1& a = Allocator1()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<WriteHandler, Allocator1>::get(h.handler_, a); - } -}; - -template <typename Executor, typename WriteHandler, typename Executor1> -struct associated_executor< - detail::write_at_streambuf_op<Executor, WriteHandler>, - Executor1> -{ - typedef typename associated_executor<WriteHandler, Executor1>::type type; - - static type get( - const detail::write_at_streambuf_op<Executor, WriteHandler>& h, - const Executor1& ex = Executor1()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<WriteHandler, Executor1>::get(h.handler_, ex); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - -template <typename AsyncRandomAccessWriteDevice, typename Allocator, - typename CompletionCondition, typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write_at(AsyncRandomAccessWriteDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - async_write_at(d, offset, b.data(), completion_condition, - detail::write_at_streambuf_op<Allocator, BOOST_ASIO_HANDLER_TYPE( - WriteHandler, void (boost::system::error_code, std::size_t))>( - b, init.completion_handler)); - - return init.result.get(); -} - -template <typename AsyncRandomAccessWriteDevice, typename Allocator, - typename WriteHandler> -inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write_at(AsyncRandomAccessWriteDevice& d, - uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) -{ - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - async_write_at(d, offset, b.data(), transfer_all(), - detail::write_at_streambuf_op<Allocator, BOOST_ASIO_HANDLER_TYPE( - WriteHandler, void (boost::system::error_code, std::size_t))>( - b, init.completion_handler)); - - return init.result.get(); -} - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_WRITE_AT_HPP diff --git a/contrib/restricted/boost/boost/asio/io_service_strand.hpp b/contrib/restricted/boost/boost/asio/io_service_strand.hpp deleted file mode 100644 index bb38c276c6..0000000000 --- a/contrib/restricted/boost/boost/asio/io_service_strand.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// io_service_strand.hpp -// ~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IO_SERVICE_STRAND_HPP -#define BOOST_ASIO_IO_SERVICE_STRAND_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/io_context_strand.hpp> - -#endif // BOOST_ASIO_IO_SERVICE_STRAND_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/address_v4_iterator.hpp b/contrib/restricted/boost/boost/asio/ip/address_v4_iterator.hpp deleted file mode 100644 index 3574cda1e9..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/address_v4_iterator.hpp +++ /dev/null @@ -1,164 +0,0 @@ -// -// ip/address_v4_iterator.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_ADDRESS_V4_ITERATOR_HPP -#define BOOST_ASIO_IP_ADDRESS_V4_ITERATOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/ip/address_v4.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -template <typename> class basic_address_iterator; - -/// An input iterator that can be used for traversing IPv4 addresses. -/** - * In addition to satisfying the input iterator requirements, this iterator - * also supports decrement. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <> class basic_address_iterator<address_v4> -{ -public: - /// The type of the elements pointed to by the iterator. - typedef address_v4 value_type; - - /// Distance between two iterators. - typedef std::ptrdiff_t difference_type; - - /// The type of a pointer to an element pointed to by the iterator. - typedef const address_v4* pointer; - - /// The type of a reference to an element pointed to by the iterator. - typedef const address_v4& reference; - - /// Denotes that the iterator satisfies the input iterator requirements. - typedef std::input_iterator_tag iterator_category; - - /// Construct an iterator that points to the specified address. - basic_address_iterator(const address_v4& addr) BOOST_ASIO_NOEXCEPT - : address_(addr) - { - } - - /// Copy constructor. - basic_address_iterator( - const basic_address_iterator& other) BOOST_ASIO_NOEXCEPT - : address_(other.address_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move constructor. - basic_address_iterator(basic_address_iterator&& other) BOOST_ASIO_NOEXCEPT - : address_(BOOST_ASIO_MOVE_CAST(address_v4)(other.address_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Assignment operator. - basic_address_iterator& operator=( - const basic_address_iterator& other) BOOST_ASIO_NOEXCEPT - { - address_ = other.address_; - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move assignment operator. - basic_address_iterator& operator=( - basic_address_iterator&& other) BOOST_ASIO_NOEXCEPT - { - address_ = BOOST_ASIO_MOVE_CAST(address_v4)(other.address_); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Dereference the iterator. - const address_v4& operator*() const BOOST_ASIO_NOEXCEPT - { - return address_; - } - - /// Dereference the iterator. - const address_v4* operator->() const BOOST_ASIO_NOEXCEPT - { - return &address_; - } - - /// Pre-increment operator. - basic_address_iterator& operator++() BOOST_ASIO_NOEXCEPT - { - address_ = address_v4((address_.to_uint() + 1) & 0xFFFFFFFF); - return *this; - } - - /// Post-increment operator. - basic_address_iterator operator++(int) BOOST_ASIO_NOEXCEPT - { - basic_address_iterator tmp(*this); - ++*this; - return tmp; - } - - /// Pre-decrement operator. - basic_address_iterator& operator--() BOOST_ASIO_NOEXCEPT - { - address_ = address_v4((address_.to_uint() - 1) & 0xFFFFFFFF); - return *this; - } - - /// Post-decrement operator. - basic_address_iterator operator--(int) - { - basic_address_iterator tmp(*this); - --*this; - return tmp; - } - - /// Compare two addresses for equality. - friend bool operator==(const basic_address_iterator& a, - const basic_address_iterator& b) - { - return a.address_ == b.address_; - } - - /// Compare two addresses for inequality. - friend bool operator!=(const basic_address_iterator& a, - const basic_address_iterator& b) - { - return a.address_ != b.address_; - } - -private: - address_v4 address_; -}; - -/// An input iterator that can be used for traversing IPv4 addresses. -typedef basic_address_iterator<address_v4> address_v4_iterator; - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_ADDRESS_V4_ITERATOR_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/address_v4_range.hpp b/contrib/restricted/boost/boost/asio/ip/address_v4_range.hpp deleted file mode 100644 index 261ead22ac..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/address_v4_range.hpp +++ /dev/null @@ -1,136 +0,0 @@ -// -// ip/address_v4_range.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_ADDRESS_V4_RANGE_HPP -#define BOOST_ASIO_IP_ADDRESS_V4_RANGE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/ip/address_v4_iterator.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -template <typename> class basic_address_range; - -/// Represents a range of IPv4 addresses. -/** - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <> class basic_address_range<address_v4> -{ -public: - /// The type of an iterator that points into the range. - typedef basic_address_iterator<address_v4> iterator; - - /// Construct an empty range. - basic_address_range() BOOST_ASIO_NOEXCEPT - : begin_(address_v4()), - end_(address_v4()) - { - } - - /// Construct an range that represents the given range of addresses. - explicit basic_address_range(const iterator& first, - const iterator& last) BOOST_ASIO_NOEXCEPT - : begin_(first), - end_(last) - { - } - - /// Copy constructor. - basic_address_range(const basic_address_range& other) BOOST_ASIO_NOEXCEPT - : begin_(other.begin_), - end_(other.end_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move constructor. - basic_address_range(basic_address_range&& other) BOOST_ASIO_NOEXCEPT - : begin_(BOOST_ASIO_MOVE_CAST(iterator)(other.begin_)), - end_(BOOST_ASIO_MOVE_CAST(iterator)(other.end_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Assignment operator. - basic_address_range& operator=( - const basic_address_range& other) BOOST_ASIO_NOEXCEPT - { - begin_ = other.begin_; - end_ = other.end_; - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move assignment operator. - basic_address_range& operator=( - basic_address_range&& other) BOOST_ASIO_NOEXCEPT - { - begin_ = BOOST_ASIO_MOVE_CAST(iterator)(other.begin_); - end_ = BOOST_ASIO_MOVE_CAST(iterator)(other.end_); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Obtain an iterator that points to the start of the range. - iterator begin() const BOOST_ASIO_NOEXCEPT - { - return begin_; - } - - /// Obtain an iterator that points to the end of the range. - iterator end() const BOOST_ASIO_NOEXCEPT - { - return end_; - } - - /// Determine whether the range is empty. - bool empty() const BOOST_ASIO_NOEXCEPT - { - return size() == 0; - } - - /// Return the size of the range. - std::size_t size() const BOOST_ASIO_NOEXCEPT - { - return end_->to_uint() - begin_->to_uint(); - } - - /// Find an address in the range. - iterator find(const address_v4& addr) const BOOST_ASIO_NOEXCEPT - { - return addr >= *begin_ && addr < *end_ ? iterator(addr) : end_; - } - -private: - iterator begin_; - iterator end_; -}; - -/// Represents a range of IPv4 addresses. -typedef basic_address_range<address_v4> address_v4_range; - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_ADDRESS_V4_RANGE_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/address_v6_iterator.hpp b/contrib/restricted/boost/boost/asio/ip/address_v6_iterator.hpp deleted file mode 100644 index 887b09f79a..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/address_v6_iterator.hpp +++ /dev/null @@ -1,185 +0,0 @@ -// -// ip/address_v6_iterator.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Oliver Kowalke (oliver dot kowalke at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_ADDRESS_V6_ITERATOR_HPP -#define BOOST_ASIO_IP_ADDRESS_V6_ITERATOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/ip/address_v6.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -template <typename> class basic_address_iterator; - -/// An input iterator that can be used for traversing IPv6 addresses. -/** - * In addition to satisfying the input iterator requirements, this iterator - * also supports decrement. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <> class basic_address_iterator<address_v6> -{ -public: - /// The type of the elements pointed to by the iterator. - typedef address_v6 value_type; - - /// Distance between two iterators. - typedef std::ptrdiff_t difference_type; - - /// The type of a pointer to an element pointed to by the iterator. - typedef const address_v6* pointer; - - /// The type of a reference to an element pointed to by the iterator. - typedef const address_v6& reference; - - /// Denotes that the iterator satisfies the input iterator requirements. - typedef std::input_iterator_tag iterator_category; - - /// Construct an iterator that points to the specified address. - basic_address_iterator(const address_v6& addr) BOOST_ASIO_NOEXCEPT - : address_(addr) - { - } - - /// Copy constructor. - basic_address_iterator( - const basic_address_iterator& other) BOOST_ASIO_NOEXCEPT - : address_(other.address_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move constructor. - basic_address_iterator(basic_address_iterator&& other) BOOST_ASIO_NOEXCEPT - : address_(BOOST_ASIO_MOVE_CAST(address_v6)(other.address_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Assignment operator. - basic_address_iterator& operator=( - const basic_address_iterator& other) BOOST_ASIO_NOEXCEPT - { - address_ = other.address_; - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move assignment operator. - basic_address_iterator& operator=( - basic_address_iterator&& other) BOOST_ASIO_NOEXCEPT - { - address_ = BOOST_ASIO_MOVE_CAST(address_v6)(other.address_); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Dereference the iterator. - const address_v6& operator*() const BOOST_ASIO_NOEXCEPT - { - return address_; - } - - /// Dereference the iterator. - const address_v6* operator->() const BOOST_ASIO_NOEXCEPT - { - return &address_; - } - - /// Pre-increment operator. - basic_address_iterator& operator++() BOOST_ASIO_NOEXCEPT - { - for (int i = 15; i >= 0; --i) - { - if (address_.addr_.s6_addr[i] < 0xFF) - { - ++address_.addr_.s6_addr[i]; - break; - } - - address_.addr_.s6_addr[i] = 0; - } - - return *this; - } - - /// Post-increment operator. - basic_address_iterator operator++(int) BOOST_ASIO_NOEXCEPT - { - basic_address_iterator tmp(*this); - ++*this; - return tmp; - } - - /// Pre-decrement operator. - basic_address_iterator& operator--() BOOST_ASIO_NOEXCEPT - { - for (int i = 15; i >= 0; --i) - { - if (address_.addr_.s6_addr[i] > 0) - { - --address_.addr_.s6_addr[i]; - break; - } - - address_.addr_.s6_addr[i] = 0xFF; - } - - return *this; - } - - /// Post-decrement operator. - basic_address_iterator operator--(int) - { - basic_address_iterator tmp(*this); - --*this; - return tmp; - } - - /// Compare two addresses for equality. - friend bool operator==(const basic_address_iterator& a, - const basic_address_iterator& b) - { - return a.address_ == b.address_; - } - - /// Compare two addresses for inequality. - friend bool operator!=(const basic_address_iterator& a, - const basic_address_iterator& b) - { - return a.address_ != b.address_; - } - -private: - address_v6 address_; -}; - -/// An input iterator that can be used for traversing IPv6 addresses. -typedef basic_address_iterator<address_v6> address_v6_iterator; - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_ADDRESS_V6_ITERATOR_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/address_v6_range.hpp b/contrib/restricted/boost/boost/asio/ip/address_v6_range.hpp deleted file mode 100644 index 0a095cd80b..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/address_v6_range.hpp +++ /dev/null @@ -1,131 +0,0 @@ -// -// ip/address_v6_range.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Oliver Kowalke (oliver dot kowalke at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_ADDRESS_V6_RANGE_HPP -#define BOOST_ASIO_IP_ADDRESS_V6_RANGE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/ip/address_v6_iterator.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -template <typename> class basic_address_range; - -/// Represents a range of IPv6 addresses. -/** - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <> class basic_address_range<address_v6> -{ -public: - /// The type of an iterator that points into the range. - typedef basic_address_iterator<address_v6> iterator; - - /// Construct an empty range. - basic_address_range() BOOST_ASIO_NOEXCEPT - : begin_(address_v6()), - end_(address_v6()) - { - } - - /// Construct an range that represents the given range of addresses. - explicit basic_address_range(const iterator& first, - const iterator& last) BOOST_ASIO_NOEXCEPT - : begin_(first), - end_(last) - { - } - - /// Copy constructor. - basic_address_range(const basic_address_range& other) BOOST_ASIO_NOEXCEPT - : begin_(other.begin_), - end_(other.end_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move constructor. - basic_address_range(basic_address_range&& other) BOOST_ASIO_NOEXCEPT - : begin_(BOOST_ASIO_MOVE_CAST(iterator)(other.begin_)), - end_(BOOST_ASIO_MOVE_CAST(iterator)(other.end_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Assignment operator. - basic_address_range& operator=( - const basic_address_range& other) BOOST_ASIO_NOEXCEPT - { - begin_ = other.begin_; - end_ = other.end_; - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move assignment operator. - basic_address_range& operator=( - basic_address_range&& other) BOOST_ASIO_NOEXCEPT - { - begin_ = BOOST_ASIO_MOVE_CAST(iterator)(other.begin_); - end_ = BOOST_ASIO_MOVE_CAST(iterator)(other.end_); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Obtain an iterator that points to the start of the range. - iterator begin() const BOOST_ASIO_NOEXCEPT - { - return begin_; - } - - /// Obtain an iterator that points to the end of the range. - iterator end() const BOOST_ASIO_NOEXCEPT - { - return end_; - } - - /// Determine whether the range is empty. - bool empty() const BOOST_ASIO_NOEXCEPT - { - return begin_ == end_; - } - - /// Find an address in the range. - iterator find(const address_v6& addr) const BOOST_ASIO_NOEXCEPT - { - return addr >= *begin_ && addr < *end_ ? iterator(addr) : end_; - } - -private: - iterator begin_; - iterator end_; -}; - -/// Represents a range of IPv6 addresses. -typedef basic_address_range<address_v6> address_v6_range; - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_ADDRESS_V6_RANGE_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/detail/socket_option.hpp b/contrib/restricted/boost/boost/asio/ip/detail/socket_option.hpp deleted file mode 100644 index ec3ca7e970..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/detail/socket_option.hpp +++ /dev/null @@ -1,568 +0,0 @@ -// -// detail/socket_option.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_DETAIL_SOCKET_OPTION_HPP -#define BOOST_ASIO_IP_DETAIL_SOCKET_OPTION_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <cstring> -#include <stdexcept> -#include <boost/asio/detail/socket_ops.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/throw_exception.hpp> -#include <boost/asio/ip/address.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { -namespace detail { -namespace socket_option { - -// Helper template for implementing multicast enable loopback options. -template <int IPv4_Level, int IPv4_Name, int IPv6_Level, int IPv6_Name> -class multicast_enable_loopback -{ -public: -#if defined(__sun) || defined(__osf__) - typedef unsigned char ipv4_value_type; - typedef unsigned char ipv6_value_type; -#elif defined(_AIX) || defined(__hpux) || defined(__QNXNTO__) - typedef unsigned char ipv4_value_type; - typedef unsigned int ipv6_value_type; -#else - typedef int ipv4_value_type; - typedef int ipv6_value_type; -#endif - - // Default constructor. - multicast_enable_loopback() - : ipv4_value_(0), - ipv6_value_(0) - { - } - - // Construct with a specific option value. - explicit multicast_enable_loopback(bool v) - : ipv4_value_(v ? 1 : 0), - ipv6_value_(v ? 1 : 0) - { - } - - // Set the value of the boolean. - multicast_enable_loopback& operator=(bool v) - { - ipv4_value_ = v ? 1 : 0; - ipv6_value_ = v ? 1 : 0; - return *this; - } - - // Get the current value of the boolean. - bool value() const - { - return !!ipv4_value_; - } - - // Convert to bool. - operator bool() const - { - return !!ipv4_value_; - } - - // Test for false. - bool operator!() const - { - return !ipv4_value_; - } - - // Get the level of the socket option. - template <typename Protocol> - int level(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Level; - return IPv4_Level; - } - - // Get the name of the socket option. - template <typename Protocol> - int name(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Name; - return IPv4_Name; - } - - // Get the address of the boolean data. - template <typename Protocol> - void* data(const Protocol& protocol) - { - if (protocol.family() == PF_INET6) - return &ipv6_value_; - return &ipv4_value_; - } - - // Get the address of the boolean data. - template <typename Protocol> - const void* data(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return &ipv6_value_; - return &ipv4_value_; - } - - // Get the size of the boolean data. - template <typename Protocol> - std::size_t size(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return sizeof(ipv6_value_); - return sizeof(ipv4_value_); - } - - // Set the size of the boolean data. - template <typename Protocol> - void resize(const Protocol& protocol, std::size_t s) - { - if (protocol.family() == PF_INET6) - { - if (s != sizeof(ipv6_value_)) - { - std::length_error ex("multicast_enable_loopback socket option resize"); - boost::asio::detail::throw_exception(ex); - } - ipv4_value_ = ipv6_value_ ? 1 : 0; - } - else - { - if (s != sizeof(ipv4_value_)) - { - std::length_error ex("multicast_enable_loopback socket option resize"); - boost::asio::detail::throw_exception(ex); - } - ipv6_value_ = ipv4_value_ ? 1 : 0; - } - } - -private: - ipv4_value_type ipv4_value_; - ipv6_value_type ipv6_value_; -}; - -// Helper template for implementing unicast hops options. -template <int IPv4_Level, int IPv4_Name, int IPv6_Level, int IPv6_Name> -class unicast_hops -{ -public: - // Default constructor. - unicast_hops() - : value_(0) - { - } - - // Construct with a specific option value. - explicit unicast_hops(int v) - : value_(v) - { - } - - // Set the value of the option. - unicast_hops& operator=(int v) - { - value_ = v; - return *this; - } - - // Get the current value of the option. - int value() const - { - return value_; - } - - // Get the level of the socket option. - template <typename Protocol> - int level(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Level; - return IPv4_Level; - } - - // Get the name of the socket option. - template <typename Protocol> - int name(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Name; - return IPv4_Name; - } - - // Get the address of the data. - template <typename Protocol> - int* data(const Protocol&) - { - return &value_; - } - - // Get the address of the data. - template <typename Protocol> - const int* data(const Protocol&) const - { - return &value_; - } - - // Get the size of the data. - template <typename Protocol> - std::size_t size(const Protocol&) const - { - return sizeof(value_); - } - - // Set the size of the data. - template <typename Protocol> - void resize(const Protocol&, std::size_t s) - { - if (s != sizeof(value_)) - { - std::length_error ex("unicast hops socket option resize"); - boost::asio::detail::throw_exception(ex); - } -#if defined(__hpux) - if (value_ < 0) - value_ = value_ & 0xFF; -#endif - } - -private: - int value_; -}; - -// Helper template for implementing multicast hops options. -template <int IPv4_Level, int IPv4_Name, int IPv6_Level, int IPv6_Name> -class multicast_hops -{ -public: -#if defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE) - typedef int ipv4_value_type; -#else - typedef unsigned char ipv4_value_type; -#endif - typedef int ipv6_value_type; - - // Default constructor. - multicast_hops() - : ipv4_value_(0), - ipv6_value_(0) - { - } - - // Construct with a specific option value. - explicit multicast_hops(int v) - { - if (v < 0 || v > 255) - { - std::out_of_range ex("multicast hops value out of range"); - boost::asio::detail::throw_exception(ex); - } - ipv4_value_ = (ipv4_value_type)v; - ipv6_value_ = v; - } - - // Set the value of the option. - multicast_hops& operator=(int v) - { - if (v < 0 || v > 255) - { - std::out_of_range ex("multicast hops value out of range"); - boost::asio::detail::throw_exception(ex); - } - ipv4_value_ = (ipv4_value_type)v; - ipv6_value_ = v; - return *this; - } - - // Get the current value of the option. - int value() const - { - return ipv6_value_; - } - - // Get the level of the socket option. - template <typename Protocol> - int level(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Level; - return IPv4_Level; - } - - // Get the name of the socket option. - template <typename Protocol> - int name(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Name; - return IPv4_Name; - } - - // Get the address of the data. - template <typename Protocol> - void* data(const Protocol& protocol) - { - if (protocol.family() == PF_INET6) - return &ipv6_value_; - return &ipv4_value_; - } - - // Get the address of the data. - template <typename Protocol> - const void* data(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return &ipv6_value_; - return &ipv4_value_; - } - - // Get the size of the data. - template <typename Protocol> - std::size_t size(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return sizeof(ipv6_value_); - return sizeof(ipv4_value_); - } - - // Set the size of the data. - template <typename Protocol> - void resize(const Protocol& protocol, std::size_t s) - { - if (protocol.family() == PF_INET6) - { - if (s != sizeof(ipv6_value_)) - { - std::length_error ex("multicast hops socket option resize"); - boost::asio::detail::throw_exception(ex); - } - if (ipv6_value_ < 0) - ipv4_value_ = 0; - else if (ipv6_value_ > 255) - ipv4_value_ = 255; - else - ipv4_value_ = (ipv4_value_type)ipv6_value_; - } - else - { - if (s != sizeof(ipv4_value_)) - { - std::length_error ex("multicast hops socket option resize"); - boost::asio::detail::throw_exception(ex); - } - ipv6_value_ = ipv4_value_; - } - } - -private: - ipv4_value_type ipv4_value_; - ipv6_value_type ipv6_value_; -}; - -// Helper template for implementing ip_mreq-based options. -template <int IPv4_Level, int IPv4_Name, int IPv6_Level, int IPv6_Name> -class multicast_request -{ -public: - // Default constructor. - multicast_request() - : ipv4_value_(), // Zero-initialisation gives the "any" address. - ipv6_value_() // Zero-initialisation gives the "any" address. - { - } - - // Construct with multicast address only. - explicit multicast_request(const address& multicast_address) - : ipv4_value_(), // Zero-initialisation gives the "any" address. - ipv6_value_() // Zero-initialisation gives the "any" address. - { - if (multicast_address.is_v6()) - { - using namespace std; // For memcpy. - address_v6 ipv6_address = multicast_address.to_v6(); - address_v6::bytes_type bytes = ipv6_address.to_bytes(); - memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16); - ipv6_value_.ipv6mr_interface = ipv6_address.scope_id(); - } - else - { - ipv4_value_.imr_multiaddr.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - multicast_address.to_v4().to_uint()); - ipv4_value_.imr_interface.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - address_v4::any().to_uint()); - } - } - - // Construct with multicast address and IPv4 address specifying an interface. - explicit multicast_request(const address_v4& multicast_address, - const address_v4& network_interface = address_v4::any()) - : ipv6_value_() // Zero-initialisation gives the "any" address. - { - ipv4_value_.imr_multiaddr.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - multicast_address.to_uint()); - ipv4_value_.imr_interface.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - network_interface.to_uint()); - } - - // Construct with multicast address and IPv6 network interface index. - explicit multicast_request( - const address_v6& multicast_address, - unsigned long network_interface = 0) - : ipv4_value_() // Zero-initialisation gives the "any" address. - { - using namespace std; // For memcpy. - address_v6::bytes_type bytes = multicast_address.to_bytes(); - memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16); - if (network_interface) - ipv6_value_.ipv6mr_interface = network_interface; - else - ipv6_value_.ipv6mr_interface = multicast_address.scope_id(); - } - - // Get the level of the socket option. - template <typename Protocol> - int level(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Level; - return IPv4_Level; - } - - // Get the name of the socket option. - template <typename Protocol> - int name(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Name; - return IPv4_Name; - } - - // Get the address of the option data. - template <typename Protocol> - const void* data(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return &ipv6_value_; - return &ipv4_value_; - } - - // Get the size of the option data. - template <typename Protocol> - std::size_t size(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return sizeof(ipv6_value_); - return sizeof(ipv4_value_); - } - -private: - boost::asio::detail::in4_mreq_type ipv4_value_; - boost::asio::detail::in6_mreq_type ipv6_value_; -}; - -// Helper template for implementing options that specify a network interface. -template <int IPv4_Level, int IPv4_Name, int IPv6_Level, int IPv6_Name> -class network_interface -{ -public: - // Default constructor. - network_interface() - { - ipv4_value_.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - address_v4::any().to_uint()); - ipv6_value_ = 0; - } - - // Construct with IPv4 interface. - explicit network_interface(const address_v4& ipv4_interface) - { - ipv4_value_.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - ipv4_interface.to_uint()); - ipv6_value_ = 0; - } - - // Construct with IPv6 interface. - explicit network_interface(unsigned int ipv6_interface) - { - ipv4_value_.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - address_v4::any().to_uint()); - ipv6_value_ = ipv6_interface; - } - - // Get the level of the socket option. - template <typename Protocol> - int level(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Level; - return IPv4_Level; - } - - // Get the name of the socket option. - template <typename Protocol> - int name(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return IPv6_Name; - return IPv4_Name; - } - - // Get the address of the option data. - template <typename Protocol> - const void* data(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return &ipv6_value_; - return &ipv4_value_; - } - - // Get the size of the option data. - template <typename Protocol> - std::size_t size(const Protocol& protocol) const - { - if (protocol.family() == PF_INET6) - return sizeof(ipv6_value_); - return sizeof(ipv4_value_); - } - -private: - boost::asio::detail::in4_addr_type ipv4_value_; - unsigned int ipv6_value_; -}; - -} // namespace socket_option -} // namespace detail -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_DETAIL_SOCKET_OPTION_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/icmp.hpp b/contrib/restricted/boost/boost/asio/ip/icmp.hpp deleted file mode 100644 index 4b9d642048..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/icmp.hpp +++ /dev/null @@ -1,117 +0,0 @@ -// -// ip/icmp.hpp -// ~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_ICMP_HPP -#define BOOST_ASIO_IP_ICMP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/basic_raw_socket.hpp> -#include <boost/asio/ip/basic_endpoint.hpp> -#include <boost/asio/ip/basic_resolver.hpp> -#include <boost/asio/ip/basic_resolver_iterator.hpp> -#include <boost/asio/ip/basic_resolver_query.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -/// Encapsulates the flags needed for ICMP. -/** - * The boost::asio::ip::icmp class contains flags necessary for ICMP sockets. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe. - * - * @par Concepts: - * Protocol, InternetProtocol. - */ -class icmp -{ -public: - /// The type of a ICMP endpoint. - typedef basic_endpoint<icmp> endpoint; - - /// Construct to represent the IPv4 ICMP protocol. - static icmp v4() - { - return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMP), - BOOST_ASIO_OS_DEF(AF_INET)); - } - - /// Construct to represent the IPv6 ICMP protocol. - static icmp v6() - { - return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMPV6), - BOOST_ASIO_OS_DEF(AF_INET6)); - } - - /// Obtain an identifier for the type of the protocol. - int type() const - { - return BOOST_ASIO_OS_DEF(SOCK_RAW); - } - - /// Obtain an identifier for the protocol. - int protocol() const - { - return protocol_; - } - - /// Obtain an identifier for the protocol family. - int family() const - { - return family_; - } - - /// The ICMP socket type. - typedef basic_raw_socket<icmp> socket; - - /// The ICMP resolver type. - typedef basic_resolver<icmp> resolver; - - /// Compare two protocols for equality. - friend bool operator==(const icmp& p1, const icmp& p2) - { - return p1.protocol_ == p2.protocol_ && p1.family_ == p2.family_; - } - - /// Compare two protocols for inequality. - friend bool operator!=(const icmp& p1, const icmp& p2) - { - return p1.protocol_ != p2.protocol_ || p1.family_ != p2.family_; - } - -private: - // Construct with a specific family. - explicit icmp(int protocol_id, int protocol_family) - : protocol_(protocol_id), - family_(protocol_family) - { - } - - int protocol_; - int family_; -}; - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_ICMP_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/impl/network_v4.hpp b/contrib/restricted/boost/boost/asio/ip/impl/network_v4.hpp deleted file mode 100644 index 3ca4e746bd..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/impl/network_v4.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// -// ip/impl/network_v4.hpp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_IMPL_NETWORK_V4_HPP -#define BOOST_ASIO_IP_IMPL_NETWORK_V4_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -#include <boost/asio/detail/throw_error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -template <typename Elem, typename Traits> -std::basic_ostream<Elem, Traits>& operator<<( - std::basic_ostream<Elem, Traits>& os, const network_v4& addr) -{ - boost::system::error_code ec; - std::string s = addr.to_string(ec); - if (ec) - { - if (os.exceptions() & std::basic_ostream<Elem, Traits>::failbit) - boost::asio::detail::throw_error(ec); - else - os.setstate(std::basic_ostream<Elem, Traits>::failbit); - } - else - for (std::string::iterator i = s.begin(); i != s.end(); ++i) - os << os.widen(*i); - return os; -} - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -#endif // BOOST_ASIO_IP_IMPL_NETWORK_V4_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/impl/network_v4.ipp b/contrib/restricted/boost/boost/asio/ip/impl/network_v4.ipp deleted file mode 100644 index 62f742c669..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/impl/network_v4.ipp +++ /dev/null @@ -1,218 +0,0 @@ -// -// ip/impl/network_v4.ipp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_IMPL_NETWORK_V4_IPP -#define BOOST_ASIO_IP_IMPL_NETWORK_V4_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <climits> -#include <cstdio> -#include <cstdlib> -#include <stdexcept> -#include <boost/asio/error.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/detail/throw_exception.hpp> -#include <boost/asio/ip/network_v4.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -network_v4::network_v4(const address_v4& addr, unsigned short prefix_len) - : address_(addr), - prefix_length_(prefix_len) -{ - if (prefix_len > 32) - { - std::out_of_range ex("prefix length too large"); - boost::asio::detail::throw_exception(ex); - } -} - -network_v4::network_v4(const address_v4& addr, const address_v4& mask) - : address_(addr), - prefix_length_(0) -{ - address_v4::bytes_type mask_bytes = mask.to_bytes(); - bool finished = false; - for (std::size_t i = 0; i < mask_bytes.size(); ++i) - { - if (finished) - { - if (mask_bytes[i]) - { - std::invalid_argument ex("non-contiguous netmask"); - boost::asio::detail::throw_exception(ex); - } - continue; - } - else - { - switch (mask_bytes[i]) - { - case 255: - prefix_length_ += 8; - break; - case 254: // prefix_length_ += 7 - prefix_length_ += 1; - case 252: // prefix_length_ += 6 - prefix_length_ += 1; - case 248: // prefix_length_ += 5 - prefix_length_ += 1; - case 240: // prefix_length_ += 4 - prefix_length_ += 1; - case 224: // prefix_length_ += 3 - prefix_length_ += 1; - case 192: // prefix_length_ += 2 - prefix_length_ += 1; - case 128: // prefix_length_ += 1 - prefix_length_ += 1; - case 0: // nbits += 0 - finished = true; - break; - default: - std::out_of_range ex("non-contiguous netmask"); - boost::asio::detail::throw_exception(ex); - } - } - } -} - -address_v4 network_v4::netmask() const BOOST_ASIO_NOEXCEPT -{ - uint32_t nmbits = 0xffffffff; - if (prefix_length_ == 0) - nmbits = 0; - else - nmbits = nmbits << (32 - prefix_length_); - return address_v4(nmbits); -} - -address_v4_range network_v4::hosts() const BOOST_ASIO_NOEXCEPT -{ - return is_host() - ? address_v4_range(address_, address_v4(address_.to_uint() + 1)) - : address_v4_range(address_v4(network().to_uint() + 1), broadcast()); -} - -bool network_v4::is_subnet_of(const network_v4& other) const -{ - if (other.prefix_length_ >= prefix_length_) - return false; // Only real subsets are allowed. - const network_v4 me(address_, other.prefix_length_); - return other.canonical() == me.canonical(); -} - -std::string network_v4::to_string() const -{ - boost::system::error_code ec; - std::string addr = to_string(ec); - boost::asio::detail::throw_error(ec); - return addr; -} - -std::string network_v4::to_string(boost::system::error_code& ec) const -{ - using namespace std; // For sprintf. - ec = boost::system::error_code(); - char prefix_len[16]; -#if defined(BOOST_ASIO_HAS_SECURE_RTL) - sprintf_s(prefix_len, sizeof(prefix_len), "/%u", prefix_length_); -#else // defined(BOOST_ASIO_HAS_SECURE_RTL) - sprintf(prefix_len, "/%u", prefix_length_); -#endif // defined(BOOST_ASIO_HAS_SECURE_RTL) - return address_.to_string() + prefix_len; -} - -network_v4 make_network_v4(const char* str) -{ - return make_network_v4(std::string(str)); -} - -network_v4 make_network_v4(const char* str, boost::system::error_code& ec) -{ - return make_network_v4(std::string(str), ec); -} - -network_v4 make_network_v4(const std::string& str) -{ - boost::system::error_code ec; - network_v4 net = make_network_v4(str, ec); - boost::asio::detail::throw_error(ec); - return net; -} - -network_v4 make_network_v4(const std::string& str, - boost::system::error_code& ec) -{ - std::string::size_type pos = str.find_first_of("/"); - - if (pos == std::string::npos) - { - ec = boost::asio::error::invalid_argument; - return network_v4(); - } - - if (pos == str.size() - 1) - { - ec = boost::asio::error::invalid_argument; - return network_v4(); - } - - std::string::size_type end = str.find_first_not_of("0123456789", pos + 1); - if (end != std::string::npos) - { - ec = boost::asio::error::invalid_argument; - return network_v4(); - } - - const address_v4 addr = make_address_v4(str.substr(0, pos), ec); - if (ec) - return network_v4(); - - const int prefix_len = std::atoi(str.substr(pos + 1).c_str()); - if (prefix_len < 0 || prefix_len > 32) - { - ec = boost::asio::error::invalid_argument; - return network_v4(); - } - - return network_v4(addr, static_cast<unsigned short>(prefix_len)); -} - -#if defined(BOOST_ASIO_HAS_STRING_VIEW) - -network_v4 make_network_v4(string_view str) -{ - return make_network_v4(static_cast<std::string>(str)); -} - -network_v4 make_network_v4(string_view str, - boost::system::error_code& ec) -{ - return make_network_v4(static_cast<std::string>(str), ec); -} - -#endif // defined(BOOST_ASIO_HAS_STRING_VIEW) - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_IMPL_NETWORK_V4_IPP diff --git a/contrib/restricted/boost/boost/asio/ip/impl/network_v6.hpp b/contrib/restricted/boost/boost/asio/ip/impl/network_v6.hpp deleted file mode 100644 index 1b13879ea3..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/impl/network_v6.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// -// ip/impl/network_v6.hpp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_IMPL_NETWORK_V6_HPP -#define BOOST_ASIO_IP_IMPL_NETWORK_V6_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -#include <boost/asio/detail/throw_error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -template <typename Elem, typename Traits> -std::basic_ostream<Elem, Traits>& operator<<( - std::basic_ostream<Elem, Traits>& os, const network_v6& addr) -{ - boost::system::error_code ec; - std::string s = addr.to_string(ec); - if (ec) - { - if (os.exceptions() & std::basic_ostream<Elem, Traits>::failbit) - boost::asio::detail::throw_error(ec); - else - os.setstate(std::basic_ostream<Elem, Traits>::failbit); - } - else - for (std::string::iterator i = s.begin(); i != s.end(); ++i) - os << os.widen(*i); - return os; -} - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -#endif // BOOST_ASIO_IP_IMPL_NETWORK_V6_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/impl/network_v6.ipp b/contrib/restricted/boost/boost/asio/ip/impl/network_v6.ipp deleted file mode 100644 index 426bc33b39..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/impl/network_v6.ipp +++ /dev/null @@ -1,187 +0,0 @@ -// -// ip/impl/network_v6.ipp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_IMPL_NETWORK_V6_IPP -#define BOOST_ASIO_IP_IMPL_NETWORK_V6_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <climits> -#include <cstdio> -#include <cstdlib> -#include <stdexcept> -#include <boost/asio/error.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/detail/throw_exception.hpp> -#include <boost/asio/ip/network_v6.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -network_v6::network_v6(const address_v6& addr, unsigned short prefix_len) - : address_(addr), - prefix_length_(prefix_len) -{ - if (prefix_len > 128) - { - std::out_of_range ex("prefix length too large"); - boost::asio::detail::throw_exception(ex); - } -} - -BOOST_ASIO_DECL address_v6 network_v6::network() const BOOST_ASIO_NOEXCEPT -{ - address_v6::bytes_type bytes(address_.to_bytes()); - for (std::size_t i = 0; i < 16; ++i) - { - if (prefix_length_ <= i * 8) - bytes[i] = 0; - else if (prefix_length_ < (i + 1) * 8) - bytes[i] &= 0xFF00 >> (prefix_length_ % 8); - } - return address_v6(bytes, address_.scope_id()); -} - -address_v6_range network_v6::hosts() const BOOST_ASIO_NOEXCEPT -{ - address_v6::bytes_type begin_bytes(address_.to_bytes()); - address_v6::bytes_type end_bytes(address_.to_bytes()); - for (std::size_t i = 0; i < 16; ++i) - { - if (prefix_length_ <= i * 8) - { - begin_bytes[i] = 0; - end_bytes[i] = 0xFF; - } - else if (prefix_length_ < (i + 1) * 8) - { - begin_bytes[i] &= 0xFF00 >> (prefix_length_ % 8); - end_bytes[i] |= 0xFF >> (prefix_length_ % 8); - } - } - return address_v6_range( - address_v6_iterator(address_v6(begin_bytes, address_.scope_id())), - ++address_v6_iterator(address_v6(end_bytes, address_.scope_id()))); -} - -bool network_v6::is_subnet_of(const network_v6& other) const -{ - if (other.prefix_length_ >= prefix_length_) - return false; // Only real subsets are allowed. - const network_v6 me(address_, other.prefix_length_); - return other.canonical() == me.canonical(); -} - -std::string network_v6::to_string() const -{ - boost::system::error_code ec; - std::string addr = to_string(ec); - boost::asio::detail::throw_error(ec); - return addr; -} - -std::string network_v6::to_string(boost::system::error_code& ec) const -{ - using namespace std; // For sprintf. - ec = boost::system::error_code(); - char prefix_len[16]; -#if defined(BOOST_ASIO_HAS_SECURE_RTL) - sprintf_s(prefix_len, sizeof(prefix_len), "/%u", prefix_length_); -#else // defined(BOOST_ASIO_HAS_SECURE_RTL) - sprintf(prefix_len, "/%u", prefix_length_); -#endif // defined(BOOST_ASIO_HAS_SECURE_RTL) - return address_.to_string() + prefix_len; -} - -network_v6 make_network_v6(const char* str) -{ - return make_network_v6(std::string(str)); -} - -network_v6 make_network_v6(const char* str, boost::system::error_code& ec) -{ - return make_network_v6(std::string(str), ec); -} - -network_v6 make_network_v6(const std::string& str) -{ - boost::system::error_code ec; - network_v6 net = make_network_v6(str, ec); - boost::asio::detail::throw_error(ec); - return net; -} - -network_v6 make_network_v6(const std::string& str, - boost::system::error_code& ec) -{ - std::string::size_type pos = str.find_first_of("/"); - - if (pos == std::string::npos) - { - ec = boost::asio::error::invalid_argument; - return network_v6(); - } - - if (pos == str.size() - 1) - { - ec = boost::asio::error::invalid_argument; - return network_v6(); - } - - std::string::size_type end = str.find_first_not_of("0123456789", pos + 1); - if (end != std::string::npos) - { - ec = boost::asio::error::invalid_argument; - return network_v6(); - } - - const address_v6 addr = make_address_v6(str.substr(0, pos), ec); - if (ec) - return network_v6(); - - const int prefix_len = std::atoi(str.substr(pos + 1).c_str()); - if (prefix_len < 0 || prefix_len > 128) - { - ec = boost::asio::error::invalid_argument; - return network_v6(); - } - - return network_v6(addr, static_cast<unsigned short>(prefix_len)); -} - -#if defined(BOOST_ASIO_HAS_STRING_VIEW) - -network_v6 make_network_v6(string_view str) -{ - return make_network_v6(static_cast<std::string>(str)); -} - -network_v6 make_network_v6(string_view str, - boost::system::error_code& ec) -{ - return make_network_v6(static_cast<std::string>(str), ec); -} - -#endif // defined(BOOST_ASIO_HAS_STRING_VIEW) - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_IMPL_NETWORK_V6_IPP diff --git a/contrib/restricted/boost/boost/asio/ip/multicast.hpp b/contrib/restricted/boost/boost/asio/ip/multicast.hpp deleted file mode 100644 index d46692c268..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/multicast.hpp +++ /dev/null @@ -1,193 +0,0 @@ -// -// ip/multicast.hpp -// ~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_MULTICAST_HPP -#define BOOST_ASIO_IP_MULTICAST_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/ip/detail/socket_option.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { -namespace multicast { - -/// Socket option to join a multicast group on a specified interface. -/** - * Implements the IPPROTO_IP/IP_ADD_MEMBERSHIP socket option. - * - * @par Examples - * Setting the option to join a multicast group: - * @code - * boost::asio::ip::udp::socket socket(io_context); - * ... - * boost::asio::ip::address multicast_address = - * boost::asio::ip::address::from_string("225.0.0.1"); - * boost::asio::ip::multicast::join_group option(multicast_address); - * socket.set_option(option); - * @endcode - * - * @par Concepts: - * SettableSocketOption. - */ -#if defined(GENERATING_DOCUMENTATION) -typedef implementation_defined join_group; -#else -typedef boost::asio::ip::detail::socket_option::multicast_request< - BOOST_ASIO_OS_DEF(IPPROTO_IP), - BOOST_ASIO_OS_DEF(IP_ADD_MEMBERSHIP), - BOOST_ASIO_OS_DEF(IPPROTO_IPV6), - BOOST_ASIO_OS_DEF(IPV6_JOIN_GROUP)> join_group; -#endif - -/// Socket option to leave a multicast group on a specified interface. -/** - * Implements the IPPROTO_IP/IP_DROP_MEMBERSHIP socket option. - * - * @par Examples - * Setting the option to leave a multicast group: - * @code - * boost::asio::ip::udp::socket socket(io_context); - * ... - * boost::asio::ip::address multicast_address = - * boost::asio::ip::address::from_string("225.0.0.1"); - * boost::asio::ip::multicast::leave_group option(multicast_address); - * socket.set_option(option); - * @endcode - * - * @par Concepts: - * SettableSocketOption. - */ -#if defined(GENERATING_DOCUMENTATION) -typedef implementation_defined leave_group; -#else -typedef boost::asio::ip::detail::socket_option::multicast_request< - BOOST_ASIO_OS_DEF(IPPROTO_IP), - BOOST_ASIO_OS_DEF(IP_DROP_MEMBERSHIP), - BOOST_ASIO_OS_DEF(IPPROTO_IPV6), - BOOST_ASIO_OS_DEF(IPV6_LEAVE_GROUP)> leave_group; -#endif - -/// Socket option for local interface to use for outgoing multicast packets. -/** - * Implements the IPPROTO_IP/IP_MULTICAST_IF socket option. - * - * @par Examples - * Setting the option: - * @code - * boost::asio::ip::udp::socket socket(io_context); - * ... - * boost::asio::ip::address_v4 local_interface = - * boost::asio::ip::address_v4::from_string("1.2.3.4"); - * boost::asio::ip::multicast::outbound_interface option(local_interface); - * socket.set_option(option); - * @endcode - * - * @par Concepts: - * SettableSocketOption. - */ -#if defined(GENERATING_DOCUMENTATION) -typedef implementation_defined outbound_interface; -#else -typedef boost::asio::ip::detail::socket_option::network_interface< - BOOST_ASIO_OS_DEF(IPPROTO_IP), - BOOST_ASIO_OS_DEF(IP_MULTICAST_IF), - BOOST_ASIO_OS_DEF(IPPROTO_IPV6), - BOOST_ASIO_OS_DEF(IPV6_MULTICAST_IF)> outbound_interface; -#endif - -/// Socket option for time-to-live associated with outgoing multicast packets. -/** - * Implements the IPPROTO_IP/IP_MULTICAST_TTL socket option. - * - * @par Examples - * Setting the option: - * @code - * boost::asio::ip::udp::socket socket(io_context); - * ... - * boost::asio::ip::multicast::hops option(4); - * socket.set_option(option); - * @endcode - * - * @par - * Getting the current option value: - * @code - * boost::asio::ip::udp::socket socket(io_context); - * ... - * boost::asio::ip::multicast::hops option; - * socket.get_option(option); - * int ttl = option.value(); - * @endcode - * - * @par Concepts: - * GettableSocketOption, SettableSocketOption. - */ -#if defined(GENERATING_DOCUMENTATION) -typedef implementation_defined hops; -#else -typedef boost::asio::ip::detail::socket_option::multicast_hops< - BOOST_ASIO_OS_DEF(IPPROTO_IP), - BOOST_ASIO_OS_DEF(IP_MULTICAST_TTL), - BOOST_ASIO_OS_DEF(IPPROTO_IPV6), - BOOST_ASIO_OS_DEF(IPV6_MULTICAST_HOPS)> hops; -#endif - -/// Socket option determining whether outgoing multicast packets will be -/// received on the same socket if it is a member of the multicast group. -/** - * Implements the IPPROTO_IP/IP_MULTICAST_LOOP socket option. - * - * @par Examples - * Setting the option: - * @code - * boost::asio::ip::udp::socket socket(io_context); - * ... - * boost::asio::ip::multicast::enable_loopback option(true); - * socket.set_option(option); - * @endcode - * - * @par - * Getting the current option value: - * @code - * boost::asio::ip::udp::socket socket(io_context); - * ... - * boost::asio::ip::multicast::enable_loopback option; - * socket.get_option(option); - * bool is_set = option.value(); - * @endcode - * - * @par Concepts: - * GettableSocketOption, SettableSocketOption. - */ -#if defined(GENERATING_DOCUMENTATION) -typedef implementation_defined enable_loopback; -#else -typedef boost::asio::ip::detail::socket_option::multicast_enable_loopback< - BOOST_ASIO_OS_DEF(IPPROTO_IP), - BOOST_ASIO_OS_DEF(IP_MULTICAST_LOOP), - BOOST_ASIO_OS_DEF(IPPROTO_IPV6), - BOOST_ASIO_OS_DEF(IPV6_MULTICAST_LOOP)> enable_loopback; -#endif - -} // namespace multicast -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_MULTICAST_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/network_v4.hpp b/contrib/restricted/boost/boost/asio/ip/network_v4.hpp deleted file mode 100644 index 24e67b8371..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/network_v4.hpp +++ /dev/null @@ -1,263 +0,0 @@ -// -// ip/network_v4.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_NETWORK_V4_HPP -#define BOOST_ASIO_IP_NETWORK_V4_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <string> -#include <boost/asio/detail/string_view.hpp> -#include <boost/system/error_code.hpp> -#include <boost/asio/ip/address_v4_range.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -/// Represents an IPv4 network. -/** - * The boost::asio::ip::network_v4 class provides the ability to use and - * manipulate IP version 4 networks. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -class network_v4 -{ -public: - /// Default constructor. - network_v4() BOOST_ASIO_NOEXCEPT - : address_(), - prefix_length_(0) - { - } - - /// Construct a network based on the specified address and prefix length. - BOOST_ASIO_DECL network_v4(const address_v4& addr, - unsigned short prefix_len); - - /// Construct network based on the specified address and netmask. - BOOST_ASIO_DECL network_v4(const address_v4& addr, - const address_v4& mask); - - /// Copy constructor. - network_v4(const network_v4& other) BOOST_ASIO_NOEXCEPT - : address_(other.address_), - prefix_length_(other.prefix_length_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move constructor. - network_v4(network_v4&& other) BOOST_ASIO_NOEXCEPT - : address_(BOOST_ASIO_MOVE_CAST(address_v4)(other.address_)), - prefix_length_(other.prefix_length_) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Assign from another network. - network_v4& operator=(const network_v4& other) BOOST_ASIO_NOEXCEPT - { - address_ = other.address_; - prefix_length_ = other.prefix_length_; - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move-assign from another network. - network_v4& operator=(network_v4&& other) BOOST_ASIO_NOEXCEPT - { - address_ = BOOST_ASIO_MOVE_CAST(address_v4)(other.address_); - prefix_length_ = other.prefix_length_; - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Obtain the address object specified when the network object was created. - address_v4 address() const BOOST_ASIO_NOEXCEPT - { - return address_; - } - - /// Obtain the prefix length that was specified when the network object was - /// created. - unsigned short prefix_length() const BOOST_ASIO_NOEXCEPT - { - return prefix_length_; - } - - /// Obtain the netmask that was specified when the network object was created. - BOOST_ASIO_DECL address_v4 netmask() const BOOST_ASIO_NOEXCEPT; - - /// Obtain an address object that represents the network address. - address_v4 network() const BOOST_ASIO_NOEXCEPT - { - return address_v4(address_.to_uint() & netmask().to_uint()); - } - - /// Obtain an address object that represents the network's broadcast address. - address_v4 broadcast() const BOOST_ASIO_NOEXCEPT - { - return address_v4(network().to_uint() | (netmask().to_uint() ^ 0xFFFFFFFF)); - } - - /// Obtain an address range corresponding to the hosts in the network. - BOOST_ASIO_DECL address_v4_range hosts() const BOOST_ASIO_NOEXCEPT; - - /// Obtain the true network address, omitting any host bits. - network_v4 canonical() const BOOST_ASIO_NOEXCEPT - { - return network_v4(network(), netmask()); - } - - /// Test if network is a valid host address. - bool is_host() const BOOST_ASIO_NOEXCEPT - { - return prefix_length_ == 32; - } - - /// Test if a network is a real subnet of another network. - BOOST_ASIO_DECL bool is_subnet_of(const network_v4& other) const; - - /// Get the network as an address in dotted decimal format. - BOOST_ASIO_DECL std::string to_string() const; - - /// Get the network as an address in dotted decimal format. - BOOST_ASIO_DECL std::string to_string(boost::system::error_code& ec) const; - - /// Compare two networks for equality. - friend bool operator==(const network_v4& a, const network_v4& b) - { - return a.address_ == b.address_ && a.prefix_length_ == b.prefix_length_; - } - - /// Compare two networks for inequality. - friend bool operator!=(const network_v4& a, const network_v4& b) - { - return !(a == b); - } - -private: - address_v4 address_; - unsigned short prefix_length_; -}; - -/// Create an IPv4 network from an address and prefix length. -/** - * @relates address_v4 - */ -inline network_v4 make_network_v4( - const address_v4& addr, unsigned short prefix_len) -{ - return network_v4(addr, prefix_len); -} - -/// Create an IPv4 network from an address and netmask. -/** - * @relates address_v4 - */ -inline network_v4 make_network_v4( - const address_v4& addr, const address_v4& mask) -{ - return network_v4(addr, mask); -} - -/// Create an IPv4 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v4 - */ -BOOST_ASIO_DECL network_v4 make_network_v4(const char* str); - -/// Create an IPv4 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v4 - */ -BOOST_ASIO_DECL network_v4 make_network_v4( - const char* str, boost::system::error_code& ec); - -/// Create an IPv4 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v4 - */ -BOOST_ASIO_DECL network_v4 make_network_v4(const std::string& str); - -/// Create an IPv4 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v4 - */ -BOOST_ASIO_DECL network_v4 make_network_v4( - const std::string& str, boost::system::error_code& ec); - -#if defined(BOOST_ASIO_HAS_STRING_VIEW) \ - || defined(GENERATING_DOCUMENTATION) - -/// Create an IPv4 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v4 - */ -BOOST_ASIO_DECL network_v4 make_network_v4(string_view str); - -/// Create an IPv4 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v4 - */ -BOOST_ASIO_DECL network_v4 make_network_v4( - string_view str, boost::system::error_code& ec); - -#endif // defined(BOOST_ASIO_HAS_STRING_VIEW) - // || defined(GENERATING_DOCUMENTATION) - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Output a network as a string. -/** - * Used to output a human-readable string for a specified network. - * - * @param os The output stream to which the string will be written. - * - * @param net The network to be written. - * - * @return The output stream. - * - * @relates boost::asio::ip::address_v4 - */ -template <typename Elem, typename Traits> -std::basic_ostream<Elem, Traits>& operator<<( - std::basic_ostream<Elem, Traits>& os, const network_v4& net); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/ip/impl/network_v4.hpp> -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/ip/impl/network_v4.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_IP_NETWORK_V4_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/network_v6.hpp b/contrib/restricted/boost/boost/asio/ip/network_v6.hpp deleted file mode 100644 index 5fe96743df..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/network_v6.hpp +++ /dev/null @@ -1,237 +0,0 @@ -// -// ip/network_v6.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_NETWORK_V6_HPP -#define BOOST_ASIO_IP_NETWORK_V6_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <string> -#include <boost/asio/detail/string_view.hpp> -#include <boost/system/error_code.hpp> -#include <boost/asio/ip/address_v6_range.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -/// Represents an IPv6 network. -/** - * The boost::asio::ip::network_v6 class provides the ability to use and - * manipulate IP version 6 networks. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -class network_v6 -{ -public: - /// Default constructor. - network_v6() BOOST_ASIO_NOEXCEPT - : address_(), - prefix_length_(0) - { - } - - /// Construct a network based on the specified address and prefix length. - BOOST_ASIO_DECL network_v6(const address_v6& addr, - unsigned short prefix_len); - - /// Copy constructor. - network_v6(const network_v6& other) BOOST_ASIO_NOEXCEPT - : address_(other.address_), - prefix_length_(other.prefix_length_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move constructor. - network_v6(network_v6&& other) BOOST_ASIO_NOEXCEPT - : address_(BOOST_ASIO_MOVE_CAST(address_v6)(other.address_)), - prefix_length_(other.prefix_length_) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Assign from another network. - network_v6& operator=(const network_v6& other) BOOST_ASIO_NOEXCEPT - { - address_ = other.address_; - prefix_length_ = other.prefix_length_; - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move-assign from another network. - network_v6& operator=(network_v6&& other) BOOST_ASIO_NOEXCEPT - { - address_ = BOOST_ASIO_MOVE_CAST(address_v6)(other.address_); - prefix_length_ = other.prefix_length_; - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Obtain the address object specified when the network object was created. - address_v6 address() const BOOST_ASIO_NOEXCEPT - { - return address_; - } - - /// Obtain the prefix length that was specified when the network object was - /// created. - unsigned short prefix_length() const BOOST_ASIO_NOEXCEPT - { - return prefix_length_; - } - - /// Obtain an address object that represents the network address. - BOOST_ASIO_DECL address_v6 network() const BOOST_ASIO_NOEXCEPT; - - /// Obtain an address range corresponding to the hosts in the network. - BOOST_ASIO_DECL address_v6_range hosts() const BOOST_ASIO_NOEXCEPT; - - /// Obtain the true network address, omitting any host bits. - network_v6 canonical() const BOOST_ASIO_NOEXCEPT - { - return network_v6(network(), prefix_length()); - } - - /// Test if network is a valid host address. - bool is_host() const BOOST_ASIO_NOEXCEPT - { - return prefix_length_ == 128; - } - - /// Test if a network is a real subnet of another network. - BOOST_ASIO_DECL bool is_subnet_of(const network_v6& other) const; - - /// Get the network as an address in dotted decimal format. - BOOST_ASIO_DECL std::string to_string() const; - - /// Get the network as an address in dotted decimal format. - BOOST_ASIO_DECL std::string to_string(boost::system::error_code& ec) const; - - /// Compare two networks for equality. - friend bool operator==(const network_v6& a, const network_v6& b) - { - return a.address_ == b.address_ && a.prefix_length_ == b.prefix_length_; - } - - /// Compare two networks for inequality. - friend bool operator!=(const network_v6& a, const network_v6& b) - { - return !(a == b); - } - -private: - address_v6 address_; - unsigned short prefix_length_; -}; - -/// Create an IPv6 network from an address and prefix length. -/** - * @relates address_v6 - */ -inline network_v6 make_network_v6( - const address_v6& addr, unsigned short prefix_len) -{ - return network_v6(addr, prefix_len); -} - -/// Create an IPv6 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v6 - */ -BOOST_ASIO_DECL network_v6 make_network_v6(const char* str); - -/// Create an IPv6 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v6 - */ -BOOST_ASIO_DECL network_v6 make_network_v6( - const char* str, boost::system::error_code& ec); - -/// Create an IPv6 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v6 - */ -BOOST_ASIO_DECL network_v6 make_network_v6(const std::string& str); - -/// Create an IPv6 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v6 - */ -BOOST_ASIO_DECL network_v6 make_network_v6( - const std::string& str, boost::system::error_code& ec); - -#if defined(BOOST_ASIO_HAS_STRING_VIEW) \ - || defined(GENERATING_DOCUMENTATION) - -/// Create an IPv6 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v6 - */ -BOOST_ASIO_DECL network_v6 make_network_v6(string_view str); - -/// Create an IPv6 network from a string containing IP address and prefix -/// length. -/** - * @relates network_v6 - */ -BOOST_ASIO_DECL network_v6 make_network_v6( - string_view str, boost::system::error_code& ec); - -#endif // defined(BOOST_ASIO_HAS_STRING_VIEW) - // || defined(GENERATING_DOCUMENTATION) - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Output a network as a string. -/** - * Used to output a human-readable string for a specified network. - * - * @param os The output stream to which the string will be written. - * - * @param net The network to be written. - * - * @return The output stream. - * - * @relates boost::asio::ip::address_v6 - */ -template <typename Elem, typename Traits> -std::basic_ostream<Elem, Traits>& operator<<( - std::basic_ostream<Elem, Traits>& os, const network_v6& net); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/ip/impl/network_v6.hpp> -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/ip/impl/network_v6.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_IP_NETWORK_V6_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/tcp.hpp b/contrib/restricted/boost/boost/asio/ip/tcp.hpp deleted file mode 100644 index dce1c8ee6a..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/tcp.hpp +++ /dev/null @@ -1,157 +0,0 @@ -// -// ip/tcp.hpp -// ~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_TCP_HPP -#define BOOST_ASIO_IP_TCP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/basic_socket_acceptor.hpp> -#include <boost/asio/basic_socket_iostream.hpp> -#include <boost/asio/basic_stream_socket.hpp> -#include <boost/asio/detail/socket_option.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/ip/basic_endpoint.hpp> -#include <boost/asio/ip/basic_resolver.hpp> -#include <boost/asio/ip/basic_resolver_iterator.hpp> -#include <boost/asio/ip/basic_resolver_query.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -/// Encapsulates the flags needed for TCP. -/** - * The boost::asio::ip::tcp class contains flags necessary for TCP sockets. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe. - * - * @par Concepts: - * Protocol, InternetProtocol. - */ -class tcp -{ -public: - /// The type of a TCP endpoint. - typedef basic_endpoint<tcp> endpoint; - - /// Construct to represent the IPv4 TCP protocol. - static tcp v4() - { - return tcp(BOOST_ASIO_OS_DEF(AF_INET)); - } - - /// Construct to represent the IPv6 TCP protocol. - static tcp v6() - { - return tcp(BOOST_ASIO_OS_DEF(AF_INET6)); - } - - /// Obtain an identifier for the type of the protocol. - int type() const - { - return BOOST_ASIO_OS_DEF(SOCK_STREAM); - } - - /// Obtain an identifier for the protocol. - int protocol() const - { - return BOOST_ASIO_OS_DEF(IPPROTO_TCP); - } - - /// Obtain an identifier for the protocol family. - int family() const - { - return family_; - } - - /// The TCP socket type. - typedef basic_stream_socket<tcp> socket; - - /// The TCP acceptor type. - typedef basic_socket_acceptor<tcp> acceptor; - - /// The TCP resolver type. - typedef basic_resolver<tcp> resolver; - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - /// The TCP iostream type. - typedef basic_socket_iostream<tcp> iostream; -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - - /// Socket option for disabling the Nagle algorithm. - /** - * Implements the IPPROTO_TCP/TCP_NODELAY socket option. - * - * @par Examples - * Setting the option: - * @code - * boost::asio::ip::tcp::socket socket(io_context); - * ... - * boost::asio::ip::tcp::no_delay option(true); - * socket.set_option(option); - * @endcode - * - * @par - * Getting the current option value: - * @code - * boost::asio::ip::tcp::socket socket(io_context); - * ... - * boost::asio::ip::tcp::no_delay option; - * socket.get_option(option); - * bool is_set = option.value(); - * @endcode - * - * @par Concepts: - * Socket_Option, Boolean_Socket_Option. - */ -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined no_delay; -#else - typedef boost::asio::detail::socket_option::boolean< - BOOST_ASIO_OS_DEF(IPPROTO_TCP), BOOST_ASIO_OS_DEF(TCP_NODELAY)> no_delay; -#endif - - /// Compare two protocols for equality. - friend bool operator==(const tcp& p1, const tcp& p2) - { - return p1.family_ == p2.family_; - } - - /// Compare two protocols for inequality. - friend bool operator!=(const tcp& p1, const tcp& p2) - { - return p1.family_ != p2.family_; - } - -private: - // Construct with a specific family. - explicit tcp(int protocol_family) - : family_(protocol_family) - { - } - - int family_; -}; - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_TCP_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/unicast.hpp b/contrib/restricted/boost/boost/asio/ip/unicast.hpp deleted file mode 100644 index 793c5f7eb4..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/unicast.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// -// ip/unicast.hpp -// ~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_UNICAST_HPP -#define BOOST_ASIO_IP_UNICAST_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/ip/detail/socket_option.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { -namespace unicast { - -/// Socket option for time-to-live associated with outgoing unicast packets. -/** - * Implements the IPPROTO_IP/IP_UNICAST_TTL socket option. - * - * @par Examples - * Setting the option: - * @code - * boost::asio::ip::udp::socket socket(io_context); - * ... - * boost::asio::ip::unicast::hops option(4); - * socket.set_option(option); - * @endcode - * - * @par - * Getting the current option value: - * @code - * boost::asio::ip::udp::socket socket(io_context); - * ... - * boost::asio::ip::unicast::hops option; - * socket.get_option(option); - * int ttl = option.value(); - * @endcode - * - * @par Concepts: - * GettableSocketOption, SettableSocketOption. - */ -#if defined(GENERATING_DOCUMENTATION) -typedef implementation_defined hops; -#else -typedef boost::asio::ip::detail::socket_option::unicast_hops< - BOOST_ASIO_OS_DEF(IPPROTO_IP), - BOOST_ASIO_OS_DEF(IP_TTL), - BOOST_ASIO_OS_DEF(IPPROTO_IPV6), - BOOST_ASIO_OS_DEF(IPV6_UNICAST_HOPS)> hops; -#endif - -} // namespace unicast -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_UNICAST_HPP diff --git a/contrib/restricted/boost/boost/asio/ip/v6_only.hpp b/contrib/restricted/boost/boost/asio/ip/v6_only.hpp deleted file mode 100644 index c2f34acc11..0000000000 --- a/contrib/restricted/boost/boost/asio/ip/v6_only.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// -// ip/v6_only.hpp -// ~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IP_V6_ONLY_HPP -#define BOOST_ASIO_IP_V6_ONLY_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/socket_option.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ip { - -/// Socket option for determining whether an IPv6 socket supports IPv6 -/// communication only. -/** - * Implements the IPPROTO_IPV6/IP_V6ONLY socket option. - * - * @par Examples - * Setting the option: - * @code - * boost::asio::ip::tcp::socket socket(io_context); - * ... - * boost::asio::ip::v6_only option(true); - * socket.set_option(option); - * @endcode - * - * @par - * Getting the current option value: - * @code - * boost::asio::ip::tcp::socket socket(io_context); - * ... - * boost::asio::ip::v6_only option; - * socket.get_option(option); - * bool v6_only = option.value(); - * @endcode - * - * @par Concepts: - * GettableSocketOption, SettableSocketOption. - */ -#if defined(GENERATING_DOCUMENTATION) -typedef implementation_defined v6_only; -#elif defined(IPV6_V6ONLY) -typedef boost::asio::detail::socket_option::boolean< - IPPROTO_IPV6, IPV6_V6ONLY> v6_only; -#else -typedef boost::asio::detail::socket_option::boolean< - boost::asio::detail::custom_socket_option_level, - boost::asio::detail::always_fail_option> v6_only; -#endif - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IP_V6_ONLY_HPP diff --git a/contrib/restricted/boost/boost/asio/is_read_buffered.hpp b/contrib/restricted/boost/boost/asio/is_read_buffered.hpp deleted file mode 100644 index 4839bc53a7..0000000000 --- a/contrib/restricted/boost/boost/asio/is_read_buffered.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// -// is_read_buffered.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IS_READ_BUFFERED_HPP -#define BOOST_ASIO_IS_READ_BUFFERED_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/buffered_read_stream_fwd.hpp> -#include <boost/asio/buffered_stream_fwd.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail { - -template <typename Stream> -char is_read_buffered_helper(buffered_stream<Stream>* s); - -template <typename Stream> -char is_read_buffered_helper(buffered_read_stream<Stream>* s); - -struct is_read_buffered_big_type { char data[10]; }; -is_read_buffered_big_type is_read_buffered_helper(...); - -} // namespace detail - -/// The is_read_buffered class is a traits class that may be used to determine -/// whether a stream type supports buffering of read data. -template <typename Stream> -class is_read_buffered -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The value member is true only if the Stream type supports buffering of - /// read data. - static const bool value; -#else - BOOST_ASIO_STATIC_CONSTANT(bool, - value = sizeof(detail::is_read_buffered_helper((Stream*)0)) == 1); -#endif -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IS_READ_BUFFERED_HPP diff --git a/contrib/restricted/boost/boost/asio/is_write_buffered.hpp b/contrib/restricted/boost/boost/asio/is_write_buffered.hpp deleted file mode 100644 index f18e981ba8..0000000000 --- a/contrib/restricted/boost/boost/asio/is_write_buffered.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// -// is_write_buffered.hpp -// ~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_IS_WRITE_BUFFERED_HPP -#define BOOST_ASIO_IS_WRITE_BUFFERED_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/buffered_stream_fwd.hpp> -#include <boost/asio/buffered_write_stream_fwd.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail { - -template <typename Stream> -char is_write_buffered_helper(buffered_stream<Stream>* s); - -template <typename Stream> -char is_write_buffered_helper(buffered_write_stream<Stream>* s); - -struct is_write_buffered_big_type { char data[10]; }; -is_write_buffered_big_type is_write_buffered_helper(...); - -} // namespace detail - -/// The is_write_buffered class is a traits class that may be used to determine -/// whether a stream type supports buffering of written data. -template <typename Stream> -class is_write_buffered -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The value member is true only if the Stream type supports buffering of - /// written data. - static const bool value; -#else - BOOST_ASIO_STATIC_CONSTANT(bool, - value = sizeof(detail::is_write_buffered_helper((Stream*)0)) == 1); -#endif -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IS_WRITE_BUFFERED_HPP diff --git a/contrib/restricted/boost/boost/asio/local/basic_endpoint.hpp b/contrib/restricted/boost/boost/asio/local/basic_endpoint.hpp deleted file mode 100644 index 248c4a809e..0000000000 --- a/contrib/restricted/boost/boost/asio/local/basic_endpoint.hpp +++ /dev/null @@ -1,241 +0,0 @@ -// -// local/basic_endpoint.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Derived from a public domain implementation written by Daniel Casimiro. -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_LOCAL_BASIC_ENDPOINT_HPP -#define BOOST_ASIO_LOCAL_BASIC_ENDPOINT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/local/detail/endpoint.hpp> - -#if !defined(BOOST_ASIO_NO_IOSTREAM) -# include <iosfwd> -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace local { - -/// Describes an endpoint for a UNIX socket. -/** - * The boost::asio::local::basic_endpoint class template describes an endpoint - * that may be associated with a particular UNIX socket. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * Endpoint. - */ -template <typename Protocol> -class basic_endpoint -{ -public: - /// The protocol type associated with the endpoint. - typedef Protocol protocol_type; - - /// The type of the endpoint structure. This type is dependent on the - /// underlying implementation of the socket layer. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined data_type; -#else - typedef boost::asio::detail::socket_addr_type data_type; -#endif - - /// Default constructor. - basic_endpoint() - { - } - - /// Construct an endpoint using the specified path name. - basic_endpoint(const char* path_name) - : impl_(path_name) - { - } - - /// Construct an endpoint using the specified path name. - basic_endpoint(const std::string& path_name) - : impl_(path_name) - { - } - - /// Copy constructor. - basic_endpoint(const basic_endpoint& other) - : impl_(other.impl_) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move constructor. - basic_endpoint(basic_endpoint&& other) - : impl_(other.impl_) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Assign from another endpoint. - basic_endpoint& operator=(const basic_endpoint& other) - { - impl_ = other.impl_; - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Move-assign from another endpoint. - basic_endpoint& operator=(basic_endpoint&& other) - { - impl_ = other.impl_; - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// The protocol associated with the endpoint. - protocol_type protocol() const - { - return protocol_type(); - } - - /// Get the underlying endpoint in the native type. - data_type* data() - { - return impl_.data(); - } - - /// Get the underlying endpoint in the native type. - const data_type* data() const - { - return impl_.data(); - } - - /// Get the underlying size of the endpoint in the native type. - std::size_t size() const - { - return impl_.size(); - } - - /// Set the underlying size of the endpoint in the native type. - void resize(std::size_t new_size) - { - impl_.resize(new_size); - } - - /// Get the capacity of the endpoint in the native type. - std::size_t capacity() const - { - return impl_.capacity(); - } - - /// Get the path associated with the endpoint. - std::string path() const - { - return impl_.path(); - } - - /// Set the path associated with the endpoint. - void path(const char* p) - { - impl_.path(p); - } - - /// Set the path associated with the endpoint. - void path(const std::string& p) - { - impl_.path(p); - } - - /// Compare two endpoints for equality. - friend bool operator==(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return e1.impl_ == e2.impl_; - } - - /// Compare two endpoints for inequality. - friend bool operator!=(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return !(e1.impl_ == e2.impl_); - } - - /// Compare endpoints for ordering. - friend bool operator<(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return e1.impl_ < e2.impl_; - } - - /// Compare endpoints for ordering. - friend bool operator>(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return e2.impl_ < e1.impl_; - } - - /// Compare endpoints for ordering. - friend bool operator<=(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return !(e2 < e1); - } - - /// Compare endpoints for ordering. - friend bool operator>=(const basic_endpoint<Protocol>& e1, - const basic_endpoint<Protocol>& e2) - { - return !(e1 < e2); - } - -private: - // The underlying UNIX domain endpoint. - boost::asio::local::detail::endpoint impl_; -}; - -/// Output an endpoint as a string. -/** - * Used to output a human-readable string for a specified endpoint. - * - * @param os The output stream to which the string will be written. - * - * @param endpoint The endpoint to be written. - * - * @return The output stream. - * - * @relates boost::asio::local::basic_endpoint - */ -template <typename Elem, typename Traits, typename Protocol> -std::basic_ostream<Elem, Traits>& operator<<( - std::basic_ostream<Elem, Traits>& os, - const basic_endpoint<Protocol>& endpoint) -{ - os << endpoint.path(); - return os; -} - -} // namespace local -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_LOCAL_BASIC_ENDPOINT_HPP diff --git a/contrib/restricted/boost/boost/asio/local/connect_pair.hpp b/contrib/restricted/boost/boost/asio/local/connect_pair.hpp deleted file mode 100644 index 10a3f6d2b1..0000000000 --- a/contrib/restricted/boost/boost/asio/local/connect_pair.hpp +++ /dev/null @@ -1,108 +0,0 @@ -// -// local/connect_pair.hpp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_LOCAL_CONNECT_PAIR_HPP -#define BOOST_ASIO_LOCAL_CONNECT_PAIR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/basic_socket.hpp> -#include <boost/asio/detail/socket_ops.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/local/basic_endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace local { - -/// Create a pair of connected sockets. -template <typename Protocol BOOST_ASIO_SVC_TPARAM BOOST_ASIO_SVC_TPARAM1> -void connect_pair( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& socket1, - basic_socket<Protocol BOOST_ASIO_SVC_TARG1>& socket2); - -/// Create a pair of connected sockets. -template <typename Protocol BOOST_ASIO_SVC_TPARAM BOOST_ASIO_SVC_TPARAM1> -BOOST_ASIO_SYNC_OP_VOID connect_pair( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& socket1, - basic_socket<Protocol BOOST_ASIO_SVC_TARG1>& socket2, - boost::system::error_code& ec); - -template <typename Protocol BOOST_ASIO_SVC_TPARAM BOOST_ASIO_SVC_TPARAM1> -inline void connect_pair( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& socket1, - basic_socket<Protocol BOOST_ASIO_SVC_TARG1>& socket2) -{ - boost::system::error_code ec; - connect_pair(socket1, socket2, ec); - boost::asio::detail::throw_error(ec, "connect_pair"); -} - -template <typename Protocol BOOST_ASIO_SVC_TPARAM BOOST_ASIO_SVC_TPARAM1> -inline BOOST_ASIO_SYNC_OP_VOID connect_pair( - basic_socket<Protocol BOOST_ASIO_SVC_TARG>& socket1, - basic_socket<Protocol BOOST_ASIO_SVC_TARG1>& socket2, - boost::system::error_code& ec) -{ - // Check that this function is only being used with a UNIX domain socket. - boost::asio::local::basic_endpoint<Protocol>* tmp - = static_cast<typename Protocol::endpoint*>(0); - (void)tmp; - - Protocol protocol; - boost::asio::detail::socket_type sv[2]; - if (boost::asio::detail::socket_ops::socketpair(protocol.family(), - protocol.type(), protocol.protocol(), sv, ec) - == boost::asio::detail::socket_error_retval) - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - - socket1.assign(protocol, sv[0], ec); - if (ec) - { - boost::system::error_code temp_ec; - boost::asio::detail::socket_ops::state_type state[2] = { 0, 0 }; - boost::asio::detail::socket_ops::close(sv[0], state[0], true, temp_ec); - boost::asio::detail::socket_ops::close(sv[1], state[1], true, temp_ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - socket2.assign(protocol, sv[1], ec); - if (ec) - { - boost::system::error_code temp_ec; - socket1.close(temp_ec); - boost::asio::detail::socket_ops::state_type state = 0; - boost::asio::detail::socket_ops::close(sv[1], state, true, temp_ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -} // namespace local -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_LOCAL_CONNECT_PAIR_HPP diff --git a/contrib/restricted/boost/boost/asio/local/datagram_protocol.hpp b/contrib/restricted/boost/boost/asio/local/datagram_protocol.hpp deleted file mode 100644 index c664323013..0000000000 --- a/contrib/restricted/boost/boost/asio/local/datagram_protocol.hpp +++ /dev/null @@ -1,82 +0,0 @@ -// -// local/datagram_protocol.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP -#define BOOST_ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/basic_datagram_socket.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/local/basic_endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace local { - -/// Encapsulates the flags needed for datagram-oriented UNIX sockets. -/** - * The boost::asio::local::datagram_protocol class contains flags necessary for - * datagram-oriented UNIX domain sockets. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe. - * - * @par Concepts: - * Protocol. - */ -class datagram_protocol -{ -public: - /// Obtain an identifier for the type of the protocol. - int type() const - { - return SOCK_DGRAM; - } - - /// Obtain an identifier for the protocol. - int protocol() const - { - return 0; - } - - /// Obtain an identifier for the protocol family. - int family() const - { - return AF_UNIX; - } - - /// The type of a UNIX domain endpoint. - typedef basic_endpoint<datagram_protocol> endpoint; - - /// The UNIX domain socket type. - typedef basic_datagram_socket<datagram_protocol> socket; -}; - -} // namespace local -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP diff --git a/contrib/restricted/boost/boost/asio/local/detail/endpoint.hpp b/contrib/restricted/boost/boost/asio/local/detail/endpoint.hpp deleted file mode 100644 index 52d6246ae9..0000000000 --- a/contrib/restricted/boost/boost/asio/local/detail/endpoint.hpp +++ /dev/null @@ -1,135 +0,0 @@ -// -// local/detail/endpoint.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Derived from a public domain implementation written by Daniel Casimiro. -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_LOCAL_DETAIL_ENDPOINT_HPP -#define BOOST_ASIO_LOCAL_DETAIL_ENDPOINT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) - -#include <cstddef> -#include <string> -#include <boost/asio/detail/socket_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace local { -namespace detail { - -// Helper class for implementing a UNIX domain endpoint. -class endpoint -{ -public: - // Default constructor. - BOOST_ASIO_DECL endpoint(); - - // Construct an endpoint using the specified path name. - BOOST_ASIO_DECL endpoint(const char* path_name); - - // Construct an endpoint using the specified path name. - BOOST_ASIO_DECL endpoint(const std::string& path_name); - - // Copy constructor. - endpoint(const endpoint& other) - : data_(other.data_), - path_length_(other.path_length_) - { - } - - // Assign from another endpoint. - endpoint& operator=(const endpoint& other) - { - data_ = other.data_; - path_length_ = other.path_length_; - return *this; - } - - // Get the underlying endpoint in the native type. - boost::asio::detail::socket_addr_type* data() - { - return &data_.base; - } - - // Get the underlying endpoint in the native type. - const boost::asio::detail::socket_addr_type* data() const - { - return &data_.base; - } - - // Get the underlying size of the endpoint in the native type. - std::size_t size() const - { - return path_length_ - + offsetof(boost::asio::detail::sockaddr_un_type, sun_path); - } - - // Set the underlying size of the endpoint in the native type. - BOOST_ASIO_DECL void resize(std::size_t size); - - // Get the capacity of the endpoint in the native type. - std::size_t capacity() const - { - return sizeof(boost::asio::detail::sockaddr_un_type); - } - - // Get the path associated with the endpoint. - BOOST_ASIO_DECL std::string path() const; - - // Set the path associated with the endpoint. - BOOST_ASIO_DECL void path(const char* p); - - // Set the path associated with the endpoint. - BOOST_ASIO_DECL void path(const std::string& p); - - // Compare two endpoints for equality. - BOOST_ASIO_DECL friend bool operator==( - const endpoint& e1, const endpoint& e2); - - // Compare endpoints for ordering. - BOOST_ASIO_DECL friend bool operator<( - const endpoint& e1, const endpoint& e2); - -private: - // The underlying UNIX socket address. - union data_union - { - boost::asio::detail::socket_addr_type base; - boost::asio::detail::sockaddr_un_type local; - } data_; - - // The length of the path associated with the endpoint. - std::size_t path_length_; - - // Initialise with a specified path. - BOOST_ASIO_DECL void init(const char* path, std::size_t path_length); -}; - -} // namespace detail -} // namespace local -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/local/detail/impl/endpoint.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) - -#endif // BOOST_ASIO_LOCAL_DETAIL_ENDPOINT_HPP diff --git a/contrib/restricted/boost/boost/asio/local/detail/impl/endpoint.ipp b/contrib/restricted/boost/boost/asio/local/detail/impl/endpoint.ipp deleted file mode 100644 index 3d6a800414..0000000000 --- a/contrib/restricted/boost/boost/asio/local/detail/impl/endpoint.ipp +++ /dev/null @@ -1,131 +0,0 @@ -// -// local/detail/impl/endpoint.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Derived from a public domain implementation written by Daniel Casimiro. -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_LOCAL_DETAIL_IMPL_ENDPOINT_IPP -#define BOOST_ASIO_LOCAL_DETAIL_IMPL_ENDPOINT_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) - -#include <cstring> -#include <boost/asio/detail/socket_ops.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/local/detail/endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace local { -namespace detail { - -endpoint::endpoint() -{ - init("", 0); -} - -endpoint::endpoint(const char* path_name) -{ - using namespace std; // For strlen. - init(path_name, strlen(path_name)); -} - -endpoint::endpoint(const std::string& path_name) -{ - init(path_name.data(), path_name.length()); -} - -void endpoint::resize(std::size_t new_size) -{ - if (new_size > sizeof(boost::asio::detail::sockaddr_un_type)) - { - boost::system::error_code ec(boost::asio::error::invalid_argument); - boost::asio::detail::throw_error(ec); - } - else if (new_size == 0) - { - path_length_ = 0; - } - else - { - path_length_ = new_size - - offsetof(boost::asio::detail::sockaddr_un_type, sun_path); - - // The path returned by the operating system may be NUL-terminated. - if (path_length_ > 0 && data_.local.sun_path[path_length_ - 1] == 0) - --path_length_; - } -} - -std::string endpoint::path() const -{ - return std::string(data_.local.sun_path, path_length_); -} - -void endpoint::path(const char* p) -{ - using namespace std; // For strlen. - init(p, strlen(p)); -} - -void endpoint::path(const std::string& p) -{ - init(p.data(), p.length()); -} - -bool operator==(const endpoint& e1, const endpoint& e2) -{ - return e1.path() == e2.path(); -} - -bool operator<(const endpoint& e1, const endpoint& e2) -{ - return e1.path() < e2.path(); -} - -void endpoint::init(const char* path_name, std::size_t path_length) -{ - if (path_length > sizeof(data_.local.sun_path) - 1) - { - // The buffer is not large enough to store this address. - boost::system::error_code ec(boost::asio::error::name_too_long); - boost::asio::detail::throw_error(ec); - } - - using namespace std; // For memcpy. - data_.local = boost::asio::detail::sockaddr_un_type(); - data_.local.sun_family = AF_UNIX; - if (path_length > 0) - memcpy(data_.local.sun_path, path_name, path_length); - path_length_ = path_length; - - // NUL-terminate normal path names. Names that start with a NUL are in the - // UNIX domain protocol's "abstract namespace" and are not NUL-terminated. - if (path_length > 0 && data_.local.sun_path[0] == 0) - data_.local.sun_path[path_length] = 0; -} - -} // namespace detail -} // namespace local -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) - -#endif // BOOST_ASIO_LOCAL_DETAIL_IMPL_ENDPOINT_IPP diff --git a/contrib/restricted/boost/boost/asio/local/stream_protocol.hpp b/contrib/restricted/boost/boost/asio/local/stream_protocol.hpp deleted file mode 100644 index 65fdbf1a90..0000000000 --- a/contrib/restricted/boost/boost/asio/local/stream_protocol.hpp +++ /dev/null @@ -1,92 +0,0 @@ -// -// local/stream_protocol.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_LOCAL_STREAM_PROTOCOL_HPP -#define BOOST_ASIO_LOCAL_STREAM_PROTOCOL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/basic_socket_acceptor.hpp> -#include <boost/asio/basic_socket_iostream.hpp> -#include <boost/asio/basic_stream_socket.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/local/basic_endpoint.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace local { - -/// Encapsulates the flags needed for stream-oriented UNIX sockets. -/** - * The boost::asio::local::stream_protocol class contains flags necessary for - * stream-oriented UNIX domain sockets. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe. - * - * @par Concepts: - * Protocol. - */ -class stream_protocol -{ -public: - /// Obtain an identifier for the type of the protocol. - int type() const - { - return SOCK_STREAM; - } - - /// Obtain an identifier for the protocol. - int protocol() const - { - return 0; - } - - /// Obtain an identifier for the protocol family. - int family() const - { - return AF_UNIX; - } - - /// The type of a UNIX domain endpoint. - typedef basic_endpoint<stream_protocol> endpoint; - - /// The UNIX domain socket type. - typedef basic_stream_socket<stream_protocol> socket; - - /// The UNIX domain acceptor type. - typedef basic_socket_acceptor<stream_protocol> acceptor; - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - /// The UNIX domain iostream type. - typedef basic_socket_iostream<stream_protocol> iostream; -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -}; - -} // namespace local -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_LOCAL_STREAM_PROTOCOL_HPP diff --git a/contrib/restricted/boost/boost/asio/packaged_task.hpp b/contrib/restricted/boost/boost/asio/packaged_task.hpp deleted file mode 100644 index da6c5aeaa8..0000000000 --- a/contrib/restricted/boost/boost/asio/packaged_task.hpp +++ /dev/null @@ -1,128 +0,0 @@ -// -// packaged_task.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_PACKAGED_TASK_HPP -#define BOOST_ASIO_PACKAGED_TASK_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_STD_FUTURE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <future> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/detail/variadic_templates.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) \ - || defined(GENERATING_DOCUMENTATION) - -/// Partial specialisation of @c async_result for @c std::packaged_task. -template <typename Result, typename... Args, typename Signature> -class async_result<std::packaged_task<Result(Args...)>, Signature> -{ -public: - /// The packaged task is the concrete completion handler type. - typedef std::packaged_task<Result(Args...)> completion_handler_type; - - /// The return type of the initiating function is the future obtained from - /// the packaged task. - typedef std::future<Result> return_type; - - /// The constructor extracts the future from the packaged task. - explicit async_result(completion_handler_type& h) - : future_(h.get_future()) - { - } - - /// Returns the packaged task's future. - return_type get() - { - return std::move(future_); - } - -private: - return_type future_; -}; - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - // || defined(GENERATING_DOCUMENTATION) - -template <typename Result, typename Signature> -struct async_result<std::packaged_task<Result()>, Signature> -{ - typedef std::packaged_task<Result()> completion_handler_type; - typedef std::future<Result> return_type; - - explicit async_result(completion_handler_type& h) - : future_(h.get_future()) - { - } - - return_type get() - { - return std::move(future_); - } - -private: - return_type future_; -}; - -#define BOOST_ASIO_PRIVATE_ASYNC_RESULT_DEF(n) \ - template <typename Result, \ - BOOST_ASIO_VARIADIC_TPARAMS(n), typename Signature> \ - class async_result< \ - std::packaged_task<Result(BOOST_ASIO_VARIADIC_TARGS(n))>, Signature> \ - { \ - public: \ - typedef std::packaged_task< \ - Result(BOOST_ASIO_VARIADIC_TARGS(n))> \ - completion_handler_type; \ - \ - typedef std::future<Result> return_type; \ - \ - explicit async_result(completion_handler_type& h) \ - : future_(h.get_future()) \ - { \ - } \ - \ - return_type get() \ - { \ - return std::move(future_); \ - } \ - \ - private: \ - return_type future_; \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_ASYNC_RESULT_DEF) -#undef BOOST_ASIO_PRIVATE_ASYNC_RESULT_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - // || defined(GENERATING_DOCUMENTATION) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_STD_FUTURE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_PACKAGED_TASK_HPP diff --git a/contrib/restricted/boost/boost/asio/placeholders.hpp b/contrib/restricted/boost/boost/asio/placeholders.hpp deleted file mode 100644 index 50e399ed28..0000000000 --- a/contrib/restricted/boost/boost/asio/placeholders.hpp +++ /dev/null @@ -1,153 +0,0 @@ -// -// placeholders.hpp -// ~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_PLACEHOLDERS_HPP -#define BOOST_ASIO_PLACEHOLDERS_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_BOOST_BIND) -# include <boost/bind/arg.hpp> -#endif // defined(BOOST_ASIO_HAS_BOOST_BIND) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace placeholders { - -#if defined(GENERATING_DOCUMENTATION) - -/// An argument placeholder, for use with boost::bind(), that corresponds to -/// the error argument of a handler for any of the asynchronous functions. -unspecified error; - -/// An argument placeholder, for use with boost::bind(), that corresponds to -/// the bytes_transferred argument of a handler for asynchronous functions such -/// as boost::asio::basic_stream_socket::async_write_some or -/// boost::asio::async_write. -unspecified bytes_transferred; - -/// An argument placeholder, for use with boost::bind(), that corresponds to -/// the iterator argument of a handler for asynchronous functions such as -/// boost::asio::async_connect. -unspecified iterator; - -/// An argument placeholder, for use with boost::bind(), that corresponds to -/// the results argument of a handler for asynchronous functions such as -/// boost::asio::basic_resolver::async_resolve. -unspecified results; - -/// An argument placeholder, for use with boost::bind(), that corresponds to -/// the results argument of a handler for asynchronous functions such as -/// boost::asio::async_connect. -unspecified endpoint; - -/// An argument placeholder, for use with boost::bind(), that corresponds to -/// the signal_number argument of a handler for asynchronous functions such as -/// boost::asio::signal_set::async_wait. -unspecified signal_number; - -#elif defined(BOOST_ASIO_HAS_BOOST_BIND) -# if defined(__BORLANDC__) || defined(__GNUC__) - -inline boost::arg<1> error() -{ - return boost::arg<1>(); -} - -inline boost::arg<2> bytes_transferred() -{ - return boost::arg<2>(); -} - -inline boost::arg<2> iterator() -{ - return boost::arg<2>(); -} - -inline boost::arg<2> results() -{ - return boost::arg<2>(); -} - -inline boost::arg<2> endpoint() -{ - return boost::arg<2>(); -} - -inline boost::arg<2> signal_number() -{ - return boost::arg<2>(); -} - -# else - -namespace detail -{ - template <int Number> - struct placeholder - { - static boost::arg<Number>& get() - { - static boost::arg<Number> result; - return result; - } - }; -} - -# if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC < 1400) - -static boost::arg<1>& error - = boost::asio::placeholders::detail::placeholder<1>::get(); -static boost::arg<2>& bytes_transferred - = boost::asio::placeholders::detail::placeholder<2>::get(); -static boost::arg<2>& iterator - = boost::asio::placeholders::detail::placeholder<2>::get(); -static boost::arg<2>& results - = boost::asio::placeholders::detail::placeholder<2>::get(); -static boost::arg<2>& endpoint - = boost::asio::placeholders::detail::placeholder<2>::get(); -static boost::arg<2>& signal_number - = boost::asio::placeholders::detail::placeholder<2>::get(); - -# else - -namespace -{ - boost::arg<1>& error - = boost::asio::placeholders::detail::placeholder<1>::get(); - boost::arg<2>& bytes_transferred - = boost::asio::placeholders::detail::placeholder<2>::get(); - boost::arg<2>& iterator - = boost::asio::placeholders::detail::placeholder<2>::get(); - boost::arg<2>& results - = boost::asio::placeholders::detail::placeholder<2>::get(); - boost::arg<2>& endpoint - = boost::asio::placeholders::detail::placeholder<2>::get(); - boost::arg<2>& signal_number - = boost::asio::placeholders::detail::placeholder<2>::get(); -} // namespace - -# endif -# endif -#endif - -} // namespace placeholders -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_PLACEHOLDERS_HPP diff --git a/contrib/restricted/boost/boost/asio/posix/basic_descriptor.hpp b/contrib/restricted/boost/boost/asio/posix/basic_descriptor.hpp deleted file mode 100644 index faf5b6def2..0000000000 --- a/contrib/restricted/boost/boost/asio/posix/basic_descriptor.hpp +++ /dev/null @@ -1,584 +0,0 @@ -// -// posix/basic_descriptor.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_POSIX_BASIC_DESCRIPTOR_HPP -#define BOOST_ASIO_POSIX_BASIC_DESCRIPTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/posix/descriptor_base.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace posix { - -/// Provides POSIX descriptor functionality. -/** - * The posix::basic_descriptor class template provides the ability to wrap a - * POSIX descriptor. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <typename DescriptorService> -class basic_descriptor - : public basic_io_object<DescriptorService>, - public descriptor_base -{ -public: - /// The native representation of a descriptor. - typedef typename DescriptorService::native_handle_type native_handle_type; - - /// A basic_descriptor is always the lowest layer. - typedef basic_descriptor<DescriptorService> lowest_layer_type; - - /// Construct a basic_descriptor without opening it. - /** - * This constructor creates a descriptor without opening it. - * - * @param io_context The io_context object that the descriptor will use to - * dispatch handlers for any asynchronous operations performed on the - * descriptor. - */ - explicit basic_descriptor(boost::asio::io_context& io_context) - : basic_io_object<DescriptorService>(io_context) - { - } - - /// Construct a basic_descriptor on an existing native descriptor. - /** - * This constructor creates a descriptor object to hold an existing native - * descriptor. - * - * @param io_context The io_context object that the descriptor will use to - * dispatch handlers for any asynchronous operations performed on the - * descriptor. - * - * @param native_descriptor A native descriptor. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_descriptor(boost::asio::io_context& io_context, - const native_handle_type& native_descriptor) - : basic_io_object<DescriptorService>(io_context) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - native_descriptor, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_descriptor from another. - /** - * This constructor moves a descriptor from one object to another. - * - * @param other The other basic_descriptor object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_descriptor(io_context&) constructor. - */ - basic_descriptor(basic_descriptor&& other) - : basic_io_object<DescriptorService>( - BOOST_ASIO_MOVE_CAST(basic_descriptor)(other)) - { - } - - /// Move-assign a basic_descriptor from another. - /** - * This assignment operator moves a descriptor from one object to another. - * - * @param other The other basic_descriptor object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_descriptor(io_context&) constructor. - */ - basic_descriptor& operator=(basic_descriptor&& other) - { - basic_io_object<DescriptorService>::operator=( - BOOST_ASIO_MOVE_CAST(basic_descriptor)(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Get a reference to the lowest layer. - /** - * This function returns a reference to the lowest layer in a stack of - * layers. Since a basic_descriptor cannot contain any further layers, it - * simply returns a reference to itself. - * - * @return A reference to the lowest layer in the stack of layers. Ownership - * is not transferred to the caller. - */ - lowest_layer_type& lowest_layer() - { - return *this; - } - - /// Get a const reference to the lowest layer. - /** - * This function returns a const reference to the lowest layer in a stack of - * layers. Since a basic_descriptor cannot contain any further layers, it - * simply returns a reference to itself. - * - * @return A const reference to the lowest layer in the stack of layers. - * Ownership is not transferred to the caller. - */ - const lowest_layer_type& lowest_layer() const - { - return *this; - } - - /// Assign an existing native descriptor to the descriptor. - /* - * This function opens the descriptor to hold an existing native descriptor. - * - * @param native_descriptor A native descriptor. - * - * @throws boost::system::system_error Thrown on failure. - */ - void assign(const native_handle_type& native_descriptor) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - native_descriptor, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - - /// Assign an existing native descriptor to the descriptor. - /* - * This function opens the descriptor to hold an existing native descriptor. - * - * @param native_descriptor A native descriptor. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID assign(const native_handle_type& native_descriptor, - boost::system::error_code& ec) - { - this->get_service().assign( - this->get_implementation(), native_descriptor, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the descriptor is open. - bool is_open() const - { - return this->get_service().is_open(this->get_implementation()); - } - - /// Close the descriptor. - /** - * This function is used to close the descriptor. Any asynchronous read or - * write operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. Note that, even if - * the function indicates an error, the underlying descriptor is closed. - */ - void close() - { - boost::system::error_code ec; - this->get_service().close(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "close"); - } - - /// Close the descriptor. - /** - * This function is used to close the descriptor. Any asynchronous read or - * write operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. Note that, even if - * the function indicates an error, the underlying descriptor is closed. - */ - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - this->get_service().close(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native descriptor representation. - /** - * This function may be used to obtain the underlying representation of the - * descriptor. This is intended to allow access to native descriptor - * functionality that is not otherwise provided. - */ - native_handle_type native_handle() - { - return this->get_service().native_handle(this->get_implementation()); - } - - /// Release ownership of the native descriptor implementation. - /** - * This function may be used to obtain the underlying representation of the - * descriptor. After calling this function, @c is_open() returns false. The - * caller is responsible for closing the descriptor. - * - * All outstanding asynchronous read or write operations will finish - * immediately, and the handlers for cancelled operations will be passed the - * boost::asio::error::operation_aborted error. - */ - native_handle_type release() - { - return this->get_service().release(this->get_implementation()); - } - - /// Cancel all asynchronous operations associated with the descriptor. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all asynchronous operations associated with the descriptor. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform an IO control command on the descriptor. - /** - * This function is used to execute an IO control command on the descriptor. - * - * @param command The IO control command to be performed on the descriptor. - * - * @throws boost::system::system_error Thrown on failure. - * - * @sa IoControlCommand @n - * boost::asio::posix::descriptor_base::bytes_readable @n - * boost::asio::posix::descriptor_base::non_blocking_io - * - * @par Example - * Getting the number of bytes ready to read: - * @code - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * boost::asio::posix::stream_descriptor::bytes_readable command; - * descriptor.io_control(command); - * std::size_t bytes_readable = command.get(); - * @endcode - */ - template <typename IoControlCommand> - void io_control(IoControlCommand& command) - { - boost::system::error_code ec; - this->get_service().io_control(this->get_implementation(), command, ec); - boost::asio::detail::throw_error(ec, "io_control"); - } - - /// Perform an IO control command on the descriptor. - /** - * This function is used to execute an IO control command on the descriptor. - * - * @param command The IO control command to be performed on the descriptor. - * - * @param ec Set to indicate what error occurred, if any. - * - * @sa IoControlCommand @n - * boost::asio::posix::descriptor_base::bytes_readable @n - * boost::asio::posix::descriptor_base::non_blocking_io - * - * @par Example - * Getting the number of bytes ready to read: - * @code - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * boost::asio::posix::stream_descriptor::bytes_readable command; - * boost::system::error_code ec; - * descriptor.io_control(command, ec); - * if (ec) - * { - * // An error occurred. - * } - * std::size_t bytes_readable = command.get(); - * @endcode - */ - template <typename IoControlCommand> - BOOST_ASIO_SYNC_OP_VOID io_control(IoControlCommand& command, - boost::system::error_code& ec) - { - this->get_service().io_control(this->get_implementation(), command, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the descriptor. - /** - * @returns @c true if the descriptor's synchronous operations will fail with - * boost::asio::error::would_block if they are unable to perform the requested - * operation immediately. If @c false, synchronous operations will block - * until complete. - * - * @note The non-blocking mode has no effect on the behaviour of asynchronous - * operations. Asynchronous operations will never fail with the error - * boost::asio::error::would_block. - */ - bool non_blocking() const - { - return this->get_service().non_blocking(this->get_implementation()); - } - - /// Sets the non-blocking mode of the descriptor. - /** - * @param mode If @c true, the descriptor's synchronous operations will fail - * with boost::asio::error::would_block if they are unable to perform the - * requested operation immediately. If @c false, synchronous operations will - * block until complete. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The non-blocking mode has no effect on the behaviour of asynchronous - * operations. Asynchronous operations will never fail with the error - * boost::asio::error::would_block. - */ - void non_blocking(bool mode) - { - boost::system::error_code ec; - this->get_service().non_blocking(this->get_implementation(), mode, ec); - boost::asio::detail::throw_error(ec, "non_blocking"); - } - - /// Sets the non-blocking mode of the descriptor. - /** - * @param mode If @c true, the descriptor's synchronous operations will fail - * with boost::asio::error::would_block if they are unable to perform the - * requested operation immediately. If @c false, synchronous operations will - * block until complete. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note The non-blocking mode has no effect on the behaviour of asynchronous - * operations. Asynchronous operations will never fail with the error - * boost::asio::error::would_block. - */ - BOOST_ASIO_SYNC_OP_VOID non_blocking( - bool mode, boost::system::error_code& ec) - { - this->get_service().non_blocking(this->get_implementation(), mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the native descriptor implementation. - /** - * This function is used to retrieve the non-blocking mode of the underlying - * native descriptor. This mode has no effect on the behaviour of the - * descriptor object's synchronous operations. - * - * @returns @c true if the underlying descriptor is in non-blocking mode and - * direct system calls may fail with boost::asio::error::would_block (or the - * equivalent system error). - * - * @note The current non-blocking mode is cached by the descriptor object. - * Consequently, the return value may be incorrect if the non-blocking mode - * was set directly on the native descriptor. - */ - bool native_non_blocking() const - { - return this->get_service().native_non_blocking( - this->get_implementation()); - } - - /// Sets the non-blocking mode of the native descriptor implementation. - /** - * This function is used to modify the non-blocking mode of the underlying - * native descriptor. It has no effect on the behaviour of the descriptor - * object's synchronous operations. - * - * @param mode If @c true, the underlying descriptor is put into non-blocking - * mode and direct system calls may fail with boost::asio::error::would_block - * (or the equivalent system error). - * - * @throws boost::system::system_error Thrown on failure. If the @c mode is - * @c false, but the current value of @c non_blocking() is @c true, this - * function fails with boost::asio::error::invalid_argument, as the - * combination does not make sense. - */ - void native_non_blocking(bool mode) - { - boost::system::error_code ec; - this->get_service().native_non_blocking( - this->get_implementation(), mode, ec); - boost::asio::detail::throw_error(ec, "native_non_blocking"); - } - - /// Sets the non-blocking mode of the native descriptor implementation. - /** - * This function is used to modify the non-blocking mode of the underlying - * native descriptor. It has no effect on the behaviour of the descriptor - * object's synchronous operations. - * - * @param mode If @c true, the underlying descriptor is put into non-blocking - * mode and direct system calls may fail with boost::asio::error::would_block - * (or the equivalent system error). - * - * @param ec Set to indicate what error occurred, if any. If the @c mode is - * @c false, but the current value of @c non_blocking() is @c true, this - * function fails with boost::asio::error::invalid_argument, as the - * combination does not make sense. - */ - BOOST_ASIO_SYNC_OP_VOID native_non_blocking( - bool mode, boost::system::error_code& ec) - { - this->get_service().native_non_blocking( - this->get_implementation(), mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Wait for the descriptor to become ready to read, ready to write, or to - /// have pending error conditions. - /** - * This function is used to perform a blocking wait for a descriptor to enter - * a ready to read, write or error condition state. - * - * @param w Specifies the desired descriptor state. - * - * @par Example - * Waiting for a descriptor to become readable. - * @code - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * descriptor.wait(boost::asio::posix::stream_descriptor::wait_read); - * @endcode - */ - void wait(wait_type w) - { - boost::system::error_code ec; - this->get_service().wait(this->get_implementation(), w, ec); - boost::asio::detail::throw_error(ec, "wait"); - } - - /// Wait for the descriptor to become ready to read, ready to write, or to - /// have pending error conditions. - /** - * This function is used to perform a blocking wait for a descriptor to enter - * a ready to read, write or error condition state. - * - * @param w Specifies the desired descriptor state. - * - * @param ec Set to indicate what error occurred, if any. - * - * @par Example - * Waiting for a descriptor to become readable. - * @code - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * boost::system::error_code ec; - * descriptor.wait(boost::asio::posix::stream_descriptor::wait_read, ec); - * @endcode - */ - BOOST_ASIO_SYNC_OP_VOID wait(wait_type w, boost::system::error_code& ec) - { - this->get_service().wait(this->get_implementation(), w, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Asynchronously wait for the descriptor to become ready to read, ready to - /// write, or to have pending error conditions. - /** - * This function is used to perform an asynchronous wait for a descriptor to - * enter a ready to read, write or error condition state. - * - * @param w Specifies the desired descriptor state. - * - * @param handler The handler to be called when the wait operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code - * void wait_handler(const boost::system::error_code& error) - * { - * if (!error) - * { - * // Wait succeeded. - * } - * } - * - * ... - * - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * descriptor.async_wait( - * boost::asio::posix::stream_descriptor::wait_read, - * wait_handler); - * @endcode - */ - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(wait_type w, BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WaitHandler. - BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; - - return this->get_service().async_wait(this->get_implementation(), - w, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); - } - -protected: - /// Protected destructor to prevent deletion through this type. - ~basic_descriptor() - { - } -}; - -} // namespace posix -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_POSIX_BASIC_DESCRIPTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/posix/basic_stream_descriptor.hpp b/contrib/restricted/boost/boost/asio/posix/basic_stream_descriptor.hpp deleted file mode 100644 index d840703a95..0000000000 --- a/contrib/restricted/boost/boost/asio/posix/basic_stream_descriptor.hpp +++ /dev/null @@ -1,364 +0,0 @@ -// -// posix/basic_stream_descriptor.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_POSIX_BASIC_STREAM_DESCRIPTOR_HPP -#define BOOST_ASIO_POSIX_BASIC_STREAM_DESCRIPTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/posix/basic_descriptor.hpp> -#include <boost/asio/posix/stream_descriptor_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace posix { - -/// Provides stream-oriented descriptor functionality. -/** - * The posix::basic_stream_descriptor class template provides asynchronous and - * blocking stream-oriented descriptor functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream. - */ -template <typename StreamDescriptorService = stream_descriptor_service> -class basic_stream_descriptor - : public basic_descriptor<StreamDescriptorService> -{ -public: - /// The native representation of a descriptor. - typedef typename StreamDescriptorService::native_handle_type - native_handle_type; - - /// Construct a basic_stream_descriptor without opening it. - /** - * This constructor creates a stream descriptor without opening it. The - * descriptor needs to be opened and then connected or accepted before data - * can be sent or received on it. - * - * @param io_context The io_context object that the stream descriptor will - * use to dispatch handlers for any asynchronous operations performed on the - * descriptor. - */ - explicit basic_stream_descriptor(boost::asio::io_context& io_context) - : basic_descriptor<StreamDescriptorService>(io_context) - { - } - - /// Construct a basic_stream_descriptor on an existing native descriptor. - /** - * This constructor creates a stream descriptor object to hold an existing - * native descriptor. - * - * @param io_context The io_context object that the stream descriptor will - * use to dispatch handlers for any asynchronous operations performed on the - * descriptor. - * - * @param native_descriptor The new underlying descriptor implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_stream_descriptor(boost::asio::io_context& io_context, - const native_handle_type& native_descriptor) - : basic_descriptor<StreamDescriptorService>(io_context, native_descriptor) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_stream_descriptor from another. - /** - * This constructor moves a stream descriptor from one object to another. - * - * @param other The other basic_stream_descriptor object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_descriptor(io_context&) constructor. - */ - basic_stream_descriptor(basic_stream_descriptor&& other) - : basic_descriptor<StreamDescriptorService>( - BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other)) - { - } - - /// Move-assign a basic_stream_descriptor from another. - /** - * This assignment operator moves a stream descriptor from one object to - * another. - * - * @param other The other basic_stream_descriptor object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_descriptor(io_context&) constructor. - */ - basic_stream_descriptor& operator=(basic_stream_descriptor&& other) - { - basic_descriptor<StreamDescriptorService>::operator=( - BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Write some data to the descriptor. - /** - * This function is used to write data to the stream descriptor. The function - * call will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the descriptor. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * descriptor.write_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().write_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "write_some"); - return s; - } - - /// Write some data to the descriptor. - /** - * This function is used to write data to the stream descriptor. The function - * call will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the descriptor. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().write_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous write. - /** - * This function is used to asynchronously write data to the stream - * descriptor. The function call always returns immediately. - * - * @param buffers One or more data buffers to be written to the descriptor. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The write operation may not transmit all of the data to the peer. - * Consider using the @ref async_write function if you need to ensure that all - * data is written before the asynchronous operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * descriptor.async_write_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - return this->get_service().async_write_some(this->get_implementation(), - buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); - } - - /// Read some data from the descriptor. - /** - * This function is used to read data from the stream descriptor. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The read_some operation may not read all of the requested number of - * 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. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * descriptor.read_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().read_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "read_some"); - return s; - } - - /// Read some data from the descriptor. - /** - * This function is used to read data from the stream descriptor. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().read_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous read. - /** - * This function is used to asynchronously read data from the stream - * descriptor. The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The read operation may not read all of the requested number of bytes. - * Consider using the @ref async_read function if you need to ensure that the - * requested amount of data is read before the asynchronous operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * descriptor.async_read_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - return this->get_service().async_read_some(this->get_implementation(), - buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); - } -}; - -} // namespace posix -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_POSIX_BASIC_STREAM_DESCRIPTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/posix/descriptor.hpp b/contrib/restricted/boost/boost/asio/posix/descriptor.hpp deleted file mode 100644 index be672ff11c..0000000000 --- a/contrib/restricted/boost/boost/asio/posix/descriptor.hpp +++ /dev/null @@ -1,646 +0,0 @@ -// -// posix/descriptor.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_POSIX_DESCRIPTOR_HPP -#define BOOST_ASIO_POSIX_DESCRIPTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/async_result.hpp> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/reactive_descriptor_service.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/posix/descriptor_base.hpp> - -#if defined(BOOST_ASIO_HAS_MOVE) -# include <utility> -#endif // defined(BOOST_ASIO_HAS_MOVE) - -#define BOOST_ASIO_SVC_T boost::asio::detail::reactive_descriptor_service - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace posix { - -/// Provides POSIX descriptor functionality. -/** - * The posix::descriptor class template provides the ability to wrap a - * POSIX descriptor. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -class descriptor - : BOOST_ASIO_SVC_ACCESS basic_io_object<BOOST_ASIO_SVC_T>, - public descriptor_base -{ -public: - /// The type of the executor associated with the object. - typedef io_context::executor_type executor_type; - - /// The native representation of a descriptor. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef BOOST_ASIO_SVC_T::native_handle_type native_handle_type; -#endif - - /// A descriptor is always the lowest layer. - typedef descriptor lowest_layer_type; - - /// Construct a descriptor without opening it. - /** - * This constructor creates a descriptor without opening it. - * - * @param io_context The io_context object that the descriptor will use to - * dispatch handlers for any asynchronous operations performed on the - * descriptor. - */ - explicit descriptor(boost::asio::io_context& io_context) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - } - - /// Construct a descriptor on an existing native descriptor. - /** - * This constructor creates a descriptor object to hold an existing native - * descriptor. - * - * @param io_context The io_context object that the descriptor will use to - * dispatch handlers for any asynchronous operations performed on the - * descriptor. - * - * @param native_descriptor A native descriptor. - * - * @throws boost::system::system_error Thrown on failure. - */ - descriptor(boost::asio::io_context& io_context, - const native_handle_type& native_descriptor) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - native_descriptor, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a descriptor from another. - /** - * This constructor moves a descriptor from one object to another. - * - * @param other The other descriptor object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c descriptor(io_context&) constructor. - */ - descriptor(descriptor&& other) - : basic_io_object<BOOST_ASIO_SVC_T>(std::move(other)) - { - } - - /// Move-assign a descriptor from another. - /** - * This assignment operator moves a descriptor from one object to another. - * - * @param other The other descriptor object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c descriptor(io_context&) constructor. - */ - descriptor& operator=(descriptor&& other) - { - basic_io_object<BOOST_ASIO_SVC_T>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_context() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_service() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_executor(); - } - - /// Get a reference to the lowest layer. - /** - * This function returns a reference to the lowest layer in a stack of - * layers. Since a descriptor cannot contain any further layers, it - * simply returns a reference to itself. - * - * @return A reference to the lowest layer in the stack of layers. Ownership - * is not transferred to the caller. - */ - lowest_layer_type& lowest_layer() - { - return *this; - } - - /// Get a const reference to the lowest layer. - /** - * This function returns a const reference to the lowest layer in a stack of - * layers. Since a descriptor cannot contain any further layers, it - * simply returns a reference to itself. - * - * @return A const reference to the lowest layer in the stack of layers. - * Ownership is not transferred to the caller. - */ - const lowest_layer_type& lowest_layer() const - { - return *this; - } - - /// Assign an existing native descriptor to the descriptor. - /* - * This function opens the descriptor to hold an existing native descriptor. - * - * @param native_descriptor A native descriptor. - * - * @throws boost::system::system_error Thrown on failure. - */ - void assign(const native_handle_type& native_descriptor) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - native_descriptor, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - - /// Assign an existing native descriptor to the descriptor. - /* - * This function opens the descriptor to hold an existing native descriptor. - * - * @param native_descriptor A native descriptor. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID assign(const native_handle_type& native_descriptor, - boost::system::error_code& ec) - { - this->get_service().assign( - this->get_implementation(), native_descriptor, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the descriptor is open. - bool is_open() const - { - return this->get_service().is_open(this->get_implementation()); - } - - /// Close the descriptor. - /** - * This function is used to close the descriptor. Any asynchronous read or - * write operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. Note that, even if - * the function indicates an error, the underlying descriptor is closed. - */ - void close() - { - boost::system::error_code ec; - this->get_service().close(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "close"); - } - - /// Close the descriptor. - /** - * This function is used to close the descriptor. Any asynchronous read or - * write operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. Note that, even if - * the function indicates an error, the underlying descriptor is closed. - */ - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - this->get_service().close(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native descriptor representation. - /** - * This function may be used to obtain the underlying representation of the - * descriptor. This is intended to allow access to native descriptor - * functionality that is not otherwise provided. - */ - native_handle_type native_handle() - { - return this->get_service().native_handle(this->get_implementation()); - } - - /// Release ownership of the native descriptor implementation. - /** - * This function may be used to obtain the underlying representation of the - * descriptor. After calling this function, @c is_open() returns false. The - * caller is responsible for closing the descriptor. - * - * All outstanding asynchronous read or write operations will finish - * immediately, and the handlers for cancelled operations will be passed the - * boost::asio::error::operation_aborted error. - */ - native_handle_type release() - { - return this->get_service().release(this->get_implementation()); - } - - /// Cancel all asynchronous operations associated with the descriptor. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all asynchronous operations associated with the descriptor. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform an IO control command on the descriptor. - /** - * This function is used to execute an IO control command on the descriptor. - * - * @param command The IO control command to be performed on the descriptor. - * - * @throws boost::system::system_error Thrown on failure. - * - * @sa IoControlCommand @n - * boost::asio::posix::descriptor_base::bytes_readable @n - * boost::asio::posix::descriptor_base::non_blocking_io - * - * @par Example - * Getting the number of bytes ready to read: - * @code - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * boost::asio::posix::stream_descriptor::bytes_readable command; - * descriptor.io_control(command); - * std::size_t bytes_readable = command.get(); - * @endcode - */ - template <typename IoControlCommand> - void io_control(IoControlCommand& command) - { - boost::system::error_code ec; - this->get_service().io_control(this->get_implementation(), command, ec); - boost::asio::detail::throw_error(ec, "io_control"); - } - - /// Perform an IO control command on the descriptor. - /** - * This function is used to execute an IO control command on the descriptor. - * - * @param command The IO control command to be performed on the descriptor. - * - * @param ec Set to indicate what error occurred, if any. - * - * @sa IoControlCommand @n - * boost::asio::posix::descriptor_base::bytes_readable @n - * boost::asio::posix::descriptor_base::non_blocking_io - * - * @par Example - * Getting the number of bytes ready to read: - * @code - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * boost::asio::posix::stream_descriptor::bytes_readable command; - * boost::system::error_code ec; - * descriptor.io_control(command, ec); - * if (ec) - * { - * // An error occurred. - * } - * std::size_t bytes_readable = command.get(); - * @endcode - */ - template <typename IoControlCommand> - BOOST_ASIO_SYNC_OP_VOID io_control(IoControlCommand& command, - boost::system::error_code& ec) - { - this->get_service().io_control(this->get_implementation(), command, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the descriptor. - /** - * @returns @c true if the descriptor's synchronous operations will fail with - * boost::asio::error::would_block if they are unable to perform the requested - * operation immediately. If @c false, synchronous operations will block - * until complete. - * - * @note The non-blocking mode has no effect on the behaviour of asynchronous - * operations. Asynchronous operations will never fail with the error - * boost::asio::error::would_block. - */ - bool non_blocking() const - { - return this->get_service().non_blocking(this->get_implementation()); - } - - /// Sets the non-blocking mode of the descriptor. - /** - * @param mode If @c true, the descriptor's synchronous operations will fail - * with boost::asio::error::would_block if they are unable to perform the - * requested operation immediately. If @c false, synchronous operations will - * block until complete. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The non-blocking mode has no effect on the behaviour of asynchronous - * operations. Asynchronous operations will never fail with the error - * boost::asio::error::would_block. - */ - void non_blocking(bool mode) - { - boost::system::error_code ec; - this->get_service().non_blocking(this->get_implementation(), mode, ec); - boost::asio::detail::throw_error(ec, "non_blocking"); - } - - /// Sets the non-blocking mode of the descriptor. - /** - * @param mode If @c true, the descriptor's synchronous operations will fail - * with boost::asio::error::would_block if they are unable to perform the - * requested operation immediately. If @c false, synchronous operations will - * block until complete. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note The non-blocking mode has no effect on the behaviour of asynchronous - * operations. Asynchronous operations will never fail with the error - * boost::asio::error::would_block. - */ - BOOST_ASIO_SYNC_OP_VOID non_blocking( - bool mode, boost::system::error_code& ec) - { - this->get_service().non_blocking(this->get_implementation(), mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the native descriptor implementation. - /** - * This function is used to retrieve the non-blocking mode of the underlying - * native descriptor. This mode has no effect on the behaviour of the - * descriptor object's synchronous operations. - * - * @returns @c true if the underlying descriptor is in non-blocking mode and - * direct system calls may fail with boost::asio::error::would_block (or the - * equivalent system error). - * - * @note The current non-blocking mode is cached by the descriptor object. - * Consequently, the return value may be incorrect if the non-blocking mode - * was set directly on the native descriptor. - */ - bool native_non_blocking() const - { - return this->get_service().native_non_blocking( - this->get_implementation()); - } - - /// Sets the non-blocking mode of the native descriptor implementation. - /** - * This function is used to modify the non-blocking mode of the underlying - * native descriptor. It has no effect on the behaviour of the descriptor - * object's synchronous operations. - * - * @param mode If @c true, the underlying descriptor is put into non-blocking - * mode and direct system calls may fail with boost::asio::error::would_block - * (or the equivalent system error). - * - * @throws boost::system::system_error Thrown on failure. If the @c mode is - * @c false, but the current value of @c non_blocking() is @c true, this - * function fails with boost::asio::error::invalid_argument, as the - * combination does not make sense. - */ - void native_non_blocking(bool mode) - { - boost::system::error_code ec; - this->get_service().native_non_blocking( - this->get_implementation(), mode, ec); - boost::asio::detail::throw_error(ec, "native_non_blocking"); - } - - /// Sets the non-blocking mode of the native descriptor implementation. - /** - * This function is used to modify the non-blocking mode of the underlying - * native descriptor. It has no effect on the behaviour of the descriptor - * object's synchronous operations. - * - * @param mode If @c true, the underlying descriptor is put into non-blocking - * mode and direct system calls may fail with boost::asio::error::would_block - * (or the equivalent system error). - * - * @param ec Set to indicate what error occurred, if any. If the @c mode is - * @c false, but the current value of @c non_blocking() is @c true, this - * function fails with boost::asio::error::invalid_argument, as the - * combination does not make sense. - */ - BOOST_ASIO_SYNC_OP_VOID native_non_blocking( - bool mode, boost::system::error_code& ec) - { - this->get_service().native_non_blocking( - this->get_implementation(), mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Wait for the descriptor to become ready to read, ready to write, or to - /// have pending error conditions. - /** - * This function is used to perform a blocking wait for a descriptor to enter - * a ready to read, write or error condition state. - * - * @param w Specifies the desired descriptor state. - * - * @par Example - * Waiting for a descriptor to become readable. - * @code - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * descriptor.wait(boost::asio::posix::stream_descriptor::wait_read); - * @endcode - */ - void wait(wait_type w) - { - boost::system::error_code ec; - this->get_service().wait(this->get_implementation(), w, ec); - boost::asio::detail::throw_error(ec, "wait"); - } - - /// Wait for the descriptor to become ready to read, ready to write, or to - /// have pending error conditions. - /** - * This function is used to perform a blocking wait for a descriptor to enter - * a ready to read, write or error condition state. - * - * @param w Specifies the desired descriptor state. - * - * @param ec Set to indicate what error occurred, if any. - * - * @par Example - * Waiting for a descriptor to become readable. - * @code - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * boost::system::error_code ec; - * descriptor.wait(boost::asio::posix::stream_descriptor::wait_read, ec); - * @endcode - */ - BOOST_ASIO_SYNC_OP_VOID wait(wait_type w, boost::system::error_code& ec) - { - this->get_service().wait(this->get_implementation(), w, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Asynchronously wait for the descriptor to become ready to read, ready to - /// write, or to have pending error conditions. - /** - * This function is used to perform an asynchronous wait for a descriptor to - * enter a ready to read, write or error condition state. - * - * @param w Specifies the desired descriptor state. - * - * @param handler The handler to be called when the wait operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * @code - * void wait_handler(const boost::system::error_code& error) - * { - * if (!error) - * { - * // Wait succeeded. - * } - * } - * - * ... - * - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * descriptor.async_wait( - * boost::asio::posix::stream_descriptor::wait_read, - * wait_handler); - * @endcode - */ - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(wait_type w, BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WaitHandler. - BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; - - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - this->get_service().async_wait( - this->get_implementation(), w, init.completion_handler); - - return init.result.get(); - } - -protected: - /// Protected destructor to prevent deletion through this type. - /** - * This function destroys the descriptor, cancelling any outstanding - * asynchronous wait operations associated with the descriptor as if by - * calling @c cancel. - */ - ~descriptor() - { - } -}; - -} // namespace posix -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#undef BOOST_ASIO_SVC_T - -#endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) - // || defined(GENERATING_DOCUMENTATION) - -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_POSIX_DESCRIPTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/posix/descriptor_base.hpp b/contrib/restricted/boost/boost/asio/posix/descriptor_base.hpp deleted file mode 100644 index 6722f04ef7..0000000000 --- a/contrib/restricted/boost/boost/asio/posix/descriptor_base.hpp +++ /dev/null @@ -1,92 +0,0 @@ -// -// posix/descriptor_base.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP -#define BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/detail/io_control.hpp> -#include <boost/asio/detail/socket_option.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace posix { - -/// The descriptor_base class is used as a base for the descriptor class as a -/// place to define the associated IO control commands. -class descriptor_base -{ -public: - /// Wait types. - /** - * For use with descriptor::wait() and descriptor::async_wait(). - */ - enum wait_type - { - /// Wait for a descriptor to become ready to read. - wait_read, - - /// Wait for a descriptor to become ready to write. - wait_write, - - /// Wait for a descriptor to have error conditions pending. - wait_error - }; - - /// IO control command to get the amount of data that can be read without - /// blocking. - /** - * Implements the FIONREAD IO control command. - * - * @par Example - * @code - * boost::asio::posix::stream_descriptor descriptor(io_context); - * ... - * boost::asio::descriptor_base::bytes_readable command(true); - * descriptor.io_control(command); - * std::size_t bytes_readable = command.get(); - * @endcode - * - * @par Concepts: - * IoControlCommand. - */ -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined bytes_readable; -#else - typedef boost::asio::detail::io_control::bytes_readable bytes_readable; -#endif - -protected: - /// Protected destructor to prevent deletion through this type. - ~descriptor_base() - { - } -}; - -} // namespace posix -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP diff --git a/contrib/restricted/boost/boost/asio/posix/stream_descriptor.hpp b/contrib/restricted/boost/boost/asio/posix/stream_descriptor.hpp deleted file mode 100644 index af8cbe92c0..0000000000 --- a/contrib/restricted/boost/boost/asio/posix/stream_descriptor.hpp +++ /dev/null @@ -1,362 +0,0 @@ -// -// posix/stream_descriptor.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_POSIX_STREAM_DESCRIPTOR_HPP -#define BOOST_ASIO_POSIX_STREAM_DESCRIPTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/posix/descriptor.hpp> - -#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ - || defined(GENERATING_DOCUMENTATION) - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/posix/basic_stream_descriptor.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -namespace boost { -namespace asio { -namespace posix { - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -// Typedef for the typical usage of a stream-oriented descriptor. -typedef basic_stream_descriptor<> stream_descriptor; -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -/// Provides stream-oriented descriptor functionality. -/** - * The posix::stream_descriptor class template provides asynchronous and - * blocking stream-oriented descriptor functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream. - */ -class stream_descriptor - : public descriptor -{ -public: - /// Construct a stream_descriptor without opening it. - /** - * This constructor creates a stream descriptor without opening it. The - * descriptor needs to be opened and then connected or accepted before data - * can be sent or received on it. - * - * @param io_context The io_context object that the stream descriptor will - * use to dispatch handlers for any asynchronous operations performed on the - * descriptor. - */ - explicit stream_descriptor(boost::asio::io_context& io_context) - : descriptor(io_context) - { - } - - /// Construct a stream_descriptor on an existing native descriptor. - /** - * This constructor creates a stream descriptor object to hold an existing - * native descriptor. - * - * @param io_context The io_context object that the stream descriptor will - * use to dispatch handlers for any asynchronous operations performed on the - * descriptor. - * - * @param native_descriptor The new underlying descriptor implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - stream_descriptor(boost::asio::io_context& io_context, - const native_handle_type& native_descriptor) - : descriptor(io_context, native_descriptor) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a stream_descriptor from another. - /** - * This constructor moves a stream descriptor from one object to another. - * - * @param other The other stream_descriptor object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c stream_descriptor(io_context&) constructor. - */ - stream_descriptor(stream_descriptor&& other) - : descriptor(std::move(other)) - { - } - - /// Move-assign a stream_descriptor from another. - /** - * This assignment operator moves a stream descriptor from one object to - * another. - * - * @param other The other stream_descriptor object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c stream_descriptor(io_context&) constructor. - */ - stream_descriptor& operator=(stream_descriptor&& other) - { - descriptor::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Write some data to the descriptor. - /** - * This function is used to write data to the stream descriptor. The function - * call will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the descriptor. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * descriptor.write_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().write_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "write_some"); - return s; - } - - /// Write some data to the descriptor. - /** - * This function is used to write data to the stream descriptor. The function - * call will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the descriptor. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().write_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous write. - /** - * This function is used to asynchronously write data to the stream - * descriptor. The function call always returns immediately. - * - * @param buffers One or more data buffers to be written to the descriptor. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The write operation may not transmit all of the data to the peer. - * Consider using the @ref async_write function if you need to ensure that all - * data is written before the asynchronous operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * descriptor.async_write_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - boost::asio::async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_write_some( - this->get_implementation(), buffers, init.completion_handler); - - return init.result.get(); - } - - /// Read some data from the descriptor. - /** - * This function is used to read data from the stream descriptor. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The read_some operation may not read all of the requested number of - * 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. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * descriptor.read_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().read_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "read_some"); - return s; - } - - /// Read some data from the descriptor. - /** - * This function is used to read data from the stream descriptor. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().read_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous read. - /** - * This function is used to asynchronously read data from the stream - * descriptor. The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The read operation may not read all of the requested number of bytes. - * Consider using the @ref async_read function if you need to ensure that the - * requested amount of data is read before the asynchronous operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * descriptor.async_read_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - boost::asio::async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_read_some( - this->get_implementation(), buffers, init.completion_handler); - - return init.result.get(); - } -}; -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -} // namespace posix -} // namespace asio -} // namespace boost - -#endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_POSIX_STREAM_DESCRIPTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/posix/stream_descriptor_service.hpp b/contrib/restricted/boost/boost/asio/posix/stream_descriptor_service.hpp deleted file mode 100644 index b91000ba29..0000000000 --- a/contrib/restricted/boost/boost/asio/posix/stream_descriptor_service.hpp +++ /dev/null @@ -1,281 +0,0 @@ -// -// posix/stream_descriptor_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_POSIX_STREAM_DESCRIPTOR_SERVICE_HPP -#define BOOST_ASIO_POSIX_STREAM_DESCRIPTOR_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/detail/reactive_descriptor_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace posix { - -/// Default service implementation for a stream descriptor. -class stream_descriptor_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base<stream_descriptor_service> -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - -private: - // The type of the platform-specific implementation. - typedef detail::reactive_descriptor_service service_impl_type; - -public: - /// The type of a stream descriptor implementation. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef service_impl_type::implementation_type implementation_type; -#endif - - /// The native descriptor type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef service_impl_type::native_handle_type native_handle_type; -#endif - - /// Construct a new stream descriptor service for the specified io_context. - explicit stream_descriptor_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base<stream_descriptor_service>(io_context), - service_impl_(io_context) - { - } - - /// Construct a new stream descriptor implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new stream descriptor implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another stream descriptor implementation. - void move_assign(implementation_type& impl, - stream_descriptor_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroy a stream descriptor implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Assign an existing native descriptor to a stream descriptor. - BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, - const native_handle_type& native_descriptor, - boost::system::error_code& ec) - { - service_impl_.assign(impl, native_descriptor, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the descriptor is open. - bool is_open(const implementation_type& impl) const - { - return service_impl_.is_open(impl); - } - - /// Close a stream descriptor implementation. - BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.close(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native descriptor implementation. - native_handle_type native_handle(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - - /// Release ownership of the native descriptor implementation. - native_handle_type release(implementation_type& impl) - { - return service_impl_.release(impl); - } - - /// Cancel all asynchronous operations associated with the descriptor. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform an IO control command on the descriptor. - template <typename IoControlCommand> - BOOST_ASIO_SYNC_OP_VOID io_control(implementation_type& impl, - IoControlCommand& command, boost::system::error_code& ec) - { - service_impl_.io_control(impl, command, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the descriptor. - bool non_blocking(const implementation_type& impl) const - { - return service_impl_.non_blocking(impl); - } - - /// Sets the non-blocking mode of the descriptor. - BOOST_ASIO_SYNC_OP_VOID non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the native descriptor implementation. - bool native_non_blocking(const implementation_type& impl) const - { - return service_impl_.native_non_blocking(impl); - } - - /// Sets the non-blocking mode of the native descriptor implementation. - BOOST_ASIO_SYNC_OP_VOID native_non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.native_non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Wait for the descriptor to become ready to read, ready to write, or to - /// have pending error conditions. - BOOST_ASIO_SYNC_OP_VOID wait(implementation_type& impl, - descriptor_base::wait_type w, boost::system::error_code& ec) - { - service_impl_.wait(impl, w, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Asynchronously wait for the descriptor to become ready to read, ready to - /// write, or to have pending error conditions. - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(implementation_type& impl, descriptor_base::wait_type w, - BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_wait(impl, w, init.completion_handler); - - return init.result.get(); - } - - /// Write the given data to the stream. - template <typename ConstBufferSequence> - std::size_t write_some(implementation_type& impl, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - return service_impl_.write_some(impl, buffers, ec); - } - - /// Start an asynchronous write. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - boost::asio::async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_write_some(impl, buffers, init.completion_handler); - - return init.result.get(); - } - - /// Read some data from the stream. - template <typename MutableBufferSequence> - std::size_t read_some(implementation_type& impl, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - return service_impl_.read_some(impl, buffers, ec); - } - - /// Start an asynchronous read. - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - boost::asio::async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_read_some(impl, buffers, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace posix -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_POSIX_STREAM_DESCRIPTOR_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/raw_socket_service.hpp b/contrib/restricted/boost/boost/asio/raw_socket_service.hpp deleted file mode 100644 index 63ebf5cb30..0000000000 --- a/contrib/restricted/boost/boost/asio/raw_socket_service.hpp +++ /dev/null @@ -1,468 +0,0 @@ -// -// raw_socket_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_RAW_SOCKET_SERVICE_HPP -#define BOOST_ASIO_RAW_SOCKET_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) -# include <boost/asio/detail/null_socket_service.hpp> -#elif defined(BOOST_ASIO_HAS_IOCP) -# include <boost/asio/detail/win_iocp_socket_service.hpp> -#else -# include <boost/asio/detail/reactive_socket_service.hpp> -#endif - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Default service implementation for a raw socket. -template <typename Protocol> -class raw_socket_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base<raw_socket_service<Protocol> > -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename Protocol::endpoint endpoint_type; - -private: - // The type of the platform-specific implementation. -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - typedef detail::null_socket_service<Protocol> service_impl_type; -#elif defined(BOOST_ASIO_HAS_IOCP) - typedef detail::win_iocp_socket_service<Protocol> service_impl_type; -#else - typedef detail::reactive_socket_service<Protocol> service_impl_type; -#endif - -public: - /// The type of a raw socket. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef typename service_impl_type::implementation_type implementation_type; -#endif - - /// The native socket type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef typename service_impl_type::native_handle_type native_handle_type; -#endif - - /// Construct a new raw socket service for the specified io_context. - explicit raw_socket_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base< - raw_socket_service<Protocol> >(io_context), - service_impl_(io_context) - { - } - - /// Construct a new raw socket implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new raw socket implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another raw socket implementation. - void move_assign(implementation_type& impl, - raw_socket_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } - - // All socket services have access to each other's implementations. - template <typename Protocol1> friend class raw_socket_service; - - /// Move-construct a new raw socket implementation from another protocol - /// type. - template <typename Protocol1> - void converting_move_construct(implementation_type& impl, - raw_socket_service<Protocol1>& other_service, - typename raw_socket_service< - Protocol1>::implementation_type& other_impl, - typename enable_if<is_convertible< - Protocol1, Protocol>::value>::type* = 0) - { - service_impl_.template converting_move_construct<Protocol1>( - impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroy a raw socket implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - // Open a new raw socket implementation. - BOOST_ASIO_SYNC_OP_VOID open(implementation_type& impl, - const protocol_type& protocol, boost::system::error_code& ec) - { - if (protocol.type() == BOOST_ASIO_OS_DEF(SOCK_RAW)) - service_impl_.open(impl, protocol, ec); - else - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Assign an existing native socket to a raw socket. - BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, - const protocol_type& protocol, const native_handle_type& native_socket, - boost::system::error_code& ec) - { - service_impl_.assign(impl, protocol, native_socket, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the socket is open. - bool is_open(const implementation_type& impl) const - { - return service_impl_.is_open(impl); - } - - /// Close a raw socket implementation. - BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.close(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Release ownership of the underlying socket. - native_handle_type release(implementation_type& impl, - boost::system::error_code& ec) - { - return service_impl_.release(impl, ec); - } - - /// Get the native socket implementation. - native_handle_type native_handle(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - - /// Cancel all asynchronous operations associated with the socket. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the socket is at the out-of-band data mark. - bool at_mark(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.at_mark(impl, ec); - } - - /// Determine the number of bytes available for reading. - std::size_t available(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.available(impl, ec); - } - - // Bind the raw socket to the specified local endpoint. - BOOST_ASIO_SYNC_OP_VOID bind(implementation_type& impl, - const endpoint_type& endpoint, boost::system::error_code& ec) - { - service_impl_.bind(impl, endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Connect the raw socket to the specified endpoint. - BOOST_ASIO_SYNC_OP_VOID connect(implementation_type& impl, - const endpoint_type& peer_endpoint, boost::system::error_code& ec) - { - service_impl_.connect(impl, peer_endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Start an asynchronous connect. - template <typename ConnectHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ConnectHandler, - void (boost::system::error_code)) - async_connect(implementation_type& impl, - const endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) - { - async_completion<ConnectHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_connect(impl, peer_endpoint, init.completion_handler); - - return init.result.get(); - } - - /// Set a socket option. - template <typename SettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID set_option(implementation_type& impl, - const SettableSocketOption& option, boost::system::error_code& ec) - { - service_impl_.set_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get a socket option. - template <typename GettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID get_option(const implementation_type& impl, - GettableSocketOption& option, boost::system::error_code& ec) const - { - service_impl_.get_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform an IO control command on the socket. - template <typename IoControlCommand> - BOOST_ASIO_SYNC_OP_VOID io_control(implementation_type& impl, - IoControlCommand& command, boost::system::error_code& ec) - { - service_impl_.io_control(impl, command, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the socket. - bool non_blocking(const implementation_type& impl) const - { - return service_impl_.non_blocking(impl); - } - - /// Sets the non-blocking mode of the socket. - BOOST_ASIO_SYNC_OP_VOID non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the native socket implementation. - bool native_non_blocking(const implementation_type& impl) const - { - return service_impl_.native_non_blocking(impl); - } - - /// Sets the non-blocking mode of the native socket implementation. - BOOST_ASIO_SYNC_OP_VOID native_non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.native_non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the local endpoint. - endpoint_type local_endpoint(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.local_endpoint(impl, ec); - } - - /// Get the remote endpoint. - endpoint_type remote_endpoint(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.remote_endpoint(impl, ec); - } - - /// Disable sends or receives on the socket. - BOOST_ASIO_SYNC_OP_VOID shutdown(implementation_type& impl, - socket_base::shutdown_type what, boost::system::error_code& ec) - { - service_impl_.shutdown(impl, what, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Wait for the socket to become ready to read, ready to write, or to have - /// pending error conditions. - BOOST_ASIO_SYNC_OP_VOID wait(implementation_type& impl, - socket_base::wait_type w, boost::system::error_code& ec) - { - service_impl_.wait(impl, w, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Asynchronously wait for the socket to become ready to read, ready to - /// write, or to have pending error conditions. - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(implementation_type& impl, socket_base::wait_type w, - BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_wait(impl, w, init.completion_handler); - - return init.result.get(); - } - - /// Send the given data to the peer. - template <typename ConstBufferSequence> - std::size_t send(implementation_type& impl, - const ConstBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return service_impl_.send(impl, buffers, flags, ec); - } - - /// Start an asynchronous send. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send(implementation_type& impl, const ConstBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_send(impl, buffers, flags, init.completion_handler); - - return init.result.get(); - } - - /// Send raw data to the specified endpoint. - template <typename ConstBufferSequence> - std::size_t send_to(implementation_type& impl, - const ConstBufferSequence& buffers, const endpoint_type& destination, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return service_impl_.send_to(impl, buffers, destination, flags, ec); - } - - /// Start an asynchronous send. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send_to(implementation_type& impl, - const ConstBufferSequence& buffers, const endpoint_type& destination, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_send_to(impl, buffers, - destination, flags, init.completion_handler); - - return init.result.get(); - } - - /// Receive some data from the peer. - template <typename MutableBufferSequence> - std::size_t receive(implementation_type& impl, - const MutableBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return service_impl_.receive(impl, buffers, flags, ec); - } - - /// Start an asynchronous receive. - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive(implementation_type& impl, - const MutableBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_receive(impl, buffers, flags, init.completion_handler); - - return init.result.get(); - } - - /// Receive raw data with the endpoint of the sender. - template <typename MutableBufferSequence> - std::size_t receive_from(implementation_type& impl, - const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return service_impl_.receive_from(impl, buffers, sender_endpoint, flags, - ec); - } - - /// Start an asynchronous receive that will get the endpoint of the sender. - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive_from(implementation_type& impl, - const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_receive_from(impl, buffers, - sender_endpoint, flags, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_RAW_SOCKET_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/read.hpp b/contrib/restricted/boost/boost/asio/read.hpp deleted file mode 100644 index cffc847769..0000000000 --- a/contrib/restricted/boost/boost/asio/read.hpp +++ /dev/null @@ -1,949 +0,0 @@ -// -// read.hpp -// ~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_READ_HPP -#define BOOST_ASIO_READ_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/error.hpp> - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -# include <boost/asio/basic_streambuf_fwd.hpp> -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/** - * @defgroup read boost::asio::read - * - * @brief Attempt to read a certain amount of data from a stream before - * returning. - */ -/*@{*/ - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * stream. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code boost::asio::read(s, boost::asio::buffer(data, size)); @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read( - * s, buffers, - * boost::asio::transfer_all()); @endcode - */ -template <typename SyncReadStream, typename MutableBufferSequence> -std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type* = 0); - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * stream. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code boost::asio::read(s, boost::asio::buffer(data, size), ec); @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read( - * s, buffers, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncReadStream, typename MutableBufferSequence> -std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, - boost::system::error_code& ec, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type* = 0); - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * stream. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the stream's read_some function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code boost::asio::read(s, boost::asio::buffer(data, size), - * boost::asio::transfer_at_least(32)); @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename SyncReadStream, typename MutableBufferSequence, - typename CompletionCondition> -std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type* = 0); - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * stream. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the stream's read_some function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncReadStream, typename MutableBufferSequence, - typename CompletionCondition> -std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, boost::system::error_code& ec, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type* = 0); - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The specified dynamic buffer sequence is full (that is, it has reached - * maximum size). - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read( - * s, buffers, - * boost::asio::transfer_all()); @endcode - */ -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The supplied buffer is full (that is, it has reached maximum size). - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read( - * s, buffers, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - boost::system::error_code& ec, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The specified dynamic buffer sequence is full (that is, it has reached - * maximum size). - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the stream's read_some function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - */ -template <typename SyncReadStream, typename DynamicBuffer, - typename CompletionCondition> -std::size_t read(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The specified dynamic buffer sequence is full (that is, it has reached - * maximum size). - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the stream's read_some function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncReadStream, typename DynamicBuffer, - typename CompletionCondition> -std::size_t read(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, boost::system::error_code& ec, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The supplied buffer is full (that is, it has reached maximum size). - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b The basic_streambuf object into which the data will be read. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read( - * s, b, - * boost::asio::transfer_all()); @endcode - */ -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. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The supplied buffer is full (that is, it has reached maximum size). - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b The basic_streambuf object into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read( - * s, b, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncReadStream, typename Allocator> -std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, - boost::system::error_code& ec); - -/// Attempt to read a certain amount of data from a stream before returning. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The supplied buffer is full (that is, it has reached maximum size). - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b The basic_streambuf object into which the data will be read. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the stream's read_some function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - */ -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. -/** - * This function is used to read a certain number of bytes of data from a - * stream. The call will block until one of the following conditions is true: - * - * @li The supplied buffer is full (that is, it has reached maximum size). - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b The basic_streambuf object into which the data will be read. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the stream's read_some function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncReadStream, typename Allocator, - typename CompletionCondition> -std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, boost::system::error_code& ec); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ -/** - * @defgroup async_read boost::asio::async_read - * - * @brief Start an asynchronous operation to read a certain amount of data from - * a stream. - */ -/*@{*/ - -/// Start an asynchronous operation to read a certain amount of data from a -/// stream. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions is - * true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other read operations (such - * as async_read, the stream's async_read_some function, or any other composed - * operations that perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * stream. Although the buffers object may be copied as necessary, ownership of - * the underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes copied into the - * // buffers. If an error occurred, - * // this will be the number of - * // bytes successfully transferred - * // prior to the error. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * boost::asio::async_read(s, boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::async_read( - * s, buffers, - * boost::asio::transfer_all(), - * handler); @endcode - */ -template <typename AsyncReadStream, typename MutableBufferSequence, - typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type* = 0); - -/// Start an asynchronous operation to read a certain amount of data from a -/// stream. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions is - * true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * stream. Although the buffers object may be copied as necessary, ownership of - * the underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_read_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the stream's async_read_some function. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes copied into the - * // buffers. If an error occurred, - * // this will be the number of - * // bytes successfully transferred - * // prior to the error. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code boost::asio::async_read(s, - * boost::asio::buffer(data, size), - * boost::asio::transfer_at_least(32), - * handler); @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename AsyncReadStream, typename MutableBufferSequence, - typename CompletionCondition, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if< - is_mutable_buffer_sequence<MutableBufferSequence>::value - >::type* = 0); - -/// Start an asynchronous operation to read a certain amount of data from a -/// stream. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions is - * true: - * - * @li The specified dynamic buffer sequence is full (that is, it has reached - * maximum size). - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other read operations (such - * as async_read, the stream's async_read_some function, or any other composed - * operations that perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * the AsyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes copied into the - * // buffers. If an error occurred, - * // this will be the number of - * // bytes successfully transferred - * // prior to the error. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note This overload is equivalent to calling: - * @code boost::asio::async_read( - * s, buffers, - * boost::asio::transfer_all(), - * handler); @endcode - */ -template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -/// Start an asynchronous operation to read a certain amount of data from a -/// stream. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions is - * true: - * - * @li The specified dynamic buffer sequence is full (that is, it has reached - * maximum size). - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other read operations (such - * as async_read, the stream's async_read_some function, or any other composed - * operations that perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * the AsyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_read_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the stream's async_read_some function. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes copied into the - * // buffers. If an error occurred, - * // this will be the number of - * // bytes successfully transferred - * // prior to the error. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -template <typename AsyncReadStream, typename DynamicBuffer, - typename CompletionCondition, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Start an asynchronous operation to read a certain amount of data from a -/// stream. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions is - * true: - * - * @li The supplied buffer is full (that is, it has reached maximum size). - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other read operations (such - * as async_read, the stream's async_read_some function, or any other composed - * operations that perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * remains valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes copied into the - * // buffers. If an error occurred, - * // this will be the number of - * // bytes successfully transferred - * // prior to the error. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note This overload is equivalent to calling: - * @code boost::asio::async_read( - * s, b, - * boost::asio::transfer_all(), - * handler); @endcode - */ -template <typename AsyncReadStream, typename Allocator, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -/// Start an asynchronous operation to read a certain amount of data from a -/// stream. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions is - * true: - * - * @li The supplied buffer is full (that is, it has reached maximum size). - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other read operations (such - * as async_read, the stream's async_read_some function, or any other composed - * operations that perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * remains valid until the handler is called. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_read_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the stream's async_read_some function. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes copied into the - * // buffers. If an error occurred, - * // this will be the number of - * // bytes successfully transferred - * // prior to the error. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -template <typename AsyncReadStream, typename Allocator, - typename CompletionCondition, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/read.hpp> - -#endif // BOOST_ASIO_READ_HPP diff --git a/contrib/restricted/boost/boost/asio/read_at.hpp b/contrib/restricted/boost/boost/asio/read_at.hpp deleted file mode 100644 index 2927ddd1ff..0000000000 --- a/contrib/restricted/boost/boost/asio/read_at.hpp +++ /dev/null @@ -1,673 +0,0 @@ -// -// read_at.hpp -// ~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_READ_AT_HPP -#define BOOST_ASIO_READ_AT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/cstdint.hpp> -#include <boost/asio/error.hpp> - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -# include <boost/asio/basic_streambuf_fwd.hpp> -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/** - * @defgroup read_at boost::asio::read_at - * - * @brief Attempt to read a certain amount of data at the specified offset - * before returning. - */ -/*@{*/ - -/// Attempt to read a certain amount of data at the specified offset before -/// returning. -/** - * This function is used to read a certain number of bytes of data from a - * random access device at the specified offset. The call will block until one - * of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the SyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @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 - * device. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code boost::asio::read_at(d, 42, boost::asio::buffer(data, size)); @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read_at( - * d, 42, buffers, - * boost::asio::transfer_all()); @endcode - */ -template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers); - -/// Attempt to read a certain amount of data at the specified offset before -/// returning. -/** - * This function is used to read a certain number of bytes of data from a - * random access device at the specified offset. The call will block until one - * of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the SyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @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 - * device. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code boost::asio::read_at(d, 42, - * boost::asio::buffer(data, size), ec); @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read_at( - * d, 42, buffers, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - boost::system::error_code& ec); - -/// Attempt to read a certain amount of data at the specified offset before -/// returning. -/** - * This function is used to read a certain number of bytes of data from a - * random access device at the specified offset. The call will block until one - * of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the SyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @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 - * device. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the device's read_some_at function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code boost::asio::read_at(d, 42, boost::asio::buffer(data, size), - * boost::asio::transfer_at_least(32)); @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, - typename CompletionCondition> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition); - -/// Attempt to read a certain amount of data at the specified offset before -/// returning. -/** - * This function is used to read a certain number of bytes of data from a - * random access device at the specified offset. The call will block until one - * of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the SyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @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 - * device. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the device's read_some_at function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, - typename CompletionCondition> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, boost::system::error_code& ec); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Attempt to read a certain amount of data at the specified offset before -/// returning. -/** - * This function is used to read a certain number of bytes of data from a - * random access device at the specified offset. The call will block until one - * of the following conditions is true: - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the SyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @param b The basic_streambuf object into which the data will be read. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read_at( - * d, 42, b, - * boost::asio::transfer_all()); @endcode - */ -template <typename SyncRandomAccessReadDevice, typename Allocator> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, basic_streambuf<Allocator>& b); - -/// Attempt to read a certain amount of data at the specified offset before -/// returning. -/** - * This function is used to read a certain number of bytes of data from a - * random access device at the specified offset. The call will block until one - * of the following conditions is true: - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the SyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @param b The basic_streambuf object into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @note This overload is equivalent to calling: - * @code boost::asio::read_at( - * d, 42, b, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncRandomAccessReadDevice, typename Allocator> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, basic_streambuf<Allocator>& b, - boost::system::error_code& ec); - -/// Attempt to read a certain amount of data at the specified offset before -/// returning. -/** - * This function is used to read a certain number of bytes of data from a - * random access device at the specified offset. The call will block until one - * of the following conditions is true: - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the SyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @param b The basic_streambuf object into which the data will be read. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the device's read_some_at function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - */ -template <typename SyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition); - -/// Attempt to read a certain amount of data at the specified offset before -/// returning. -/** - * This function is used to read a certain number of bytes of data from a - * random access device at the specified offset. The call will block until one - * of the following conditions is true: - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the SyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @param b The basic_streambuf object into which the data will be read. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest read_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the device's read_some_at function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition> -std::size_t read_at(SyncRandomAccessReadDevice& d, - uint64_t offset, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, boost::system::error_code& ec); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ -/** - * @defgroup async_read_at boost::asio::async_read_at - * - * @brief Start an asynchronous operation to read a certain amount of data at - * the specified offset. - */ -/*@{*/ - -/// Start an asynchronous operation to read a certain amount of data at the -/// specified offset. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a random access device at the specified offset. The function call - * always returns immediately. The asynchronous operation will continue until - * one of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * async_read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the AsyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @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 - * device. Although the buffers object may be copied as necessary, ownership of - * the underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // Number of bytes copied into the buffers. If an error - * // occurred, this will be the number of bytes successfully - * // transferred prior to the error. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * boost::asio::async_read_at(d, 42, boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::async_read_at( - * d, 42, buffers, - * boost::asio::transfer_all(), - * handler); @endcode - */ -template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, - typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset, - const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -/// Start an asynchronous operation to read a certain amount of data at the -/// specified offset. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a random access device at the specified offset. The function call - * always returns immediately. The asynchronous operation will continue until - * one of the following conditions is true: - * - * @li The supplied buffers are full. That is, the bytes transferred is equal to - * the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * @param d The device from which the data is to be read. The type must support - * the AsyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @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 - * device. Although the buffers object may be copied as necessary, ownership of - * the underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_read_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the device's async_read_some_at function. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // Number of bytes copied into the buffers. If an error - * // occurred, this will be the number of bytes successfully - * // transferred prior to the error. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code boost::asio::async_read_at(d, 42, - * boost::asio::buffer(data, size), - * boost::asio::transfer_at_least(32), - * handler); @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, - typename CompletionCondition, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_at(AsyncRandomAccessReadDevice& d, - uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Start an asynchronous operation to read a certain amount of data at the -/// specified offset. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a random access device at the specified offset. The function call - * always returns immediately. The asynchronous operation will continue until - * one of the following conditions is true: - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * async_read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the AsyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @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 - * remains valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // Number of bytes copied into the buffers. If an error - * // occurred, this will be the number of bytes successfully - * // transferred prior to the error. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note This overload is equivalent to calling: - * @code boost::asio::async_read_at( - * d, 42, b, - * boost::asio::transfer_all(), - * handler); @endcode - */ -template <typename AsyncRandomAccessReadDevice, typename Allocator, - typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset, - basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -/// Start an asynchronous operation to read a certain amount of data at the -/// specified offset. -/** - * This function is used to asynchronously read a certain number of bytes of - * data from a random access device at the specified offset. The function call - * always returns immediately. The asynchronous operation will continue until - * one of the following conditions is true: - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * async_read_some_at function. - * - * @param d The device from which the data is to be read. The type must support - * the AsyncRandomAccessReadDevice concept. - * - * @param offset The offset at which the data will be read. - * - * @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 - * remains valid until the handler is called. - * - * @param completion_condition The function object to be called to determine - * whether the read operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_read_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the read operation is complete. A non-zero - * return value indicates the maximum number of bytes to be read on the next - * call to the device's async_read_some_at function. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // Number of bytes copied into the buffers. If an error - * // occurred, this will be the number of bytes successfully - * // transferred prior to the error. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -template <typename AsyncRandomAccessReadDevice, typename Allocator, - typename CompletionCondition, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_at(AsyncRandomAccessReadDevice& d, - uint64_t offset, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/read_at.hpp> - -#endif // BOOST_ASIO_READ_AT_HPP diff --git a/contrib/restricted/boost/boost/asio/read_until.hpp b/contrib/restricted/boost/boost/asio/read_until.hpp deleted file mode 100644 index 7b66b7fe43..0000000000 --- a/contrib/restricted/boost/boost/asio/read_until.hpp +++ /dev/null @@ -1,1826 +0,0 @@ -// -// read_until.hpp -// ~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_READ_UNTIL_HPP -#define BOOST_ASIO_READ_UNTIL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <string> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/regex_fwd.hpp> -#include <boost/asio/detail/string_view.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -# include <boost/asio/basic_streambuf_fwd.hpp> -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail -{ - char (&has_result_type_helper(...))[2]; - - template <typename T> - char has_result_type_helper(T*, typename T::result_type* = 0); - - template <typename T> - struct has_result_type - { - enum { value = (sizeof((has_result_type_helper)((T*)(0))) == 1) }; - }; -} // namespace detail - -/// Type trait used to determine whether a type can be used as a match condition -/// function with read_until and async_read_until. -template <typename T> -struct is_match_condition -{ -#if defined(GENERATING_DOCUMENTATION) - /// The value member is true if the type may be used as a match condition. - static const bool value; -#else - enum - { - value = boost::asio::is_function< - typename boost::asio::remove_pointer<T>::type>::value - || detail::has_result_type<T>::value - }; -#endif -}; - -/** - * @defgroup read_until boost::asio::read_until - * - * @brief Read data into a dynamic buffer sequence, or into a streambuf, until - * it contains a delimiter, matches a regular expression, or a function object - * indicates a match. - */ -/*@{*/ - -/// Read data into a dynamic buffer sequence until it contains a specified -/// delimiter. -/** - * This function is used to read data into the specified dynamic buffer - * sequence until the dynamic buffer sequence's get area contains the specified - * delimiter. The call will block until one of the following conditions is - * true: - * - * @li The get area of the dynamic buffer sequence contains the specified - * delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the dynamic buffer sequence's get area already - * contains the delimiter, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * - * @param delim The delimiter character. - * - * @returns The number of bytes in the dynamic buffer sequence's get area up to - * and including the delimiter. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note After a successful read_until operation, the dynamic buffer sequence - * may contain additional data beyond the delimiter. An application will - * typically leave that data in the dynamic buffer sequence for a subsequent - * read_until operation to examine. - * - * @par Example - * To read data into a @c std::string until a newline is encountered: - * @code std::string data; - * std::string n = boost::asio::read_until(s, - * boost::asio::dynamic_buffer(data), '\n'); - * std::string line = data.substr(0, n); - * data.erase(0, n); @endcode - * After the @c read_until operation completes successfully, the string @c data - * contains the delimiter: - * @code { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } @endcode - * The call to @c substr then extracts the data up to and including the - * delimiter, so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\n' } @endcode - * After the call to @c erase, the remaining data is left in the buffer @c b as - * follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c read_until operation. - */ -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, char delim); - -/// Read data into a dynamic buffer sequence until it contains a specified -/// delimiter. -/** - * This function is used to read data into the specified dynamic buffer - * sequence until the dynamic buffer sequence's get area contains the specified - * delimiter. The call will block until one of the following conditions is - * true: - * - * @li The get area of the dynamic buffer sequence contains the specified - * delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the dynamic buffer sequence's get area already - * contains the delimiter, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * - * @param delim The delimiter character. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes in the dynamic buffer sequence's get area up to - * and including the delimiter. Returns 0 if an error occurred. - * - * @note After a successful read_until operation, the dynamic buffer sequence - * may contain additional data beyond the delimiter. An application will - * typically leave that data in the dynamic buffer sequence for a subsequent - * read_until operation to examine. - */ -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - char delim, boost::system::error_code& ec); - -/// Read data into a dynamic buffer sequence until it contains a specified -/// delimiter. -/** - * This function is used to read data into the specified dynamic buffer - * sequence until the dynamic buffer sequence's get area contains the specified - * delimiter. The call will block until one of the following conditions is - * true: - * - * @li The get area of the dynamic buffer sequence contains the specified - * delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the dynamic buffer sequence's get area already - * contains the delimiter, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * - * @param delim The delimiter string. - * - * @returns The number of bytes in the dynamic buffer sequence's get area up to - * and including the delimiter. - * - * @note After a successful read_until operation, the dynamic buffer sequence - * may contain additional data beyond the delimiter. An application will - * typically leave that data in the dynamic buffer sequence for a subsequent - * read_until operation to examine. - * - * @par Example - * To read data into a @c std::string until a CR-LF sequence is encountered: - * @code std::string data; - * std::string n = boost::asio::read_until(s, - * boost::asio::dynamic_buffer(data), "\r\n"); - * std::string line = data.substr(0, n); - * data.erase(0, n); @endcode - * After the @c read_until operation completes successfully, the string @c data - * contains the delimiter: - * @code { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } @endcode - * The call to @c substr then extracts the data up to and including the - * delimiter, so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\r', '\n' } @endcode - * After the call to @c erase, the remaining data is left in the buffer @c b as - * follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c read_until operation. - */ -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_STRING_VIEW_PARAM delim); - -/// Read data into a dynamic buffer sequence until it contains a specified -/// delimiter. -/** - * This function is used to read data into the specified dynamic buffer - * sequence until the dynamic buffer sequence's get area contains the specified - * delimiter. The call will block until one of the following conditions is - * true: - * - * @li The get area of the dynamic buffer sequence contains the specified - * delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the dynamic buffer sequence's get area already - * contains the delimiter, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * - * @param delim The delimiter string. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes in the dynamic buffer sequence's get area up to - * and including the delimiter. Returns 0 if an error occurred. - * - * @note After a successful read_until operation, the dynamic buffer sequence - * may contain additional data beyond the delimiter. An application will - * typically leave that data in the dynamic buffer sequence for a subsequent - * read_until operation to examine. - */ -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_STRING_VIEW_PARAM delim, - boost::system::error_code& ec); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if defined(BOOST_ASIO_HAS_BOOST_REGEX) \ - || defined(GENERATING_DOCUMENTATION) - -/// Read data into a dynamic buffer sequence until some part of the data it -/// contains matches a regular expression. -/** - * This function is used to read data into the specified dynamic buffer - * sequence until the dynamic buffer sequence's get area contains some data - * that matches a regular expression. The call will block until one of the - * following conditions is true: - * - * @li A substring of the dynamic buffer sequence's get area matches the - * regular expression. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the dynamic buffer sequence's get area already - * contains data 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 SyncReadStream concept. - * - * @param buffers A dynamic buffer sequence into which the data will be read. - * - * @param expr The regular expression. - * - * @returns The number of bytes in the dynamic buffer sequence's get area up to - * and including the substring that matches the regular expression. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note After a successful read_until operation, the dynamic buffer sequence - * may contain additional data beyond that which matched the regular - * expression. An application will typically leave that data in the dynamic - * buffer sequence for a subsequent read_until operation to examine. - * - * @par Example - * To read data into a @c std::string until a CR-LF sequence is encountered: - * @code std::string data; - * std::string n = boost::asio::read_until(s, - * boost::asio::dynamic_buffer(data), boost::regex("\r\n")); - * std::string line = data.substr(0, n); - * data.erase(0, n); @endcode - * After the @c read_until operation completes successfully, the string @c data - * contains the delimiter: - * @code { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } @endcode - * The call to @c substr then extracts the data up to and including the - * delimiter, so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\r', '\n' } @endcode - * After the call to @c erase, the remaining data is left in the buffer @c b as - * follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c read_until operation. - */ -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - const boost::regex& expr); - -/// Read data into a dynamic buffer sequence until some part of the data it -/// contains matches a regular expression. -/** - * This function is used to read data into the specified dynamic buffer - * sequence until the dynamic buffer sequence's get area contains some data - * that matches a regular expression. The call will block until one of the - * following conditions is true: - * - * @li A substring of the dynamic buffer sequence's get area matches the - * regular expression. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the dynamic buffer sequence's get area already - * contains data 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 SyncReadStream concept. - * - * @param buffers A dynamic buffer sequence into which the data will be read. - * - * @param expr The regular expression. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes in the dynamic buffer sequence's get area up to - * and including the substring that matches the regular expression. Returns 0 - * if an error occurred. - * - * @note After a successful read_until operation, the dynamic buffer sequence - * may contain additional data beyond that which matched the regular - * expression. An application will typically leave that data in the dynamic - * buffer sequence for a subsequent read_until operation to examine. - */ -template <typename SyncReadStream, typename DynamicBuffer> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - const boost::regex& expr, boost::system::error_code& ec); - -#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX) - // || defined(GENERATING_DOCUMENTATION) - -/// Read data into a dynamic buffer sequence until a function object indicates a -/// match. - -/** - * This function is used to read data into the specified dynamic buffer - * sequence until a user-defined match condition function object, when applied - * to the data contained in the dynamic buffer sequence, indicates a successful - * match. The call will block until one of the following conditions is true: - * - * @li The match condition function object returns a std::pair where the second - * element evaluates to true. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the match condition function object already indicates - * a match, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers A dynamic buffer sequence into which the data will be read. - * - * @param match_condition The function object to be called to determine whether - * a match exists. The signature of the function object must be: - * @code pair<iterator, bool> match_condition(iterator begin, iterator end); - * @endcode - * where @c iterator represents the type: - * @code buffers_iterator<typename DynamicBuffer::const_buffers_type> - * @endcode - * The iterator parameters @c begin and @c end define the range of bytes to be - * scanned to determine whether there is a match. The @c first member of the - * return value is an iterator marking one-past-the-end of the bytes that have - * been consumed by the match function. This iterator is used to calculate the - * @c begin parameter for any subsequent invocation of the match condition. The - * @c second member of the return value is true if a match has been found, false - * otherwise. - * - * @returns The number of bytes in the dynamic_buffer's get area that - * have been fully consumed by the match function. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note After a successful read_until operation, the dynamic buffer sequence - * may contain additional data beyond that which matched the function object. - * An application will typically leave that data in the dynamic buffer sequence - * for a subsequent read_until operation to examine. - - * @note The default implementation of the @c is_match_condition type trait - * evaluates to true for function pointers and function objects with a - * @c result_type typedef. It must be specialised for other user-defined - * function objects. - * - * @par Examples - * To read data into a dynamic buffer sequence until whitespace is encountered: - * @code typedef boost::asio::buffers_iterator< - * boost::asio::const_buffers_1> iterator; - * - * std::pair<iterator, bool> - * match_whitespace(iterator begin, iterator end) - * { - * iterator i = begin; - * while (i != end) - * if (std::isspace(*i++)) - * return std::make_pair(i, true); - * return std::make_pair(i, false); - * } - * ... - * std::string data; - * boost::asio::read_until(s, data, match_whitespace); - * @endcode - * - * To read data into a @c std::string until a matching character is found: - * @code class match_char - * { - * public: - * explicit match_char(char c) : c_(c) {} - * - * template <typename Iterator> - * std::pair<Iterator, bool> operator()( - * Iterator begin, Iterator end) const - * { - * Iterator i = begin; - * while (i != end) - * if (c_ == *i++) - * return std::make_pair(i, true); - * return std::make_pair(i, false); - * } - * - * private: - * char c_; - * }; - * - * namespace asio { - * template <> struct is_match_condition<match_char> - * : public boost::true_type {}; - * } // namespace asio - * ... - * std::string data; - * boost::asio::read_until(s, data, match_char('a')); - * @endcode - */ -template <typename SyncReadStream, - typename DynamicBuffer, typename MatchCondition> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - MatchCondition match_condition, - typename enable_if<is_match_condition<MatchCondition>::value>::type* = 0); - -/// Read data into a dynamic buffer sequence until a function object indicates a -/// match. -/** - * This function is used to read data into the specified dynamic buffer - * sequence until a user-defined match condition function object, when applied - * to the data contained in the dynamic buffer sequence, indicates a successful - * match. The call will block until one of the following conditions is true: - * - * @li The match condition function object returns a std::pair where the second - * element evaluates to true. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the match condition function object already indicates - * a match, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param buffers A dynamic buffer sequence into which the data will be read. - * - * @param match_condition The function object to be called to determine whether - * a match exists. The signature of the function object must be: - * @code pair<iterator, bool> match_condition(iterator begin, iterator end); - * @endcode - * where @c iterator represents the type: - * @code buffers_iterator<DynamicBuffer::const_buffers_type> - * @endcode - * The iterator parameters @c begin and @c end define the range of bytes to be - * scanned to determine whether there is a match. The @c first member of the - * return value is an iterator marking one-past-the-end of the bytes that have - * been consumed by the match function. This iterator is used to calculate the - * @c begin parameter for any subsequent invocation of the match condition. The - * @c second member of the return value is true if a match has been found, false - * otherwise. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes in the dynamic buffer sequence's get area that - * have been fully consumed by the match function. Returns 0 if an error - * occurred. - * - * @note After a successful read_until operation, the dynamic buffer sequence - * may contain additional data beyond that which matched the function object. - * An application will typically leave that data in the dynamic buffer sequence - * for a subsequent read_until operation to examine. - * - * @note The default implementation of the @c is_match_condition type trait - * evaluates to true for function pointers and function objects with a - * @c result_type typedef. It must be specialised for other user-defined - * function objects. - */ -template <typename SyncReadStream, - typename DynamicBuffer, typename MatchCondition> -std::size_t read_until(SyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - MatchCondition match_condition, boost::system::error_code& ec, - typename enable_if<is_match_condition<MatchCondition>::value>::type* = 0); - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Read data into a streambuf until it contains a specified delimiter. -/** - * This function is used to read data into the specified streambuf until the - * streambuf's get area contains the specified delimiter. The call will block - * until one of the following conditions is true: - * - * @li The get area of the streambuf contains the specified delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the streambuf's get area already contains the - * delimiter, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b A streambuf object into which the data will be read. - * - * @param delim The delimiter character. - * - * @returns The number of bytes in the streambuf's get area up to and including - * the delimiter. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note After a successful read_until operation, the streambuf may contain - * additional data beyond the delimiter. An application will typically leave - * that data in the streambuf for a subsequent read_until operation to examine. - * - * @par Example - * To read data into a streambuf until a newline is encountered: - * @code boost::asio::streambuf b; - * boost::asio::read_until(s, b, '\n'); - * std::istream is(&b); - * std::string line; - * std::getline(is, line); @endcode - * After the @c read_until operation completes successfully, the buffer @c b - * contains the delimiter: - * @code { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } @endcode - * The call to @c std::getline then extracts the data up to and including the - * newline (which is discarded), so that the string @c line contains: - * @code { 'a', 'b', ..., 'c' } @endcode - * The remaining data is left in the buffer @c b as follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c read_until operation. - */ -template <typename SyncReadStream, typename Allocator> -std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, char delim); - -/// Read data into a streambuf until it contains a specified delimiter. -/** - * This function is used to read data into the specified streambuf until the - * streambuf's get area contains the specified delimiter. The call will block - * until one of the following conditions is true: - * - * @li The get area of the streambuf contains the specified delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the streambuf's get area already contains the - * delimiter, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b A streambuf object into which the data will be read. - * - * @param delim The delimiter character. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes in the streambuf's get area up to and including - * the delimiter. Returns 0 if an error occurred. - * - * @note After a successful read_until operation, the streambuf may contain - * additional data beyond the delimiter. An application will typically leave - * that data in the streambuf for a subsequent read_until operation to examine. - */ -template <typename SyncReadStream, typename Allocator> -std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, char delim, - boost::system::error_code& ec); - -/// Read data into a streambuf until it contains a specified delimiter. -/** - * This function is used to read data into the specified streambuf until the - * streambuf's get area contains the specified delimiter. The call will block - * until one of the following conditions is true: - * - * @li The get area of the streambuf contains the specified delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the streambuf's get area already contains the - * delimiter, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b A streambuf object into which the data will be read. - * - * @param delim The delimiter string. - * - * @returns The number of bytes in the streambuf's get area up to and including - * the delimiter. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note After a successful read_until operation, the streambuf may contain - * additional data beyond the delimiter. An application will typically leave - * that data in the streambuf for a subsequent read_until operation to examine. - * - * @par Example - * To read data into a streambuf until a newline is encountered: - * @code boost::asio::streambuf b; - * boost::asio::read_until(s, b, "\r\n"); - * std::istream is(&b); - * std::string line; - * std::getline(is, line); @endcode - * After the @c read_until operation completes successfully, the buffer @c b - * contains the delimiter: - * @code { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } @endcode - * The call to @c std::getline then extracts the data up to and including the - * newline (which is discarded), so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\r' } @endcode - * The remaining data is left in the buffer @c b as follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c read_until operation. - */ -template <typename SyncReadStream, typename Allocator> -std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - BOOST_ASIO_STRING_VIEW_PARAM delim); - -/// Read data into a streambuf until it contains a specified delimiter. -/** - * This function is used to read data into the specified streambuf until the - * streambuf's get area contains the specified delimiter. The call will block - * until one of the following conditions is true: - * - * @li The get area of the streambuf contains the specified delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the streambuf's get area already contains the - * delimiter, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b A streambuf object into which the data will be read. - * - * @param delim The delimiter string. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes in the streambuf's get area up to and including - * the delimiter. Returns 0 if an error occurred. - * - * @note After a successful read_until operation, the streambuf may contain - * additional data beyond the delimiter. An application will typically leave - * that data in the streambuf for a subsequent read_until operation to examine. - */ -template <typename SyncReadStream, typename Allocator> -std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - BOOST_ASIO_STRING_VIEW_PARAM delim, boost::system::error_code& ec); - -#if defined(BOOST_ASIO_HAS_BOOST_REGEX) \ - || defined(GENERATING_DOCUMENTATION) - -/// Read data into a streambuf until some part of the data it contains matches -/// a regular expression. -/** - * This function is used to read data into the specified streambuf until the - * streambuf's get area contains some data that matches a regular expression. - * The call will block until one of the following conditions is true: - * - * @li A substring of the streambuf's get area matches the regular expression. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the streambuf's get area already contains data 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 SyncReadStream concept. - * - * @param b A streambuf object into which the data will be read. - * - * @param expr The regular expression. - * - * @returns The number of bytes in the streambuf's get area up to and including - * the substring that matches the regular expression. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note After a successful read_until operation, the streambuf may contain - * additional data beyond that which matched the regular expression. An - * application will typically leave that data in the streambuf for a subsequent - * read_until operation to examine. - * - * @par Example - * To read data into a streambuf until a CR-LF sequence is encountered: - * @code boost::asio::streambuf b; - * boost::asio::read_until(s, b, boost::regex("\r\n")); - * std::istream is(&b); - * std::string line; - * std::getline(is, line); @endcode - * After the @c read_until operation completes successfully, the buffer @c b - * contains the data which matched the regular expression: - * @code { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } @endcode - * The call to @c std::getline then extracts the data up to and including the - * newline (which is discarded), so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\r' } @endcode - * The remaining data is left in the buffer @c b as follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c read_until operation. - */ -template <typename SyncReadStream, typename Allocator> -std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr); - -/// Read data into a streambuf until some part of the data it contains matches -/// a regular expression. -/** - * This function is used to read data into the specified streambuf until the - * streambuf's get area contains some data that matches a regular expression. - * The call will block until one of the following conditions is true: - * - * @li A substring of the streambuf's get area matches the regular expression. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the streambuf's get area already contains data 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 SyncReadStream concept. - * - * @param b A streambuf object into which the data will be read. - * - * @param expr The regular expression. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes in the streambuf's get area up to and including - * the substring that matches the regular expression. Returns 0 if an error - * occurred. - * - * @note After a successful read_until operation, the streambuf may contain - * additional data beyond that which matched the regular expression. An - * application will typically leave that data in the streambuf for a subsequent - * read_until operation to examine. - */ -template <typename SyncReadStream, typename Allocator> -std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr, - boost::system::error_code& ec); - -#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX) - // || defined(GENERATING_DOCUMENTATION) - -/// Read data into a streambuf until a function object indicates a match. -/** - * This function is used to read data into the specified streambuf until a - * user-defined match condition function object, when applied to the data - * contained in the streambuf, indicates a successful match. The call will - * block until one of the following conditions is true: - * - * @li The match condition function object returns a std::pair where the second - * element evaluates to true. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the match condition function object already indicates - * a match, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b A streambuf object into which the data will be read. - * - * @param match_condition The function object to be called to determine whether - * a match exists. The signature of the function object must be: - * @code pair<iterator, bool> match_condition(iterator begin, iterator end); - * @endcode - * where @c iterator represents the type: - * @code buffers_iterator<basic_streambuf<Allocator>::const_buffers_type> - * @endcode - * The iterator parameters @c begin and @c end define the range of bytes to be - * scanned to determine whether there is a match. The @c first member of the - * return value is an iterator marking one-past-the-end of the bytes that have - * been consumed by the match function. This iterator is used to calculate the - * @c begin parameter for any subsequent invocation of the match condition. The - * @c second member of the return value is true if a match has been found, false - * otherwise. - * - * @returns The number of bytes in the streambuf's get area that have been fully - * consumed by the match function. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note After a successful read_until operation, the streambuf may contain - * additional data beyond that which matched the function object. An application - * will typically leave that data in the streambuf for a subsequent read_until - * operation to examine. - * - * @note The default implementation of the @c is_match_condition type trait - * evaluates to true for function pointers and function objects with a - * @c result_type typedef. It must be specialised for other user-defined - * function objects. - * - * @par Examples - * To read data into a streambuf until whitespace is encountered: - * @code typedef boost::asio::buffers_iterator< - * boost::asio::streambuf::const_buffers_type> iterator; - * - * std::pair<iterator, bool> - * match_whitespace(iterator begin, iterator end) - * { - * iterator i = begin; - * while (i != end) - * if (std::isspace(*i++)) - * return std::make_pair(i, true); - * return std::make_pair(i, false); - * } - * ... - * boost::asio::streambuf b; - * boost::asio::read_until(s, b, match_whitespace); - * @endcode - * - * To read data into a streambuf until a matching character is found: - * @code class match_char - * { - * public: - * explicit match_char(char c) : c_(c) {} - * - * template <typename Iterator> - * std::pair<Iterator, bool> operator()( - * Iterator begin, Iterator end) const - * { - * Iterator i = begin; - * while (i != end) - * if (c_ == *i++) - * return std::make_pair(i, true); - * return std::make_pair(i, false); - * } - * - * private: - * char c_; - * }; - * - * namespace asio { - * template <> struct is_match_condition<match_char> - * : public boost::true_type {}; - * } // namespace asio - * ... - * boost::asio::streambuf b; - * boost::asio::read_until(s, b, match_char('a')); - * @endcode - */ -template <typename SyncReadStream, typename Allocator, typename MatchCondition> -std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, MatchCondition match_condition, - typename enable_if<is_match_condition<MatchCondition>::value>::type* = 0); - -/// Read data into a streambuf until a function object indicates a match. -/** - * This function is used to read data into the specified streambuf until a - * user-defined match condition function object, when applied to the data - * contained in the streambuf, indicates a successful match. The call will - * block until one of the following conditions is true: - * - * @li The match condition function object returns a std::pair where the second - * element evaluates to true. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * read_some function. If the match condition function object already indicates - * a match, the function returns immediately. - * - * @param s The stream from which the data is to be read. The type must support - * the SyncReadStream concept. - * - * @param b A streambuf object into which the data will be read. - * - * @param match_condition The function object to be called to determine whether - * a match exists. The signature of the function object must be: - * @code pair<iterator, bool> match_condition(iterator begin, iterator end); - * @endcode - * where @c iterator represents the type: - * @code buffers_iterator<basic_streambuf<Allocator>::const_buffers_type> - * @endcode - * The iterator parameters @c begin and @c end define the range of bytes to be - * scanned to determine whether there is a match. The @c first member of the - * return value is an iterator marking one-past-the-end of the bytes that have - * been consumed by the match function. This iterator is used to calculate the - * @c begin parameter for any subsequent invocation of the match condition. The - * @c second member of the return value is true if a match has been found, false - * otherwise. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes in the streambuf's get area that have been fully - * consumed by the match function. Returns 0 if an error occurred. - * - * @note After a successful read_until operation, the streambuf may contain - * additional data beyond that which matched the function object. An application - * will typically leave that data in the streambuf for a subsequent read_until - * operation to examine. - * - * @note The default implementation of the @c is_match_condition type trait - * evaluates to true for function pointers and function objects with a - * @c result_type typedef. It must be specialised for other user-defined - * function objects. - */ -template <typename SyncReadStream, typename Allocator, typename MatchCondition> -std::size_t read_until(SyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - MatchCondition match_condition, boost::system::error_code& ec, - typename enable_if<is_match_condition<MatchCondition>::value>::type* = 0); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ -/** - * @defgroup async_read_until boost::asio::async_read_until - * - * @brief Start an asynchronous operation to read data into a dynamic buffer - * sequence, or into a streambuf, until it contains a delimiter, matches a - * regular expression, or a function object indicates a match. - */ -/*@{*/ - -/// Start an asynchronous operation to read data into a dynamic buffer sequence -/// until it contains a specified delimiter. -/** - * This function is used to asynchronously read data into the specified dynamic - * buffer sequence until the dynamic buffer sequence's get area contains the - * specified delimiter. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li The get area of the dynamic buffer sequence contains the specified - * delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. If - * the dynamic buffer sequence's get area already contains the delimiter, this - * asynchronous operation completes immediately. The program must ensure that - * the stream performs no other read operations (such as async_read, - * async_read_until, the stream's async_read_some function, or any other - * composed operations that perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * the AsyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param delim The delimiter character. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // The number of bytes in the dynamic buffer sequence's - * // get area up to and including the delimiter. - * // 0 if an error occurred. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note After a successful async_read_until operation, the dynamic buffer - * sequence may contain additional data beyond the delimiter. An application - * will typically leave that data in the dynamic buffer sequence for a - * subsequent async_read_until operation to examine. - * - * @par Example - * To asynchronously read data into a @c std::string until a newline is - * encountered: - * @code std::string data; - * ... - * void handler(const boost::system::error_code& e, std::size_t size) - * { - * if (!e) - * { - * std::string line = data.substr(0, n); - * data.erase(0, n); - * ... - * } - * } - * ... - * boost::asio::async_read_until(s, data, '\n', handler); @endcode - * After the @c async_read_until operation completes successfully, the buffer - * @c data contains the delimiter: - * @code { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } @endcode - * The call to @c substr then extracts the data up to and including the - * delimiter, so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\n' } @endcode - * After the call to @c erase, the remaining data is left in the buffer @c data - * as follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c async_read_until operation. - */ -template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - char delim, BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -/// Start an asynchronous operation to read data into a dynamic buffer sequence -/// until it contains a specified delimiter. -/** - * This function is used to asynchronously read data into the specified dynamic - * buffer sequence until the dynamic buffer sequence's get area contains the - * specified delimiter. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li The get area of the dynamic buffer sequence contains the specified - * delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. If - * the dynamic buffer sequence's get area already contains the delimiter, this - * asynchronous operation completes immediately. The program must ensure that - * the stream performs no other read operations (such as async_read, - * async_read_until, the stream's async_read_some function, or any other - * composed operations that perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * the AsyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param delim The delimiter string. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // The number of bytes in the dynamic buffer sequence's - * // get area up to and including the delimiter. - * // 0 if an error occurred. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note After a successful async_read_until operation, the dynamic buffer - * sequence may contain additional data beyond the delimiter. An application - * will typically leave that data in the dynamic buffer sequence for a - * subsequent async_read_until operation to examine. - * - * @par Example - * To asynchronously read data into a @c std::string until a CR-LF sequence is - * encountered: - * @code std::string data; - * ... - * void handler(const boost::system::error_code& e, std::size_t size) - * { - * if (!e) - * { - * std::string line = data.substr(0, n); - * data.erase(0, n); - * ... - * } - * } - * ... - * boost::asio::async_read_until(s, data, "\r\n", handler); @endcode - * After the @c async_read_until operation completes successfully, the string - * @c data contains the delimiter: - * @code { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } @endcode - * The call to @c substr then extracts the data up to and including the - * delimiter, so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\r', '\n' } @endcode - * After the call to @c erase, the remaining data is left in the string @c data - * as follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c async_read_until operation. - */ -template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_STRING_VIEW_PARAM delim, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if defined(BOOST_ASIO_HAS_BOOST_REGEX) \ - || defined(GENERATING_DOCUMENTATION) - -/// Start an asynchronous operation to read data into a dynamic buffer sequence -/// until some part of its data matches a regular expression. -/** - * This function is used to asynchronously read data into the specified dynamic - * buffer sequence until the dynamic buffer sequence's get area contains some - * data that matches a regular expression. The function call always returns - * immediately. The asynchronous operation will continue until one of the - * following conditions is true: - * - * @li A substring of the dynamic buffer sequence's get area matches the regular - * expression. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. If - * the dynamic buffer sequence's get area already contains data that matches - * the regular expression, this asynchronous operation completes immediately. - * The program must ensure that the stream performs no other read operations - * (such as async_read, async_read_until, the stream's async_read_some - * function, or any other composed operations that perform reads) until this - * operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * the AsyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param expr The regular expression. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // The number of bytes in the dynamic buffer - * // sequence's get area up to and including the - * // substring that matches the regular expression. - * // 0 if an error occurred. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note After a successful async_read_until operation, the dynamic buffer - * sequence may contain additional data beyond that which matched the regular - * expression. An application will typically leave that data in the dynamic - * buffer sequence for a subsequent async_read_until operation to examine. - * - * @par Example - * To asynchronously read data into a @c std::string until a CR-LF sequence is - * encountered: - * @code std::string data; - * ... - * void handler(const boost::system::error_code& e, std::size_t size) - * { - * if (!e) - * { - * std::string line = data.substr(0, n); - * data.erase(0, n); - * ... - * } - * } - * ... - * boost::asio::async_read_until(s, data, - * boost::regex("\r\n"), handler); @endcode - * After the @c async_read_until operation completes successfully, the string - * @c data contains the data which matched the regular expression: - * @code { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } @endcode - * The call to @c substr then extracts the data up to and including the match, - * so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\r', '\n' } @endcode - * After the call to @c erase, the remaining data is left in the string @c data - * as follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c async_read_until operation. - */ -template <typename AsyncReadStream, - typename DynamicBuffer, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - const boost::regex& expr, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX) - // || defined(GENERATING_DOCUMENTATION) - -/// Start an asynchronous operation to read data into a dynamic buffer sequence -/// until a function object indicates a match. -/** - * This function is used to asynchronously read data into the specified dynamic - * buffer sequence until a user-defined match condition function object, when - * applied to the data contained in the dynamic buffer sequence, indicates a - * successful match. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li The match condition function object returns a std::pair where the second - * element evaluates to true. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. If - * the match condition function object already indicates a match, this - * asynchronous operation completes immediately. The program must ensure that - * the stream performs no other read operations (such as async_read, - * async_read_until, the stream's async_read_some function, or any other - * composed operations that perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * the AsyncReadStream concept. - * - * @param buffers The dynamic buffer sequence into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param match_condition The function object to be called to determine whether - * a match exists. The signature of the function object must be: - * @code pair<iterator, bool> match_condition(iterator begin, iterator end); - * @endcode - * where @c iterator represents the type: - * @code buffers_iterator<typename DynamicBuffer::const_buffers_type> - * @endcode - * The iterator parameters @c begin and @c end define the range of bytes to be - * scanned to determine whether there is a match. The @c first member of the - * return value is an iterator marking one-past-the-end of the bytes that have - * been consumed by the match function. This iterator is used to calculate the - * @c begin parameter for any subsequent invocation of the match condition. The - * @c second member of the return value is true if a match has been found, false - * otherwise. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // The number of bytes in the dynamic buffer sequence's - * // get area that have been fully consumed by the match - * // function. O if an error occurred. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note After a successful async_read_until operation, the dynamic buffer - * sequence may contain additional data beyond that which matched the function - * object. An application will typically leave that data in the dynamic buffer - * sequence for a subsequent async_read_until operation to examine. - * - * @note The default implementation of the @c is_match_condition type trait - * evaluates to true for function pointers and function objects with a - * @c result_type typedef. It must be specialised for other user-defined - * function objects. - * - * @par Examples - * To asynchronously read data into a @c std::string until whitespace is - * encountered: - * @code typedef boost::asio::buffers_iterator< - * boost::asio::const_buffers_1> iterator; - * - * std::pair<iterator, bool> - * match_whitespace(iterator begin, iterator end) - * { - * iterator i = begin; - * while (i != end) - * if (std::isspace(*i++)) - * return std::make_pair(i, true); - * return std::make_pair(i, false); - * } - * ... - * void handler(const boost::system::error_code& e, std::size_t size); - * ... - * std::string data; - * boost::asio::async_read_until(s, data, match_whitespace, handler); - * @endcode - * - * To asynchronously read data into a @c std::string until a matching character - * is found: - * @code class match_char - * { - * public: - * explicit match_char(char c) : c_(c) {} - * - * template <typename Iterator> - * std::pair<Iterator, bool> operator()( - * Iterator begin, Iterator end) const - * { - * Iterator i = begin; - * while (i != end) - * if (c_ == *i++) - * return std::make_pair(i, true); - * return std::make_pair(i, false); - * } - * - * private: - * char c_; - * }; - * - * namespace asio { - * template <> struct is_match_condition<match_char> - * : public boost::true_type {}; - * } // namespace asio - * ... - * void handler(const boost::system::error_code& e, std::size_t size); - * ... - * std::string data; - * boost::asio::async_read_until(s, data, match_char('a'), handler); - * @endcode - */ -template <typename AsyncReadStream, typename DynamicBuffer, - typename MatchCondition, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if<is_match_condition<MatchCondition>::value>::type* = 0); - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Start an asynchronous operation to read data into a streambuf until it -/// contains a specified delimiter. -/** - * This function is used to asynchronously read data into the specified - * streambuf until the streambuf's get area contains the specified delimiter. - * The function call always returns immediately. The asynchronous operation - * will continue until one of the following conditions is true: - * - * @li The get area of the streambuf contains the specified delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. If - * the streambuf's get area already contains the delimiter, this asynchronous - * operation completes immediately. The program must ensure that the stream - * performs no other read operations (such as async_read, async_read_until, the - * stream's async_read_some function, or any other composed operations that - * perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * valid until the handler is called. - * - * @param delim The delimiter character. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // The number of bytes in the streambuf's get - * // area up to and including the delimiter. - * // 0 if an error occurred. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note After a successful async_read_until operation, the streambuf may - * contain additional data beyond the delimiter. An application will typically - * leave that data in the streambuf for a subsequent async_read_until operation - * to examine. - * - * @par Example - * To asynchronously read data into a streambuf until a newline is encountered: - * @code boost::asio::streambuf b; - * ... - * void handler(const boost::system::error_code& e, std::size_t size) - * { - * if (!e) - * { - * std::istream is(&b); - * std::string line; - * std::getline(is, line); - * ... - * } - * } - * ... - * boost::asio::async_read_until(s, b, '\n', handler); @endcode - * After the @c async_read_until operation completes successfully, the buffer - * @c b contains the delimiter: - * @code { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } @endcode - * The call to @c std::getline then extracts the data up to and including the - * newline (which is discarded), so that the string @c line contains: - * @code { 'a', 'b', ..., 'c' } @endcode - * The remaining data is left in the buffer @c b as follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c async_read_until operation. - */ -template <typename AsyncReadStream, typename Allocator, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - char delim, BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -/// Start an asynchronous operation to read data into a streambuf until it -/// contains a specified delimiter. -/** - * This function is used to asynchronously read data into the specified - * streambuf until the streambuf's get area contains the specified delimiter. - * The function call always returns immediately. The asynchronous operation - * will continue until one of the following conditions is true: - * - * @li The get area of the streambuf contains the specified delimiter. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. If - * the streambuf's get area already contains the delimiter, this asynchronous - * operation completes immediately. The program must ensure that the stream - * performs no other read operations (such as async_read, async_read_until, the - * stream's async_read_some function, or any other composed operations that - * perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * valid until the handler is called. - * - * @param delim The delimiter string. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // The number of bytes in the streambuf's get - * // area up to and including the delimiter. - * // 0 if an error occurred. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note After a successful async_read_until operation, the streambuf may - * contain additional data beyond the delimiter. An application will typically - * leave that data in the streambuf for a subsequent async_read_until operation - * to examine. - * - * @par Example - * To asynchronously read data into a streambuf until a newline is encountered: - * @code boost::asio::streambuf b; - * ... - * void handler(const boost::system::error_code& e, std::size_t size) - * { - * if (!e) - * { - * std::istream is(&b); - * std::string line; - * std::getline(is, line); - * ... - * } - * } - * ... - * boost::asio::async_read_until(s, b, "\r\n", handler); @endcode - * After the @c async_read_until operation completes successfully, the buffer - * @c b contains the delimiter: - * @code { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } @endcode - * The call to @c std::getline then extracts the data up to and including the - * newline (which is discarded), so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\r' } @endcode - * The remaining data is left in the buffer @c b as follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c async_read_until operation. - */ -template <typename AsyncReadStream, typename Allocator, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - BOOST_ASIO_STRING_VIEW_PARAM delim, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -#if defined(BOOST_ASIO_HAS_BOOST_REGEX) \ - || defined(GENERATING_DOCUMENTATION) - -/// Start an asynchronous operation to read data into a streambuf until some -/// part of its data matches a regular expression. -/** - * This function is used to asynchronously read data into the specified - * streambuf until the streambuf's get area contains some data that matches a - * regular expression. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li A substring of the streambuf's get area matches the regular expression. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. If - * the streambuf's get area already contains data that matches the regular - * expression, this asynchronous operation completes immediately. The program - * must ensure that the stream performs no other read operations (such as - * async_read, async_read_until, the stream's async_read_some function, or any - * other composed operations that perform reads) until this operation - * completes. - * - * @param s The stream from which the data is to be read. The type must support - * 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 - * valid until the handler is called. - * - * @param expr The regular expression. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // The number of bytes in the streambuf's get - * // area up to and including the substring - * // that matches the regular. expression. - * // 0 if an error occurred. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note After a successful async_read_until operation, the streambuf may - * contain additional data beyond that which matched the regular expression. An - * application will typically leave that data in the streambuf for a subsequent - * async_read_until operation to examine. - * - * @par Example - * To asynchronously read data into a streambuf until a CR-LF sequence is - * encountered: - * @code boost::asio::streambuf b; - * ... - * void handler(const boost::system::error_code& e, std::size_t size) - * { - * if (!e) - * { - * std::istream is(&b); - * std::string line; - * std::getline(is, line); - * ... - * } - * } - * ... - * boost::asio::async_read_until(s, b, boost::regex("\r\n"), handler); @endcode - * After the @c async_read_until operation completes successfully, the buffer - * @c b contains the data which matched the regular expression: - * @code { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } @endcode - * The call to @c std::getline then extracts the data up to and including the - * newline (which is discarded), so that the string @c line contains: - * @code { 'a', 'b', ..., 'c', '\r' } @endcode - * The remaining data is left in the buffer @c b as follows: - * @code { 'd', 'e', ... } @endcode - * This data may be the start of a new line, to be extracted by a subsequent - * @c async_read_until operation. - */ -template <typename AsyncReadStream, typename Allocator, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler); - -#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX) - // || defined(GENERATING_DOCUMENTATION) - -/// Start an asynchronous operation to read data into a streambuf until a -/// function object indicates a match. -/** - * This function is used to asynchronously read data into the specified - * streambuf until a user-defined match condition function object, when applied - * to the data contained in the streambuf, indicates a successful match. The - * function call always returns immediately. The asynchronous operation will - * continue until one of the following conditions is true: - * - * @li The match condition function object returns a std::pair where the second - * element evaluates to true. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_read_some function, and is known as a <em>composed operation</em>. If - * the match condition function object already indicates a match, this - * asynchronous operation completes immediately. The program must ensure that - * the stream performs no other read operations (such as async_read, - * async_read_until, the stream's async_read_some function, or any other - * composed operations that perform reads) until this operation completes. - * - * @param s The stream from which the data is to be read. The type must support - * the AsyncReadStream concept. - * - * @param b A streambuf object into which the data will be read. - * - * @param match_condition The function object to be called to determine whether - * a match exists. The signature of the function object must be: - * @code pair<iterator, bool> match_condition(iterator begin, iterator end); - * @endcode - * where @c iterator represents the type: - * @code buffers_iterator<basic_streambuf<Allocator>::const_buffers_type> - * @endcode - * The iterator parameters @c begin and @c end define the range of bytes to be - * scanned to determine whether there is a match. The @c first member of the - * return value is an iterator marking one-past-the-end of the bytes that have - * been consumed by the match function. This iterator is used to calculate the - * @c begin parameter for any subsequent invocation of the match condition. The - * @c second member of the return value is true if a match has been found, false - * otherwise. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // The number of bytes in the streambuf's get - * // area that have been fully consumed by the - * // match function. O if an error occurred. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note After a successful async_read_until operation, the streambuf may - * contain additional data beyond that which matched the function object. An - * application will typically leave that data in the streambuf for a subsequent - * async_read_until operation to examine. - * - * @note The default implementation of the @c is_match_condition type trait - * evaluates to true for function pointers and function objects with a - * @c result_type typedef. It must be specialised for other user-defined - * function objects. - * - * @par Examples - * To asynchronously read data into a streambuf until whitespace is encountered: - * @code typedef boost::asio::buffers_iterator< - * boost::asio::streambuf::const_buffers_type> iterator; - * - * std::pair<iterator, bool> - * match_whitespace(iterator begin, iterator end) - * { - * iterator i = begin; - * while (i != end) - * if (std::isspace(*i++)) - * return std::make_pair(i, true); - * return std::make_pair(i, false); - * } - * ... - * void handler(const boost::system::error_code& e, std::size_t size); - * ... - * boost::asio::streambuf b; - * boost::asio::async_read_until(s, b, match_whitespace, handler); - * @endcode - * - * To asynchronously read data into a streambuf until a matching character is - * found: - * @code class match_char - * { - * public: - * explicit match_char(char c) : c_(c) {} - * - * template <typename Iterator> - * std::pair<Iterator, bool> operator()( - * Iterator begin, Iterator end) const - * { - * Iterator i = begin; - * while (i != end) - * if (c_ == *i++) - * return std::make_pair(i, true); - * return std::make_pair(i, false); - * } - * - * private: - * char c_; - * }; - * - * namespace asio { - * template <> struct is_match_condition<match_char> - * : public boost::true_type {}; - * } // namespace asio - * ... - * void handler(const boost::system::error_code& e, std::size_t size); - * ... - * boost::asio::streambuf b; - * boost::asio::async_read_until(s, b, match_char('a'), handler); - * @endcode - */ -template <typename AsyncReadStream, typename Allocator, - typename MatchCondition, typename ReadHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) -async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, - MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler, - typename enable_if<is_match_condition<MatchCondition>::value>::type* = 0); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/read_until.hpp> - -#endif // BOOST_ASIO_READ_UNTIL_HPP diff --git a/contrib/restricted/boost/boost/asio/seq_packet_socket_service.hpp b/contrib/restricted/boost/boost/asio/seq_packet_socket_service.hpp deleted file mode 100644 index d6445782b3..0000000000 --- a/contrib/restricted/boost/boost/asio/seq_packet_socket_service.hpp +++ /dev/null @@ -1,418 +0,0 @@ -// -// seq_packet_socket_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP -#define BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) -# include <boost/asio/detail/null_socket_service.hpp> -#elif defined(BOOST_ASIO_HAS_IOCP) -# include <boost/asio/detail/win_iocp_socket_service.hpp> -#else -# include <boost/asio/detail/reactive_socket_service.hpp> -#endif - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Default service implementation for a sequenced packet socket. -template <typename Protocol> -class seq_packet_socket_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base< - seq_packet_socket_service<Protocol> > -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename Protocol::endpoint endpoint_type; - -private: - // The type of the platform-specific implementation. -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - typedef detail::null_socket_service<Protocol> service_impl_type; -#elif defined(BOOST_ASIO_HAS_IOCP) - typedef detail::win_iocp_socket_service<Protocol> service_impl_type; -#else - typedef detail::reactive_socket_service<Protocol> service_impl_type; -#endif - -public: - /// The type of a sequenced packet socket implementation. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef typename service_impl_type::implementation_type implementation_type; -#endif - - /// The native socket type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef typename service_impl_type::native_handle_type native_handle_type; -#endif - - /// Construct a new sequenced packet socket service for the specified - /// io_context. - explicit seq_packet_socket_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base< - seq_packet_socket_service<Protocol> >(io_context), - service_impl_(io_context) - { - } - - /// Construct a new sequenced packet socket implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new sequenced packet socket implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another sequenced packet socket implementation. - void move_assign(implementation_type& impl, - seq_packet_socket_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } - - // All socket services have access to each other's implementations. - template <typename Protocol1> friend class seq_packet_socket_service; - - /// Move-construct a new sequenced packet socket implementation from another - /// protocol type. - template <typename Protocol1> - void converting_move_construct(implementation_type& impl, - seq_packet_socket_service<Protocol1>& other_service, - typename seq_packet_socket_service< - Protocol1>::implementation_type& other_impl, - typename enable_if<is_convertible< - Protocol1, Protocol>::value>::type* = 0) - { - service_impl_.template converting_move_construct<Protocol1>( - impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroy a sequenced packet socket implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Open a sequenced packet socket. - BOOST_ASIO_SYNC_OP_VOID open(implementation_type& impl, - const protocol_type& protocol, boost::system::error_code& ec) - { - if (protocol.type() == BOOST_ASIO_OS_DEF(SOCK_SEQPACKET)) - service_impl_.open(impl, protocol, ec); - else - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Assign an existing native socket to a sequenced packet socket. - BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, - const protocol_type& protocol, const native_handle_type& native_socket, - boost::system::error_code& ec) - { - service_impl_.assign(impl, protocol, native_socket, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the socket is open. - bool is_open(const implementation_type& impl) const - { - return service_impl_.is_open(impl); - } - - /// Close a sequenced packet socket implementation. - BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.close(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Release ownership of the underlying socket. - native_handle_type release(implementation_type& impl, - boost::system::error_code& ec) - { - return service_impl_.release(impl, ec); - } - - /// Get the native socket implementation. - native_handle_type native_handle(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - - /// Cancel all asynchronous operations associated with the socket. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the socket is at the out-of-band data mark. - bool at_mark(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.at_mark(impl, ec); - } - - /// Determine the number of bytes available for reading. - std::size_t available(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.available(impl, ec); - } - - /// Bind the sequenced packet socket to the specified local endpoint. - BOOST_ASIO_SYNC_OP_VOID bind(implementation_type& impl, - const endpoint_type& endpoint, boost::system::error_code& ec) - { - service_impl_.bind(impl, endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Connect the sequenced packet socket to the specified endpoint. - BOOST_ASIO_SYNC_OP_VOID connect(implementation_type& impl, - const endpoint_type& peer_endpoint, boost::system::error_code& ec) - { - service_impl_.connect(impl, peer_endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Start an asynchronous connect. - template <typename ConnectHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ConnectHandler, - void (boost::system::error_code)) - async_connect(implementation_type& impl, - const endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) - { - async_completion<ConnectHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_connect(impl, peer_endpoint, init.completion_handler); - - return init.result.get(); - } - - /// Set a socket option. - template <typename SettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID set_option(implementation_type& impl, - const SettableSocketOption& option, boost::system::error_code& ec) - { - service_impl_.set_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get a socket option. - template <typename GettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID get_option(const implementation_type& impl, - GettableSocketOption& option, boost::system::error_code& ec) const - { - service_impl_.get_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform an IO control command on the socket. - template <typename IoControlCommand> - BOOST_ASIO_SYNC_OP_VOID io_control(implementation_type& impl, - IoControlCommand& command, boost::system::error_code& ec) - { - service_impl_.io_control(impl, command, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the socket. - bool non_blocking(const implementation_type& impl) const - { - return service_impl_.non_blocking(impl); - } - - /// Sets the non-blocking mode of the socket. - BOOST_ASIO_SYNC_OP_VOID non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the native socket implementation. - bool native_non_blocking(const implementation_type& impl) const - { - return service_impl_.native_non_blocking(impl); - } - - /// Sets the non-blocking mode of the native socket implementation. - BOOST_ASIO_SYNC_OP_VOID native_non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.native_non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the local endpoint. - endpoint_type local_endpoint(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.local_endpoint(impl, ec); - } - - /// Get the remote endpoint. - endpoint_type remote_endpoint(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.remote_endpoint(impl, ec); - } - - /// Disable sends or receives on the socket. - BOOST_ASIO_SYNC_OP_VOID shutdown(implementation_type& impl, - socket_base::shutdown_type what, boost::system::error_code& ec) - { - service_impl_.shutdown(impl, what, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Wait for the socket to become ready to read, ready to write, or to have - /// pending error conditions. - BOOST_ASIO_SYNC_OP_VOID wait(implementation_type& impl, - socket_base::wait_type w, boost::system::error_code& ec) - { - service_impl_.wait(impl, w, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Asynchronously wait for the socket to become ready to read, ready to - /// write, or to have pending error conditions. - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(implementation_type& impl, socket_base::wait_type w, - BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_wait(impl, w, init.completion_handler); - - return init.result.get(); - } - - /// Send the given data to the peer. - template <typename ConstBufferSequence> - std::size_t send(implementation_type& impl, - const ConstBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return service_impl_.send(impl, buffers, flags, ec); - } - - /// Start an asynchronous send. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send(implementation_type& impl, - const ConstBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_send(impl, buffers, flags, init.completion_handler); - - return init.result.get(); - } - - /// Receive some data from the peer. - template <typename MutableBufferSequence> - std::size_t receive(implementation_type& impl, - const MutableBufferSequence& buffers, socket_base::message_flags in_flags, - socket_base::message_flags& out_flags, boost::system::error_code& ec) - { - return service_impl_.receive_with_flags(impl, - buffers, in_flags, out_flags, ec); - } - - /// Start an asynchronous receive. - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive(implementation_type& impl, - const MutableBufferSequence& buffers, socket_base::message_flags in_flags, - socket_base::message_flags& out_flags, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_receive_with_flags(impl, - buffers, in_flags, out_flags, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/serial_port.hpp b/contrib/restricted/boost/boost/asio/serial_port.hpp deleted file mode 100644 index f2185b8037..0000000000 --- a/contrib/restricted/boost/boost/asio/serial_port.hpp +++ /dev/null @@ -1,771 +0,0 @@ -// -// serial_port.hpp -// ~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SERIAL_PORT_HPP -#define BOOST_ASIO_SERIAL_PORT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_SERIAL_PORT) \ - || defined(GENERATING_DOCUMENTATION) - -#include <string> -#include <boost/asio/async_result.hpp> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/serial_port_base.hpp> - -#if defined(BOOST_ASIO_HAS_MOVE) -# include <utility> -#endif // defined(BOOST_ASIO_HAS_MOVE) - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/basic_serial_port.hpp> -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# if defined(BOOST_ASIO_HAS_IOCP) -# include <boost/asio/detail/win_iocp_serial_port_service.hpp> -# define BOOST_ASIO_SVC_T detail::win_iocp_serial_port_service -# else -# include <boost/asio/detail/reactive_serial_port_service.hpp> -# define BOOST_ASIO_SVC_T detail::reactive_serial_port_service -# endif -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -// Typedef for the typical usage of a serial port. -typedef basic_serial_port<> serial_port; -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -/// Provides serial port functionality. -/** - * The serial_port class provides a wrapper over serial port functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -class serial_port - : BOOST_ASIO_SVC_ACCESS basic_io_object<BOOST_ASIO_SVC_T>, - public serial_port_base -{ -public: - /// The type of the executor associated with the object. - typedef io_context::executor_type executor_type; - - /// The native representation of a serial port. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef BOOST_ASIO_SVC_T::native_handle_type native_handle_type; -#endif - - /// A basic_serial_port is always the lowest layer. - typedef serial_port lowest_layer_type; - - /// Construct a serial_port without opening it. - /** - * This constructor creates a serial port without opening it. - * - * @param io_context The io_context object that the serial port will use to - * dispatch handlers for any asynchronous operations performed on the port. - */ - explicit serial_port(boost::asio::io_context& io_context) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - } - - /// Construct and open a serial_port. - /** - * This constructor creates and opens a serial port for the specified device - * name. - * - * @param io_context The io_context object that the serial port will use to - * dispatch handlers for any asynchronous operations performed on the port. - * - * @param device The platform-specific device name for this serial - * port. - */ - explicit serial_port(boost::asio::io_context& io_context, - const char* device) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().open(this->get_implementation(), device, ec); - boost::asio::detail::throw_error(ec, "open"); - } - - /// Construct and open a serial_port. - /** - * This constructor creates and opens a serial port for the specified device - * name. - * - * @param io_context The io_context object that the serial port will use to - * dispatch handlers for any asynchronous operations performed on the port. - * - * @param device The platform-specific device name for this serial - * port. - */ - explicit serial_port(boost::asio::io_context& io_context, - const std::string& device) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().open(this->get_implementation(), device, ec); - boost::asio::detail::throw_error(ec, "open"); - } - - /// Construct a serial_port on an existing native serial port. - /** - * This constructor creates a serial port object to hold an existing native - * serial port. - * - * @param io_context The io_context object that the serial port will use to - * dispatch handlers for any asynchronous operations performed on the port. - * - * @param native_serial_port A native serial port. - * - * @throws boost::system::system_error Thrown on failure. - */ - serial_port(boost::asio::io_context& io_context, - const native_handle_type& native_serial_port) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - native_serial_port, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a serial_port from another. - /** - * This constructor moves a serial port from one object to another. - * - * @param other The other serial_port object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c serial_port(io_context&) constructor. - */ - serial_port(serial_port&& other) - : basic_io_object<BOOST_ASIO_SVC_T>(std::move(other)) - { - } - - /// Move-assign a serial_port from another. - /** - * This assignment operator moves a serial port from one object to another. - * - * @param other The other serial_port object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c serial_port(io_context&) constructor. - */ - serial_port& operator=(serial_port&& other) - { - basic_io_object<BOOST_ASIO_SVC_T>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroys the serial port. - /** - * This function destroys the serial port, cancelling any outstanding - * asynchronous wait operations associated with the serial port as if by - * calling @c cancel. - */ - ~serial_port() - { - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_context() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_service() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_executor(); - } - - /// Get a reference to the lowest layer. - /** - * This function returns a reference to the lowest layer in a stack of - * layers. Since a serial_port cannot contain any further layers, it simply - * returns a reference to itself. - * - * @return A reference to the lowest layer in the stack of layers. Ownership - * is not transferred to the caller. - */ - lowest_layer_type& lowest_layer() - { - return *this; - } - - /// Get a const reference to the lowest layer. - /** - * This function returns a const reference to the lowest layer in a stack of - * layers. Since a serial_port cannot contain any further layers, it simply - * returns a reference to itself. - * - * @return A const reference to the lowest layer in the stack of layers. - * Ownership is not transferred to the caller. - */ - const lowest_layer_type& lowest_layer() const - { - return *this; - } - - /// Open the serial port using the specified device name. - /** - * This function opens the serial port for the specified device name. - * - * @param device The platform-specific device name. - * - * @throws boost::system::system_error Thrown on failure. - */ - void open(const std::string& device) - { - boost::system::error_code ec; - this->get_service().open(this->get_implementation(), device, ec); - boost::asio::detail::throw_error(ec, "open"); - } - - /// Open the serial port using the specified device name. - /** - * This function opens the serial port using the given platform-specific - * device name. - * - * @param device The platform-specific device name. - * - * @param ec Set the indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID open(const std::string& device, - boost::system::error_code& ec) - { - this->get_service().open(this->get_implementation(), device, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Assign an existing native serial port to the serial port. - /* - * This function opens the serial port to hold an existing native serial port. - * - * @param native_serial_port A native serial port. - * - * @throws boost::system::system_error Thrown on failure. - */ - void assign(const native_handle_type& native_serial_port) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), - native_serial_port, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - - /// Assign an existing native serial port to the serial port. - /* - * This function opens the serial port to hold an existing native serial port. - * - * @param native_serial_port A native serial port. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID assign(const native_handle_type& native_serial_port, - boost::system::error_code& ec) - { - this->get_service().assign(this->get_implementation(), - native_serial_port, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the serial port is open. - bool is_open() const - { - return this->get_service().is_open(this->get_implementation()); - } - - /// Close the serial port. - /** - * This function is used to close the serial port. Any asynchronous read or - * write operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void close() - { - boost::system::error_code ec; - this->get_service().close(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "close"); - } - - /// Close the serial port. - /** - * This function is used to close the serial port. Any asynchronous read or - * write operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - this->get_service().close(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native serial port representation. - /** - * This function may be used to obtain the underlying representation of the - * serial port. This is intended to allow access to native serial port - * functionality that is not otherwise provided. - */ - native_handle_type native_handle() - { - return this->get_service().native_handle(this->get_implementation()); - } - - /// Cancel all asynchronous operations associated with the serial port. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all asynchronous operations associated with the serial port. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Send a break sequence to the serial port. - /** - * This function causes a break sequence of platform-specific duration to be - * sent out the serial port. - * - * @throws boost::system::system_error Thrown on failure. - */ - void send_break() - { - boost::system::error_code ec; - this->get_service().send_break(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "send_break"); - } - - /// Send a break sequence to the serial port. - /** - * This function causes a break sequence of platform-specific duration to be - * sent out the serial port. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID send_break(boost::system::error_code& ec) - { - this->get_service().send_break(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Set an option on the serial port. - /** - * This function is used to set an option on the serial port. - * - * @param option The option value to be set on the serial port. - * - * @throws boost::system::system_error Thrown on failure. - * - * @sa SettableSerialPortOption @n - * boost::asio::serial_port_base::baud_rate @n - * boost::asio::serial_port_base::flow_control @n - * boost::asio::serial_port_base::parity @n - * boost::asio::serial_port_base::stop_bits @n - * boost::asio::serial_port_base::character_size - */ - template <typename SettableSerialPortOption> - void set_option(const SettableSerialPortOption& option) - { - boost::system::error_code ec; - this->get_service().set_option(this->get_implementation(), option, ec); - boost::asio::detail::throw_error(ec, "set_option"); - } - - /// Set an option on the serial port. - /** - * This function is used to set an option on the serial port. - * - * @param option The option value to be set on the serial port. - * - * @param ec Set to indicate what error occurred, if any. - * - * @sa SettableSerialPortOption @n - * boost::asio::serial_port_base::baud_rate @n - * boost::asio::serial_port_base::flow_control @n - * boost::asio::serial_port_base::parity @n - * boost::asio::serial_port_base::stop_bits @n - * boost::asio::serial_port_base::character_size - */ - template <typename SettableSerialPortOption> - BOOST_ASIO_SYNC_OP_VOID set_option(const SettableSerialPortOption& option, - boost::system::error_code& ec) - { - this->get_service().set_option(this->get_implementation(), option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get an option from the serial port. - /** - * This function is used to get the current value of an option on the serial - * port. - * - * @param option The option value to be obtained from the serial port. - * - * @throws boost::system::system_error Thrown on failure. - * - * @sa GettableSerialPortOption @n - * boost::asio::serial_port_base::baud_rate @n - * boost::asio::serial_port_base::flow_control @n - * boost::asio::serial_port_base::parity @n - * boost::asio::serial_port_base::stop_bits @n - * boost::asio::serial_port_base::character_size - */ - template <typename GettableSerialPortOption> - void get_option(GettableSerialPortOption& option) - { - boost::system::error_code ec; - this->get_service().get_option(this->get_implementation(), option, ec); - boost::asio::detail::throw_error(ec, "get_option"); - } - - /// Get an option from the serial port. - /** - * This function is used to get the current value of an option on the serial - * port. - * - * @param option The option value to be obtained from the serial port. - * - * @param ec Set to indicate what error occurred, if any. - * - * @sa GettableSerialPortOption @n - * boost::asio::serial_port_base::baud_rate @n - * boost::asio::serial_port_base::flow_control @n - * boost::asio::serial_port_base::parity @n - * boost::asio::serial_port_base::stop_bits @n - * boost::asio::serial_port_base::character_size - */ - template <typename GettableSerialPortOption> - BOOST_ASIO_SYNC_OP_VOID get_option(GettableSerialPortOption& option, - boost::system::error_code& ec) - { - this->get_service().get_option(this->get_implementation(), option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Write some data to the serial port. - /** - * This function is used to write data to the serial port. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the serial port. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * serial_port.write_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().write_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "write_some"); - return s; - } - - /// Write some data to the serial port. - /** - * This function is used to write data to the serial port. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the serial port. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().write_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous write. - /** - * This function is used to asynchronously write data to the serial port. - * The function call always returns immediately. - * - * @param buffers One or more data buffers to be written to the serial port. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The write operation may not transmit all of the data to the peer. - * Consider using the @ref async_write function if you need to ensure that all - * data is written before the asynchronous operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * serial_port.async_write_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_write_some( - this->get_implementation(), buffers, init.completion_handler); - - return init.result.get(); - } - - /// Read some data from the serial port. - /** - * This function is used to read data from the serial port. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The read_some operation may not read all of the requested number of - * 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. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * serial_port.read_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().read_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "read_some"); - return s; - } - - /// Read some data from the serial port. - /** - * This function is used to read data from the serial port. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().read_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous read. - /** - * This function is used to asynchronously read data from the serial port. - * The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The read operation may not read all of the requested number of bytes. - * Consider using the @ref async_read function if you need to ensure that the - * requested amount of data is read before the asynchronous operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * serial_port.async_read_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_read_some( - this->get_implementation(), buffers, init.completion_handler); - - return init.result.get(); - } -}; -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# undef BOOST_ASIO_SVC_T -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_SERIAL_PORT_HPP diff --git a/contrib/restricted/boost/boost/asio/serial_port_base.hpp b/contrib/restricted/boost/boost/asio/serial_port_base.hpp deleted file mode 100644 index 3b8c4951f3..0000000000 --- a/contrib/restricted/boost/boost/asio/serial_port_base.hpp +++ /dev/null @@ -1,169 +0,0 @@ -// -// serial_port_base.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SERIAL_PORT_BASE_HPP -#define BOOST_ASIO_SERIAL_PORT_BASE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_SERIAL_PORT) \ - || defined(GENERATING_DOCUMENTATION) - -#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) -# include <termios.h> -#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - -#include <boost/asio/detail/socket_types.hpp> -#include <boost/system/error_code.hpp> - -#if defined(GENERATING_DOCUMENTATION) -# define BOOST_ASIO_OPTION_STORAGE implementation_defined -#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) -# define BOOST_ASIO_OPTION_STORAGE DCB -#else -# define BOOST_ASIO_OPTION_STORAGE termios -#endif - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// The serial_port_base class is used as a base for the basic_serial_port class -/// template so that we have a common place to define the serial port options. -class serial_port_base -{ -public: - /// Serial port option to permit changing the baud rate. - /** - * Implements changing the baud rate for a given serial port. - */ - class baud_rate - { - public: - explicit baud_rate(unsigned int rate = 0); - unsigned int value() const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID store( - BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec) const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID load( - const BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec); - private: - unsigned int value_; - }; - - /// Serial port option to permit changing the flow control. - /** - * Implements changing the flow control for a given serial port. - */ - class flow_control - { - public: - enum type { none, software, hardware }; - BOOST_ASIO_DECL explicit flow_control(type t = none); - type value() const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID store( - BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec) const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID load( - const BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec); - private: - type value_; - }; - - /// Serial port option to permit changing the parity. - /** - * Implements changing the parity for a given serial port. - */ - class parity - { - public: - enum type { none, odd, even }; - BOOST_ASIO_DECL explicit parity(type t = none); - type value() const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID store( - BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec) const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID load( - const BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec); - private: - type value_; - }; - - /// Serial port option to permit changing the number of stop bits. - /** - * Implements changing the number of stop bits for a given serial port. - */ - class stop_bits - { - public: - enum type { one, onepointfive, two }; - BOOST_ASIO_DECL explicit stop_bits(type t = one); - type value() const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID store( - BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec) const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID load( - const BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec); - private: - type value_; - }; - - /// Serial port option to permit changing the character size. - /** - * Implements changing the character size for a given serial port. - */ - class character_size - { - public: - BOOST_ASIO_DECL explicit character_size(unsigned int t = 8); - unsigned int value() const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID store( - BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec) const; - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID load( - const BOOST_ASIO_OPTION_STORAGE& storage, - boost::system::error_code& ec); - private: - unsigned int value_; - }; - -protected: - /// Protected destructor to prevent deletion through this type. - ~serial_port_base() - { - } -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#undef BOOST_ASIO_OPTION_STORAGE - -#include <boost/asio/impl/serial_port_base.hpp> -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/impl/serial_port_base.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_SERIAL_PORT_BASE_HPP diff --git a/contrib/restricted/boost/boost/asio/serial_port_service.hpp b/contrib/restricted/boost/boost/asio/serial_port_service.hpp deleted file mode 100644 index 935f92fffa..0000000000 --- a/contrib/restricted/boost/boost/asio/serial_port_service.hpp +++ /dev/null @@ -1,251 +0,0 @@ -// -// serial_port_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SERIAL_PORT_SERVICE_HPP -#define BOOST_ASIO_SERIAL_PORT_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_SERIAL_PORT) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <string> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/reactive_serial_port_service.hpp> -#include <boost/asio/detail/win_iocp_serial_port_service.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/serial_port_base.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Default service implementation for a serial port. -class serial_port_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base<serial_port_service> -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - -private: - // The type of the platform-specific implementation. -#if defined(BOOST_ASIO_HAS_IOCP) - typedef detail::win_iocp_serial_port_service service_impl_type; -#else - typedef detail::reactive_serial_port_service service_impl_type; -#endif - -public: - /// The type of a serial port implementation. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef service_impl_type::implementation_type implementation_type; -#endif - - /// The native handle type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef service_impl_type::native_handle_type native_handle_type; -#endif - - /// Construct a new serial port service for the specified io_context. - explicit serial_port_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base<serial_port_service>(io_context), - service_impl_(io_context) - { - } - - /// Construct a new serial port implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new serial port implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another serial port implementation. - void move_assign(implementation_type& impl, - serial_port_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroy a serial port implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Open a serial port. - BOOST_ASIO_SYNC_OP_VOID open(implementation_type& impl, - const std::string& device, boost::system::error_code& ec) - { - service_impl_.open(impl, device, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Assign an existing native handle to a serial port. - BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, - const native_handle_type& handle, boost::system::error_code& ec) - { - service_impl_.assign(impl, handle, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the handle is open. - bool is_open(const implementation_type& impl) const - { - return service_impl_.is_open(impl); - } - - /// Close a serial port implementation. - BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.close(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native handle implementation. - native_handle_type native_handle(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - - /// Cancel all asynchronous operations associated with the handle. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Set a serial port option. - template <typename SettableSerialPortOption> - BOOST_ASIO_SYNC_OP_VOID set_option(implementation_type& impl, - const SettableSerialPortOption& option, boost::system::error_code& ec) - { - service_impl_.set_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get a serial port option. - template <typename GettableSerialPortOption> - BOOST_ASIO_SYNC_OP_VOID get_option(const implementation_type& impl, - GettableSerialPortOption& option, boost::system::error_code& ec) const - { - service_impl_.get_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Send a break sequence to the serial port. - BOOST_ASIO_SYNC_OP_VOID send_break(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.send_break(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Write the given data to the stream. - template <typename ConstBufferSequence> - std::size_t write_some(implementation_type& impl, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - return service_impl_.write_some(impl, buffers, ec); - } - - /// Start an asynchronous write. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_write_some(impl, buffers, init.completion_handler); - - return init.result.get(); - } - - /// Read some data from the stream. - template <typename MutableBufferSequence> - std::size_t read_some(implementation_type& impl, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - return service_impl_.read_some(impl, buffers, ec); - } - - /// Start an asynchronous read. - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_read_some(impl, buffers, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_SERIAL_PORT_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/signal_set.hpp b/contrib/restricted/boost/boost/asio/signal_set.hpp deleted file mode 100644 index 0ddb996a58..0000000000 --- a/contrib/restricted/boost/boost/asio/signal_set.hpp +++ /dev/null @@ -1,449 +0,0 @@ -// -// signal_set.hpp -// ~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SIGNAL_SET_HPP -#define BOOST_ASIO_SIGNAL_SET_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/async_result.hpp> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/basic_signal_set.hpp> -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/detail/signal_set_service.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -namespace boost { -namespace asio { - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -// Typedef for the typical usage of a signal set. -typedef basic_signal_set<> signal_set; -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -/// Provides signal functionality. -/** - * The signal_set class provides the ability to perform an asynchronous wait - * for one or more signals to occur. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Example - * Performing an asynchronous wait: - * @code - * void handler( - * const boost::system::error_code& error, - * int signal_number) - * { - * if (!error) - * { - * // A signal occurred. - * } - * } - * - * ... - * - * // Construct a signal set registered for process termination. - * boost::asio::signal_set signals(io_context, SIGINT, SIGTERM); - * - * // Start an asynchronous wait for one of the signals to occur. - * signals.async_wait(handler); - * @endcode - * - * @par Queueing of signal notifications - * - * If a signal is registered with a signal_set, and the signal occurs when - * there are no waiting handlers, then the signal notification is queued. The - * next async_wait operation on that signal_set will dequeue the notification. - * If multiple notifications are queued, subsequent async_wait operations - * dequeue them one at a time. Signal notifications are dequeued in order of - * ascending signal number. - * - * If a signal number is removed from a signal_set (using the @c remove or @c - * erase member functions) then any queued notifications for that signal are - * discarded. - * - * @par Multiple registration of signals - * - * The same signal number may be registered with different signal_set objects. - * When the signal occurs, one handler is called for each signal_set object. - * - * Note that multiple registration only works for signals that are registered - * using Asio. The application must not also register a signal handler using - * functions such as @c signal() or @c sigaction(). - * - * @par Signal masking on POSIX platforms - * - * POSIX allows signals to be blocked using functions such as @c sigprocmask() - * and @c pthread_sigmask(). For signals to be delivered, programs must ensure - * that any signals registered using signal_set objects are unblocked in at - * least one thread. - */ -class signal_set - : BOOST_ASIO_SVC_ACCESS basic_io_object<detail::signal_set_service> -{ -public: - /// The type of the executor associated with the object. - typedef io_context::executor_type executor_type; - - /// Construct a signal set without adding any signals. - /** - * This constructor creates a signal set without registering for any signals. - * - * @param io_context The io_context object that the signal set will use to - * dispatch handlers for any asynchronous operations performed on the set. - */ - explicit signal_set(boost::asio::io_context& io_context) - : basic_io_object<detail::signal_set_service>(io_context) - { - } - - /// Construct a signal set and add one signal. - /** - * This constructor creates a signal set and registers for one signal. - * - * @param io_context The io_context object that the signal set will use to - * dispatch handlers for any asynchronous operations performed on the set. - * - * @param signal_number_1 The signal number to be added. - * - * @note This constructor is equivalent to performing: - * @code boost::asio::signal_set signals(io_context); - * signals.add(signal_number_1); @endcode - */ - signal_set(boost::asio::io_context& io_context, int signal_number_1) - : basic_io_object<detail::signal_set_service>(io_context) - { - boost::system::error_code ec; - this->get_service().add(this->get_implementation(), signal_number_1, ec); - boost::asio::detail::throw_error(ec, "add"); - } - - /// Construct a signal set and add two signals. - /** - * This constructor creates a signal set and registers for two signals. - * - * @param io_context The io_context object that the signal set will use to - * dispatch handlers for any asynchronous operations performed on the set. - * - * @param signal_number_1 The first signal number to be added. - * - * @param signal_number_2 The second signal number to be added. - * - * @note This constructor is equivalent to performing: - * @code boost::asio::signal_set signals(io_context); - * signals.add(signal_number_1); - * signals.add(signal_number_2); @endcode - */ - signal_set(boost::asio::io_context& io_context, int signal_number_1, - int signal_number_2) - : basic_io_object<detail::signal_set_service>(io_context) - { - boost::system::error_code ec; - this->get_service().add(this->get_implementation(), signal_number_1, ec); - boost::asio::detail::throw_error(ec, "add"); - this->get_service().add(this->get_implementation(), signal_number_2, ec); - boost::asio::detail::throw_error(ec, "add"); - } - - /// Construct a signal set and add three signals. - /** - * This constructor creates a signal set and registers for three signals. - * - * @param io_context The io_context object that the signal set will use to - * dispatch handlers for any asynchronous operations performed on the set. - * - * @param signal_number_1 The first signal number to be added. - * - * @param signal_number_2 The second signal number to be added. - * - * @param signal_number_3 The third signal number to be added. - * - * @note This constructor is equivalent to performing: - * @code boost::asio::signal_set signals(io_context); - * signals.add(signal_number_1); - * signals.add(signal_number_2); - * signals.add(signal_number_3); @endcode - */ - signal_set(boost::asio::io_context& io_context, int signal_number_1, - int signal_number_2, int signal_number_3) - : basic_io_object<detail::signal_set_service>(io_context) - { - boost::system::error_code ec; - this->get_service().add(this->get_implementation(), signal_number_1, ec); - boost::asio::detail::throw_error(ec, "add"); - this->get_service().add(this->get_implementation(), signal_number_2, ec); - boost::asio::detail::throw_error(ec, "add"); - this->get_service().add(this->get_implementation(), signal_number_3, ec); - boost::asio::detail::throw_error(ec, "add"); - } - - /// Destroys the signal set. - /** - * This function destroys the signal set, cancelling any outstanding - * asynchronous wait operations associated with the signal set as if by - * calling @c cancel. - */ - ~signal_set() - { - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_context() - { - return basic_io_object<detail::signal_set_service>::get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_service() - { - return basic_io_object<detail::signal_set_service>::get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return basic_io_object<detail::signal_set_service>::get_executor(); - } - - /// Add a signal to a signal_set. - /** - * This function adds the specified signal to the set. It has no effect if the - * signal is already in the set. - * - * @param signal_number The signal to be added to the set. - * - * @throws boost::system::system_error Thrown on failure. - */ - void add(int signal_number) - { - boost::system::error_code ec; - this->get_service().add(this->get_implementation(), signal_number, ec); - boost::asio::detail::throw_error(ec, "add"); - } - - /// Add a signal to a signal_set. - /** - * This function adds the specified signal to the set. It has no effect if the - * signal is already in the set. - * - * @param signal_number The signal to be added to the set. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID add(int signal_number, - boost::system::error_code& ec) - { - this->get_service().add(this->get_implementation(), signal_number, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Remove a signal from a signal_set. - /** - * This function removes the specified signal from the set. It has no effect - * if the signal is not in the set. - * - * @param signal_number The signal to be removed from the set. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Removes any notifications that have been queued for the specified - * signal number. - */ - void remove(int signal_number) - { - boost::system::error_code ec; - this->get_service().remove(this->get_implementation(), signal_number, ec); - boost::asio::detail::throw_error(ec, "remove"); - } - - /// Remove a signal from a signal_set. - /** - * This function removes the specified signal from the set. It has no effect - * if the signal is not in the set. - * - * @param signal_number The signal to be removed from the set. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Removes any notifications that have been queued for the specified - * signal number. - */ - BOOST_ASIO_SYNC_OP_VOID remove(int signal_number, - boost::system::error_code& ec) - { - this->get_service().remove(this->get_implementation(), signal_number, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Remove all signals from a signal_set. - /** - * This function removes all signals from the set. It has no effect if the set - * is already empty. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Removes all queued notifications. - */ - void clear() - { - boost::system::error_code ec; - this->get_service().clear(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "clear"); - } - - /// Remove all signals from a signal_set. - /** - * This function removes all signals from the set. It has no effect if the set - * is already empty. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Removes all queued notifications. - */ - BOOST_ASIO_SYNC_OP_VOID clear(boost::system::error_code& ec) - { - this->get_service().clear(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Cancel all operations associated with the signal set. - /** - * This function forces the completion of any pending asynchronous wait - * operations against the signal set. The handler for each cancelled - * operation will be invoked with the boost::asio::error::operation_aborted - * error code. - * - * Cancellation does not alter the set of registered signals. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If a registered signal occurred before cancel() is called, then the - * handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all operations associated with the signal set. - /** - * This function forces the completion of any pending asynchronous wait - * operations against the signal set. The handler for each cancelled - * operation will be invoked with the boost::asio::error::operation_aborted - * error code. - * - * Cancellation does not alter the set of registered signals. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note If a registered signal occurred before cancel() is called, then the - * handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Start an asynchronous operation to wait for a signal to be delivered. - /** - * This function may be used to initiate an asynchronous wait against the - * signal set. It always returns immediately. - * - * For each call to async_wait(), the supplied handler will be called exactly - * once. The handler will be called when: - * - * @li One of the registered signals in the signal set occurs; or - * - * @li The signal set was cancelled, in which case the handler is passed the - * error code boost::asio::error::operation_aborted. - * - * @param handler The handler to be called when the signal occurs. Copies - * will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * int signal_number // Indicates which signal occurred. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ - template <typename SignalHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(SignalHandler, - void (boost::system::error_code, int)) - async_wait(BOOST_ASIO_MOVE_ARG(SignalHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a SignalHandler. - BOOST_ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check; - - async_completion<SignalHandler, - void (boost::system::error_code, int)> init(handler); - - this->get_service().async_wait(this->get_implementation(), - init.completion_handler); - - return init.result.get(); - } -}; -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -} // namespace asio -} // namespace boost - -#endif // BOOST_ASIO_SIGNAL_SET_HPP diff --git a/contrib/restricted/boost/boost/asio/signal_set_service.hpp b/contrib/restricted/boost/boost/asio/signal_set_service.hpp deleted file mode 100644 index 743611620d..0000000000 --- a/contrib/restricted/boost/boost/asio/signal_set_service.hpp +++ /dev/null @@ -1,144 +0,0 @@ -// -// signal_set_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SIGNAL_SET_SERVICE_HPP -#define BOOST_ASIO_SIGNAL_SET_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/signal_set_service.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Default service implementation for a signal set. -class signal_set_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base<signal_set_service> -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - -public: - /// The type of a signal set implementation. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef detail::signal_set_service::implementation_type implementation_type; -#endif - - /// Construct a new signal set service for the specified io_context. - explicit signal_set_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base<signal_set_service>(io_context), - service_impl_(io_context) - { - } - - /// Construct a new signal set implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - - /// Destroy a signal set implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Add a signal to a signal_set. - BOOST_ASIO_SYNC_OP_VOID add(implementation_type& impl, - int signal_number, boost::system::error_code& ec) - { - service_impl_.add(impl, signal_number, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Remove a signal to a signal_set. - BOOST_ASIO_SYNC_OP_VOID remove(implementation_type& impl, - int signal_number, boost::system::error_code& ec) - { - service_impl_.remove(impl, signal_number, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Remove all signals from a signal_set. - BOOST_ASIO_SYNC_OP_VOID clear(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.clear(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Cancel all operations associated with the signal set. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - // Start an asynchronous operation to wait for a signal to be delivered. - template <typename SignalHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(SignalHandler, - void (boost::system::error_code, int)) - async_wait(implementation_type& impl, - BOOST_ASIO_MOVE_ARG(SignalHandler) handler) - { - async_completion<SignalHandler, - void (boost::system::error_code, int)> init(handler); - - service_impl_.async_wait(impl, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // Perform any fork-related housekeeping. - void notify_fork(boost::asio::io_context::fork_event event) - { - service_impl_.notify_fork(event); - } - - // The platform-specific implementation. - detail::signal_set_service service_impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_SIGNAL_SET_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/socket_acceptor_service.hpp b/contrib/restricted/boost/boost/asio/socket_acceptor_service.hpp deleted file mode 100644 index ed5c084401..0000000000 --- a/contrib/restricted/boost/boost/asio/socket_acceptor_service.hpp +++ /dev/null @@ -1,374 +0,0 @@ -// -// socket_acceptor_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SOCKET_ACCEPTOR_SERVICE_HPP -#define BOOST_ASIO_SOCKET_ACCEPTOR_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/basic_socket.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) -# include <boost/asio/detail/null_socket_service.hpp> -#elif defined(BOOST_ASIO_HAS_IOCP) -# include <boost/asio/detail/win_iocp_socket_service.hpp> -#else -# include <boost/asio/detail/reactive_socket_service.hpp> -#endif - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Default service implementation for a socket acceptor. -template <typename Protocol> -class socket_acceptor_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base<socket_acceptor_service<Protocol> > -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename protocol_type::endpoint endpoint_type; - -private: - // The type of the platform-specific implementation. -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - typedef detail::null_socket_service<Protocol> service_impl_type; -#elif defined(BOOST_ASIO_HAS_IOCP) - typedef detail::win_iocp_socket_service<Protocol> service_impl_type; -#else - typedef detail::reactive_socket_service<Protocol> service_impl_type; -#endif - -public: - /// The native type of the socket acceptor. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef typename service_impl_type::implementation_type implementation_type; -#endif - - /// The native acceptor type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef typename service_impl_type::native_handle_type native_handle_type; -#endif - - /// Construct a new socket acceptor service for the specified io_context. - explicit socket_acceptor_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base< - socket_acceptor_service<Protocol> >(io_context), - service_impl_(io_context) - { - } - - /// Construct a new socket acceptor implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new socket acceptor implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another socket acceptor implementation. - void move_assign(implementation_type& impl, - socket_acceptor_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } - - // All acceptor services have access to each other's implementations. - template <typename Protocol1> friend class socket_acceptor_service; - - /// Move-construct a new socket acceptor implementation from another protocol - /// type. - template <typename Protocol1> - void converting_move_construct(implementation_type& impl, - socket_acceptor_service<Protocol1>& other_service, - typename socket_acceptor_service< - Protocol1>::implementation_type& other_impl, - typename enable_if<is_convertible< - Protocol1, Protocol>::value>::type* = 0) - { - service_impl_.template converting_move_construct<Protocol1>( - impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroy a socket acceptor implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Open a new socket acceptor implementation. - BOOST_ASIO_SYNC_OP_VOID open(implementation_type& impl, - const protocol_type& protocol, boost::system::error_code& ec) - { - service_impl_.open(impl, protocol, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Assign an existing native acceptor to a socket acceptor. - BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, - const protocol_type& protocol, const native_handle_type& native_acceptor, - boost::system::error_code& ec) - { - service_impl_.assign(impl, protocol, native_acceptor, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the acceptor is open. - bool is_open(const implementation_type& impl) const - { - return service_impl_.is_open(impl); - } - - /// Cancel all asynchronous operations associated with the acceptor. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Bind the socket acceptor to the specified local endpoint. - BOOST_ASIO_SYNC_OP_VOID bind(implementation_type& impl, - const endpoint_type& endpoint, boost::system::error_code& ec) - { - service_impl_.bind(impl, endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Place the socket acceptor into the state where it will listen for new - /// connections. - BOOST_ASIO_SYNC_OP_VOID listen(implementation_type& impl, int backlog, - boost::system::error_code& ec) - { - service_impl_.listen(impl, backlog, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Close a socket acceptor implementation. - BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.close(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Release ownership of the underlying acceptor. - native_handle_type release(implementation_type& impl, - boost::system::error_code& ec) - { - return service_impl_.release(impl, ec); - } - - /// Get the native acceptor implementation. - native_handle_type native_handle(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - - /// Set a socket option. - template <typename SettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID set_option(implementation_type& impl, - const SettableSocketOption& option, boost::system::error_code& ec) - { - service_impl_.set_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get a socket option. - template <typename GettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID get_option(const implementation_type& impl, - GettableSocketOption& option, boost::system::error_code& ec) const - { - service_impl_.get_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform an IO control command on the socket. - template <typename IoControlCommand> - BOOST_ASIO_SYNC_OP_VOID io_control(implementation_type& impl, - IoControlCommand& command, boost::system::error_code& ec) - { - service_impl_.io_control(impl, command, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the acceptor. - bool non_blocking(const implementation_type& impl) const - { - return service_impl_.non_blocking(impl); - } - - /// Sets the non-blocking mode of the acceptor. - BOOST_ASIO_SYNC_OP_VOID non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the native acceptor implementation. - bool native_non_blocking(const implementation_type& impl) const - { - return service_impl_.native_non_blocking(impl); - } - - /// Sets the non-blocking mode of the native acceptor implementation. - BOOST_ASIO_SYNC_OP_VOID native_non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.native_non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the local endpoint. - endpoint_type local_endpoint(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.local_endpoint(impl, ec); - } - - /// Wait for the acceptor to become ready to read, ready to write, or to have - /// pending error conditions. - BOOST_ASIO_SYNC_OP_VOID wait(implementation_type& impl, - socket_base::wait_type w, boost::system::error_code& ec) - { - service_impl_.wait(impl, w, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Asynchronously wait for the acceptor to become ready to read, ready to - /// write, or to have pending error conditions. - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(implementation_type& impl, socket_base::wait_type w, - BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_wait(impl, w, init.completion_handler); - - return init.result.get(); - } - - /// Accept a new connection. - template <typename Protocol1, typename SocketService> - BOOST_ASIO_SYNC_OP_VOID accept(implementation_type& impl, - basic_socket<Protocol1, SocketService>& peer, - endpoint_type* peer_endpoint, boost::system::error_code& ec, - typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0) - { - service_impl_.accept(impl, peer, peer_endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Accept a new connection. - typename Protocol::socket accept(implementation_type& impl, - io_context* peer_io_context, endpoint_type* peer_endpoint, - boost::system::error_code& ec) - { - return service_impl_.accept(impl, peer_io_context, peer_endpoint, ec); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - /// Start an asynchronous accept. - template <typename Protocol1, typename SocketService, typename AcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, - void (boost::system::error_code)) - async_accept(implementation_type& impl, - basic_socket<Protocol1, SocketService>& peer, - endpoint_type* peer_endpoint, - BOOST_ASIO_MOVE_ARG(AcceptHandler) handler, - typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0) - { - async_completion<AcceptHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_accept(impl, - peer, peer_endpoint, init.completion_handler); - - return init.result.get(); - } - -#if defined(BOOST_ASIO_HAS_MOVE) - /// Start an asynchronous accept. - template <typename MoveAcceptHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler, - void (boost::system::error_code, typename Protocol::socket)) - async_accept(implementation_type& impl, - boost::asio::io_context* peer_io_context, endpoint_type* peer_endpoint, - BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler) - { - async_completion<MoveAcceptHandler, - void (boost::system::error_code, - typename Protocol::socket)> init(handler); - - service_impl_.async_accept(impl, - peer_io_context, peer_endpoint, init.completion_handler); - - return init.result.get(); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_SOCKET_ACCEPTOR_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/spawn.hpp b/contrib/restricted/boost/boost/asio/spawn.hpp deleted file mode 100644 index b39cb90143..0000000000 --- a/contrib/restricted/boost/boost/asio/spawn.hpp +++ /dev/null @@ -1,338 +0,0 @@ -// -// spawn.hpp -// ~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SPAWN_HPP -#define BOOST_ASIO_SPAWN_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/coroutine/all.hpp> -#include <boost/asio/bind_executor.hpp> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/detail/wrapped_handler.hpp> -#include <boost/asio/executor.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/is_executor.hpp> -#include <boost/asio/strand.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Context object the represents the currently executing coroutine. -/** - * The basic_yield_context class is used to represent the currently executing - * stackful coroutine. A basic_yield_context may be passed as a handler to an - * asynchronous operation. For example: - * - * @code template <typename Handler> - * void my_coroutine(basic_yield_context<Handler> yield) - * { - * ... - * std::size_t n = my_socket.async_read_some(buffer, yield); - * ... - * } @endcode - * - * The initiating function (async_read_some in the above example) suspends the - * current coroutine. The coroutine is resumed when the asynchronous operation - * completes, and the result of the operation is returned. - */ -template <typename Handler> -class basic_yield_context -{ -public: - /// The coroutine callee type, used by the implementation. - /** - * When using Boost.Coroutine v1, this type is: - * @code typename coroutine<void()> @endcode - * When using Boost.Coroutine v2 (unidirectional coroutines), this type is: - * @code push_coroutine<void> @endcode - */ -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined callee_type; -#elif defined(BOOST_COROUTINES_UNIDIRECT) || defined(BOOST_COROUTINES_V2) - typedef boost::coroutines::push_coroutine<void> callee_type; -#else - typedef boost::coroutines::coroutine<void()> callee_type; -#endif - - /// The coroutine caller type, used by the implementation. - /** - * When using Boost.Coroutine v1, this type is: - * @code typename coroutine<void()>::caller_type @endcode - * When using Boost.Coroutine v2 (unidirectional coroutines), this type is: - * @code pull_coroutine<void> @endcode - */ -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined caller_type; -#elif defined(BOOST_COROUTINES_UNIDIRECT) || defined(BOOST_COROUTINES_V2) - typedef boost::coroutines::pull_coroutine<void> caller_type; -#else - typedef boost::coroutines::coroutine<void()>::caller_type caller_type; -#endif - - /// Construct a yield context to represent the specified coroutine. - /** - * Most applications do not need to use this constructor. Instead, the - * spawn() function passes a yield context as an argument to the coroutine - * function. - */ - basic_yield_context( - const detail::weak_ptr<callee_type>& coro, - caller_type& ca, Handler& handler) - : coro_(coro), - ca_(ca), - handler_(handler), - ec_(0) - { - } - - /// Construct a yield context from another yield context type. - /** - * Requires that OtherHandler be convertible to Handler. - */ - template <typename OtherHandler> - basic_yield_context(const basic_yield_context<OtherHandler>& other) - : coro_(other.coro_), - ca_(other.ca_), - handler_(other.handler_), - ec_(other.ec_) - { - } - - /// Return a yield context that sets the specified error_code. - /** - * By default, when a yield context is used with an asynchronous operation, a - * non-success error_code is converted to system_error and thrown. This - * operator may be used to specify an error_code object that should instead be - * set with the asynchronous operation's result. For example: - * - * @code template <typename Handler> - * void my_coroutine(basic_yield_context<Handler> yield) - * { - * ... - * std::size_t n = my_socket.async_read_some(buffer, yield[ec]); - * if (ec) - * { - * // An error occurred. - * } - * ... - * } @endcode - */ - basic_yield_context operator[](boost::system::error_code& ec) const - { - basic_yield_context tmp(*this); - tmp.ec_ = &ec; - return tmp; - } - -#if defined(GENERATING_DOCUMENTATION) -private: -#endif // defined(GENERATING_DOCUMENTATION) - detail::weak_ptr<callee_type> coro_; - caller_type& ca_; - Handler handler_; - boost::system::error_code* ec_; -}; - -#if defined(GENERATING_DOCUMENTATION) -/// Context object that represents the currently executing coroutine. -typedef basic_yield_context<unspecified> yield_context; -#else // defined(GENERATING_DOCUMENTATION) -typedef basic_yield_context< - executor_binder<void(*)(), executor> > yield_context; -#endif // defined(GENERATING_DOCUMENTATION) - -/** - * @defgroup spawn boost::asio::spawn - * - * @brief Start a new stackful coroutine. - * - * The spawn() function is a high-level wrapper over the Boost.Coroutine - * library. This function enables programs to implement asynchronous logic in a - * synchronous manner, as illustrated by the following example: - * - * @code boost::asio::spawn(my_strand, do_echo); - * - * // ... - * - * void do_echo(boost::asio::yield_context yield) - * { - * try - * { - * char data[128]; - * for (;;) - * { - * std::size_t length = - * my_socket.async_read_some( - * boost::asio::buffer(data), yield); - * - * boost::asio::async_write(my_socket, - * boost::asio::buffer(data, length), yield); - * } - * } - * catch (std::exception& e) - * { - * // ... - * } - * } @endcode - */ -/*@{*/ - -/// Start a new stackful coroutine, calling the specified handler when it -/// completes. -/** - * This function is used to launch a new coroutine. - * - * @param function The coroutine function. The function must have the signature: - * @code void function(basic_yield_context<Handler> yield); @endcode - * - * @param attributes Boost.Coroutine attributes used to customise the coroutine. - */ -template <typename Function> -void spawn(BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes - = boost::coroutines::attributes()); - -/// Start a new stackful coroutine, calling the specified handler when it -/// completes. -/** - * This function is used to launch a new coroutine. - * - * @param handler A handler to be called when the coroutine exits. More - * importantly, the handler provides an execution context (via the the handler - * invocation hook) for the coroutine. The handler must have the signature: - * @code void handler(); @endcode - * - * @param function The coroutine function. The function must have the signature: - * @code void function(basic_yield_context<Handler> yield); @endcode - * - * @param attributes Boost.Coroutine attributes used to customise the coroutine. - */ -template <typename Handler, typename Function> -void spawn(BOOST_ASIO_MOVE_ARG(Handler) handler, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes - = boost::coroutines::attributes(), - typename enable_if<!is_executor<typename decay<Handler>::type>::value && - !is_convertible<Handler&, execution_context&>::value>::type* = 0); - -/// Start a new stackful coroutine, inheriting the execution context of another. -/** - * This function is used to launch a new coroutine. - * - * @param ctx Identifies the current coroutine as a parent of the new - * coroutine. This specifies that the new coroutine should inherit the - * execution context of the parent. For example, if the parent coroutine is - * executing in a particular strand, then the new coroutine will execute in the - * same strand. - * - * @param function The coroutine function. The function must have the signature: - * @code void function(basic_yield_context<Handler> yield); @endcode - * - * @param attributes Boost.Coroutine attributes used to customise the coroutine. - */ -template <typename Handler, typename Function> -void spawn(basic_yield_context<Handler> ctx, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes - = boost::coroutines::attributes()); - -/// Start a new stackful coroutine that executes on a given executor. -/** - * This function is used to launch a new coroutine. - * - * @param ex Identifies the executor that will run the coroutine. The new - * coroutine is implicitly given its own strand within this executor. - * - * @param function The coroutine function. The function must have the signature: - * @code void function(yield_context yield); @endcode - * - * @param attributes Boost.Coroutine attributes used to customise the coroutine. - */ -template <typename Function, typename Executor> -void spawn(const Executor& ex, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes - = boost::coroutines::attributes(), - typename enable_if<is_executor<Executor>::value>::type* = 0); - -/// Start a new stackful coroutine that executes on a given strand. -/** - * This function is used to launch a new coroutine. - * - * @param ex Identifies the strand that will run the coroutine. - * - * @param function The coroutine function. The function must have the signature: - * @code void function(yield_context yield); @endcode - * - * @param attributes Boost.Coroutine attributes used to customise the coroutine. - */ -template <typename Function, typename Executor> -void spawn(const strand<Executor>& ex, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes - = boost::coroutines::attributes()); - -/// Start a new stackful coroutine that executes in the context of a strand. -/** - * This function is used to launch a new coroutine. - * - * @param s Identifies a strand. By starting multiple coroutines on the same - * strand, the implementation ensures that none of those coroutines can execute - * simultaneously. - * - * @param function The coroutine function. The function must have the signature: - * @code void function(yield_context yield); @endcode - * - * @param attributes Boost.Coroutine attributes used to customise the coroutine. - */ -template <typename Function> -void spawn(const boost::asio::io_context::strand& s, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes - = boost::coroutines::attributes()); - -/// Start a new stackful coroutine that executes on a given execution context. -/** - * This function is used to launch a new coroutine. - * - * @param ctx Identifies the execution context that will run the coroutine. The - * new coroutine is implicitly given its own strand within this execution - * context. - * - * @param function The coroutine function. The function must have the signature: - * @code void function(yield_context yield); @endcode - * - * @param attributes Boost.Coroutine attributes used to customise the coroutine. - */ -template <typename Function, typename ExecutionContext> -void spawn(ExecutionContext& ctx, - BOOST_ASIO_MOVE_ARG(Function) function, - const boost::coroutines::attributes& attributes - = boost::coroutines::attributes(), - typename enable_if<is_convertible< - ExecutionContext&, execution_context&>::value>::type* = 0); - -/*@}*/ - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/spawn.hpp> - -#endif // BOOST_ASIO_SPAWN_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl.hpp b/contrib/restricted/boost/boost/asio/ssl.hpp deleted file mode 100644 index 35138880ae..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// -// ssl.hpp -// ~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_HPP -#define BOOST_ASIO_SSL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/ssl/context.hpp> -#include <boost/asio/ssl/context_base.hpp> -#include <boost/asio/ssl/error.hpp> -#include <boost/asio/ssl/rfc2818_verification.hpp> -#include <boost/asio/ssl/stream.hpp> -#include <boost/asio/ssl/stream_base.hpp> -#include <boost/asio/ssl/verify_context.hpp> -#include <boost/asio/ssl/verify_mode.hpp> - -#endif // BOOST_ASIO_SSL_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/context.hpp b/contrib/restricted/boost/boost/asio/ssl/context.hpp deleted file mode 100644 index 3d0cbfbfbc..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/context.hpp +++ /dev/null @@ -1,760 +0,0 @@ -// -// ssl/context.hpp -// ~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_CONTEXT_HPP -#define BOOST_ASIO_SSL_CONTEXT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <string> -#include <boost/asio/buffer.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/ssl/context_base.hpp> -#include <boost/asio/ssl/detail/openssl_types.hpp> -#include <boost/asio/ssl/detail/openssl_init.hpp> -#include <boost/asio/ssl/detail/password_callback.hpp> -#include <boost/asio/ssl/detail/verify_callback.hpp> -#include <boost/asio/ssl/verify_mode.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -class context - : public context_base, - private noncopyable -{ -public: - /// The native handle type of the SSL context. - typedef SSL_CTX* native_handle_type; - - /// Constructor. - BOOST_ASIO_DECL explicit context(method m); - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a context from another. - /** - * This constructor moves an SSL context from one object to another. - * - * @param other The other context object from which the move will occur. - * - * @note Following the move, the following operations only are valid for the - * moved-from object: - * @li Destruction. - * @li As a target for move-assignment. - */ - BOOST_ASIO_DECL context(context&& other); - - /// Move-assign a context from another. - /** - * This assignment operator moves an SSL context from one object to another. - * - * @param other The other context object from which the move will occur. - * - * @note Following the move, the following operations only are valid for the - * moved-from object: - * @li Destruction. - * @li As a target for move-assignment. - */ - BOOST_ASIO_DECL context& operator=(context&& other); -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destructor. - BOOST_ASIO_DECL ~context(); - - /// Get the underlying implementation in the native type. - /** - * This function may be used to obtain the underlying implementation of the - * context. This is intended to allow access to context functionality that is - * not otherwise provided. - */ - BOOST_ASIO_DECL native_handle_type native_handle(); - - /// Clear options on the context. - /** - * This function may be used to configure the SSL options used by the context. - * - * @param o A bitmask of options. The available option values are defined in - * the context_base class. The specified options, if currently enabled on the - * context, are cleared. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_clear_options. - */ - BOOST_ASIO_DECL void clear_options(options o); - - /// Clear options on the context. - /** - * This function may be used to configure the SSL options used by the context. - * - * @param o A bitmask of options. The available option values are defined in - * the context_base class. The specified options, if currently enabled on the - * context, are cleared. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_clear_options. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID clear_options(options o, - boost::system::error_code& ec); - - /// Set options on the context. - /** - * This function may be used to configure the SSL options used by the context. - * - * @param o A bitmask of options. The available option values are defined in - * the context_base class. The options are bitwise-ored with any existing - * value for the options. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_set_options. - */ - BOOST_ASIO_DECL void set_options(options o); - - /// Set options on the context. - /** - * This function may be used to configure the SSL options used by the context. - * - * @param o A bitmask of options. The available option values are defined in - * the context_base class. The options are bitwise-ored with any existing - * value for the options. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_set_options. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID set_options(options o, - boost::system::error_code& ec); - - /// Set the peer verification mode. - /** - * This function may be used to configure the peer verification mode used by - * the context. - * - * @param v A bitmask of peer verification modes. See @ref verify_mode for - * available values. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_set_verify. - */ - BOOST_ASIO_DECL void set_verify_mode(verify_mode v); - - /// Set the peer verification mode. - /** - * This function may be used to configure the peer verification mode used by - * the context. - * - * @param v A bitmask of peer verification modes. See @ref verify_mode for - * available values. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_set_verify. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID set_verify_mode( - verify_mode v, boost::system::error_code& ec); - - /// Set the peer verification depth. - /** - * This function may be used to configure the maximum verification depth - * allowed by the context. - * - * @param depth Maximum depth for the certificate chain verification that - * shall be allowed. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_set_verify_depth. - */ - BOOST_ASIO_DECL void set_verify_depth(int depth); - - /// Set the peer verification depth. - /** - * This function may be used to configure the maximum verification depth - * allowed by the context. - * - * @param depth Maximum depth for the certificate chain verification that - * shall be allowed. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_set_verify_depth. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID set_verify_depth( - int depth, boost::system::error_code& ec); - - /// Set the callback used to verify peer certificates. - /** - * This function is used to specify a callback function that will be called - * by the implementation when it needs to verify a peer certificate. - * - * @param callback The function object to be used for verifying a certificate. - * The function signature of the handler must be: - * @code bool verify_callback( - * bool preverified, // True if the certificate passed pre-verification. - * verify_context& ctx // The peer certificate and other context. - * ); @endcode - * The return value of the callback is true if the certificate has passed - * verification, false otherwise. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_set_verify. - */ - template <typename VerifyCallback> - void set_verify_callback(VerifyCallback callback); - - /// Set the callback used to verify peer certificates. - /** - * This function is used to specify a callback function that will be called - * by the implementation when it needs to verify a peer certificate. - * - * @param callback The function object to be used for verifying a certificate. - * The function signature of the handler must be: - * @code bool verify_callback( - * bool preverified, // True if the certificate passed pre-verification. - * verify_context& ctx // The peer certificate and other context. - * ); @endcode - * The return value of the callback is true if the certificate has passed - * verification, false otherwise. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_set_verify. - */ - template <typename VerifyCallback> - BOOST_ASIO_SYNC_OP_VOID set_verify_callback(VerifyCallback callback, - boost::system::error_code& ec); - - /// Load a certification authority file for performing verification. - /** - * This function is used to load one or more trusted certification authorities - * from a file. - * - * @param filename The name of a file containing certification authority - * certificates in PEM format. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_load_verify_locations. - */ - BOOST_ASIO_DECL void load_verify_file(const std::string& filename); - - /// Load a certification authority file for performing verification. - /** - * This function is used to load the certificates for one or more trusted - * certification authorities from a file. - * - * @param filename The name of a file containing certification authority - * certificates in PEM format. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_load_verify_locations. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID load_verify_file( - const std::string& filename, boost::system::error_code& ec); - - /// Add certification authority for performing verification. - /** - * This function is used to add one trusted certification authority - * from a memory buffer. - * - * @param ca The buffer containing the certification authority certificate. - * The certificate must use the PEM format. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_get_cert_store and @c X509_STORE_add_cert. - */ - BOOST_ASIO_DECL void add_certificate_authority(const const_buffer& ca); - - /// Add certification authority for performing verification. - /** - * This function is used to add one trusted certification authority - * from a memory buffer. - * - * @param ca The buffer containing the certification authority certificate. - * The certificate must use the PEM format. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_get_cert_store and @c X509_STORE_add_cert. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID add_certificate_authority( - const const_buffer& ca, boost::system::error_code& ec); - - /// Configures the context to use the default directories for finding - /// certification authority certificates. - /** - * This function specifies that the context should use the default, - * system-dependent directories for locating certification authority - * certificates. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_set_default_verify_paths. - */ - BOOST_ASIO_DECL void set_default_verify_paths(); - - /// Configures the context to use the default directories for finding - /// certification authority certificates. - /** - * This function specifies that the context should use the default, - * system-dependent directories for locating certification authority - * certificates. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_set_default_verify_paths. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID set_default_verify_paths( - boost::system::error_code& ec); - - /// Add a directory containing certificate authority files to be used for - /// performing verification. - /** - * This function is used to specify the name of a directory containing - * certification authority certificates. Each file in the directory must - * contain a single certificate. The files must be named using the subject - * name's hash and an extension of ".0". - * - * @param path The name of a directory containing the certificates. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_load_verify_locations. - */ - BOOST_ASIO_DECL void add_verify_path(const std::string& path); - - /// Add a directory containing certificate authority files to be used for - /// performing verification. - /** - * This function is used to specify the name of a directory containing - * certification authority certificates. Each file in the directory must - * contain a single certificate. The files must be named using the subject - * name's hash and an extension of ".0". - * - * @param path The name of a directory containing the certificates. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_load_verify_locations. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID add_verify_path( - const std::string& path, boost::system::error_code& ec); - - /// Use a certificate from a memory buffer. - /** - * This function is used to load a certificate into the context from a buffer. - * - * @param certificate The buffer containing the certificate. - * - * @param format The certificate format (ASN.1 or PEM). - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_use_certificate or SSL_CTX_use_certificate_ASN1. - */ - BOOST_ASIO_DECL void use_certificate( - const const_buffer& certificate, file_format format); - - /// Use a certificate from a memory buffer. - /** - * This function is used to load a certificate into the context from a buffer. - * - * @param certificate The buffer containing the certificate. - * - * @param format The certificate format (ASN.1 or PEM). - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_use_certificate or SSL_CTX_use_certificate_ASN1. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_certificate( - const const_buffer& certificate, file_format format, - boost::system::error_code& ec); - - /// Use a certificate from a file. - /** - * This function is used to load a certificate into the context from a file. - * - * @param filename The name of the file containing the certificate. - * - * @param format The file format (ASN.1 or PEM). - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_use_certificate_file. - */ - BOOST_ASIO_DECL void use_certificate_file( - const std::string& filename, file_format format); - - /// Use a certificate from a file. - /** - * This function is used to load a certificate into the context from a file. - * - * @param filename The name of the file containing the certificate. - * - * @param format The file format (ASN.1 or PEM). - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_use_certificate_file. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_certificate_file( - const std::string& filename, file_format format, - boost::system::error_code& ec); - - /// Use a certificate chain from a memory buffer. - /** - * This function is used to load a certificate chain into the context from a - * buffer. - * - * @param chain The buffer containing the certificate chain. The certificate - * chain must use the PEM format. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_use_certificate and SSL_CTX_add_extra_chain_cert. - */ - BOOST_ASIO_DECL void use_certificate_chain(const const_buffer& chain); - - /// Use a certificate chain from a memory buffer. - /** - * This function is used to load a certificate chain into the context from a - * buffer. - * - * @param chain The buffer containing the certificate chain. The certificate - * chain must use the PEM format. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_use_certificate and SSL_CTX_add_extra_chain_cert. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_certificate_chain( - const const_buffer& chain, boost::system::error_code& ec); - - /// Use a certificate chain from a file. - /** - * This function is used to load a certificate chain into the context from a - * file. - * - * @param filename The name of the file containing the certificate. The file - * must use the PEM format. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_use_certificate_chain_file. - */ - BOOST_ASIO_DECL void use_certificate_chain_file(const std::string& filename); - - /// Use a certificate chain from a file. - /** - * This function is used to load a certificate chain into the context from a - * file. - * - * @param filename The name of the file containing the certificate. The file - * must use the PEM format. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_use_certificate_chain_file. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_certificate_chain_file( - const std::string& filename, boost::system::error_code& ec); - - /// Use a private key from a memory buffer. - /** - * This function is used to load a private key into the context from a buffer. - * - * @param private_key The buffer containing the private key. - * - * @param format The private key format (ASN.1 or PEM). - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_use_PrivateKey or SSL_CTX_use_PrivateKey_ASN1. - */ - BOOST_ASIO_DECL void use_private_key( - const const_buffer& private_key, file_format format); - - /// Use a private key from a memory buffer. - /** - * This function is used to load a private key into the context from a buffer. - * - * @param private_key The buffer containing the private key. - * - * @param format The private key format (ASN.1 or PEM). - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_use_PrivateKey or SSL_CTX_use_PrivateKey_ASN1. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_private_key( - const const_buffer& private_key, file_format format, - boost::system::error_code& ec); - - /// Use a private key from a file. - /** - * This function is used to load a private key into the context from a file. - * - * @param filename The name of the file containing the private key. - * - * @param format The file format (ASN.1 or PEM). - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_use_PrivateKey_file. - */ - BOOST_ASIO_DECL void use_private_key_file( - const std::string& filename, file_format format); - - /// Use a private key from a file. - /** - * This function is used to load a private key into the context from a file. - * - * @param filename The name of the file containing the private key. - * - * @param format The file format (ASN.1 or PEM). - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_use_PrivateKey_file. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_private_key_file( - const std::string& filename, file_format format, - boost::system::error_code& ec); - - /// Use an RSA private key from a memory buffer. - /** - * This function is used to load an RSA private key into the context from a - * buffer. - * - * @param private_key The buffer containing the RSA private key. - * - * @param format The private key format (ASN.1 or PEM). - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_use_RSAPrivateKey or SSL_CTX_use_RSAPrivateKey_ASN1. - */ - BOOST_ASIO_DECL void use_rsa_private_key( - const const_buffer& private_key, file_format format); - - /// Use an RSA private key from a memory buffer. - /** - * This function is used to load an RSA private key into the context from a - * buffer. - * - * @param private_key The buffer containing the RSA private key. - * - * @param format The private key format (ASN.1 or PEM). - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_use_RSAPrivateKey or SSL_CTX_use_RSAPrivateKey_ASN1. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_rsa_private_key( - const const_buffer& private_key, file_format format, - boost::system::error_code& ec); - - /// Use an RSA private key from a file. - /** - * This function is used to load an RSA private key into the context from a - * file. - * - * @param filename The name of the file containing the RSA private key. - * - * @param format The file format (ASN.1 or PEM). - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_use_RSAPrivateKey_file. - */ - BOOST_ASIO_DECL void use_rsa_private_key_file( - const std::string& filename, file_format format); - - /// Use an RSA private key from a file. - /** - * This function is used to load an RSA private key into the context from a - * file. - * - * @param filename The name of the file containing the RSA private key. - * - * @param format The file format (ASN.1 or PEM). - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_use_RSAPrivateKey_file. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_rsa_private_key_file( - const std::string& filename, file_format format, - boost::system::error_code& ec); - - /// Use the specified memory buffer to obtain the temporary Diffie-Hellman - /// parameters. - /** - * This function is used to load Diffie-Hellman parameters into the context - * from a buffer. - * - * @param dh The memory buffer containing the Diffie-Hellman parameters. The - * buffer must use the PEM format. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_set_tmp_dh. - */ - BOOST_ASIO_DECL void use_tmp_dh(const const_buffer& dh); - - /// Use the specified memory buffer to obtain the temporary Diffie-Hellman - /// parameters. - /** - * This function is used to load Diffie-Hellman parameters into the context - * from a buffer. - * - * @param dh The memory buffer containing the Diffie-Hellman parameters. The - * buffer must use the PEM format. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_set_tmp_dh. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_tmp_dh( - const const_buffer& dh, boost::system::error_code& ec); - - /// Use the specified file to obtain the temporary Diffie-Hellman parameters. - /** - * This function is used to load Diffie-Hellman parameters into the context - * from a file. - * - * @param filename The name of the file containing the Diffie-Hellman - * parameters. The file must use the PEM format. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_set_tmp_dh. - */ - BOOST_ASIO_DECL void use_tmp_dh_file(const std::string& filename); - - /// Use the specified file to obtain the temporary Diffie-Hellman parameters. - /** - * This function is used to load Diffie-Hellman parameters into the context - * from a file. - * - * @param filename The name of the file containing the Diffie-Hellman - * parameters. The file must use the PEM format. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_set_tmp_dh. - */ - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_tmp_dh_file( - const std::string& filename, boost::system::error_code& ec); - - /// Set the password callback. - /** - * This function is used to specify a callback function to obtain password - * information about an encrypted key in PEM format. - * - * @param callback The function object to be used for obtaining the password. - * The function signature of the handler must be: - * @code std::string password_callback( - * std::size_t max_length, // The maximum size for a password. - * password_purpose purpose // Whether password is for reading or writing. - * ); @endcode - * The return value of the callback is a string containing the password. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_CTX_set_default_passwd_cb. - */ - template <typename PasswordCallback> - void set_password_callback(PasswordCallback callback); - - /// Set the password callback. - /** - * This function is used to specify a callback function to obtain password - * information about an encrypted key in PEM format. - * - * @param callback The function object to be used for obtaining the password. - * The function signature of the handler must be: - * @code std::string password_callback( - * std::size_t max_length, // The maximum size for a password. - * password_purpose purpose // Whether password is for reading or writing. - * ); @endcode - * The return value of the callback is a string containing the password. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_CTX_set_default_passwd_cb. - */ - template <typename PasswordCallback> - BOOST_ASIO_SYNC_OP_VOID set_password_callback(PasswordCallback callback, - boost::system::error_code& ec); - -private: - struct bio_cleanup; - struct x509_cleanup; - struct evp_pkey_cleanup; - struct rsa_cleanup; - struct dh_cleanup; - - // Helper function used to set a peer certificate verification callback. - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID do_set_verify_callback( - detail::verify_callback_base* callback, boost::system::error_code& ec); - - // Callback used when the SSL implementation wants to verify a certificate. - BOOST_ASIO_DECL static int verify_callback_function( - int preverified, X509_STORE_CTX* ctx); - - // Helper function used to set a password callback. - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID do_set_password_callback( - detail::password_callback_base* callback, boost::system::error_code& ec); - - // Callback used when the SSL implementation wants a password. - BOOST_ASIO_DECL static int password_callback_function( - char* buf, int size, int purpose, void* data); - - // Helper function to set the temporary Diffie-Hellman parameters from a BIO. - BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID do_use_tmp_dh( - BIO* bio, boost::system::error_code& ec); - - // Helper function to make a BIO from a memory buffer. - BOOST_ASIO_DECL BIO* make_buffer_bio(const const_buffer& b); - - // The underlying native implementation. - native_handle_type handle_; - - // Ensure openssl is initialised. - boost::asio::ssl::detail::openssl_init<> init_; -}; - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/ssl/impl/context.hpp> -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/ssl/impl/context.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_SSL_CONTEXT_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/context_base.hpp b/contrib/restricted/boost/boost/asio/ssl/context_base.hpp deleted file mode 100644 index 8671ee676a..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/context_base.hpp +++ /dev/null @@ -1,194 +0,0 @@ -// -// ssl/context_base.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_CONTEXT_BASE_HPP -#define BOOST_ASIO_SSL_CONTEXT_BASE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/ssl/detail/openssl_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -/// The context_base class is used as a base for the basic_context class -/// template so that we have a common place to define various enums. -class context_base -{ -public: - /// Different methods supported by a context. - enum method - { - /// Generic SSL version 2. - sslv2, - - /// SSL version 2 client. - sslv2_client, - - /// SSL version 2 server. - sslv2_server, - - /// Generic SSL version 3. - sslv3, - - /// SSL version 3 client. - sslv3_client, - - /// SSL version 3 server. - sslv3_server, - - /// Generic TLS version 1. - tlsv1, - - /// TLS version 1 client. - tlsv1_client, - - /// TLS version 1 server. - tlsv1_server, - - /// Generic SSL/TLS. - sslv23, - - /// SSL/TLS client. - sslv23_client, - - /// SSL/TLS server. - sslv23_server, - - /// Generic TLS version 1.1. - tlsv11, - - /// TLS version 1.1 client. - tlsv11_client, - - /// TLS version 1.1 server. - tlsv11_server, - - /// Generic TLS version 1.2. - tlsv12, - - /// TLS version 1.2 client. - tlsv12_client, - - /// TLS version 1.2 server. - tlsv12_server, - - /// Generic TLS. - tls, - - /// TLS client. - tls_client, - - /// TLS server. - tls_server - }; - - /// Bitmask type for SSL options. - typedef long options; - -#if defined(GENERATING_DOCUMENTATION) - /// Implement various bug workarounds. - static const long default_workarounds = implementation_defined; - - /// Always create a new key when using tmp_dh parameters. - static const long single_dh_use = implementation_defined; - - /// Disable SSL v2. - static const long no_sslv2 = implementation_defined; - - /// Disable SSL v3. - static const long no_sslv3 = implementation_defined; - - /// Disable TLS v1. - static const long no_tlsv1 = implementation_defined; - - /// Disable TLS v1.1. - static const long no_tlsv1_1 = implementation_defined; - - /// Disable TLS v1.2. - static const long no_tlsv1_2 = implementation_defined; - - /// Disable compression. Compression is disabled by default. - static const long no_compression = implementation_defined; -#else - BOOST_ASIO_STATIC_CONSTANT(long, default_workarounds = SSL_OP_ALL); - BOOST_ASIO_STATIC_CONSTANT(long, single_dh_use = SSL_OP_SINGLE_DH_USE); - BOOST_ASIO_STATIC_CONSTANT(long, no_sslv2 = SSL_OP_NO_SSLv2); - BOOST_ASIO_STATIC_CONSTANT(long, no_sslv3 = SSL_OP_NO_SSLv3); - BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1 = SSL_OP_NO_TLSv1); -# if defined(SSL_OP_NO_TLSv1_1) - BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_1 = SSL_OP_NO_TLSv1_1); -# else // defined(SSL_OP_NO_TLSv1_1) - BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_1 = 0x10000000L); -# endif // defined(SSL_OP_NO_TLSv1_1) -# if defined(SSL_OP_NO_TLSv1_2) - BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = SSL_OP_NO_TLSv1_2); -# else // defined(SSL_OP_NO_TLSv1_2) - BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = 0x08000000L); -# endif // defined(SSL_OP_NO_TLSv1_2) -# if defined(SSL_OP_NO_COMPRESSION) - BOOST_ASIO_STATIC_CONSTANT(long, no_compression = SSL_OP_NO_COMPRESSION); -# else // defined(SSL_OP_NO_COMPRESSION) - BOOST_ASIO_STATIC_CONSTANT(long, no_compression = 0x20000L); -# endif // defined(SSL_OP_NO_COMPRESSION) -#endif - - /// File format types. - enum file_format - { - /// ASN.1 file. - asn1, - - /// PEM file. - pem - }; - -#if !defined(GENERATING_DOCUMENTATION) - // The following types and constants are preserved for backward compatibility. - // New programs should use the equivalents of the same names that are defined - // in the boost::asio::ssl namespace. - typedef int verify_mode; - BOOST_ASIO_STATIC_CONSTANT(int, verify_none = SSL_VERIFY_NONE); - BOOST_ASIO_STATIC_CONSTANT(int, verify_peer = SSL_VERIFY_PEER); - BOOST_ASIO_STATIC_CONSTANT(int, - verify_fail_if_no_peer_cert = SSL_VERIFY_FAIL_IF_NO_PEER_CERT); - BOOST_ASIO_STATIC_CONSTANT(int, verify_client_once = SSL_VERIFY_CLIENT_ONCE); -#endif - - /// Purpose of PEM password. - enum password_purpose - { - /// The password is needed for reading/decryption. - for_reading, - - /// The password is needed for writing/encryption. - for_writing - }; - -protected: - /// Protected destructor to prevent deletion through this type. - ~context_base() - { - } -}; - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_CONTEXT_BASE_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/buffered_handshake_op.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/buffered_handshake_op.hpp deleted file mode 100644 index a8963ec590..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/buffered_handshake_op.hpp +++ /dev/null @@ -1,116 +0,0 @@ -// -// ssl/detail/buffered_handshake_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_BUFFERED_HANDSHAKE_OP_HPP -#define BOOST_ASIO_SSL_DETAIL_BUFFERED_HANDSHAKE_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/ssl/detail/engine.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -template <typename ConstBufferSequence> -class buffered_handshake_op -{ -public: - buffered_handshake_op(stream_base::handshake_type type, - const ConstBufferSequence& buffers) - : type_(type), - buffers_(buffers), - total_buffer_size_(boost::asio::buffer_size(buffers_)) - { - } - - engine::want operator()(engine& eng, - boost::system::error_code& ec, - std::size_t& bytes_transferred) const - { - return this->process(eng, ec, bytes_transferred, - boost::asio::buffer_sequence_begin(buffers_), - boost::asio::buffer_sequence_end(buffers_)); - } - - template <typename Handler> - void call_handler(Handler& handler, - const boost::system::error_code& ec, - const std::size_t& bytes_transferred) const - { - handler(ec, bytes_transferred); - } - -private: - template <typename Iterator> - engine::want process(engine& eng, - boost::system::error_code& ec, - std::size_t& bytes_transferred, - Iterator begin, Iterator end) const - { - Iterator iter = begin; - std::size_t accumulated_size = 0; - - for (;;) - { - engine::want want = eng.handshake(type_, ec); - if (want != engine::want_input_and_retry - || bytes_transferred == total_buffer_size_) - return want; - - // Find the next buffer piece to be fed to the engine. - while (iter != end) - { - const_buffer buffer(*iter); - - // Skip over any buffers which have already been consumed by the engine. - if (bytes_transferred >= accumulated_size + buffer.size()) - { - accumulated_size += buffer.size(); - ++iter; - continue; - } - - // The current buffer may have been partially consumed by the engine on - // a previous iteration. If so, adjust the buffer to point to the - // unused portion. - if (bytes_transferred > accumulated_size) - buffer = buffer + (bytes_transferred - accumulated_size); - - // Pass the buffer to the engine, and update the bytes transferred to - // reflect the total number of bytes consumed so far. - bytes_transferred += buffer.size(); - buffer = eng.put_input(buffer); - bytes_transferred -= buffer.size(); - break; - } - } - } - - stream_base::handshake_type type_; - ConstBufferSequence buffers_; - std::size_t total_buffer_size_; -}; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_BUFFERED_HANDSHAKE_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/engine.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/engine.hpp deleted file mode 100644 index 01717e789e..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/engine.hpp +++ /dev/null @@ -1,162 +0,0 @@ -// -// ssl/detail/engine.hpp -// ~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_ENGINE_HPP -#define BOOST_ASIO_SSL_DETAIL_ENGINE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/buffer.hpp> -#include <boost/asio/detail/static_mutex.hpp> -#include <boost/asio/ssl/detail/openssl_types.hpp> -#include <boost/asio/ssl/detail/verify_callback.hpp> -#include <boost/asio/ssl/stream_base.hpp> -#include <boost/asio/ssl/verify_mode.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -class engine -{ -public: - enum want - { - // Returned by functions to indicate that the engine wants input. The input - // buffer should be updated to point to the data. The engine then needs to - // be called again to retry the operation. - want_input_and_retry = -2, - - // Returned by functions to indicate that the engine wants to write output. - // The output buffer points to the data to be written. The engine then - // needs to be called again to retry the operation. - want_output_and_retry = -1, - - // Returned by functions to indicate that the engine doesn't need input or - // output. - want_nothing = 0, - - // Returned by functions to indicate that the engine wants to write output. - // The output buffer points to the data to be written. After that the - // operation is complete, and the engine does not need to be called again. - want_output = 1 - }; - - // Construct a new engine for the specified context. - BOOST_ASIO_DECL explicit engine(SSL_CTX* context); - - // Destructor. - BOOST_ASIO_DECL ~engine(); - - // Get the underlying implementation in the native type. - BOOST_ASIO_DECL SSL* native_handle(); - - // Set the peer verification mode. - BOOST_ASIO_DECL boost::system::error_code set_verify_mode( - verify_mode v, boost::system::error_code& ec); - - // Set the peer verification depth. - BOOST_ASIO_DECL boost::system::error_code set_verify_depth( - int depth, boost::system::error_code& ec); - - // Set a peer certificate verification callback. - BOOST_ASIO_DECL boost::system::error_code set_verify_callback( - verify_callback_base* callback, boost::system::error_code& ec); - - // Perform an SSL handshake using either SSL_connect (client-side) or - // SSL_accept (server-side). - BOOST_ASIO_DECL want handshake( - stream_base::handshake_type type, boost::system::error_code& ec); - - // Perform a graceful shutdown of the SSL session. - BOOST_ASIO_DECL want shutdown(boost::system::error_code& ec); - - // Write bytes to the SSL session. - BOOST_ASIO_DECL want write(const boost::asio::const_buffer& data, - boost::system::error_code& ec, std::size_t& bytes_transferred); - - // Read bytes from the SSL session. - BOOST_ASIO_DECL want read(const boost::asio::mutable_buffer& data, - boost::system::error_code& ec, std::size_t& bytes_transferred); - - // Get output data to be written to the transport. - BOOST_ASIO_DECL boost::asio::mutable_buffer get_output( - const boost::asio::mutable_buffer& data); - - // Put input data that was read from the transport. - BOOST_ASIO_DECL boost::asio::const_buffer put_input( - const boost::asio::const_buffer& data); - - // Map an error::eof code returned by the underlying transport according to - // the type and state of the SSL session. Returns a const reference to the - // error code object, suitable for passing to a completion handler. - BOOST_ASIO_DECL const boost::system::error_code& map_error_code( - boost::system::error_code& ec) const; - -private: - // Disallow copying and assignment. - engine(const engine&); - engine& operator=(const engine&); - - // Callback used when the SSL implementation wants to verify a certificate. - BOOST_ASIO_DECL static int verify_callback_function( - int preverified, X509_STORE_CTX* ctx); - -#if (OPENSSL_VERSION_NUMBER < 0x10000000L) - // The SSL_accept function may not be thread safe. This mutex is used to - // protect all calls to the SSL_accept function. - BOOST_ASIO_DECL static boost::asio::detail::static_mutex& accept_mutex(); -#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) - - // Perform one operation. Returns >= 0 on success or error, want_read if the - // operation needs more input, or want_write if it needs to write some output - // before the operation can complete. - BOOST_ASIO_DECL want perform(int (engine::* op)(void*, std::size_t), - void* data, std::size_t length, boost::system::error_code& ec, - std::size_t* bytes_transferred); - - // Adapt the SSL_accept function to the signature needed for perform(). - BOOST_ASIO_DECL int do_accept(void*, std::size_t); - - // Adapt the SSL_connect function to the signature needed for perform(). - BOOST_ASIO_DECL int do_connect(void*, std::size_t); - - // Adapt the SSL_shutdown function to the signature needed for perform(). - BOOST_ASIO_DECL int do_shutdown(void*, std::size_t); - - // Adapt the SSL_read function to the signature needed for perform(). - BOOST_ASIO_DECL int do_read(void* data, std::size_t length); - - // Adapt the SSL_write function to the signature needed for perform(). - BOOST_ASIO_DECL int do_write(void* data, std::size_t length); - - SSL* ssl_; - BIO* ext_bio_; -}; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/ssl/detail/impl/engine.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_SSL_DETAIL_ENGINE_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/handshake_op.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/handshake_op.hpp deleted file mode 100644 index edb112eee2..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/handshake_op.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// -// ssl/detail/handshake_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP -#define BOOST_ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/ssl/detail/engine.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -class handshake_op -{ -public: - handshake_op(stream_base::handshake_type type) - : type_(type) - { - } - - engine::want operator()(engine& eng, - boost::system::error_code& ec, - std::size_t& bytes_transferred) const - { - bytes_transferred = 0; - return eng.handshake(type_, ec); - } - - template <typename Handler> - void call_handler(Handler& handler, - const boost::system::error_code& ec, - const std::size_t&) const - { - handler(ec); - } - -private: - stream_base::handshake_type type_; -}; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/impl/engine.ipp b/contrib/restricted/boost/boost/asio/ssl/detail/impl/engine.ipp deleted file mode 100644 index 9142a5df3a..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/impl/engine.ipp +++ /dev/null @@ -1,324 +0,0 @@ -// -// ssl/detail/impl/engine.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_IMPL_ENGINE_IPP -#define BOOST_ASIO_SSL_DETAIL_IMPL_ENGINE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/ssl/detail/engine.hpp> -#include <boost/asio/ssl/error.hpp> -#include <boost/asio/ssl/verify_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -engine::engine(SSL_CTX* context) - : ssl_(::SSL_new(context)) -{ - if (!ssl_) - { - boost::system::error_code ec( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - boost::asio::detail::throw_error(ec, "engine"); - } - -#if (OPENSSL_VERSION_NUMBER < 0x10000000L) - accept_mutex().init(); -#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) - - ::SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE); - ::SSL_set_mode(ssl_, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); -#if defined(SSL_MODE_RELEASE_BUFFERS) - ::SSL_set_mode(ssl_, SSL_MODE_RELEASE_BUFFERS); -#endif // defined(SSL_MODE_RELEASE_BUFFERS) - - ::BIO* int_bio = 0; - ::BIO_new_bio_pair(&int_bio, 0, &ext_bio_, 0); - ::SSL_set_bio(ssl_, int_bio, int_bio); -} - -engine::~engine() -{ - if (SSL_get_app_data(ssl_)) - { - delete static_cast<verify_callback_base*>(SSL_get_app_data(ssl_)); - SSL_set_app_data(ssl_, 0); - } - - ::BIO_free(ext_bio_); - ::SSL_free(ssl_); -} - -SSL* engine::native_handle() -{ - return ssl_; -} - -boost::system::error_code engine::set_verify_mode( - verify_mode v, boost::system::error_code& ec) -{ - ::SSL_set_verify(ssl_, v, ::SSL_get_verify_callback(ssl_)); - - ec = boost::system::error_code(); - return ec; -} - -boost::system::error_code engine::set_verify_depth( - int depth, boost::system::error_code& ec) -{ - ::SSL_set_verify_depth(ssl_, depth); - - ec = boost::system::error_code(); - return ec; -} - -boost::system::error_code engine::set_verify_callback( - verify_callback_base* callback, boost::system::error_code& ec) -{ - if (SSL_get_app_data(ssl_)) - delete static_cast<verify_callback_base*>(SSL_get_app_data(ssl_)); - - SSL_set_app_data(ssl_, callback); - - ::SSL_set_verify(ssl_, ::SSL_get_verify_mode(ssl_), - &engine::verify_callback_function); - - ec = boost::system::error_code(); - return ec; -} - -int engine::verify_callback_function(int preverified, X509_STORE_CTX* ctx) -{ - if (ctx) - { - if (SSL* ssl = static_cast<SSL*>( - ::X509_STORE_CTX_get_ex_data( - ctx, ::SSL_get_ex_data_X509_STORE_CTX_idx()))) - { - if (SSL_get_app_data(ssl)) - { - verify_callback_base* callback = - static_cast<verify_callback_base*>( - SSL_get_app_data(ssl)); - - verify_context verify_ctx(ctx); - return callback->call(preverified != 0, verify_ctx) ? 1 : 0; - } - } - } - - return 0; -} - -engine::want engine::handshake( - stream_base::handshake_type type, boost::system::error_code& ec) -{ - return perform((type == boost::asio::ssl::stream_base::client) - ? &engine::do_connect : &engine::do_accept, 0, 0, ec, 0); -} - -engine::want engine::shutdown(boost::system::error_code& ec) -{ - return perform(&engine::do_shutdown, 0, 0, ec, 0); -} - -engine::want engine::write(const boost::asio::const_buffer& data, - boost::system::error_code& ec, std::size_t& bytes_transferred) -{ - if (data.size() == 0) - { - ec = boost::system::error_code(); - return engine::want_nothing; - } - - return perform(&engine::do_write, - const_cast<void*>(data.data()), - data.size(), ec, &bytes_transferred); -} - -engine::want engine::read(const boost::asio::mutable_buffer& data, - boost::system::error_code& ec, std::size_t& bytes_transferred) -{ - if (data.size() == 0) - { - ec = boost::system::error_code(); - return engine::want_nothing; - } - - return perform(&engine::do_read, data.data(), - data.size(), ec, &bytes_transferred); -} - -boost::asio::mutable_buffer engine::get_output( - const boost::asio::mutable_buffer& data) -{ - int length = ::BIO_read(ext_bio_, - data.data(), static_cast<int>(data.size())); - - return boost::asio::buffer(data, - length > 0 ? static_cast<std::size_t>(length) : 0); -} - -boost::asio::const_buffer engine::put_input( - const boost::asio::const_buffer& data) -{ - int length = ::BIO_write(ext_bio_, - data.data(), static_cast<int>(data.size())); - - return boost::asio::buffer(data + - (length > 0 ? static_cast<std::size_t>(length) : 0)); -} - -const boost::system::error_code& engine::map_error_code( - boost::system::error_code& ec) const -{ - // We only want to map the error::eof code. - if (ec != boost::asio::error::eof) - return ec; - - // If there's data yet to be read, it's an error. - if (BIO_wpending(ext_bio_)) - { - ec = boost::asio::ssl::error::stream_truncated; - return ec; - } - - // SSL v2 doesn't provide a protocol-level shutdown, so an eof on the - // underlying transport is passed through. -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - if (SSL_version(ssl_) == SSL2_VERSION) - return ec; -#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L) - - // Otherwise, the peer should have negotiated a proper shutdown. - if ((::SSL_get_shutdown(ssl_) & SSL_RECEIVED_SHUTDOWN) == 0) - { - ec = boost::asio::ssl::error::stream_truncated; - } - - return ec; -} - -#if (OPENSSL_VERSION_NUMBER < 0x10000000L) -boost::asio::detail::static_mutex& engine::accept_mutex() -{ - static boost::asio::detail::static_mutex mutex = BOOST_ASIO_STATIC_MUTEX_INIT; - return mutex; -} -#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) - -engine::want engine::perform(int (engine::* op)(void*, std::size_t), - void* data, std::size_t length, boost::system::error_code& ec, - std::size_t* bytes_transferred) -{ - std::size_t pending_output_before = ::BIO_ctrl_pending(ext_bio_); - ::ERR_clear_error(); - int result = (this->*op)(data, length); - int ssl_error = ::SSL_get_error(ssl_, result); - int sys_error = static_cast<int>(::ERR_get_error()); - std::size_t pending_output_after = ::BIO_ctrl_pending(ext_bio_); - - if (ssl_error == SSL_ERROR_SSL) - { - ec = boost::system::error_code(sys_error, - boost::asio::error::get_ssl_category()); - return want_nothing; - } - - if (ssl_error == SSL_ERROR_SYSCALL) - { - ec = boost::system::error_code(sys_error, - boost::asio::error::get_system_category()); - return want_nothing; - } - - if (result > 0 && bytes_transferred) - *bytes_transferred = static_cast<std::size_t>(result); - - if (ssl_error == SSL_ERROR_WANT_WRITE) - { - ec = boost::system::error_code(); - return want_output_and_retry; - } - else if (pending_output_after > pending_output_before) - { - ec = boost::system::error_code(); - return result > 0 ? want_output : want_output_and_retry; - } - else if (ssl_error == SSL_ERROR_WANT_READ) - { - ec = boost::system::error_code(); - return want_input_and_retry; - } - else if (::SSL_get_shutdown(ssl_) & SSL_RECEIVED_SHUTDOWN) - { - ec = boost::asio::error::eof; - return want_nothing; - } - else - { - ec = boost::system::error_code(); - return want_nothing; - } -} - -int engine::do_accept(void*, std::size_t) -{ -#if (OPENSSL_VERSION_NUMBER < 0x10000000L) - boost::asio::detail::static_mutex::scoped_lock lock(accept_mutex()); -#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) - return ::SSL_accept(ssl_); -} - -int engine::do_connect(void*, std::size_t) -{ - return ::SSL_connect(ssl_); -} - -int engine::do_shutdown(void*, std::size_t) -{ - int result = ::SSL_shutdown(ssl_); - if (result == 0) - result = ::SSL_shutdown(ssl_); - return result; -} - -int engine::do_read(void* data, std::size_t length) -{ - return ::SSL_read(ssl_, data, - length < INT_MAX ? static_cast<int>(length) : INT_MAX); -} - -int engine::do_write(void* data, std::size_t length) -{ - return ::SSL_write(ssl_, data, - length < INT_MAX ? static_cast<int>(length) : INT_MAX); -} - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_IMPL_ENGINE_IPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/impl/openssl_init.ipp b/contrib/restricted/boost/boost/asio/ssl/detail/impl/openssl_init.ipp deleted file mode 100644 index 1608138e9d..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/impl/openssl_init.ipp +++ /dev/null @@ -1,167 +0,0 @@ -// -// ssl/detail/impl/openssl_init.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_IMPL_OPENSSL_INIT_IPP -#define BOOST_ASIO_SSL_DETAIL_IMPL_OPENSSL_INIT_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <vector> -#include <boost/asio/detail/assert.hpp> -#include <boost/asio/detail/mutex.hpp> -#include <boost/asio/detail/tss_ptr.hpp> -#include <boost/asio/ssl/detail/openssl_init.hpp> -#include <boost/asio/ssl/detail/openssl_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -class openssl_init_base::do_init -{ -public: - do_init() - { -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - ::SSL_library_init(); - ::SSL_load_error_strings(); - ::OpenSSL_add_all_algorithms(); - - mutexes_.resize(::CRYPTO_num_locks()); - for (size_t i = 0; i < mutexes_.size(); ++i) - mutexes_[i].reset(new boost::asio::detail::mutex); - ::CRYPTO_set_locking_callback(&do_init::openssl_locking_func); -#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L) -#if (OPENSSL_VERSION_NUMBER < 0x10000000L) - ::CRYPTO_set_id_callback(&do_init::openssl_id_func); -#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) - -#if !defined(SSL_OP_NO_COMPRESSION) \ - && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - null_compression_methods_ = sk_SSL_COMP_new_null(); -#endif // !defined(SSL_OP_NO_COMPRESSION) - // && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - } - - ~do_init() - { -#if !defined(SSL_OP_NO_COMPRESSION) \ - && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - sk_SSL_COMP_free(null_compression_methods_); -#endif // !defined(SSL_OP_NO_COMPRESSION) - // && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - -#if (OPENSSL_VERSION_NUMBER < 0x10000000L) - ::CRYPTO_set_id_callback(0); -#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - ::CRYPTO_set_locking_callback(0); - ::ERR_free_strings(); - ::EVP_cleanup(); - ::CRYPTO_cleanup_all_ex_data(); -#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L) -#if (OPENSSL_VERSION_NUMBER < 0x10000000L) - ::ERR_remove_state(0); -#elif (OPENSSL_VERSION_NUMBER < 0x10100000L) - ::ERR_remove_thread_state(NULL); -#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) -#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) \ - && (OPENSSL_VERSION_NUMBER < 0x10100000L) \ - && !defined(SSL_OP_NO_COMPRESSION) - ::SSL_COMP_free_compression_methods(); -#endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L) - // && (OPENSSL_VERSION_NUMBER < 0x10100000L) - // && !defined(SSL_OP_NO_COMPRESSION) -#if !defined(OPENSSL_IS_BORINGSSL) - ::CONF_modules_unload(1); -#endif // !defined(OPENSSL_IS_BORINGSSL) -#if !defined(OPENSSL_NO_ENGINE) \ - && (OPENSSL_VERSION_NUMBER < 0x10100000L) - ::ENGINE_cleanup(); -#endif // !defined(OPENSSL_NO_ENGINE) - // && (OPENSSL_VERSION_NUMBER < 0x10100000L) - } - -#if !defined(SSL_OP_NO_COMPRESSION) \ - && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - STACK_OF(SSL_COMP)* get_null_compression_methods() const - { - return null_compression_methods_; - } -#endif // !defined(SSL_OP_NO_COMPRESSION) - // && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - -private: -#if (OPENSSL_VERSION_NUMBER < 0x10000000L) - static unsigned long openssl_id_func() - { -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - return ::GetCurrentThreadId(); -#else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - void* id = &errno; - BOOST_ASIO_ASSERT(sizeof(unsigned long) >= sizeof(void*)); - return reinterpret_cast<unsigned long>(id); -#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - } -#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) - -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - static void openssl_locking_func(int mode, int n, - const char* /*file*/, int /*line*/) - { - if (mode & CRYPTO_LOCK) - instance()->mutexes_[n]->lock(); - else - instance()->mutexes_[n]->unlock(); - } - - // Mutexes to be used in locking callbacks. - std::vector<boost::asio::detail::shared_ptr< - boost::asio::detail::mutex> > mutexes_; -#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L) - -#if !defined(SSL_OP_NO_COMPRESSION) \ - && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - STACK_OF(SSL_COMP)* null_compression_methods_; -#endif // !defined(SSL_OP_NO_COMPRESSION) - // && (OPENSSL_VERSION_NUMBER >= 0x00908000L) -}; - -boost::asio::detail::shared_ptr<openssl_init_base::do_init> -openssl_init_base::instance() -{ - static boost::asio::detail::shared_ptr<do_init> init(new do_init); - return init; -} - -#if !defined(SSL_OP_NO_COMPRESSION) \ - && (OPENSSL_VERSION_NUMBER >= 0x00908000L) -STACK_OF(SSL_COMP)* openssl_init_base::get_null_compression_methods() -{ - return instance()->get_null_compression_methods(); -} -#endif // !defined(SSL_OP_NO_COMPRESSION) - // && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_IMPL_OPENSSL_INIT_IPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/io.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/io.hpp deleted file mode 100644 index 604148c795..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/io.hpp +++ /dev/null @@ -1,374 +0,0 @@ -// -// ssl/detail/io.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_IO_HPP -#define BOOST_ASIO_SSL_DETAIL_IO_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/ssl/detail/engine.hpp> -#include <boost/asio/ssl/detail/stream_core.hpp> -#include <boost/asio/write.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -template <typename Stream, typename Operation> -std::size_t io(Stream& next_layer, stream_core& core, - const Operation& op, boost::system::error_code& ec) -{ - std::size_t bytes_transferred = 0; - do switch (op(core.engine_, ec, bytes_transferred)) - { - case engine::want_input_and_retry: - - // If the input buffer is empty then we need to read some more data from - // the underlying transport. - if (core.input_.size() == 0) - core.input_ = boost::asio::buffer(core.input_buffer_, - next_layer.read_some(core.input_buffer_, ec)); - - // Pass the new input data to the engine. - core.input_ = core.engine_.put_input(core.input_); - - // Try the operation again. - continue; - - case engine::want_output_and_retry: - - // Get output data from the engine and write it to the underlying - // transport. - boost::asio::write(next_layer, - core.engine_.get_output(core.output_buffer_), ec); - - // Try the operation again. - continue; - - case engine::want_output: - - // Get output data from the engine and write it to the underlying - // transport. - boost::asio::write(next_layer, - core.engine_.get_output(core.output_buffer_), ec); - - // Operation is complete. Return result to caller. - core.engine_.map_error_code(ec); - return bytes_transferred; - - default: - - // Operation is complete. Return result to caller. - core.engine_.map_error_code(ec); - return bytes_transferred; - - } while (!ec); - - // Operation failed. Return result to caller. - core.engine_.map_error_code(ec); - return 0; -} - -template <typename Stream, typename Operation, typename Handler> -class io_op -{ -public: - io_op(Stream& next_layer, stream_core& core, - const Operation& op, Handler& handler) - : next_layer_(next_layer), - core_(core), - op_(op), - start_(0), - want_(engine::want_nothing), - bytes_transferred_(0), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - io_op(const io_op& other) - : next_layer_(other.next_layer_), - core_(other.core_), - op_(other.op_), - start_(other.start_), - want_(other.want_), - ec_(other.ec_), - bytes_transferred_(other.bytes_transferred_), - handler_(other.handler_) - { - } - - io_op(io_op&& other) - : next_layer_(other.next_layer_), - core_(other.core_), - op_(BOOST_ASIO_MOVE_CAST(Operation)(other.op_)), - start_(other.start_), - want_(other.want_), - ec_(other.ec_), - bytes_transferred_(other.bytes_transferred_), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - void operator()(boost::system::error_code ec, - std::size_t bytes_transferred = ~std::size_t(0), int start = 0) - { - switch (start_ = start) - { - case 1: // Called after at least one async operation. - do - { - switch (want_ = op_(core_.engine_, ec_, bytes_transferred_)) - { - case engine::want_input_and_retry: - - // If the input buffer already has data in it we can pass it to the - // engine and then retry the operation immediately. - if (core_.input_.size() != 0) - { - core_.input_ = core_.engine_.put_input(core_.input_); - continue; - } - - // The engine wants more data to be read from input. However, we - // cannot allow more than one read operation at a time on the - // underlying transport. The pending_read_ timer's expiry is set to - // pos_infin if a read is in progress, and neg_infin otherwise. - if (core_.expiry(core_.pending_read_) == core_.neg_infin()) - { - // Prevent other read operations from being started. - core_.pending_read_.expires_at(core_.pos_infin()); - - // Start reading some data from the underlying transport. - next_layer_.async_read_some( - boost::asio::buffer(core_.input_buffer_), - BOOST_ASIO_MOVE_CAST(io_op)(*this)); - } - else - { - // Wait until the current read operation completes. - core_.pending_read_.async_wait(BOOST_ASIO_MOVE_CAST(io_op)(*this)); - } - - // Yield control until asynchronous operation completes. Control - // resumes at the "default:" label below. - return; - - case engine::want_output_and_retry: - case engine::want_output: - - // The engine wants some data to be written to the output. However, we - // cannot allow more than one write operation at a time on the - // underlying transport. The pending_write_ timer's expiry is set to - // pos_infin if a write is in progress, and neg_infin otherwise. - if (core_.expiry(core_.pending_write_) == core_.neg_infin()) - { - // Prevent other write operations from being started. - core_.pending_write_.expires_at(core_.pos_infin()); - - // Start writing all the data to the underlying transport. - boost::asio::async_write(next_layer_, - core_.engine_.get_output(core_.output_buffer_), - BOOST_ASIO_MOVE_CAST(io_op)(*this)); - } - else - { - // Wait until the current write operation completes. - core_.pending_write_.async_wait(BOOST_ASIO_MOVE_CAST(io_op)(*this)); - } - - // Yield control until asynchronous operation completes. Control - // resumes at the "default:" label below. - return; - - default: - - // The SSL operation is done and we can invoke the handler, but we - // have to keep in mind that this function might be being called from - // the async operation's initiating function. In this case we're not - // allowed to call the handler directly. Instead, issue a zero-sized - // read so the handler runs "as-if" posted using io_context::post(). - if (start) - { - next_layer_.async_read_some( - boost::asio::buffer(core_.input_buffer_, 0), - BOOST_ASIO_MOVE_CAST(io_op)(*this)); - - // Yield control until asynchronous operation completes. Control - // resumes at the "default:" label below. - return; - } - else - { - // Continue on to run handler directly. - break; - } - } - - default: - if (bytes_transferred == ~std::size_t(0)) - bytes_transferred = 0; // Timer cancellation, no data transferred. - else if (!ec_) - ec_ = ec; - - switch (want_) - { - case engine::want_input_and_retry: - - // Add received data to the engine's input. - core_.input_ = boost::asio::buffer( - core_.input_buffer_, bytes_transferred); - core_.input_ = core_.engine_.put_input(core_.input_); - - // Release any waiting read operations. - core_.pending_read_.expires_at(core_.neg_infin()); - - // Try the operation again. - continue; - - case engine::want_output_and_retry: - - // Release any waiting write operations. - core_.pending_write_.expires_at(core_.neg_infin()); - - // Try the operation again. - continue; - - case engine::want_output: - - // Release any waiting write operations. - core_.pending_write_.expires_at(core_.neg_infin()); - - // Fall through to call handler. - - default: - - // Pass the result to the handler. - op_.call_handler(handler_, - core_.engine_.map_error_code(ec_), - ec_ ? 0 : bytes_transferred_); - - // Our work here is done. - return; - } - } while (!ec_); - - // Operation failed. Pass the result to the handler. - op_.call_handler(handler_, core_.engine_.map_error_code(ec_), 0); - } - } - -//private: - Stream& next_layer_; - stream_core& core_; - Operation op_; - int start_; - engine::want want_; - boost::system::error_code ec_; - std::size_t bytes_transferred_; - Handler handler_; -}; - -template <typename Stream, typename Operation, typename Handler> -inline void* asio_handler_allocate(std::size_t size, - io_op<Stream, Operation, Handler>* this_handler) -{ - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); -} - -template <typename Stream, typename Operation, typename Handler> -inline void asio_handler_deallocate(void* pointer, std::size_t size, - io_op<Stream, Operation, Handler>* this_handler) -{ - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); -} - -template <typename Stream, typename Operation, typename Handler> -inline bool asio_handler_is_continuation( - io_op<Stream, Operation, Handler>* this_handler) -{ - return this_handler->start_ == 0 ? true - : boost_asio_handler_cont_helpers::is_continuation(this_handler->handler_); -} - -template <typename Function, typename Stream, - typename Operation, typename Handler> -inline void asio_handler_invoke(Function& function, - io_op<Stream, Operation, Handler>* this_handler) -{ - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); -} - -template <typename Function, typename Stream, - typename Operation, typename Handler> -inline void asio_handler_invoke(const Function& function, - io_op<Stream, Operation, Handler>* this_handler) -{ - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); -} - -template <typename Stream, typename Operation, typename Handler> -inline void async_io(Stream& next_layer, stream_core& core, - const Operation& op, Handler& handler) -{ - io_op<Stream, Operation, Handler>( - next_layer, core, op, handler)( - boost::system::error_code(), 0, 1); -} - -} // namespace detail -} // namespace ssl - -template <typename Stream, typename Operation, - typename Handler, typename Allocator> -struct associated_allocator< - ssl::detail::io_op<Stream, Operation, Handler>, Allocator> -{ - typedef typename associated_allocator<Handler, Allocator>::type type; - - static type get(const ssl::detail::io_op<Stream, Operation, Handler>& h, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return associated_allocator<Handler, Allocator>::get(h.handler_, a); - } -}; - -template <typename Stream, typename Operation, - typename Handler, typename Executor> -struct associated_executor< - ssl::detail::io_op<Stream, Operation, Handler>, Executor> -{ - typedef typename associated_executor<Handler, Executor>::type type; - - static type get(const ssl::detail::io_op<Stream, Operation, Handler>& h, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT - { - return associated_executor<Handler, Executor>::get(h.handler_, ex); - } -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_IO_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/openssl_init.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/openssl_init.hpp deleted file mode 100644 index 05b1ea4a33..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/openssl_init.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// -// ssl/detail/openssl_init.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_OPENSSL_INIT_HPP -#define BOOST_ASIO_SSL_DETAIL_OPENSSL_INIT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstring> -#include <boost/asio/detail/memory.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/ssl/detail/openssl_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -class openssl_init_base - : private noncopyable -{ -protected: - // Class that performs the actual initialisation. - class do_init; - - // Helper function to manage a do_init singleton. The static instance of the - // openssl_init object ensures that this function is always called before - // main, and therefore before any other threads can get started. The do_init - // instance must be static in this function to ensure that it gets - // initialised before any other global objects try to use it. - BOOST_ASIO_DECL static boost::asio::detail::shared_ptr<do_init> instance(); - -#if !defined(SSL_OP_NO_COMPRESSION) \ - && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - // Get an empty stack of compression methods, to be used when disabling - // compression. - BOOST_ASIO_DECL static STACK_OF(SSL_COMP)* get_null_compression_methods(); -#endif // !defined(SSL_OP_NO_COMPRESSION) - // && (OPENSSL_VERSION_NUMBER >= 0x00908000L) -}; - -template <bool Do_Init = true> -class openssl_init : private openssl_init_base -{ -public: - // Constructor. - openssl_init() - : ref_(instance()) - { - using namespace std; // For memmove. - - // Ensure openssl_init::instance_ is linked in. - openssl_init* tmp = &instance_; - memmove(&tmp, &tmp, sizeof(openssl_init*)); - } - - // Destructor. - ~openssl_init() - { - } - -#if !defined(SSL_OP_NO_COMPRESSION) \ - && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - using openssl_init_base::get_null_compression_methods; -#endif // !defined(SSL_OP_NO_COMPRESSION) - // && (OPENSSL_VERSION_NUMBER >= 0x00908000L) - -private: - // Instance to force initialisation of openssl at global scope. - static openssl_init instance_; - - // Reference to singleton do_init object to ensure that openssl does not get - // cleaned up until the last user has finished with it. - boost::asio::detail::shared_ptr<do_init> ref_; -}; - -template <bool Do_Init> -openssl_init<Do_Init> openssl_init<Do_Init>::instance_; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/ssl/detail/impl/openssl_init.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_SSL_DETAIL_OPENSSL_INIT_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/openssl_types.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/openssl_types.hpp deleted file mode 100644 index c955ac6013..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/openssl_types.hpp +++ /dev/null @@ -1,30 +0,0 @@ -// -// ssl/detail/openssl_types.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP -#define BOOST_ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/socket_types.hpp> -#include <openssl/conf.h> -#include <openssl/ssl.h> -#if !defined(OPENSSL_NO_ENGINE) -# include <openssl/engine.h> -#endif // !defined(OPENSSL_NO_ENGINE) -#include <openssl/dh.h> -#include <openssl/err.h> -#include <openssl/rsa.h> -#include <openssl/x509v3.h> - -#endif // BOOST_ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/password_callback.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/password_callback.hpp deleted file mode 100644 index 2a442f34d2..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/password_callback.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// -// ssl/detail/password_callback.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP -#define BOOST_ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <cstddef> -#include <string> -#include <boost/asio/ssl/context_base.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -class password_callback_base -{ -public: - virtual ~password_callback_base() - { - } - - virtual std::string call(std::size_t size, - context_base::password_purpose purpose) = 0; -}; - -template <typename PasswordCallback> -class password_callback : public password_callback_base -{ -public: - explicit password_callback(PasswordCallback callback) - : callback_(callback) - { - } - - virtual std::string call(std::size_t size, - context_base::password_purpose purpose) - { - return callback_(size, purpose); - } - -private: - PasswordCallback callback_; -}; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/read_op.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/read_op.hpp deleted file mode 100644 index 31929c9474..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/read_op.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// -// ssl/detail/read_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_READ_OP_HPP -#define BOOST_ASIO_SSL_DETAIL_READ_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/ssl/detail/engine.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -template <typename MutableBufferSequence> -class read_op -{ -public: - read_op(const MutableBufferSequence& buffers) - : buffers_(buffers) - { - } - - engine::want operator()(engine& eng, - boost::system::error_code& ec, - std::size_t& bytes_transferred) const - { - boost::asio::mutable_buffer buffer = - boost::asio::detail::buffer_sequence_adapter<boost::asio::mutable_buffer, - MutableBufferSequence>::first(buffers_); - - return eng.read(buffer, ec, bytes_transferred); - } - - template <typename Handler> - void call_handler(Handler& handler, - const boost::system::error_code& ec, - const std::size_t& bytes_transferred) const - { - handler(ec, bytes_transferred); - } - -private: - MutableBufferSequence buffers_; -}; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_READ_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/shutdown_op.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/shutdown_op.hpp deleted file mode 100644 index e98430621e..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/shutdown_op.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// -// ssl/detail/shutdown_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP -#define BOOST_ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/ssl/detail/engine.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -class shutdown_op -{ -public: - engine::want operator()(engine& eng, - boost::system::error_code& ec, - std::size_t& bytes_transferred) const - { - bytes_transferred = 0; - return eng.shutdown(ec); - } - - template <typename Handler> - void call_handler(Handler& handler, - const boost::system::error_code& ec, - const std::size_t&) const - { - handler(ec); - } -}; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/stream_core.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/stream_core.hpp deleted file mode 100644 index fc0a6ffffc..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/stream_core.hpp +++ /dev/null @@ -1,136 +0,0 @@ -// -// ssl/detail/stream_core.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_STREAM_CORE_HPP -#define BOOST_ASIO_SSL_DETAIL_STREAM_CORE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) -# include <boost/asio/deadline_timer.hpp> -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) -# include <boost/asio/steady_timer.hpp> -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) -#include <boost/asio/ssl/detail/engine.hpp> -#include <boost/asio/buffer.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -struct stream_core -{ - // According to the OpenSSL documentation, this is the buffer size that is - // sufficient to hold the largest possible TLS record. - enum { max_tls_record_size = 17 * 1024 }; - - stream_core(SSL_CTX* context, boost::asio::io_context& io_context) - : engine_(context), - pending_read_(io_context), - pending_write_(io_context), - output_buffer_space_(max_tls_record_size), - output_buffer_(boost::asio::buffer(output_buffer_space_)), - input_buffer_space_(max_tls_record_size), - input_buffer_(boost::asio::buffer(input_buffer_space_)) - { - pending_read_.expires_at(neg_infin()); - pending_write_.expires_at(neg_infin()); - } - - ~stream_core() - { - } - - // The SSL engine. - engine engine_; - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // Timer used for storing queued read operations. - boost::asio::deadline_timer pending_read_; - - // Timer used for storing queued write operations. - boost::asio::deadline_timer pending_write_; - - // Helper function for obtaining a time value that always fires. - static boost::asio::deadline_timer::time_type neg_infin() - { - return boost::posix_time::neg_infin; - } - - // Helper function for obtaining a time value that never fires. - static boost::asio::deadline_timer::time_type pos_infin() - { - return boost::posix_time::pos_infin; - } - - // Helper function to get a timer's expiry time. - static boost::asio::deadline_timer::time_type expiry( - const boost::asio::deadline_timer& timer) - { - return timer.expires_at(); - } -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // Timer used for storing queued read operations. - boost::asio::steady_timer pending_read_; - - // Timer used for storing queued write operations. - boost::asio::steady_timer pending_write_; - - // Helper function for obtaining a time value that always fires. - static boost::asio::steady_timer::time_point neg_infin() - { - return (boost::asio::steady_timer::time_point::min)(); - } - - // Helper function for obtaining a time value that never fires. - static boost::asio::steady_timer::time_point pos_infin() - { - return (boost::asio::steady_timer::time_point::max)(); - } - - // Helper function to get a timer's expiry time. - static boost::asio::steady_timer::time_point expiry( - const boost::asio::steady_timer& timer) - { - return timer.expiry(); - } -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - - // Buffer space used to prepare output intended for the transport. - std::vector<unsigned char> output_buffer_space_; - - // A buffer that may be used to prepare output intended for the transport. - const boost::asio::mutable_buffer output_buffer_; - - // Buffer space used to read input intended for the engine. - std::vector<unsigned char> input_buffer_space_; - - // A buffer that may be used to read input intended for the engine. - const boost::asio::mutable_buffer input_buffer_; - - // The buffer pointing to the engine's unconsumed input. - boost::asio::const_buffer input_; -}; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_STREAM_CORE_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/verify_callback.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/verify_callback.hpp deleted file mode 100644 index 1e96b2554b..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/verify_callback.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// -// ssl/detail/verify_callback.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP -#define BOOST_ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/ssl/verify_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -class verify_callback_base -{ -public: - virtual ~verify_callback_base() - { - } - - virtual bool call(bool preverified, verify_context& ctx) = 0; -}; - -template <typename VerifyCallback> -class verify_callback : public verify_callback_base -{ -public: - explicit verify_callback(VerifyCallback callback) - : callback_(callback) - { - } - - virtual bool call(bool preverified, verify_context& ctx) - { - return callback_(preverified, ctx); - } - -private: - VerifyCallback callback_; -}; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/detail/write_op.hpp b/contrib/restricted/boost/boost/asio/ssl/detail/write_op.hpp deleted file mode 100644 index 17ab95d67e..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/detail/write_op.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// -// ssl/detail/write_op.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_DETAIL_WRITE_OP_HPP -#define BOOST_ASIO_SSL_DETAIL_WRITE_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/ssl/detail/engine.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { -namespace detail { - -template <typename ConstBufferSequence> -class write_op -{ -public: - write_op(const ConstBufferSequence& buffers) - : buffers_(buffers) - { - } - - engine::want operator()(engine& eng, - boost::system::error_code& ec, - std::size_t& bytes_transferred) const - { - boost::asio::const_buffer buffer = - boost::asio::detail::buffer_sequence_adapter<boost::asio::const_buffer, - ConstBufferSequence>::first(buffers_); - - return eng.write(buffer, ec, bytes_transferred); - } - - template <typename Handler> - void call_handler(Handler& handler, - const boost::system::error_code& ec, - const std::size_t& bytes_transferred) const - { - handler(ec, bytes_transferred); - } - -private: - ConstBufferSequence buffers_; -}; - -} // namespace detail -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_DETAIL_WRITE_OP_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/error.hpp b/contrib/restricted/boost/boost/asio/ssl/error.hpp deleted file mode 100644 index 4a68d71703..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/error.hpp +++ /dev/null @@ -1,115 +0,0 @@ -// -// ssl/error.hpp -// ~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_ERROR_HPP -#define BOOST_ASIO_SSL_ERROR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/system/error_code.hpp> -#include <boost/asio/ssl/detail/openssl_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace error { - -enum ssl_errors -{ - // Error numbers are those produced by openssl. -}; - -extern BOOST_ASIO_DECL -const boost::system::error_category& get_ssl_category(); - -static const boost::system::error_category& - ssl_category BOOST_ASIO_UNUSED_VARIABLE - = boost::asio::error::get_ssl_category(); - -} // namespace error -namespace ssl { -namespace error { - -enum stream_errors -{ -#if defined(GENERATING_DOCUMENTATION) - /// The underlying stream closed before the ssl stream gracefully shut down. - stream_truncated -#elif (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL) - stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ) -#else - stream_truncated = 1 -#endif -}; - -extern BOOST_ASIO_DECL -const boost::system::error_category& get_stream_category(); - -static const boost::system::error_category& - stream_category BOOST_ASIO_UNUSED_VARIABLE - = boost::asio::ssl::error::get_stream_category(); - -} // namespace error -} // namespace ssl -} // namespace asio -} // namespace boost - -namespace boost { -namespace system { - -template<> struct is_error_code_enum<boost::asio::error::ssl_errors> -{ - static const bool value = true; -}; - -template<> struct is_error_code_enum<boost::asio::ssl::error::stream_errors> -{ - static const bool value = true; -}; - -} // namespace system -} // namespace boost - -namespace boost { -namespace asio { -namespace error { - -inline boost::system::error_code make_error_code(ssl_errors e) -{ - return boost::system::error_code( - static_cast<int>(e), get_ssl_category()); -} - -} // namespace error -namespace ssl { -namespace error { - -inline boost::system::error_code make_error_code(stream_errors e) -{ - return boost::system::error_code( - static_cast<int>(e), get_stream_category()); -} - -} // namespace error -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/ssl/impl/error.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_SSL_ERROR_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/impl/context.hpp b/contrib/restricted/boost/boost/asio/ssl/impl/context.hpp deleted file mode 100644 index 8f016830f9..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/impl/context.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// -// ssl/impl/context.hpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_IMPL_CONTEXT_HPP -#define BOOST_ASIO_SSL_IMPL_CONTEXT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/detail/throw_error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -template <typename VerifyCallback> -void context::set_verify_callback(VerifyCallback callback) -{ - boost::system::error_code ec; - this->set_verify_callback(callback, ec); - boost::asio::detail::throw_error(ec, "set_verify_callback"); -} - -template <typename VerifyCallback> -BOOST_ASIO_SYNC_OP_VOID context::set_verify_callback( - VerifyCallback callback, boost::system::error_code& ec) -{ - do_set_verify_callback( - new detail::verify_callback<VerifyCallback>(callback), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -template <typename PasswordCallback> -void context::set_password_callback(PasswordCallback callback) -{ - boost::system::error_code ec; - this->set_password_callback(callback, ec); - boost::asio::detail::throw_error(ec, "set_password_callback"); -} - -template <typename PasswordCallback> -BOOST_ASIO_SYNC_OP_VOID context::set_password_callback( - PasswordCallback callback, boost::system::error_code& ec) -{ - do_set_password_callback( - new detail::password_callback<PasswordCallback>(callback), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_IMPL_CONTEXT_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/impl/context.ipp b/contrib/restricted/boost/boost/asio/ssl/impl/context.ipp deleted file mode 100644 index f35e43c2a6..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/impl/context.ipp +++ /dev/null @@ -1,1161 +0,0 @@ -// -// ssl/impl/context.ipp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_IMPL_CONTEXT_IPP -#define BOOST_ASIO_SSL_IMPL_CONTEXT_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <cstring> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/ssl/context.hpp> -#include <boost/asio/ssl/error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -struct context::bio_cleanup -{ - BIO* p; - ~bio_cleanup() { if (p) ::BIO_free(p); } -}; - -struct context::x509_cleanup -{ - X509* p; - ~x509_cleanup() { if (p) ::X509_free(p); } -}; - -struct context::evp_pkey_cleanup -{ - EVP_PKEY* p; - ~evp_pkey_cleanup() { if (p) ::EVP_PKEY_free(p); } -}; - -struct context::rsa_cleanup -{ - RSA* p; - ~rsa_cleanup() { if (p) ::RSA_free(p); } -}; - -struct context::dh_cleanup -{ - DH* p; - ~dh_cleanup() { if (p) ::DH_free(p); } -}; - -context::context(context::method m) - : handle_(0) -{ - ::ERR_clear_error(); - - switch (m) - { - // SSL v2. -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) || defined(OPENSSL_NO_SSL2) - case context::sslv2: - case context::sslv2_client: - case context::sslv2_server: - boost::asio::detail::throw_error( - boost::asio::error::invalid_argument, "context"); - break; -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) || defined(OPENSSL_NO_SSL2) - case context::sslv2: - handle_ = ::SSL_CTX_new(::SSLv2_method()); - break; - case context::sslv2_client: - handle_ = ::SSL_CTX_new(::SSLv2_client_method()); - break; - case context::sslv2_server: - handle_ = ::SSL_CTX_new(::SSLv2_server_method()); - break; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) || defined(OPENSSL_NO_SSL2) - - // SSL v3. -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - case context::sslv3: - handle_ = ::SSL_CTX_new(::TLS_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, SSL3_VERSION); - SSL_CTX_set_max_proto_version(handle_, SSL3_VERSION); - } - break; - case context::sslv3_client: - handle_ = ::SSL_CTX_new(::TLS_client_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, SSL3_VERSION); - SSL_CTX_set_max_proto_version(handle_, SSL3_VERSION); - } - break; - case context::sslv3_server: - handle_ = ::SSL_CTX_new(::TLS_server_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, SSL3_VERSION); - SSL_CTX_set_max_proto_version(handle_, SSL3_VERSION); - } - break; -#elif defined(OPENSSL_NO_SSL3) - case context::sslv3: - case context::sslv3_client: - case context::sslv3_server: - boost::asio::detail::throw_error( - boost::asio::error::invalid_argument, "context"); - break; -#else // defined(OPENSSL_NO_SSL3) - case context::sslv3: - handle_ = ::SSL_CTX_new(::SSLv3_method()); - break; - case context::sslv3_client: - handle_ = ::SSL_CTX_new(::SSLv3_client_method()); - break; - case context::sslv3_server: - handle_ = ::SSL_CTX_new(::SSLv3_server_method()); - break; -#endif // defined(OPENSSL_NO_SSL3) - - // TLS v1.0. -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - case context::tlsv1: - handle_ = ::SSL_CTX_new(::TLS_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); - SSL_CTX_set_max_proto_version(handle_, TLS1_VERSION); - } - break; - case context::tlsv1_client: - handle_ = ::SSL_CTX_new(::TLS_client_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); - SSL_CTX_set_max_proto_version(handle_, TLS1_VERSION); - } - break; - case context::tlsv1_server: - handle_ = ::SSL_CTX_new(::TLS_server_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); - SSL_CTX_set_max_proto_version(handle_, TLS1_VERSION); - } - break; -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - case context::tlsv1: - handle_ = ::SSL_CTX_new(::TLSv1_method()); - break; - case context::tlsv1_client: - handle_ = ::SSL_CTX_new(::TLSv1_client_method()); - break; - case context::tlsv1_server: - handle_ = ::SSL_CTX_new(::TLSv1_server_method()); - break; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - - // TLS v1.1. -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - case context::tlsv11: - handle_ = ::SSL_CTX_new(::TLS_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, TLS1_1_VERSION); - SSL_CTX_set_max_proto_version(handle_, TLS1_1_VERSION); - } - break; - case context::tlsv11_client: - handle_ = ::SSL_CTX_new(::TLS_client_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, TLS1_1_VERSION); - SSL_CTX_set_max_proto_version(handle_, TLS1_1_VERSION); - } - break; - case context::tlsv11_server: - handle_ = ::SSL_CTX_new(::TLS_server_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, TLS1_1_VERSION); - SSL_CTX_set_max_proto_version(handle_, TLS1_1_VERSION); - } - break; -#elif defined(SSL_TXT_TLSV1_1) - case context::tlsv11: - handle_ = ::SSL_CTX_new(::TLSv1_1_method()); - break; - case context::tlsv11_client: - handle_ = ::SSL_CTX_new(::TLSv1_1_client_method()); - break; - case context::tlsv11_server: - handle_ = ::SSL_CTX_new(::TLSv1_1_server_method()); - break; -#else // defined(SSL_TXT_TLSV1_1) - case context::tlsv11: - case context::tlsv11_client: - case context::tlsv11_server: - boost::asio::detail::throw_error( - boost::asio::error::invalid_argument, "context"); - break; -#endif // defined(SSL_TXT_TLSV1_1) - - // TLS v1.2. -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - case context::tlsv12: - handle_ = ::SSL_CTX_new(::TLS_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, TLS1_2_VERSION); - SSL_CTX_set_max_proto_version(handle_, TLS1_2_VERSION); - } - break; - case context::tlsv12_client: - handle_ = ::SSL_CTX_new(::TLS_client_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, TLS1_2_VERSION); - SSL_CTX_set_max_proto_version(handle_, TLS1_2_VERSION); - } - break; - case context::tlsv12_server: - handle_ = ::SSL_CTX_new(::TLS_server_method()); - if (handle_) - { - SSL_CTX_set_min_proto_version(handle_, TLS1_2_VERSION); - SSL_CTX_set_max_proto_version(handle_, TLS1_2_VERSION); - } - break; -#elif defined(SSL_TXT_TLSV1_1) - case context::tlsv12: - handle_ = ::SSL_CTX_new(::TLSv1_2_method()); - break; - case context::tlsv12_client: - handle_ = ::SSL_CTX_new(::TLSv1_2_client_method()); - break; - case context::tlsv12_server: - handle_ = ::SSL_CTX_new(::TLSv1_2_server_method()); - break; -#else // defined(SSL_TXT_TLSV1_1) - case context::tlsv12: - case context::tlsv12_client: - case context::tlsv12_server: - boost::asio::detail::throw_error( - boost::asio::error::invalid_argument, "context"); - break; -#endif // defined(SSL_TXT_TLSV1_1) - - // Any supported SSL/TLS version. - case context::sslv23: - handle_ = ::SSL_CTX_new(::SSLv23_method()); - break; - case context::sslv23_client: - handle_ = ::SSL_CTX_new(::SSLv23_client_method()); - break; - case context::sslv23_server: - handle_ = ::SSL_CTX_new(::SSLv23_server_method()); - break; - - // Any supported TLS version. -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - case context::tls: - handle_ = ::SSL_CTX_new(::TLS_method()); - if (handle_) - SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); - break; - case context::tls_client: - handle_ = ::SSL_CTX_new(::TLS_client_method()); - if (handle_) - SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); - break; - case context::tls_server: - handle_ = ::SSL_CTX_new(::TLS_server_method()); - if (handle_) - SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); - break; -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - case context::tls: - handle_ = ::SSL_CTX_new(::SSLv23_method()); - if (handle_) - SSL_CTX_set_options(handle_, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); - break; - case context::tls_client: - handle_ = ::SSL_CTX_new(::SSLv23_client_method()); - if (handle_) - SSL_CTX_set_options(handle_, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); - break; - case context::tls_server: - handle_ = ::SSL_CTX_new(::SSLv23_server_method()); - if (handle_) - SSL_CTX_set_options(handle_, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); - break; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - - default: - handle_ = ::SSL_CTX_new(0); - break; - } - - if (handle_ == 0) - { - boost::system::error_code ec( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - boost::asio::detail::throw_error(ec, "context"); - } - - set_options(no_compression); -} - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) -context::context(context&& other) -{ - handle_ = other.handle_; - other.handle_ = 0; -} - -context& context::operator=(context&& other) -{ - context tmp(BOOST_ASIO_MOVE_CAST(context)(*this)); - handle_ = other.handle_; - other.handle_ = 0; - return *this; -} -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - -context::~context() -{ - if (handle_) - { -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - void* cb_userdata = handle_->default_passwd_callback_userdata; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - if (cb_userdata) - { - detail::password_callback_base* callback = - static_cast<detail::password_callback_base*>( - cb_userdata); - delete callback; -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - ::SSL_CTX_set_default_passwd_cb_userdata(handle_, 0); -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - handle_->default_passwd_callback_userdata = 0; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - } - - if (SSL_CTX_get_app_data(handle_)) - { - detail::verify_callback_base* callback = - static_cast<detail::verify_callback_base*>( - SSL_CTX_get_app_data(handle_)); - delete callback; - SSL_CTX_set_app_data(handle_, 0); - } - - ::SSL_CTX_free(handle_); - } -} - -context::native_handle_type context::native_handle() -{ - return handle_; -} - -void context::clear_options(context::options o) -{ - boost::system::error_code ec; - clear_options(o, ec); - boost::asio::detail::throw_error(ec, "clear_options"); -} - -BOOST_ASIO_SYNC_OP_VOID context::clear_options( - context::options o, boost::system::error_code& ec) -{ -#if (OPENSSL_VERSION_NUMBER >= 0x009080DFL) \ - && (OPENSSL_VERSION_NUMBER != 0x00909000L) -# if !defined(SSL_OP_NO_COMPRESSION) - if ((o & context::no_compression) != 0) - { -# if (OPENSSL_VERSION_NUMBER >= 0x00908000L) - handle_->comp_methods = SSL_COMP_get_compression_methods(); -# endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L) - o ^= context::no_compression; - } -# endif // !defined(SSL_OP_NO_COMPRESSION) - - ::SSL_CTX_clear_options(handle_, o); - - ec = boost::system::error_code(); -#else // (OPENSSL_VERSION_NUMBER >= 0x009080DFL) - // && (OPENSSL_VERSION_NUMBER != 0x00909000L) - (void)o; - ec = boost::asio::error::operation_not_supported; -#endif // (OPENSSL_VERSION_NUMBER >= 0x009080DFL) - // && (OPENSSL_VERSION_NUMBER != 0x00909000L) - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::set_options(context::options o) -{ - boost::system::error_code ec; - set_options(o, ec); - boost::asio::detail::throw_error(ec, "set_options"); -} - -BOOST_ASIO_SYNC_OP_VOID context::set_options( - context::options o, boost::system::error_code& ec) -{ -#if !defined(SSL_OP_NO_COMPRESSION) - if ((o & context::no_compression) != 0) - { -#if (OPENSSL_VERSION_NUMBER >= 0x00908000L) - handle_->comp_methods = - boost::asio::ssl::detail::openssl_init<>::get_null_compression_methods(); -#endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L) - o ^= context::no_compression; - } -#endif // !defined(SSL_OP_NO_COMPRESSION) - - ::SSL_CTX_set_options(handle_, o); - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::set_verify_mode(verify_mode v) -{ - boost::system::error_code ec; - set_verify_mode(v, ec); - boost::asio::detail::throw_error(ec, "set_verify_mode"); -} - -BOOST_ASIO_SYNC_OP_VOID context::set_verify_mode( - verify_mode v, boost::system::error_code& ec) -{ - ::SSL_CTX_set_verify(handle_, v, ::SSL_CTX_get_verify_callback(handle_)); - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::set_verify_depth(int depth) -{ - boost::system::error_code ec; - set_verify_depth(depth, ec); - boost::asio::detail::throw_error(ec, "set_verify_depth"); -} - -BOOST_ASIO_SYNC_OP_VOID context::set_verify_depth( - int depth, boost::system::error_code& ec) -{ - ::SSL_CTX_set_verify_depth(handle_, depth); - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::load_verify_file(const std::string& filename) -{ - boost::system::error_code ec; - load_verify_file(filename, ec); - boost::asio::detail::throw_error(ec, "load_verify_file"); -} - -BOOST_ASIO_SYNC_OP_VOID context::load_verify_file( - const std::string& filename, boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - if (::SSL_CTX_load_verify_locations(handle_, filename.c_str(), 0) != 1) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::add_certificate_authority(const const_buffer& ca) -{ - boost::system::error_code ec; - add_certificate_authority(ca, ec); - boost::asio::detail::throw_error(ec, "add_certificate_authority"); -} - -BOOST_ASIO_SYNC_OP_VOID context::add_certificate_authority( - const const_buffer& ca, boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - bio_cleanup bio = { make_buffer_bio(ca) }; - if (bio.p) - { - if (X509_STORE* store = ::SSL_CTX_get_cert_store(handle_)) - { - for (;;) - { - x509_cleanup cert = { ::PEM_read_bio_X509(bio.p, 0, 0, 0) }; - if (!cert.p) - break; - - if (::X509_STORE_add_cert(store, cert.p) != 1) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - } - } - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::set_default_verify_paths() -{ - boost::system::error_code ec; - set_default_verify_paths(ec); - boost::asio::detail::throw_error(ec, "set_default_verify_paths"); -} - -BOOST_ASIO_SYNC_OP_VOID context::set_default_verify_paths( - boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - if (::SSL_CTX_set_default_verify_paths(handle_) != 1) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::add_verify_path(const std::string& path) -{ - boost::system::error_code ec; - add_verify_path(path, ec); - boost::asio::detail::throw_error(ec, "add_verify_path"); -} - -BOOST_ASIO_SYNC_OP_VOID context::add_verify_path( - const std::string& path, boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - if (::SSL_CTX_load_verify_locations(handle_, 0, path.c_str()) != 1) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::use_certificate( - const const_buffer& certificate, file_format format) -{ - boost::system::error_code ec; - use_certificate(certificate, format, ec); - boost::asio::detail::throw_error(ec, "use_certificate"); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_certificate( - const const_buffer& certificate, file_format format, - boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - if (format == context_base::asn1) - { - if (::SSL_CTX_use_certificate_ASN1(handle_, - static_cast<int>(certificate.size()), - static_cast<const unsigned char*>(certificate.data())) == 1) - { - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - else if (format == context_base::pem) - { - bio_cleanup bio = { make_buffer_bio(certificate) }; - if (bio.p) - { - x509_cleanup cert = { ::PEM_read_bio_X509(bio.p, 0, 0, 0) }; - if (cert.p) - { - if (::SSL_CTX_use_certificate(handle_, cert.p) == 1) - { - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - } - } - else - { - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::use_certificate_file( - const std::string& filename, file_format format) -{ - boost::system::error_code ec; - use_certificate_file(filename, format, ec); - boost::asio::detail::throw_error(ec, "use_certificate_file"); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_certificate_file( - const std::string& filename, file_format format, - boost::system::error_code& ec) -{ - int file_type; - switch (format) - { - case context_base::asn1: - file_type = SSL_FILETYPE_ASN1; - break; - case context_base::pem: - file_type = SSL_FILETYPE_PEM; - break; - default: - { - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - - ::ERR_clear_error(); - - if (::SSL_CTX_use_certificate_file(handle_, filename.c_str(), file_type) != 1) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::use_certificate_chain(const const_buffer& chain) -{ - boost::system::error_code ec; - use_certificate_chain(chain, ec); - boost::asio::detail::throw_error(ec, "use_certificate_chain"); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_certificate_chain( - const const_buffer& chain, boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - bio_cleanup bio = { make_buffer_bio(chain) }; - if (bio.p) - { -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_); - void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - pem_password_cb* callback = handle_->default_passwd_callback; - void* cb_userdata = handle_->default_passwd_callback_userdata; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - x509_cleanup cert = { - ::PEM_read_bio_X509_AUX(bio.p, 0, - callback, - cb_userdata) }; - if (!cert.p) - { - ec = boost::system::error_code(ERR_R_PEM_LIB, - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - int result = ::SSL_CTX_use_certificate(handle_, cert.p); - if (result == 0 || ::ERR_peek_error() != 0) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - -#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER) - ::SSL_CTX_clear_chain_certs(handle_); -#else - if (handle_->extra_certs) - { - ::sk_X509_pop_free(handle_->extra_certs, X509_free); - handle_->extra_certs = 0; - } -#endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L) - - while (X509* cacert = ::PEM_read_bio_X509(bio.p, 0, - callback, - cb_userdata)) - { - if (!::SSL_CTX_add_extra_chain_cert(handle_, cacert)) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - - result = ::ERR_peek_last_error(); - if ((ERR_GET_LIB(result) == ERR_LIB_PEM) - && (ERR_GET_REASON(result) == PEM_R_NO_START_LINE)) - { - ::ERR_clear_error(); - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::use_certificate_chain_file(const std::string& filename) -{ - boost::system::error_code ec; - use_certificate_chain_file(filename, ec); - boost::asio::detail::throw_error(ec, "use_certificate_chain_file"); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_certificate_chain_file( - const std::string& filename, boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - if (::SSL_CTX_use_certificate_chain_file(handle_, filename.c_str()) != 1) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::use_private_key( - const const_buffer& private_key, context::file_format format) -{ - boost::system::error_code ec; - use_private_key(private_key, format, ec); - boost::asio::detail::throw_error(ec, "use_private_key"); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_private_key( - const const_buffer& private_key, context::file_format format, - boost::system::error_code& ec) -{ - ::ERR_clear_error(); - -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_); - void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - pem_password_cb* callback = handle_->default_passwd_callback; - void* cb_userdata = handle_->default_passwd_callback_userdata; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - - bio_cleanup bio = { make_buffer_bio(private_key) }; - if (bio.p) - { - evp_pkey_cleanup evp_private_key = { 0 }; - switch (format) - { - case context_base::asn1: - evp_private_key.p = ::d2i_PrivateKey_bio(bio.p, 0); - break; - case context_base::pem: - evp_private_key.p = ::PEM_read_bio_PrivateKey( - bio.p, 0, callback, - cb_userdata); - break; - default: - { - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - - if (evp_private_key.p) - { - if (::SSL_CTX_use_PrivateKey(handle_, evp_private_key.p) == 1) - { - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - } - - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::use_private_key_file( - const std::string& filename, context::file_format format) -{ - boost::system::error_code ec; - use_private_key_file(filename, format, ec); - boost::asio::detail::throw_error(ec, "use_private_key_file"); -} - -void context::use_rsa_private_key( - const const_buffer& private_key, context::file_format format) -{ - boost::system::error_code ec; - use_rsa_private_key(private_key, format, ec); - boost::asio::detail::throw_error(ec, "use_rsa_private_key"); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_rsa_private_key( - const const_buffer& private_key, context::file_format format, - boost::system::error_code& ec) -{ - ::ERR_clear_error(); - -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_); - void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - pem_password_cb* callback = handle_->default_passwd_callback; - void* cb_userdata = handle_->default_passwd_callback_userdata; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - - bio_cleanup bio = { make_buffer_bio(private_key) }; - if (bio.p) - { - rsa_cleanup rsa_private_key = { 0 }; - switch (format) - { - case context_base::asn1: - rsa_private_key.p = ::d2i_RSAPrivateKey_bio(bio.p, 0); - break; - case context_base::pem: - rsa_private_key.p = ::PEM_read_bio_RSAPrivateKey( - bio.p, 0, callback, - cb_userdata); - break; - default: - { - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - - if (rsa_private_key.p) - { - if (::SSL_CTX_use_RSAPrivateKey(handle_, rsa_private_key.p) == 1) - { - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - } - - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_private_key_file( - const std::string& filename, context::file_format format, - boost::system::error_code& ec) -{ - int file_type; - switch (format) - { - case context_base::asn1: - file_type = SSL_FILETYPE_ASN1; - break; - case context_base::pem: - file_type = SSL_FILETYPE_PEM; - break; - default: - { - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - - ::ERR_clear_error(); - - if (::SSL_CTX_use_PrivateKey_file(handle_, filename.c_str(), file_type) != 1) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::use_rsa_private_key_file( - const std::string& filename, context::file_format format) -{ - boost::system::error_code ec; - use_rsa_private_key_file(filename, format, ec); - boost::asio::detail::throw_error(ec, "use_rsa_private_key_file"); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_rsa_private_key_file( - const std::string& filename, context::file_format format, - boost::system::error_code& ec) -{ - int file_type; - switch (format) - { - case context_base::asn1: - file_type = SSL_FILETYPE_ASN1; - break; - case context_base::pem: - file_type = SSL_FILETYPE_PEM; - break; - default: - { - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - - ::ERR_clear_error(); - - if (::SSL_CTX_use_RSAPrivateKey_file( - handle_, filename.c_str(), file_type) != 1) - { - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::use_tmp_dh(const const_buffer& dh) -{ - boost::system::error_code ec; - use_tmp_dh(dh, ec); - boost::asio::detail::throw_error(ec, "use_tmp_dh"); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_tmp_dh( - const const_buffer& dh, boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - bio_cleanup bio = { make_buffer_bio(dh) }; - if (bio.p) - { - return do_use_tmp_dh(bio.p, ec); - } - - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -void context::use_tmp_dh_file(const std::string& filename) -{ - boost::system::error_code ec; - use_tmp_dh_file(filename, ec); - boost::asio::detail::throw_error(ec, "use_tmp_dh_file"); -} - -BOOST_ASIO_SYNC_OP_VOID context::use_tmp_dh_file( - const std::string& filename, boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - bio_cleanup bio = { ::BIO_new_file(filename.c_str(), "r") }; - if (bio.p) - { - return do_use_tmp_dh(bio.p, ec); - } - - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -BOOST_ASIO_SYNC_OP_VOID context::do_use_tmp_dh( - BIO* bio, boost::system::error_code& ec) -{ - ::ERR_clear_error(); - - dh_cleanup dh = { ::PEM_read_bio_DHparams(bio, 0, 0, 0) }; - if (dh.p) - { - if (::SSL_CTX_set_tmp_dh(handle_, dh.p) == 1) - { - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - } - - ec = boost::system::error_code( - static_cast<int>(::ERR_get_error()), - boost::asio::error::get_ssl_category()); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -BOOST_ASIO_SYNC_OP_VOID context::do_set_verify_callback( - detail::verify_callback_base* callback, boost::system::error_code& ec) -{ - if (SSL_CTX_get_app_data(handle_)) - { - delete static_cast<detail::verify_callback_base*>( - SSL_CTX_get_app_data(handle_)); - } - - SSL_CTX_set_app_data(handle_, callback); - - ::SSL_CTX_set_verify(handle_, - ::SSL_CTX_get_verify_mode(handle_), - &context::verify_callback_function); - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -int context::verify_callback_function(int preverified, X509_STORE_CTX* ctx) -{ - if (ctx) - { - if (SSL* ssl = static_cast<SSL*>( - ::X509_STORE_CTX_get_ex_data( - ctx, ::SSL_get_ex_data_X509_STORE_CTX_idx()))) - { - if (SSL_CTX* handle = ::SSL_get_SSL_CTX(ssl)) - { - if (SSL_CTX_get_app_data(handle)) - { - detail::verify_callback_base* callback = - static_cast<detail::verify_callback_base*>( - SSL_CTX_get_app_data(handle)); - - verify_context verify_ctx(ctx); - return callback->call(preverified != 0, verify_ctx) ? 1 : 0; - } - } - } - } - - return 0; -} - -BOOST_ASIO_SYNC_OP_VOID context::do_set_password_callback( - detail::password_callback_base* callback, boost::system::error_code& ec) -{ -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) - void* old_callback = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); - ::SSL_CTX_set_default_passwd_cb_userdata(handle_, callback); -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - void* old_callback = handle_->default_passwd_callback_userdata; - handle_->default_passwd_callback_userdata = callback; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) - - if (old_callback) - delete static_cast<detail::password_callback_base*>( - old_callback); - - SSL_CTX_set_default_passwd_cb(handle_, &context::password_callback_function); - - ec = boost::system::error_code(); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); -} - -int context::password_callback_function( - char* buf, int size, int purpose, void* data) -{ - using namespace std; // For strncat and strlen. - - if (data) - { - detail::password_callback_base* callback = - static_cast<detail::password_callback_base*>(data); - - std::string passwd = callback->call(static_cast<std::size_t>(size), - purpose ? context_base::for_writing : context_base::for_reading); - -#if defined(BOOST_ASIO_HAS_SECURE_RTL) - strcpy_s(buf, size, passwd.c_str()); -#else // defined(BOOST_ASIO_HAS_SECURE_RTL) - *buf = '\0'; - if (size > 0) - strncat(buf, passwd.c_str(), size - 1); -#endif // defined(BOOST_ASIO_HAS_SECURE_RTL) - - return static_cast<int>(strlen(buf)); - } - - return 0; -} - -BIO* context::make_buffer_bio(const const_buffer& b) -{ - return ::BIO_new_mem_buf( - const_cast<void*>(b.data()), - static_cast<int>(b.size())); -} - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_IMPL_CONTEXT_IPP diff --git a/contrib/restricted/boost/boost/asio/ssl/impl/error.ipp b/contrib/restricted/boost/boost/asio/ssl/impl/error.ipp deleted file mode 100644 index a359619765..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/impl/error.ipp +++ /dev/null @@ -1,102 +0,0 @@ -// -// ssl/impl/error.ipp -// ~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_IMPL_ERROR_IPP -#define BOOST_ASIO_SSL_IMPL_ERROR_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/ssl/error.hpp> -#include <boost/asio/ssl/detail/openssl_init.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace error { -namespace detail { - -class ssl_category : public boost::system::error_category -{ -public: - const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT - { - return "asio.ssl"; - } - - std::string message(int value) const - { - const char* s = ::ERR_reason_error_string(value); - return s ? s : "asio.ssl error"; - } -}; - -} // namespace detail - -const boost::system::error_category& get_ssl_category() -{ - static detail::ssl_category instance; - return instance; -} - -} // namespace error -namespace ssl { -namespace error { - -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL) - -const boost::system::error_category& get_stream_category() -{ - return boost::asio::error::get_ssl_category(); -} - -#else - -namespace detail { - -class stream_category : public boost::system::error_category -{ -public: - const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT - { - return "asio.ssl.stream"; - } - - std::string message(int value) const - { - switch (value) - { - case stream_truncated: return "stream truncated"; - default: return "asio.ssl.stream error"; - } - } -}; - -} // namespace detail - -const boost::system::error_category& get_stream_category() -{ - static detail::stream_category instance; - return instance; -} - -#endif - -} // namespace error -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_IMPL_ERROR_IPP diff --git a/contrib/restricted/boost/boost/asio/ssl/impl/rfc2818_verification.ipp b/contrib/restricted/boost/boost/asio/ssl/impl/rfc2818_verification.ipp deleted file mode 100644 index 63ce663bdc..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/impl/rfc2818_verification.ipp +++ /dev/null @@ -1,162 +0,0 @@ -// -// ssl/impl/rfc2818_verification.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_IMPL_RFC2818_VERIFICATION_IPP -#define BOOST_ASIO_SSL_IMPL_RFC2818_VERIFICATION_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <cctype> -#include <cstring> -#include <boost/asio/ip/address.hpp> -#include <boost/asio/ssl/rfc2818_verification.hpp> -#include <boost/asio/ssl/detail/openssl_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -bool rfc2818_verification::operator()( - bool preverified, verify_context& ctx) const -{ - using namespace std; // For memcmp. - - // Don't bother looking at certificates that have failed pre-verification. - if (!preverified) - return false; - - // We're only interested in checking the certificate at the end of the chain. - int depth = X509_STORE_CTX_get_error_depth(ctx.native_handle()); - if (depth > 0) - return true; - - // Try converting the host name to an address. If it is an address then we - // need to look for an IP address in the certificate rather than a host name. - boost::system::error_code ec; - ip::address address = ip::make_address(host_, ec); - bool is_address = !ec; - - X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle()); - - // Go through the alternate names in the certificate looking for matching DNS - // or IP address entries. - GENERAL_NAMES* gens = static_cast<GENERAL_NAMES*>( - X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0)); - for (int i = 0; i < sk_GENERAL_NAME_num(gens); ++i) - { - GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i); - if (gen->type == GEN_DNS && !is_address) - { - ASN1_IA5STRING* domain = gen->d.dNSName; - if (domain->type == V_ASN1_IA5STRING && domain->data && domain->length) - { - const char* pattern = reinterpret_cast<const char*>(domain->data); - std::size_t pattern_length = domain->length; - if (match_pattern(pattern, pattern_length, host_.c_str())) - { - GENERAL_NAMES_free(gens); - return true; - } - } - } - else if (gen->type == GEN_IPADD && is_address) - { - ASN1_OCTET_STRING* ip_address = gen->d.iPAddress; - if (ip_address->type == V_ASN1_OCTET_STRING && ip_address->data) - { - if (address.is_v4() && ip_address->length == 4) - { - ip::address_v4::bytes_type bytes = address.to_v4().to_bytes(); - if (memcmp(bytes.data(), ip_address->data, 4) == 0) - { - GENERAL_NAMES_free(gens); - return true; - } - } - else if (address.is_v6() && ip_address->length == 16) - { - ip::address_v6::bytes_type bytes = address.to_v6().to_bytes(); - if (memcmp(bytes.data(), ip_address->data, 16) == 0) - { - GENERAL_NAMES_free(gens); - return true; - } - } - } - } - } - GENERAL_NAMES_free(gens); - - // No match in the alternate names, so try the common names. We should only - // use the "most specific" common name, which is the last one in the list. - X509_NAME* name = X509_get_subject_name(cert); - int i = -1; - ASN1_STRING* common_name = 0; - while ((i = X509_NAME_get_index_by_NID(name, NID_commonName, i)) >= 0) - { - X509_NAME_ENTRY* name_entry = X509_NAME_get_entry(name, i); - common_name = X509_NAME_ENTRY_get_data(name_entry); - } - if (common_name && common_name->data && common_name->length) - { - const char* pattern = reinterpret_cast<const char*>(common_name->data); - std::size_t pattern_length = common_name->length; - if (match_pattern(pattern, pattern_length, host_.c_str())) - return true; - } - - return false; -} - -bool rfc2818_verification::match_pattern(const char* pattern, - std::size_t pattern_length, const char* host) -{ - using namespace std; // For tolower. - - const char* p = pattern; - const char* p_end = p + pattern_length; - const char* h = host; - - while (p != p_end && *h) - { - if (*p == '*') - { - ++p; - while (*h && *h != '.') - if (match_pattern(p, p_end - p, h++)) - return true; - } - else if (tolower(*p) == tolower(*h)) - { - ++p; - ++h; - } - else - { - return false; - } - } - - return p == p_end && !*h; -} - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_IMPL_RFC2818_VERIFICATION_IPP diff --git a/contrib/restricted/boost/boost/asio/ssl/impl/src.hpp b/contrib/restricted/boost/boost/asio/ssl/impl/src.hpp deleted file mode 100644 index 2e8859ea2b..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/impl/src.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// -// impl/ssl/src.hpp -// ~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_IMPL_SRC_HPP -#define BOOST_ASIO_SSL_IMPL_SRC_HPP - -#define BOOST_ASIO_SOURCE - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# error Do not compile Asio library source with BOOST_ASIO_HEADER_ONLY defined -#endif - -#include <boost/asio/ssl/impl/context.ipp> -#include <boost/asio/ssl/impl/error.ipp> -#include <boost/asio/ssl/detail/impl/engine.ipp> -#include <boost/asio/ssl/detail/impl/openssl_init.ipp> -#include <boost/asio/ssl/impl/rfc2818_verification.ipp> - -#endif // BOOST_ASIO_SSL_IMPL_SRC_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/rfc2818_verification.hpp b/contrib/restricted/boost/boost/asio/ssl/rfc2818_verification.hpp deleted file mode 100644 index 047688b007..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/rfc2818_verification.hpp +++ /dev/null @@ -1,96 +0,0 @@ -// -// ssl/rfc2818_verification.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_RFC2818_VERIFICATION_HPP -#define BOOST_ASIO_SSL_RFC2818_VERIFICATION_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <string> -#include <boost/asio/ssl/detail/openssl_types.hpp> -#include <boost/asio/ssl/verify_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -/// Verifies a certificate against a hostname according to the rules described -/// in RFC 2818. -/** - * @par Example - * The following example shows how to synchronously open a secure connection to - * a given host name: - * @code - * using boost::asio::ip::tcp; - * namespace ssl = boost::asio::ssl; - * typedef ssl::stream<tcp::socket> ssl_socket; - * - * // Create a context that uses the default paths for finding CA certificates. - * ssl::context ctx(ssl::context::sslv23); - * ctx.set_default_verify_paths(); - * - * // Open a socket and connect it to the remote host. - * boost::asio::io_context io_context; - * ssl_socket sock(io_context, ctx); - * tcp::resolver resolver(io_context); - * tcp::resolver::query query("host.name", "https"); - * boost::asio::connect(sock.lowest_layer(), resolver.resolve(query)); - * sock.lowest_layer().set_option(tcp::no_delay(true)); - * - * // Perform SSL handshake and verify the remote host's certificate. - * sock.set_verify_mode(ssl::verify_peer); - * sock.set_verify_callback(ssl::rfc2818_verification("host.name")); - * sock.handshake(ssl_socket::client); - * - * // ... read and write as normal ... - * @endcode - */ -class rfc2818_verification -{ -public: - /// The type of the function object's result. - typedef bool result_type; - - /// Constructor. - explicit rfc2818_verification(const std::string& host) - : host_(host) - { - } - - /// Perform certificate verification. - BOOST_ASIO_DECL bool operator()(bool preverified, verify_context& ctx) const; - -private: - // Helper function to check a host name against a pattern. - BOOST_ASIO_DECL static bool match_pattern(const char* pattern, - std::size_t pattern_length, const char* host); - - // Helper function to check a host name against an IPv4 address - // The host name to be checked. - std::string host_; -}; - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/ssl/impl/rfc2818_verification.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_SSL_RFC2818_VERIFICATION_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/stream.hpp b/contrib/restricted/boost/boost/asio/ssl/stream.hpp deleted file mode 100644 index 005ff465f4..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/stream.hpp +++ /dev/null @@ -1,763 +0,0 @@ -// -// ssl/stream.hpp -// ~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_STREAM_HPP -#define BOOST_ASIO_SSL_STREAM_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/buffer_sequence_adapter.hpp> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/ssl/context.hpp> -#include <boost/asio/ssl/detail/buffered_handshake_op.hpp> -#include <boost/asio/ssl/detail/handshake_op.hpp> -#include <boost/asio/ssl/detail/io.hpp> -#include <boost/asio/ssl/detail/read_op.hpp> -#include <boost/asio/ssl/detail/shutdown_op.hpp> -#include <boost/asio/ssl/detail/stream_core.hpp> -#include <boost/asio/ssl/detail/write_op.hpp> -#include <boost/asio/ssl/stream_base.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -/// Provides stream-oriented functionality using SSL. -/** - * The stream class template provides asynchronous and blocking stream-oriented - * functionality using SSL. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. The application must also ensure that all - * asynchronous operations are performed within the same implicit or explicit - * strand. - * - * @par Example - * To use the SSL stream template with an ip::tcp::socket, you would write: - * @code - * boost::asio::io_context io_context; - * boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23); - * boost::asio::ssl::stream<asio:ip::tcp::socket> sock(io_context, ctx); - * @endcode - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream. - */ -template <typename Stream> -class stream : - public stream_base, - private noncopyable -{ -public: - /// The native handle type of the SSL stream. - typedef SSL* native_handle_type; - - /// Structure for use with deprecated impl_type. - struct impl_struct - { - SSL* ssl; - }; - - /// The type of the next layer. - typedef typename remove_reference<Stream>::type next_layer_type; - - /// The type of the lowest layer. - typedef typename next_layer_type::lowest_layer_type lowest_layer_type; - - /// The type of the executor associated with the object. - typedef typename lowest_layer_type::executor_type executor_type; - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Construct a stream. - /** - * This constructor creates a stream and initialises the underlying stream - * object. - * - * @param arg The argument to be passed to initialise the underlying stream. - * - * @param ctx The SSL context to be used for the stream. - */ - template <typename Arg> - stream(Arg&& arg, context& ctx) - : next_layer_(BOOST_ASIO_MOVE_CAST(Arg)(arg)), - core_(ctx.native_handle(), - next_layer_.lowest_layer().get_executor().context()) - { - } -#else // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - template <typename Arg> - stream(Arg& arg, context& ctx) - : next_layer_(arg), - core_(ctx.native_handle(), - next_layer_.lowest_layer().get_executor().context()) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destructor. - /** - * @note A @c stream object must not be destroyed while there are pending - * asynchronous operations associated with it. - */ - ~stream() - { - } - - /// Get the executor associated with the object. - /** - * This function may be used to obtain the executor object that the stream - * uses to dispatch handlers for asynchronous operations. - * - * @return A copy of the executor that stream will use to dispatch handlers. - */ - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return next_layer_.lowest_layer().get_executor(); - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - boost::asio::io_context& get_io_context() - { - return next_layer_.lowest_layer().get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - boost::asio::io_context& get_io_service() - { - return next_layer_.lowest_layer().get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the underlying implementation in the native type. - /** - * This function may be used to obtain the underlying implementation of the - * context. This is intended to allow access to context functionality that is - * not otherwise provided. - * - * @par Example - * The native_handle() function returns a pointer of type @c SSL* that is - * suitable for passing to functions such as @c SSL_get_verify_result and - * @c SSL_get_peer_certificate: - * @code - * boost::asio::ssl::stream<asio:ip::tcp::socket> sock(io_context, ctx); - * - * // ... establish connection and perform handshake ... - * - * if (X509* cert = SSL_get_peer_certificate(sock.native_handle())) - * { - * if (SSL_get_verify_result(sock.native_handle()) == X509_V_OK) - * { - * // ... - * } - * } - * @endcode - */ - native_handle_type native_handle() - { - return core_.engine_.native_handle(); - } - - /// Get a reference to the next layer. - /** - * This function returns a reference to the next layer in a stack of stream - * layers. - * - * @return A reference to the next layer in the stack of stream layers. - * Ownership is not transferred to the caller. - */ - const next_layer_type& next_layer() const - { - return next_layer_; - } - - /// Get a reference to the next layer. - /** - * This function returns a reference to the next layer in a stack of stream - * layers. - * - * @return A reference to the next layer in the stack of stream layers. - * Ownership is not transferred to the caller. - */ - next_layer_type& next_layer() - { - return next_layer_; - } - - /// Get a reference to the lowest layer. - /** - * This function returns a reference to the lowest layer in a stack of - * stream layers. - * - * @return A reference to the lowest layer in the stack of stream layers. - * Ownership is not transferred to the caller. - */ - lowest_layer_type& lowest_layer() - { - return next_layer_.lowest_layer(); - } - - /// Get a reference to the lowest layer. - /** - * This function returns a reference to the lowest layer in a stack of - * stream layers. - * - * @return A reference to the lowest layer in the stack of stream layers. - * Ownership is not transferred to the caller. - */ - const lowest_layer_type& lowest_layer() const - { - return next_layer_.lowest_layer(); - } - - /// Set the peer verification mode. - /** - * This function may be used to configure the peer verification mode used by - * the stream. The new mode will override the mode inherited from the context. - * - * @param v A bitmask of peer verification modes. See @ref verify_mode for - * available values. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_set_verify. - */ - void set_verify_mode(verify_mode v) - { - boost::system::error_code ec; - set_verify_mode(v, ec); - boost::asio::detail::throw_error(ec, "set_verify_mode"); - } - - /// Set the peer verification mode. - /** - * This function may be used to configure the peer verification mode used by - * the stream. The new mode will override the mode inherited from the context. - * - * @param v A bitmask of peer verification modes. See @ref verify_mode for - * available values. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_set_verify. - */ - BOOST_ASIO_SYNC_OP_VOID set_verify_mode( - verify_mode v, boost::system::error_code& ec) - { - core_.engine_.set_verify_mode(v, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Set the peer verification depth. - /** - * This function may be used to configure the maximum verification depth - * allowed by the stream. - * - * @param depth Maximum depth for the certificate chain verification that - * shall be allowed. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_set_verify_depth. - */ - void set_verify_depth(int depth) - { - boost::system::error_code ec; - set_verify_depth(depth, ec); - boost::asio::detail::throw_error(ec, "set_verify_depth"); - } - - /// Set the peer verification depth. - /** - * This function may be used to configure the maximum verification depth - * allowed by the stream. - * - * @param depth Maximum depth for the certificate chain verification that - * shall be allowed. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_set_verify_depth. - */ - BOOST_ASIO_SYNC_OP_VOID set_verify_depth( - int depth, boost::system::error_code& ec) - { - core_.engine_.set_verify_depth(depth, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Set the callback used to verify peer certificates. - /** - * This function is used to specify a callback function that will be called - * by the implementation when it needs to verify a peer certificate. - * - * @param callback The function object to be used for verifying a certificate. - * The function signature of the handler must be: - * @code bool verify_callback( - * bool preverified, // True if the certificate passed pre-verification. - * verify_context& ctx // The peer certificate and other context. - * ); @endcode - * The return value of the callback is true if the certificate has passed - * verification, false otherwise. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note Calls @c SSL_set_verify. - */ - template <typename VerifyCallback> - void set_verify_callback(VerifyCallback callback) - { - boost::system::error_code ec; - this->set_verify_callback(callback, ec); - boost::asio::detail::throw_error(ec, "set_verify_callback"); - } - - /// Set the callback used to verify peer certificates. - /** - * This function is used to specify a callback function that will be called - * by the implementation when it needs to verify a peer certificate. - * - * @param callback The function object to be used for verifying a certificate. - * The function signature of the handler must be: - * @code bool verify_callback( - * bool preverified, // True if the certificate passed pre-verification. - * verify_context& ctx // The peer certificate and other context. - * ); @endcode - * The return value of the callback is true if the certificate has passed - * verification, false otherwise. - * - * @param ec Set to indicate what error occurred, if any. - * - * @note Calls @c SSL_set_verify. - */ - template <typename VerifyCallback> - BOOST_ASIO_SYNC_OP_VOID set_verify_callback(VerifyCallback callback, - boost::system::error_code& ec) - { - core_.engine_.set_verify_callback( - new detail::verify_callback<VerifyCallback>(callback), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform SSL handshaking. - /** - * This function is used to perform SSL handshaking on the stream. The - * function call will block until handshaking is complete or an error occurs. - * - * @param type The type of handshaking to be performed, i.e. as a client or as - * a server. - * - * @throws boost::system::system_error Thrown on failure. - */ - void handshake(handshake_type type) - { - boost::system::error_code ec; - handshake(type, ec); - boost::asio::detail::throw_error(ec, "handshake"); - } - - /// Perform SSL handshaking. - /** - * This function is used to perform SSL handshaking on the stream. The - * function call will block until handshaking is complete or an error occurs. - * - * @param type The type of handshaking to be performed, i.e. as a client or as - * a server. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID handshake(handshake_type type, - boost::system::error_code& ec) - { - detail::io(next_layer_, core_, detail::handshake_op(type), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform SSL handshaking. - /** - * This function is used to perform SSL handshaking on the stream. The - * function call will block until handshaking is complete or an error occurs. - * - * @param type The type of handshaking to be performed, i.e. as a client or as - * a server. - * - * @param buffers The buffered data to be reused for the handshake. - * - * @throws boost::system::system_error Thrown on failure. - */ - template <typename ConstBufferSequence> - void handshake(handshake_type type, const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - handshake(type, buffers, ec); - boost::asio::detail::throw_error(ec, "handshake"); - } - - /// Perform SSL handshaking. - /** - * This function is used to perform SSL handshaking on the stream. The - * function call will block until handshaking is complete or an error occurs. - * - * @param type The type of handshaking to be performed, i.e. as a client or as - * a server. - * - * @param buffers The buffered data to be reused for the handshake. - * - * @param ec Set to indicate what error occurred, if any. - */ - template <typename ConstBufferSequence> - BOOST_ASIO_SYNC_OP_VOID handshake(handshake_type type, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - detail::io(next_layer_, core_, - detail::buffered_handshake_op<ConstBufferSequence>(type, buffers), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Start an asynchronous SSL handshake. - /** - * This function is used to asynchronously perform an SSL handshake on the - * stream. This function call always returns immediately. - * - * @param type The type of handshaking to be performed, i.e. as a client or as - * a server. - * - * @param handler The handler to be called when the handshake operation - * completes. Copies will be made of the handler as required. The equivalent - * function signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation. - * ); @endcode - */ - template <typename HandshakeHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, - void (boost::system::error_code)) - async_handshake(handshake_type type, - BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a HandshakeHandler. - BOOST_ASIO_HANDSHAKE_HANDLER_CHECK(HandshakeHandler, handler) type_check; - - boost::asio::async_completion<HandshakeHandler, - void (boost::system::error_code)> init(handler); - - detail::async_io(next_layer_, core_, - detail::handshake_op(type), init.completion_handler); - - return init.result.get(); - } - - /// Start an asynchronous SSL handshake. - /** - * This function is used to asynchronously perform an SSL handshake on the - * stream. This function call always returns immediately. - * - * @param type The type of handshaking to be performed, i.e. as a client or as - * a server. - * - * @param buffers The buffered data to be reused for the handshake. Although - * the buffers object may be copied as necessary, ownership of the underlying - * buffers is retained by the caller, which must guarantee that they remain - * valid until the handler is called. - * - * @param handler The handler to be called when the handshake operation - * completes. Copies will be made of the handler as required. The equivalent - * function signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Amount of buffers used in handshake. - * ); @endcode - */ - template <typename ConstBufferSequence, typename BufferedHandshakeHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler, - void (boost::system::error_code, std::size_t)) - async_handshake(handshake_type type, const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a BufferedHandshakeHandler. - BOOST_ASIO_BUFFERED_HANDSHAKE_HANDLER_CHECK( - BufferedHandshakeHandler, handler) type_check; - - boost::asio::async_completion<BufferedHandshakeHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::async_io(next_layer_, core_, - detail::buffered_handshake_op<ConstBufferSequence>(type, buffers), - init.completion_handler); - - return init.result.get(); - } - - /// Shut down SSL on the stream. - /** - * This function is used to shut down SSL on the stream. The function call - * will block until SSL has been shut down or an error occurs. - * - * @throws boost::system::system_error Thrown on failure. - */ - void shutdown() - { - boost::system::error_code ec; - shutdown(ec); - boost::asio::detail::throw_error(ec, "shutdown"); - } - - /// Shut down SSL on the stream. - /** - * This function is used to shut down SSL on the stream. The function call - * will block until SSL has been shut down or an error occurs. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID shutdown(boost::system::error_code& ec) - { - detail::io(next_layer_, core_, detail::shutdown_op(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Asynchronously shut down SSL on the stream. - /** - * This function is used to asynchronously shut down SSL on the stream. This - * function call always returns immediately. - * - * @param handler The handler to be called when the handshake operation - * completes. Copies will be made of the handler as required. The equivalent - * function signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation. - * ); @endcode - */ - template <typename ShutdownHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ShutdownHandler, - void (boost::system::error_code)) - async_shutdown(BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ShutdownHandler. - BOOST_ASIO_SHUTDOWN_HANDLER_CHECK(ShutdownHandler, handler) type_check; - - boost::asio::async_completion<ShutdownHandler, - void (boost::system::error_code)> init(handler); - - detail::async_io(next_layer_, core_, detail::shutdown_op(), - init.completion_handler); - - return init.result.get(); - } - - /// Write some data to the stream. - /** - * This function is used to write data on the stream. The function call will - * block until one or more bytes of data has been written successfully, or - * until an error occurs. - * - * @param buffers The data to be written. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that all - * data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t n = write_some(buffers, ec); - boost::asio::detail::throw_error(ec, "write_some"); - return n; - } - - /// Write some data to the stream. - /** - * This function is used to write data on the stream. The function call will - * block until one or more bytes of data has been written successfully, or - * until an error occurs. - * - * @param buffers The data to be written to the stream. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that all - * data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return detail::io(next_layer_, core_, - detail::write_op<ConstBufferSequence>(buffers), ec); - } - - /// Start an asynchronous write. - /** - * This function is used to asynchronously write one or more bytes of data to - * the stream. The function call always returns immediately. - * - * @param buffers The data to be written to the stream. Although the buffers - * object may be copied as necessary, ownership of the underlying buffers is - * retained by the caller, which must guarantee that they remain valid until - * the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The equivalent function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * - * @note The async_write_some operation may not transmit all of the data to - * 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 ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - boost::asio::async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::async_io(next_layer_, core_, - detail::write_op<ConstBufferSequence>(buffers), - init.completion_handler); - - return init.result.get(); - } - - /// Read some data from the stream. - /** - * This function is used to read data from the stream. The function call will - * block until one or more bytes of data has been read successfully, or until - * an error occurs. - * - * @param buffers The buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note The read_some operation may not read all of the requested number of - * 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t n = read_some(buffers, ec); - boost::asio::detail::throw_error(ec, "read_some"); - return n; - } - - /// Read some data from the stream. - /** - * This function is used to read data from the stream. The function call will - * block until one or more bytes of data has been read successfully, or until - * an error occurs. - * - * @param buffers The buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return detail::io(next_layer_, core_, - detail::read_op<MutableBufferSequence>(buffers), ec); - } - - /// Start an asynchronous read. - /** - * This function is used to asynchronously read one or more bytes of data from - * the stream. The function call always returns immediately. - * - * @param buffers The buffers into which the data will be read. Although the - * buffers object may be copied as necessary, ownership of the underlying - * buffers is retained by the caller, which must guarantee that they remain - * valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The equivalent function - * signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * - * @note The async_read_some operation may not read all of the requested - * number of bytes. Consider using the @ref async_read function if you need to - * ensure that the requested amount of data is read before the asynchronous - * operation completes. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - boost::asio::async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - detail::async_io(next_layer_, core_, - detail::read_op<MutableBufferSequence>(buffers), - init.completion_handler); - - return init.result.get(); - } - -private: - Stream next_layer_; - detail::stream_core core_; -}; - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_STREAM_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/stream_base.hpp b/contrib/restricted/boost/boost/asio/ssl/stream_base.hpp deleted file mode 100644 index 5847214894..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/stream_base.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// -// ssl/stream_base.hpp -// ~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_STREAM_BASE_HPP -#define BOOST_ASIO_SSL_STREAM_BASE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -/// The stream_base class is used as a base for the boost::asio::ssl::stream -/// class template so that we have a common place to define various enums. -class stream_base -{ -public: - /// Different handshake types. - enum handshake_type - { - /// Perform handshaking as a client. - client, - - /// Perform handshaking as a server. - server - }; - -protected: - /// Protected destructor to prevent deletion through this type. - ~stream_base() - { - } -}; - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_STREAM_BASE_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/verify_context.hpp b/contrib/restricted/boost/boost/asio/ssl/verify_context.hpp deleted file mode 100644 index c5fdaf4adb..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/verify_context.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// -// ssl/verify_context.hpp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP -#define BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/ssl/detail/openssl_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -/// A simple wrapper around the X509_STORE_CTX type, used during verification of -/// a peer certificate. -/** - * @note The verify_context does not own the underlying X509_STORE_CTX object. - */ -class verify_context - : private noncopyable -{ -public: - /// The native handle type of the verification context. - typedef X509_STORE_CTX* native_handle_type; - - /// Constructor. - explicit verify_context(native_handle_type handle) - : handle_(handle) - { - } - - /// Get the underlying implementation in the native type. - /** - * This function may be used to obtain the underlying implementation of the - * context. This is intended to allow access to context functionality that is - * not otherwise provided. - */ - native_handle_type native_handle() - { - return handle_; - } - -private: - // The underlying native implementation. - native_handle_type handle_; -}; - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP diff --git a/contrib/restricted/boost/boost/asio/ssl/verify_mode.hpp b/contrib/restricted/boost/boost/asio/ssl/verify_mode.hpp deleted file mode 100644 index 9ae6050442..0000000000 --- a/contrib/restricted/boost/boost/asio/ssl/verify_mode.hpp +++ /dev/null @@ -1,65 +0,0 @@ -// -// ssl/verify_mode.hpp -// ~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SSL_VERIFY_MODE_HPP -#define BOOST_ASIO_SSL_VERIFY_MODE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/ssl/detail/openssl_types.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace ssl { - -/// Bitmask type for peer verification. -/** - * Possible values are: - * - * @li @ref verify_none - * @li @ref verify_peer - * @li @ref verify_fail_if_no_peer_cert - * @li @ref verify_client_once - */ -typedef int verify_mode; - -#if defined(GENERATING_DOCUMENTATION) -/// No verification. -const int verify_none = implementation_defined; - -/// Verify the peer. -const int verify_peer = implementation_defined; - -/// Fail verification if the peer has no certificate. Ignored unless -/// @ref verify_peer is set. -const int verify_fail_if_no_peer_cert = implementation_defined; - -/// Do not request client certificate on renegotiation. Ignored unless -/// @ref verify_peer is set. -const int verify_client_once = implementation_defined; -#else -const int verify_none = SSL_VERIFY_NONE; -const int verify_peer = SSL_VERIFY_PEER; -const int verify_fail_if_no_peer_cert = SSL_VERIFY_FAIL_IF_NO_PEER_CERT; -const int verify_client_once = SSL_VERIFY_CLIENT_ONCE; -#endif - -} // namespace ssl -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_SSL_VERIFY_MODE_HPP diff --git a/contrib/restricted/boost/boost/asio/steady_timer.hpp b/contrib/restricted/boost/boost/asio/steady_timer.hpp deleted file mode 100644 index ab30b9c8fd..0000000000 --- a/contrib/restricted/boost/boost/asio/steady_timer.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// steady_timer.hpp -// ~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_STEADY_TIMER_HPP -#define BOOST_ASIO_STEADY_TIMER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/basic_waitable_timer.hpp> -#include <boost/asio/detail/chrono.hpp> - -namespace boost { -namespace asio { - -/// Typedef for a timer based on the steady clock. -/** - * This typedef uses the C++11 @c <chrono> standard library facility, if - * available. Otherwise, it may use the Boost.Chrono library. To explicitly - * utilise Boost.Chrono, use the basic_waitable_timer template directly: - * @code - * typedef basic_waitable_timer<boost::chrono::steady_clock> timer; - * @endcode - */ -typedef basic_waitable_timer<chrono::steady_clock> steady_timer; - -} // namespace asio -} // namespace boost - -#endif // defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_STEADY_TIMER_HPP diff --git a/contrib/restricted/boost/boost/asio/strand.hpp b/contrib/restricted/boost/boost/asio/strand.hpp deleted file mode 100644 index b82e988fe4..0000000000 --- a/contrib/restricted/boost/boost/asio/strand.hpp +++ /dev/null @@ -1,288 +0,0 @@ -// -// strand.hpp -// ~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_STRAND_HPP -#define BOOST_ASIO_STRAND_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/strand_executor_service.hpp> -#include <boost/asio/detail/type_traits.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Provides serialised function invocation for any executor type. -template <typename Executor> -class strand -{ -public: - /// The type of the underlying executor. - typedef Executor inner_executor_type; - - /// Default constructor. - /** - * This constructor is only valid if the underlying executor type is default - * constructible. - */ - strand() - : executor_(), - impl_(use_service<detail::strand_executor_service>( - executor_.context()).create_implementation()) - { - } - - /// Construct a strand for the specified executor. - explicit strand(const Executor& e) - : executor_(e), - impl_(use_service<detail::strand_executor_service>( - executor_.context()).create_implementation()) - { - } - - /// Copy constructor. - strand(const strand& other) BOOST_ASIO_NOEXCEPT - : executor_(other.executor_), - impl_(other.impl_) - { - } - - /// Converting constructor. - /** - * This constructor is only valid if the @c OtherExecutor type is convertible - * to @c Executor. - */ - template <class OtherExecutor> - strand( - const strand<OtherExecutor>& other) BOOST_ASIO_NOEXCEPT - : executor_(other.executor_), - impl_(other.impl_) - { - } - - /// Assignment operator. - strand& operator=(const strand& other) BOOST_ASIO_NOEXCEPT - { - executor_ = other.executor_; - impl_ = other.impl_; - return *this; - } - - /// Converting assignment operator. - /** - * This assignment operator is only valid if the @c OtherExecutor type is - * convertible to @c Executor. - */ - template <class OtherExecutor> - strand& operator=( - const strand<OtherExecutor>& other) BOOST_ASIO_NOEXCEPT - { - executor_ = other.executor_; - impl_ = other.impl_; - return *this; - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move constructor. - strand(strand&& other) BOOST_ASIO_NOEXCEPT - : executor_(BOOST_ASIO_MOVE_CAST(Executor)(other.executor_)), - impl_(BOOST_ASIO_MOVE_CAST(implementation_type)(other.impl_)) - { - } - - /// Converting move constructor. - /** - * This constructor is only valid if the @c OtherExecutor type is convertible - * to @c Executor. - */ - template <class OtherExecutor> - strand(strand<OtherExecutor>&& other) BOOST_ASIO_NOEXCEPT - : executor_(BOOST_ASIO_MOVE_CAST(OtherExecutor)(other)), - impl_(BOOST_ASIO_MOVE_CAST(implementation_type)(other.impl_)) - { - } - - /// Move assignment operator. - strand& operator=(strand&& other) BOOST_ASIO_NOEXCEPT - { - executor_ = BOOST_ASIO_MOVE_CAST(Executor)(other); - impl_ = BOOST_ASIO_MOVE_CAST(implementation_type)(other.impl_); - return *this; - } - - /// Converting move assignment operator. - /** - * This assignment operator is only valid if the @c OtherExecutor type is - * convertible to @c Executor. - */ - template <class OtherExecutor> - strand& operator=( - const strand<OtherExecutor>&& other) BOOST_ASIO_NOEXCEPT - { - executor_ = BOOST_ASIO_MOVE_CAST(OtherExecutor)(other); - impl_ = BOOST_ASIO_MOVE_CAST(implementation_type)(other.impl_); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destructor. - ~strand() - { - } - - /// Obtain the underlying executor. - inner_executor_type get_inner_executor() const BOOST_ASIO_NOEXCEPT - { - return executor_; - } - - /// Obtain the underlying execution context. - execution_context& context() const BOOST_ASIO_NOEXCEPT - { - return executor_.context(); - } - - /// Inform the strand that it has some outstanding work to do. - /** - * The strand delegates this call to its underlying executor. - */ - void on_work_started() const BOOST_ASIO_NOEXCEPT - { - executor_.on_work_started(); - } - - /// Inform the strand that some work is no longer outstanding. - /** - * The strand delegates this call to its underlying executor. - */ - void on_work_finished() const BOOST_ASIO_NOEXCEPT - { - executor_.on_work_finished(); - } - - /// Request the strand to invoke the given function object. - /** - * This function is used to ask the strand to execute the given function - * object on its underlying executor. The function object will be executed - * inside this function if the strand is not otherwise busy and if the - * underlying executor's @c dispatch() function is also able to execute the - * function before returning. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template <typename Function, typename Allocator> - void dispatch(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const - { - detail::strand_executor_service::dispatch(impl_, - executor_, BOOST_ASIO_MOVE_CAST(Function)(f), a); - } - - /// Request the strand to invoke the given function object. - /** - * This function is used to ask the executor to execute the given function - * object. The function object will never be executed inside this function. - * Instead, it will be scheduled by the underlying executor's defer function. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template <typename Function, typename Allocator> - void post(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const - { - detail::strand_executor_service::post(impl_, - executor_, BOOST_ASIO_MOVE_CAST(Function)(f), a); - } - - /// Request the strand to invoke the given function object. - /** - * This function is used to ask the executor to execute the given function - * object. The function object will never be executed inside this function. - * Instead, it will be scheduled by the underlying executor's defer function. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template <typename Function, typename Allocator> - void defer(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const - { - detail::strand_executor_service::defer(impl_, - executor_, BOOST_ASIO_MOVE_CAST(Function)(f), a); - } - - /// Determine whether the strand is running in the current thread. - /** - * @return @c true if the current thread is executing a function that was - * submitted to the strand using post(), dispatch() or defer(). Otherwise - * returns @c false. - */ - bool running_in_this_thread() const BOOST_ASIO_NOEXCEPT - { - return detail::strand_executor_service::running_in_this_thread(impl_); - } - - /// Compare two strands for equality. - /** - * Two strands are equal if they refer to the same ordered, non-concurrent - * state. - */ - friend bool operator==(const strand& a, const strand& b) BOOST_ASIO_NOEXCEPT - { - return a.impl_ == b.impl_; - } - - /// Compare two strands for inequality. - /** - * Two strands are equal if they refer to the same ordered, non-concurrent - * state. - */ - friend bool operator!=(const strand& a, const strand& b) BOOST_ASIO_NOEXCEPT - { - return a.impl_ != b.impl_; - } - -private: - Executor executor_; - typedef detail::strand_executor_service::implementation_type - implementation_type; - implementation_type impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -// If both io_context.hpp and strand.hpp have been included, automatically -// include the header file needed for the io_context::strand class. -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -# if defined(BOOST_ASIO_IO_CONTEXT_HPP) -# include <boost/asio/io_context_strand.hpp> -# endif // defined(BOOST_ASIO_IO_CONTEXT_HPP) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -#endif // BOOST_ASIO_STRAND_HPP diff --git a/contrib/restricted/boost/boost/asio/stream_socket_service.hpp b/contrib/restricted/boost/boost/asio/stream_socket_service.hpp deleted file mode 100644 index 04159ea66f..0000000000 --- a/contrib/restricted/boost/boost/asio/stream_socket_service.hpp +++ /dev/null @@ -1,414 +0,0 @@ -// -// stream_socket_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_STREAM_SOCKET_SERVICE_HPP -#define BOOST_ASIO_STREAM_SOCKET_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) -# include <boost/asio/detail/winrt_ssocket_service.hpp> -#elif defined(BOOST_ASIO_HAS_IOCP) -# include <boost/asio/detail/win_iocp_socket_service.hpp> -#else -# include <boost/asio/detail/reactive_socket_service.hpp> -#endif - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Default service implementation for a stream socket. -template <typename Protocol> -class stream_socket_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base<stream_socket_service<Protocol> > -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - - /// The protocol type. - typedef Protocol protocol_type; - - /// The endpoint type. - typedef typename Protocol::endpoint endpoint_type; - -private: - // The type of the platform-specific implementation. -#if defined(BOOST_ASIO_WINDOWS_RUNTIME) - typedef detail::winrt_ssocket_service<Protocol> service_impl_type; -#elif defined(BOOST_ASIO_HAS_IOCP) - typedef detail::win_iocp_socket_service<Protocol> service_impl_type; -#else - typedef detail::reactive_socket_service<Protocol> service_impl_type; -#endif - -public: - /// The type of a stream socket implementation. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef typename service_impl_type::implementation_type implementation_type; -#endif - - /// The native socket type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef typename service_impl_type::native_handle_type native_handle_type; -#endif - - /// Construct a new stream socket service for the specified io_context. - explicit stream_socket_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base< - stream_socket_service<Protocol> >(io_context), - service_impl_(io_context) - { - } - - /// Construct a new stream socket implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new stream socket implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another stream socket implementation. - void move_assign(implementation_type& impl, - stream_socket_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } - - // All socket services have access to each other's implementations. - template <typename Protocol1> friend class stream_socket_service; - - /// Move-construct a new stream socket implementation from another protocol - /// type. - template <typename Protocol1> - void converting_move_construct(implementation_type& impl, - stream_socket_service<Protocol1>& other_service, - typename stream_socket_service< - Protocol1>::implementation_type& other_impl, - typename enable_if<is_convertible< - Protocol1, Protocol>::value>::type* = 0) - { - service_impl_.template converting_move_construct<Protocol1>( - impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroy a stream socket implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Open a stream socket. - BOOST_ASIO_SYNC_OP_VOID open(implementation_type& impl, - const protocol_type& protocol, boost::system::error_code& ec) - { - if (protocol.type() == BOOST_ASIO_OS_DEF(SOCK_STREAM)) - service_impl_.open(impl, protocol, ec); - else - ec = boost::asio::error::invalid_argument; - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Assign an existing native socket to a stream socket. - BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, - const protocol_type& protocol, const native_handle_type& native_socket, - boost::system::error_code& ec) - { - service_impl_.assign(impl, protocol, native_socket, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the socket is open. - bool is_open(const implementation_type& impl) const - { - return service_impl_.is_open(impl); - } - - /// Close a stream socket implementation. - BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.close(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Release ownership of the underlying socket. - native_handle_type release(implementation_type& impl, - boost::system::error_code& ec) - { - return service_impl_.release(impl, ec); - } - - /// Get the native socket implementation. - native_handle_type native_handle(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - - /// Cancel all asynchronous operations associated with the socket. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the socket is at the out-of-band data mark. - bool at_mark(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.at_mark(impl, ec); - } - - /// Determine the number of bytes available for reading. - std::size_t available(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.available(impl, ec); - } - - /// Bind the stream socket to the specified local endpoint. - BOOST_ASIO_SYNC_OP_VOID bind(implementation_type& impl, - const endpoint_type& endpoint, boost::system::error_code& ec) - { - service_impl_.bind(impl, endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Connect the stream socket to the specified endpoint. - BOOST_ASIO_SYNC_OP_VOID connect(implementation_type& impl, - const endpoint_type& peer_endpoint, boost::system::error_code& ec) - { - service_impl_.connect(impl, peer_endpoint, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Start an asynchronous connect. - template <typename ConnectHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ConnectHandler, - void (boost::system::error_code)) - async_connect(implementation_type& impl, - const endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) - { - async_completion<ConnectHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_connect(impl, peer_endpoint, init.completion_handler); - - return init.result.get(); - } - - /// Set a socket option. - template <typename SettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID set_option(implementation_type& impl, - const SettableSocketOption& option, boost::system::error_code& ec) - { - service_impl_.set_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get a socket option. - template <typename GettableSocketOption> - BOOST_ASIO_SYNC_OP_VOID get_option(const implementation_type& impl, - GettableSocketOption& option, boost::system::error_code& ec) const - { - service_impl_.get_option(impl, option, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform an IO control command on the socket. - template <typename IoControlCommand> - BOOST_ASIO_SYNC_OP_VOID io_control(implementation_type& impl, - IoControlCommand& command, boost::system::error_code& ec) - { - service_impl_.io_control(impl, command, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the socket. - bool non_blocking(const implementation_type& impl) const - { - return service_impl_.non_blocking(impl); - } - - /// Sets the non-blocking mode of the socket. - BOOST_ASIO_SYNC_OP_VOID non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Gets the non-blocking mode of the native socket implementation. - bool native_non_blocking(const implementation_type& impl) const - { - return service_impl_.native_non_blocking(impl); - } - - /// Sets the non-blocking mode of the native socket implementation. - BOOST_ASIO_SYNC_OP_VOID native_non_blocking(implementation_type& impl, - bool mode, boost::system::error_code& ec) - { - service_impl_.native_non_blocking(impl, mode, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the local endpoint. - endpoint_type local_endpoint(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.local_endpoint(impl, ec); - } - - /// Get the remote endpoint. - endpoint_type remote_endpoint(const implementation_type& impl, - boost::system::error_code& ec) const - { - return service_impl_.remote_endpoint(impl, ec); - } - - /// Disable sends or receives on the socket. - BOOST_ASIO_SYNC_OP_VOID shutdown(implementation_type& impl, - socket_base::shutdown_type what, boost::system::error_code& ec) - { - service_impl_.shutdown(impl, what, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Wait for the socket to become ready to read, ready to write, or to have - /// pending error conditions. - BOOST_ASIO_SYNC_OP_VOID wait(implementation_type& impl, - socket_base::wait_type w, boost::system::error_code& ec) - { - service_impl_.wait(impl, w, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Asynchronously wait for the socket to become ready to read, ready to - /// write, or to have pending error conditions. - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(implementation_type& impl, socket_base::wait_type w, - BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_wait(impl, w, init.completion_handler); - - return init.result.get(); - } - - /// Send the given data to the peer. - template <typename ConstBufferSequence> - std::size_t send(implementation_type& impl, - const ConstBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return service_impl_.send(impl, buffers, flags, ec); - } - - /// Start an asynchronous send. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_send(implementation_type& impl, - const ConstBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_send(impl, buffers, flags, init.completion_handler); - - return init.result.get(); - } - - /// Receive some data from the peer. - template <typename MutableBufferSequence> - std::size_t receive(implementation_type& impl, - const MutableBufferSequence& buffers, - socket_base::message_flags flags, boost::system::error_code& ec) - { - return service_impl_.receive(impl, buffers, flags, ec); - } - - /// Start an asynchronous receive. - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_receive(implementation_type& impl, - const MutableBufferSequence& buffers, - socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_receive(impl, buffers, flags, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_STREAM_SOCKET_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/streambuf.hpp b/contrib/restricted/boost/boost/asio/streambuf.hpp deleted file mode 100644 index 737a631151..0000000000 --- a/contrib/restricted/boost/boost/asio/streambuf.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// -// streambuf.hpp -// ~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_STREAMBUF_HPP -#define BOOST_ASIO_STREAMBUF_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -#include <boost/asio/basic_streambuf.hpp> - -namespace boost { -namespace asio { - -/// Typedef for the typical usage of basic_streambuf. -typedef basic_streambuf<> streambuf; - -} // namespace asio -} // namespace boost - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) - -#endif // BOOST_ASIO_STREAMBUF_HPP diff --git a/contrib/restricted/boost/boost/asio/system_timer.hpp b/contrib/restricted/boost/boost/asio/system_timer.hpp deleted file mode 100644 index c2ff9947b9..0000000000 --- a/contrib/restricted/boost/boost/asio/system_timer.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// system_timer.hpp -// ~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_SYSTEM_TIMER_HPP -#define BOOST_ASIO_SYSTEM_TIMER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/basic_waitable_timer.hpp> -#include <boost/asio/detail/chrono.hpp> - -namespace boost { -namespace asio { - -/// Typedef for a timer based on the system clock. -/** - * This typedef uses the C++11 @c <chrono> standard library facility, if - * available. Otherwise, it may use the Boost.Chrono library. To explicitly - * utilise Boost.Chrono, use the basic_waitable_timer template directly: - * @code - * typedef basic_waitable_timer<boost::chrono::system_clock> timer; - * @endcode - */ -typedef basic_waitable_timer<chrono::system_clock> system_timer; - -} // namespace asio -} // namespace boost - -#endif // defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_SYSTEM_TIMER_HPP diff --git a/contrib/restricted/boost/boost/asio/thread_pool.hpp b/contrib/restricted/boost/boost/asio/thread_pool.hpp deleted file mode 100644 index e959a645c6..0000000000 --- a/contrib/restricted/boost/boost/asio/thread_pool.hpp +++ /dev/null @@ -1,234 +0,0 @@ -// -// thread_pool.hpp -// ~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_THREAD_POOL_HPP -#define BOOST_ASIO_THREAD_POOL_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/scheduler.hpp> -#include <boost/asio/detail/thread_group.hpp> -#include <boost/asio/execution_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// A simple fixed-size thread pool. -/** - * The thread pool class is an execution context where functions are permitted - * to run on one of a fixed number of threads. - * - * @par Submitting tasks to the pool - * - * To submit functions to the io_context, use the @ref boost::asio::dispatch, - * @ref boost::asio::post or @ref boost::asio::defer free functions. - * - * For example: - * - * @code void my_task() - * { - * ... - * } - * - * ... - * - * // Launch the pool with four threads. - * boost::asio::thread_pool pool(4); - * - * // Submit a function to the pool. - * boost::asio::post(pool, my_task); - * - * // Submit a lambda object to the pool. - * boost::asio::post(pool, - * []() - * { - * ... - * }); - * - * // Wait for all tasks in the pool to complete. - * pool.join(); @endcode - */ -class thread_pool - : public execution_context -{ -public: - class executor_type; - - /// Constructs a pool with an automatically determined number of threads. - BOOST_ASIO_DECL thread_pool(); - - /// Constructs a pool with a specified number of threads. - BOOST_ASIO_DECL thread_pool(std::size_t num_threads); - - /// Destructor. - /** - * Automatically stops and joins the pool, if not explicitly done beforehand. - */ - BOOST_ASIO_DECL ~thread_pool(); - - /// Obtains the executor associated with the pool. - executor_type get_executor() BOOST_ASIO_NOEXCEPT; - - /// Stops the threads. - /** - * This function stops the threads as soon as possible. As a result of calling - * @c stop(), pending function objects may be never be invoked. - */ - BOOST_ASIO_DECL void stop(); - - /// Joins the threads. - /** - * This function blocks until the threads in the pool have completed. If @c - * stop() is not called prior to @c join(), the @c join() call will wait - * until the pool has no more outstanding work. - */ - BOOST_ASIO_DECL void join(); - -private: - friend class executor_type; - struct thread_function; - - // The underlying scheduler. - detail::scheduler& scheduler_; - - // The threads in the pool. - detail::thread_group threads_; -}; - -/// Executor used to submit functions to a thread pool. -class thread_pool::executor_type -{ -public: - /// Obtain the underlying execution context. - thread_pool& context() const BOOST_ASIO_NOEXCEPT; - - /// Inform the thread pool that it has some outstanding work to do. - /** - * This function is used to inform the thread pool that some work has begun. - * This ensures that the thread pool's join() function will not return while - * the work is underway. - */ - void on_work_started() const BOOST_ASIO_NOEXCEPT; - - /// Inform the thread pool that some work is no longer outstanding. - /** - * This function is used to inform the thread pool that some work has - * finished. Once the count of unfinished work reaches zero, the thread - * pool's join() function is permitted to exit. - */ - void on_work_finished() const BOOST_ASIO_NOEXCEPT; - - /// Request the thread pool to invoke the given function object. - /** - * This function is used to ask the thread pool to execute the given function - * object. If the current thread belongs to the pool, @c dispatch() executes - * the function before returning. Otherwise, the function will be scheduled - * to run on the thread pool. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template <typename Function, typename Allocator> - void dispatch(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const; - - /// Request the thread pool to invoke the given function object. - /** - * This function is used to ask the thread pool to execute the given function - * object. The function object will never be executed inside @c post(). - * Instead, it will be scheduled to run on the thread pool. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template <typename Function, typename Allocator> - void post(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const; - - /// Request the thread pool to invoke the given function object. - /** - * This function is used to ask the thread pool to execute the given function - * object. The function object will never be executed inside @c defer(). - * Instead, it will be scheduled to run on the thread pool. - * - * If the current thread belongs to the thread pool, @c defer() will delay - * scheduling the function object until the current thread returns control to - * the pool. - * - * @param f The function object to be called. The executor will make - * a copy of the handler object as required. The function signature of the - * function object must be: @code void function(); @endcode - * - * @param a An allocator that may be used by the executor to allocate the - * internal storage needed for function invocation. - */ - template <typename Function, typename Allocator> - void defer(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const; - - /// Determine whether the thread pool is running in the current thread. - /** - * @return @c true if the current thread belongs to the pool. Otherwise - * returns @c false. - */ - bool running_in_this_thread() const BOOST_ASIO_NOEXCEPT; - - /// Compare two executors for equality. - /** - * Two executors are equal if they refer to the same underlying thread pool. - */ - friend bool operator==(const executor_type& a, - const executor_type& b) BOOST_ASIO_NOEXCEPT - { - return &a.pool_ == &b.pool_; - } - - /// Compare two executors for inequality. - /** - * Two executors are equal if they refer to the same underlying thread pool. - */ - friend bool operator!=(const executor_type& a, - const executor_type& b) BOOST_ASIO_NOEXCEPT - { - return &a.pool_ != &b.pool_; - } - -private: - friend class thread_pool; - - // Constructor. - explicit executor_type(thread_pool& p) : pool_(p) {} - - // The underlying thread pool. - thread_pool& pool_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/thread_pool.hpp> -#if defined(BOOST_ASIO_HEADER_ONLY) -# include <boost/asio/impl/thread_pool.ipp> -#endif // defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_THREAD_POOL_HPP diff --git a/contrib/restricted/boost/boost/asio/ts/buffer.hpp b/contrib/restricted/boost/boost/asio/ts/buffer.hpp deleted file mode 100644 index 2774935f1b..0000000000 --- a/contrib/restricted/boost/boost/asio/ts/buffer.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// ts/buffer.hpp -// ~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_TS_BUFFER_HPP -#define BOOST_ASIO_TS_BUFFER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/buffer.hpp> -#include <boost/asio/completion_condition.hpp> -#include <boost/asio/read.hpp> -#include <boost/asio/write.hpp> -#include <boost/asio/read_until.hpp> - -#endif // BOOST_ASIO_TS_BUFFER_HPP diff --git a/contrib/restricted/boost/boost/asio/ts/executor.hpp b/contrib/restricted/boost/boost/asio/ts/executor.hpp deleted file mode 100644 index df52817a35..0000000000 --- a/contrib/restricted/boost/boost/asio/ts/executor.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// -// ts/executor.hpp -// ~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_TS_EXECUTOR_HPP -#define BOOST_ASIO_TS_EXECUTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/handler_type.hpp> -#include <boost/asio/async_result.hpp> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/execution_context.hpp> -#include <boost/asio/is_executor.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/bind_executor.hpp> -#include <boost/asio/executor_work_guard.hpp> -#include <boost/asio/system_executor.hpp> -#include <boost/asio/executor.hpp> -#include <boost/asio/dispatch.hpp> -#include <boost/asio/post.hpp> -#include <boost/asio/defer.hpp> -#include <boost/asio/strand.hpp> -#include <boost/asio/packaged_task.hpp> -#include <boost/asio/use_future.hpp> - -#endif // BOOST_ASIO_TS_EXECUTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/ts/internet.hpp b/contrib/restricted/boost/boost/asio/ts/internet.hpp deleted file mode 100644 index 7448015734..0000000000 --- a/contrib/restricted/boost/boost/asio/ts/internet.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// ts/internet.hpp -// ~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_TS_INTERNET_HPP -#define BOOST_ASIO_TS_INTERNET_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/ip/address.hpp> -#include <boost/asio/ip/address_v4.hpp> -#include <boost/asio/ip/address_v4_iterator.hpp> -#include <boost/asio/ip/address_v4_range.hpp> -#include <boost/asio/ip/address_v6.hpp> -#include <boost/asio/ip/address_v6_iterator.hpp> -#include <boost/asio/ip/address_v6_range.hpp> -#include <boost/asio/ip/bad_address_cast.hpp> -#include <boost/asio/ip/basic_endpoint.hpp> -#include <boost/asio/ip/basic_resolver_query.hpp> -#include <boost/asio/ip/basic_resolver_entry.hpp> -#include <boost/asio/ip/basic_resolver_iterator.hpp> -#include <boost/asio/ip/basic_resolver.hpp> -#include <boost/asio/ip/host_name.hpp> -#include <boost/asio/ip/network_v4.hpp> -#include <boost/asio/ip/network_v6.hpp> -#include <boost/asio/ip/tcp.hpp> -#include <boost/asio/ip/udp.hpp> -#include <boost/asio/ip/v6_only.hpp> -#include <boost/asio/ip/unicast.hpp> -#include <boost/asio/ip/multicast.hpp> - -#endif // BOOST_ASIO_TS_INTERNET_HPP diff --git a/contrib/restricted/boost/boost/asio/ts/io_context.hpp b/contrib/restricted/boost/boost/asio/ts/io_context.hpp deleted file mode 100644 index aea646cc4a..0000000000 --- a/contrib/restricted/boost/boost/asio/ts/io_context.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// ts/io_context.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_TS_IO_CONTEXT_HPP -#define BOOST_ASIO_TS_IO_CONTEXT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/io_context.hpp> - -#endif // BOOST_ASIO_TS_IO_CONTEXT_HPP diff --git a/contrib/restricted/boost/boost/asio/ts/net.hpp b/contrib/restricted/boost/boost/asio/ts/net.hpp deleted file mode 100644 index dbac252849..0000000000 --- a/contrib/restricted/boost/boost/asio/ts/net.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// ts/net.hpp -// ~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_TS_NET_HPP -#define BOOST_ASIO_TS_NET_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/ts/netfwd.hpp> -#include <boost/asio/ts/executor.hpp> -#include <boost/asio/ts/io_context.hpp> -#include <boost/asio/ts/timer.hpp> -#include <boost/asio/ts/buffer.hpp> -#include <boost/asio/ts/socket.hpp> -#include <boost/asio/ts/internet.hpp> - -#endif // BOOST_ASIO_TS_NET_HPP diff --git a/contrib/restricted/boost/boost/asio/ts/netfwd.hpp b/contrib/restricted/boost/boost/asio/ts/netfwd.hpp deleted file mode 100644 index 10800baea4..0000000000 --- a/contrib/restricted/boost/boost/asio/ts/netfwd.hpp +++ /dev/null @@ -1,199 +0,0 @@ -// -// ts/netfwd.hpp -// ~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_TS_NETFWD_HPP -#define BOOST_ASIO_TS_NETFWD_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_CHRONO) -# include <boost/asio/detail/chrono.hpp> -#endif // defined(BOOST_ASIO_HAS_CHRONO) - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) -# include <boost/asio/detail/date_time_fwd.hpp> -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - -#if !defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -class execution_context; - -template <typename T, typename Executor> -class executor_binder; - -template <typename Executor> -class executor_work_guard; - -class system_executor; - -class executor; - -template <typename Executor> -class strand; - -class io_context; - -template <typename Clock> -struct wait_traits; - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - -template <typename Time> -struct time_traits; - -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -template <typename Clock, typename WaitTraits> -class waitable_timer_service; - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - -template <typename TimeType, typename TimeTraits> -class deadline_timer_service; - -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL) -#define BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL - -template <typename Clock, - typename WaitTraits = boost::asio::wait_traits<Clock> - BOOST_ASIO_SVC_TPARAM_DEF2(= waitable_timer_service<Clock, WaitTraits>)> -class basic_waitable_timer; - -#endif // !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL) - -#if defined(BOOST_ASIO_HAS_CHRONO) - -typedef basic_waitable_timer<chrono::system_clock> system_timer; - -typedef basic_waitable_timer<chrono::steady_clock> steady_timer; - -typedef basic_waitable_timer<chrono::high_resolution_clock> - high_resolution_timer; - -#endif // defined(BOOST_ASIO_HAS_CHRONO) - -template <class Protocol BOOST_ASIO_SVC_TPARAM> -class basic_socket; - -template <typename Protocol BOOST_ASIO_SVC_TPARAM> -class basic_datagram_socket; - -template <typename Protocol BOOST_ASIO_SVC_TPARAM> -class basic_stream_socket; - -template <typename Protocol BOOST_ASIO_SVC_TPARAM> -class basic_socket_acceptor; - -#if !defined(BOOST_ASIO_BASIC_SOCKET_STREAMBUF_FWD_DECL) -#define BOOST_ASIO_BASIC_SOCKET_STREAMBUF_FWD_DECL - -// Forward declaration with defaulted arguments. -template <typename Protocol - BOOST_ASIO_SVC_TPARAM_DEF1(= stream_socket_service<Protocol>), -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - || defined(GENERATING_DOCUMENTATION) - typename Clock = boost::posix_time::ptime, - typename WaitTraits = time_traits<Clock> - BOOST_ASIO_SVC_TPARAM1_DEF2(= deadline_timer_service<Clock, WaitTraits>)> -#else - typename Clock = chrono::steady_clock, - typename WaitTraits = wait_traits<Clock> - BOOST_ASIO_SVC_TPARAM1_DEF1(= steady_timer::service_type)> -#endif -class basic_socket_streambuf; - -#endif // !defined(BOOST_ASIO_BASIC_SOCKET_STREAMBUF_FWD_DECL) - -#if !defined(BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL) -#define BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL - -// Forward declaration with defaulted arguments. -template <typename Protocol - BOOST_ASIO_SVC_TPARAM_DEF1(= stream_socket_service<Protocol>), -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - || defined(GENERATING_DOCUMENTATION) - typename Clock = boost::posix_time::ptime, - typename WaitTraits = time_traits<Clock> - BOOST_ASIO_SVC_TPARAM1_DEF2(= deadline_timer_service<Clock, WaitTraits>)> -#else - typename Clock = chrono::steady_clock, - typename WaitTraits = wait_traits<Clock> - BOOST_ASIO_SVC_TPARAM1_DEF1(= steady_timer::service_type)> -#endif -class basic_socket_iostream; - -#endif // !defined(BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL) - -namespace ip { - -class address; - -class address_v4; - -class address_v6; - -template <typename Address> -class basic_address_iterator; - -typedef basic_address_iterator<address_v4> address_v4_iterator; - -typedef basic_address_iterator<address_v6> address_v6_iterator; - -template <typename Address> -class basic_address_range; - -typedef basic_address_range<address_v4> address_v4_range; - -typedef basic_address_range<address_v6> address_v6_range; - -class network_v4; - -class network_v6; - -template <typename InternetProtocol> -class basic_endpoint; - -template <typename InternetProtocol> -class basic_resolver_entry; - -template <typename InternetProtocol> -class basic_resolver_results; - -template <typename InternetProtocol BOOST_ASIO_SVC_TPARAM> -class basic_resolver; - -class tcp; - -class udp; - -} // namespace ip -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // !defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_TS_NETFWD_HPP diff --git a/contrib/restricted/boost/boost/asio/ts/socket.hpp b/contrib/restricted/boost/boost/asio/ts/socket.hpp deleted file mode 100644 index 01e6855332..0000000000 --- a/contrib/restricted/boost/boost/asio/ts/socket.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// -// ts/socket.hpp -// ~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_TS_SOCKET_HPP -#define BOOST_ASIO_TS_SOCKET_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/socket_base.hpp> -#include <boost/asio/basic_socket.hpp> -#include <boost/asio/basic_datagram_socket.hpp> -#include <boost/asio/basic_stream_socket.hpp> -#include <boost/asio/basic_socket_acceptor.hpp> -#include <boost/asio/basic_socket_streambuf.hpp> -#include <boost/asio/basic_socket_iostream.hpp> -#include <boost/asio/connect.hpp> - -#endif // BOOST_ASIO_TS_SOCKET_HPP diff --git a/contrib/restricted/boost/boost/asio/ts/timer.hpp b/contrib/restricted/boost/boost/asio/ts/timer.hpp deleted file mode 100644 index adc6bf99c4..0000000000 --- a/contrib/restricted/boost/boost/asio/ts/timer.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// ts/timer.hpp -// ~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_TS_TIMER_HPP -#define BOOST_ASIO_TS_TIMER_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/chrono.hpp> - -#include <boost/asio/wait_traits.hpp> -#include <boost/asio/basic_waitable_timer.hpp> -#include <boost/asio/system_timer.hpp> -#include <boost/asio/steady_timer.hpp> -#include <boost/asio/high_resolution_timer.hpp> - -#endif // BOOST_ASIO_TS_TIMER_HPP diff --git a/contrib/restricted/boost/boost/asio/unyield.hpp b/contrib/restricted/boost/boost/asio/unyield.hpp deleted file mode 100644 index de3ed0275e..0000000000 --- a/contrib/restricted/boost/boost/asio/unyield.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// unyield.hpp -// ~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifdef reenter -# undef reenter -#endif - -#ifdef yield -# undef yield -#endif - -#ifdef fork -# undef fork -#endif diff --git a/contrib/restricted/boost/boost/asio/use_future.hpp b/contrib/restricted/boost/boost/asio/use_future.hpp deleted file mode 100644 index b2d65a6d0c..0000000000 --- a/contrib/restricted/boost/boost/asio/use_future.hpp +++ /dev/null @@ -1,161 +0,0 @@ -// -// use_future.hpp -// ~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_USE_FUTURE_HPP -#define BOOST_ASIO_USE_FUTURE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_STD_FUTURE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <memory> -#include <boost/asio/detail/type_traits.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -template <typename Function, typename Allocator> -class packaged_token; - -template <typename Function, typename Allocator, typename Result> -class packaged_handler; - -} // namespace detail - -/// Class used to specify that an asynchronous operation should return a future. -/** - * The use_future_t class is used to indicate that an asynchronous operation - * should return a std::future object. A use_future_t object may be passed as a - * handler to an asynchronous operation, typically using the special value @c - * boost::asio::use_future. For example: - * - * @code std::future<std::size_t> my_future - * = my_socket.async_read_some(my_buffer, boost::asio::use_future); @endcode - * - * The initiating function (async_read_some in the above example) returns a - * future that will receive the result of the operation. If the operation - * completes with an error_code indicating failure, it is converted into a - * system_error and passed back to the caller via the future. - */ -template <typename Allocator = std::allocator<void> > -class use_future_t -{ -public: - /// The allocator type. The allocator is used when constructing the - /// @c std::promise object for a given asynchronous operation. - typedef Allocator allocator_type; - - /// Construct using default-constructed allocator. - BOOST_ASIO_CONSTEXPR use_future_t() - { - } - - /// Construct using specified allocator. - explicit use_future_t(const Allocator& allocator) - : allocator_(allocator) - { - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use rebind().) Specify an alternate allocator. - template <typename OtherAllocator> - use_future_t<OtherAllocator> operator[](const OtherAllocator& allocator) const - { - return use_future_t<OtherAllocator>(allocator); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Specify an alternate allocator. - template <typename OtherAllocator> - use_future_t<OtherAllocator> rebind(const OtherAllocator& allocator) const - { - return use_future_t<OtherAllocator>(allocator); - } - - /// Obtain allocator. - allocator_type get_allocator() const - { - return allocator_; - } - - /// Wrap a function object in a packaged task. - /** - * The @c package function is used to adapt a function object as a packaged - * task. When this adapter is passed as a completion token to an asynchronous - * operation, the result of the function object is retuned via a std::future. - * - * @par Example - * - * @code std::future<std::size_t> fut = - * my_socket.async_read_some(buffer, - * use_future([](boost::system::error_code ec, std::size_t n) - * { - * return ec ? 0 : n; - * })); - * ... - * std::size_t n = fut.get(); @endcode - */ - template <typename Function> -#if defined(GENERATING_DOCUMENTATION) - unspecified -#else // defined(GENERATING_DOCUMENTATION) - detail::packaged_token<typename decay<Function>::type, Allocator> -#endif // defined(GENERATING_DOCUMENTATION) - operator()(BOOST_ASIO_MOVE_ARG(Function) f) const; - -private: - // Helper type to ensure that use_future can be constexpr default-constructed - // even when std::allocator<void> can't be. - struct std_allocator_void - { - BOOST_ASIO_CONSTEXPR std_allocator_void() - { - } - - operator std::allocator<void>() const - { - return std::allocator<void>(); - } - }; - - typename conditional< - is_same<std::allocator<void>, Allocator>::value, - std_allocator_void, Allocator>::type allocator_; -}; - -/// A special value, similar to std::nothrow. -/** - * See the documentation for boost::asio::use_future_t for a usage example. - */ -#if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION) -constexpr use_future_t<> use_future; -#elif defined(BOOST_ASIO_MSVC) -__declspec(selectany) use_future_t<> use_future; -#endif - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/use_future.hpp> - -#endif // defined(BOOST_ASIO_HAS_STD_FUTURE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_USE_FUTURE_HPP diff --git a/contrib/restricted/boost/boost/asio/uses_executor.hpp b/contrib/restricted/boost/boost/asio/uses_executor.hpp deleted file mode 100644 index 6398816fab..0000000000 --- a/contrib/restricted/boost/boost/asio/uses_executor.hpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// uses_executor.hpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_USES_EXECUTOR_HPP -#define BOOST_ASIO_USES_EXECUTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/type_traits.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// A special type, similar to std::nothrow_t, used to disambiguate -/// constructors that accept executor arguments. -/** - * The executor_arg_t struct is an empty structure type used as a unique type - * to disambiguate constructor and function overloading. Specifically, some - * types have constructors with executor_arg_t as the first argument, - * immediately followed by an argument of a type that satisfies the Executor - * type requirements. - */ -struct executor_arg_t -{ - /// Constructor. - BOOST_ASIO_CONSTEXPR executor_arg_t() BOOST_ASIO_NOEXCEPT - { - } -}; - -/// A special value, similar to std::nothrow, used to disambiguate constructors -/// that accept executor arguments. -/** - * See boost::asio::executor_arg_t and boost::asio::uses_executor - * for more information. - */ -#if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION) -constexpr executor_arg_t executor_arg; -#elif defined(BOOST_ASIO_MSVC) -__declspec(selectany) executor_arg_t executor_arg; -#endif - -/// The uses_executor trait detects whether a type T has an associated executor -/// that is convertible from type Executor. -/** - * Meets the BinaryTypeTrait requirements. The Asio library provides a - * definition that is derived from false_type. A program may specialize this - * template to derive from true_type for a user-defined type T that can be - * constructed with an executor, where the first argument of a constructor has - * type executor_arg_t and the second argument is convertible from type - * Executor. - */ -template <typename T, typename Executor> -struct uses_executor : false_type {}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_USES_EXECUTOR_HPP diff --git a/contrib/restricted/boost/boost/asio/version.hpp b/contrib/restricted/boost/boost/asio/version.hpp deleted file mode 100644 index f7a02913c3..0000000000 --- a/contrib/restricted/boost/boost/asio/version.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// -// version.hpp -// ~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_VERSION_HPP -#define BOOST_ASIO_VERSION_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -// BOOST_ASIO_VERSION % 100 is the sub-minor version -// BOOST_ASIO_VERSION / 100 % 1000 is the minor version -// BOOST_ASIO_VERSION / 100000 is the major version -#define BOOST_ASIO_VERSION 101201 // 1.12.1 - -#endif // BOOST_ASIO_VERSION_HPP diff --git a/contrib/restricted/boost/boost/asio/waitable_timer_service.hpp b/contrib/restricted/boost/boost/asio/waitable_timer_service.hpp deleted file mode 100644 index 164aae90c6..0000000000 --- a/contrib/restricted/boost/boost/asio/waitable_timer_service.hpp +++ /dev/null @@ -1,212 +0,0 @@ -// -// waitable_timer_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP -#define BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/chrono_time_traits.hpp> -#include <boost/asio/detail/deadline_timer_service.hpp> -#include <boost/asio/io_context.hpp> -#include <boost/asio/wait_traits.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/// Default service implementation for a timer. -template <typename Clock, - typename WaitTraits = boost::asio::wait_traits<Clock> > -class waitable_timer_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base< - waitable_timer_service<Clock, WaitTraits> > -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - - /// The clock type. - typedef Clock clock_type; - - /// The duration type of the clock. - typedef typename clock_type::duration duration; - - /// The time point type of the clock. - typedef typename clock_type::time_point time_point; - - /// The wait traits type. - typedef WaitTraits traits_type; - -private: - // The type of the platform-specific implementation. - typedef detail::deadline_timer_service< - detail::chrono_time_traits<Clock, WaitTraits> > service_impl_type; - -public: - /// The implementation type of the waitable timer. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef typename service_impl_type::implementation_type implementation_type; -#endif - - /// Construct a new timer service for the specified io_context. - explicit waitable_timer_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base< - waitable_timer_service<Clock, WaitTraits> >(io_context), - service_impl_(io_context) - { - } - - /// Construct a new timer implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - - /// Destroy a timer implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new timer implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another timer implementation. - void move_assign(implementation_type& impl, - waitable_timer_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Cancel any asynchronous wait operations associated with the timer. - std::size_t cancel(implementation_type& impl, boost::system::error_code& ec) - { - return service_impl_.cancel(impl, ec); - } - - /// Cancels one asynchronous wait operation associated with the timer. - std::size_t cancel_one(implementation_type& impl, - boost::system::error_code& ec) - { - return service_impl_.cancel_one(impl, ec); - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the expiry time for the timer as an - /// absolute time. - time_point expires_at(const implementation_type& impl) const - { - return service_impl_.expiry(impl); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the expiry time for the timer as an absolute time. - time_point expiry(const implementation_type& impl) const - { - return service_impl_.expiry(impl); - } - - /// Set the expiry time for the timer as an absolute time. - std::size_t expires_at(implementation_type& impl, - const time_point& expiry_time, boost::system::error_code& ec) - { - return service_impl_.expires_at(impl, expiry_time, ec); - } - - /// Set the expiry time for the timer relative to now. - std::size_t expires_after(implementation_type& impl, - const duration& expiry_time, boost::system::error_code& ec) - { - return service_impl_.expires_after(impl, expiry_time, ec); - } - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the expiry time for the timer relative to - /// now. - duration expires_from_now(const implementation_type& impl) const - { - typedef detail::chrono_time_traits<Clock, WaitTraits> traits; - return traits::subtract(service_impl_.expiry(impl), traits::now()); - } - - /// (Deprecated: Use expires_after().) Set the expiry time for the timer - /// relative to now. - std::size_t expires_from_now(implementation_type& impl, - const duration& expiry_time, boost::system::error_code& ec) - { - return service_impl_.expires_after(impl, expiry_time, ec); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - // Perform a blocking wait on the timer. - void wait(implementation_type& impl, boost::system::error_code& ec) - { - service_impl_.wait(impl, ec); - } - - // Start an asynchronous wait on the timer. - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(implementation_type& impl, - BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_wait(impl, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/basic_handle.hpp b/contrib/restricted/boost/boost/asio/windows/basic_handle.hpp deleted file mode 100644 index ce7d0e8fa0..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/basic_handle.hpp +++ /dev/null @@ -1,275 +0,0 @@ -// -// windows/basic_handle.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_BASIC_HANDLE_HPP -#define BOOST_ASIO_WINDOWS_BASIC_HANDLE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \ - || defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \ - || defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -/// Provides Windows handle functionality. -/** - * The windows::basic_handle class template provides the ability to wrap a - * Windows handle. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <typename HandleService> -class basic_handle - : public basic_io_object<HandleService> -{ -public: - /// The native representation of a handle. - typedef typename HandleService::native_handle_type native_handle_type; - - /// A basic_handle is always the lowest layer. - typedef basic_handle<HandleService> lowest_layer_type; - - /// Construct a basic_handle without opening it. - /** - * This constructor creates a handle without opening it. - * - * @param io_context The io_context object that the handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - */ - explicit basic_handle(boost::asio::io_context& io_context) - : basic_io_object<HandleService>(io_context) - { - } - - /// Construct a basic_handle on an existing native handle. - /** - * This constructor creates a handle object to hold an existing native handle. - * - * @param io_context The io_context object that the handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - * - * @param handle A native handle. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_handle(boost::asio::io_context& io_context, - const native_handle_type& handle) - : basic_io_object<HandleService>(io_context) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), handle, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_handle from another. - /** - * This constructor moves a handle from one object to another. - * - * @param other The other basic_handle object from which the move will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_handle(io_context&) constructor. - */ - basic_handle(basic_handle&& other) - : basic_io_object<HandleService>( - BOOST_ASIO_MOVE_CAST(basic_handle)(other)) - { - } - - /// Move-assign a basic_handle from another. - /** - * This assignment operator moves a handle from one object to another. - * - * @param other The other basic_handle object from which the move will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_handle(io_context&) constructor. - */ - basic_handle& operator=(basic_handle&& other) - { - basic_io_object<HandleService>::operator=( - BOOST_ASIO_MOVE_CAST(basic_handle)(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Get a reference to the lowest layer. - /** - * This function returns a reference to the lowest layer in a stack of - * layers. Since a basic_handle cannot contain any further layers, it simply - * returns a reference to itself. - * - * @return A reference to the lowest layer in the stack of layers. Ownership - * is not transferred to the caller. - */ - lowest_layer_type& lowest_layer() - { - return *this; - } - - /// Get a const reference to the lowest layer. - /** - * This function returns a const reference to the lowest layer in a stack of - * layers. Since a basic_handle cannot contain any further layers, it simply - * returns a reference to itself. - * - * @return A const reference to the lowest layer in the stack of layers. - * Ownership is not transferred to the caller. - */ - const lowest_layer_type& lowest_layer() const - { - return *this; - } - - /// Assign an existing native handle to the handle. - /* - * This function opens the handle to hold an existing native handle. - * - * @param handle A native handle. - * - * @throws boost::system::system_error Thrown on failure. - */ - void assign(const native_handle_type& handle) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), handle, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - - /// Assign an existing native handle to the handle. - /* - * This function opens the handle to hold an existing native handle. - * - * @param handle A native handle. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID assign(const native_handle_type& handle, - boost::system::error_code& ec) - { - this->get_service().assign(this->get_implementation(), handle, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the handle is open. - bool is_open() const - { - return this->get_service().is_open(this->get_implementation()); - } - - /// Close the handle. - /** - * This function is used to close the handle. Any asynchronous read or write - * operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void close() - { - boost::system::error_code ec; - this->get_service().close(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "close"); - } - - /// Close the handle. - /** - * This function is used to close the handle. Any asynchronous read or write - * operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - this->get_service().close(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native handle representation. - /** - * This function may be used to obtain the underlying representation of the - * handle. This is intended to allow access to native handle functionality - * that is not otherwise provided. - */ - native_handle_type native_handle() - { - return this->get_service().native_handle(this->get_implementation()); - } - - /// Cancel all asynchronous operations associated with the handle. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all asynchronous operations associated with the handle. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - -protected: - /// Protected destructor to prevent deletion through this type. - ~basic_handle() - { - } -}; - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) - // || defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) - // || defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_WINDOWS_BASIC_HANDLE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/basic_object_handle.hpp b/contrib/restricted/boost/boost/asio/windows/basic_object_handle.hpp deleted file mode 100644 index b4a2565e23..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/basic_object_handle.hpp +++ /dev/null @@ -1,184 +0,0 @@ -// -// windows/basic_object_handle.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_BASIC_OBJECT_HANDLE_HPP -#define BOOST_ASIO_WINDOWS_BASIC_OBJECT_HANDLE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/windows/basic_handle.hpp> -#include <boost/asio/windows/object_handle_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -/// Provides object-oriented handle functionality. -/** - * The windows::basic_object_handle class template provides asynchronous and - * blocking object-oriented handle functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <typename ObjectHandleService = object_handle_service> -class basic_object_handle - : public basic_handle<ObjectHandleService> -{ -public: - /// The native representation of a handle. - typedef typename ObjectHandleService::native_handle_type native_handle_type; - - /// Construct a basic_object_handle without opening it. - /** - * This constructor creates an object handle without opening it. - * - * @param io_context The io_context object that the object handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - */ - explicit basic_object_handle(boost::asio::io_context& io_context) - : basic_handle<ObjectHandleService>(io_context) - { - } - - /// Construct a basic_object_handle on an existing native handle. - /** - * This constructor creates an object handle object to hold an existing native - * handle. - * - * @param io_context The io_context object that the object handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - * - * @param native_handle The new underlying handle implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_object_handle(boost::asio::io_context& io_context, - const native_handle_type& native_handle) - : basic_handle<ObjectHandleService>(io_context, native_handle) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_object_handle from another. - /** - * This constructor moves an object handle from one object to another. - * - * @param other The other basic_object_handle object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_object_handle(io_context&) constructor. - */ - basic_object_handle(basic_object_handle&& other) - : basic_handle<ObjectHandleService>( - BOOST_ASIO_MOVE_CAST(basic_object_handle)(other)) - { - } - - /// Move-assign a basic_object_handle from another. - /** - * This assignment operator moves an object handle from one object to another. - * - * @param other The other basic_object_handle object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_object_handle(io_context&) constructor. - */ - basic_object_handle& operator=(basic_object_handle&& other) - { - basic_handle<ObjectHandleService>::operator=( - BOOST_ASIO_MOVE_CAST(basic_object_handle)(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Perform a blocking wait on the object handle. - /** - * This function is used to wait for the object handle to be set to the - * signalled state. This function blocks and does not return until the object - * handle has been set to the signalled state. - * - * @throws boost::system::system_error Thrown on failure. - */ - void wait() - { - boost::system::error_code ec; - this->get_service().wait(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "wait"); - } - - /// Perform a blocking wait on the object handle. - /** - * This function is used to wait for the object handle to be set to the - * signalled state. This function blocks and does not return until the object - * handle has been set to the signalled state. - * - * @param ec Set to indicate what error occurred, if any. - */ - void wait(boost::system::error_code& ec) - { - this->get_service().wait(this->get_implementation(), ec); - } - - /// Start an asynchronous wait on the object handle. - /** - * This function is be used to initiate an asynchronous wait against the - * object handle. It always returns immediately. - * - * @param handler The handler to be called when the object handle is set to - * the signalled state. Copies will be made of the handler as required. The - * function signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - return this->get_service().async_wait(this->get_implementation(), - BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); - } -}; - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_WINDOWS_BASIC_OBJECT_HANDLE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/basic_random_access_handle.hpp b/contrib/restricted/boost/boost/asio/windows/basic_random_access_handle.hpp deleted file mode 100644 index 53765e1766..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/basic_random_access_handle.hpp +++ /dev/null @@ -1,378 +0,0 @@ -// -// windows/basic_random_access_handle.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_BASIC_RANDOM_ACCESS_HANDLE_HPP -#define BOOST_ASIO_WINDOWS_BASIC_RANDOM_ACCESS_HANDLE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/windows/basic_handle.hpp> -#include <boost/asio/windows/random_access_handle_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -/// Provides random-access handle functionality. -/** - * The windows::basic_random_access_handle class template provides asynchronous - * and blocking random-access handle functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -template <typename RandomAccessHandleService = random_access_handle_service> -class basic_random_access_handle - : public basic_handle<RandomAccessHandleService> -{ -public: - /// The native representation of a handle. - typedef typename RandomAccessHandleService::native_handle_type - native_handle_type; - - /// Construct a basic_random_access_handle without opening it. - /** - * This constructor creates a random-access handle without opening it. The - * handle needs to be opened before data can be written to or read from it. - * - * @param io_context The io_context object that the random-access handle will - * use to dispatch handlers for any asynchronous operations performed on the - * handle. - */ - explicit basic_random_access_handle(boost::asio::io_context& io_context) - : basic_handle<RandomAccessHandleService>(io_context) - { - } - - /// Construct a basic_random_access_handle on an existing native handle. - /** - * This constructor creates a random-access handle object to hold an existing - * native handle. - * - * @param io_context The io_context object that the random-access handle will - * use to dispatch handlers for any asynchronous operations performed on the - * handle. - * - * @param handle The new underlying handle implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_random_access_handle(boost::asio::io_context& io_context, - const native_handle_type& handle) - : basic_handle<RandomAccessHandleService>(io_context, handle) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_random_access_handle from another. - /** - * This constructor moves a random-access handle from one object to another. - * - * @param other The other basic_random_access_handle object from which the - * move will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_random_access_handle(io_context&) - * constructor. - */ - basic_random_access_handle(basic_random_access_handle&& other) - : basic_handle<RandomAccessHandleService>( - BOOST_ASIO_MOVE_CAST(basic_random_access_handle)(other)) - { - } - - /// Move-assign a basic_random_access_handle from another. - /** - * This assignment operator moves a random-access handle from one object to - * another. - * - * @param other The other basic_random_access_handle object from which the - * move will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_random_access_handle(io_context&) - * constructor. - */ - basic_random_access_handle& operator=(basic_random_access_handle&& other) - { - basic_handle<RandomAccessHandleService>::operator=( - BOOST_ASIO_MOVE_CAST(basic_random_access_handle)(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Write some data to the handle at the specified offset. - /** - * This function is used to write data to the random-access handle. The - * function call will block until one or more bytes of the data has been - * written successfully, or until an error occurs. - * - * @param offset The offset at which the data will be written. - * - * @param buffers One or more data buffers to be written to the handle. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The write_some_at operation may not write all of the data. Consider - * using the @ref write_at function if you need to ensure that all data is - * written before the blocking operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * handle.write_some_at(42, boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t write_some_at(uint64_t offset, - const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().write_some_at( - this->get_implementation(), offset, buffers, ec); - boost::asio::detail::throw_error(ec, "write_some_at"); - return s; - } - - /// Write some data to the handle at the specified offset. - /** - * This function is used to write data to the random-access handle. The - * function call will block until one or more bytes of the data has been - * written successfully, or until an error occurs. - * - * @param offset The offset at which the data will be written. - * - * @param buffers One or more data buffers to be written to the handle. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write_at function if you need to ensure that - * all data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some_at(uint64_t offset, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - return this->get_service().write_some_at( - this->get_implementation(), offset, buffers, ec); - } - - /// Start an asynchronous write at the specified offset. - /** - * This function is used to asynchronously write data to the random-access - * handle. The function call always returns immediately. - * - * @param offset The offset at which the data will be written. - * - * @param buffers One or more data buffers to be written to the handle. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The write operation may not transmit all of the data to the peer. - * Consider using the @ref async_write_at function if you need to ensure that - * all data is written before the asynchronous operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * handle.async_write_some_at(42, boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some_at(uint64_t offset, - const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - return this->get_service().async_write_some_at(this->get_implementation(), - offset, buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); - } - - /// Read some data from the handle at the specified offset. - /** - * This function is used to read data from the random-access handle. The - * function call will block until one or more bytes of data has been read - * successfully, or until an error occurs. - * - * @param offset The offset at which the data will be read. - * - * @param buffers One or more buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The read_some operation may not read all of the requested number of - * bytes. Consider using the @ref read_at function if you need to ensure that - * the requested amount of data is read before the blocking operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * handle.read_some_at(42, boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t read_some_at(uint64_t offset, - const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().read_some_at( - this->get_implementation(), offset, buffers, ec); - boost::asio::detail::throw_error(ec, "read_some_at"); - return s; - } - - /// Read some data from the handle at the specified offset. - /** - * This function is used to read data from the random-access handle. The - * function call will block until one or more bytes of data has been read - * successfully, or until an error occurs. - * - * @param offset The offset at which the data will be read. - * - * @param buffers One or more buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * bytes. Consider using the @ref read_at function if you need to ensure that - * the requested amount of data is read before the blocking operation - * completes. - */ - template <typename MutableBufferSequence> - std::size_t read_some_at(uint64_t offset, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - return this->get_service().read_some_at( - this->get_implementation(), offset, buffers, ec); - } - - /// Start an asynchronous read at the specified offset. - /** - * This function is used to asynchronously read data from the random-access - * handle. The function call always returns immediately. - * - * @param offset The offset at which the data will be read. - * - * @param buffers One or more buffers into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The read operation may not read all of the requested number of bytes. - * Consider using the @ref async_read_at function if you need to ensure that - * the requested amount of data is read before the asynchronous operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * handle.async_read_some_at(42, boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some_at(uint64_t offset, - const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - return this->get_service().async_read_some_at(this->get_implementation(), - offset, buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); - } -}; - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_WINDOWS_BASIC_RANDOM_ACCESS_HANDLE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/basic_stream_handle.hpp b/contrib/restricted/boost/boost/asio/windows/basic_stream_handle.hpp deleted file mode 100644 index 8063987983..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/basic_stream_handle.hpp +++ /dev/null @@ -1,361 +0,0 @@ -// -// windows/basic_stream_handle.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_BASIC_STREAM_HANDLE_HPP -#define BOOST_ASIO_WINDOWS_BASIC_STREAM_HANDLE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <boost/asio/detail/handler_type_requirements.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/windows/basic_handle.hpp> -#include <boost/asio/windows/stream_handle_service.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -/// Provides stream-oriented handle functionality. -/** - * The windows::basic_stream_handle class template provides asynchronous and - * blocking stream-oriented handle functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream. - */ -template <typename StreamHandleService = stream_handle_service> -class basic_stream_handle - : public basic_handle<StreamHandleService> -{ -public: - /// The native representation of a handle. - typedef typename StreamHandleService::native_handle_type native_handle_type; - - /// Construct a basic_stream_handle without opening it. - /** - * This constructor creates a stream handle without opening it. The handle - * needs to be opened and then connected or accepted before data can be sent - * or received on it. - * - * @param io_context The io_context object that the stream handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - */ - explicit basic_stream_handle(boost::asio::io_context& io_context) - : basic_handle<StreamHandleService>(io_context) - { - } - - /// Construct a basic_stream_handle on an existing native handle. - /** - * This constructor creates a stream handle object to hold an existing native - * handle. - * - * @param io_context The io_context object that the stream handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - * - * @param handle The new underlying handle implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - basic_stream_handle(boost::asio::io_context& io_context, - const native_handle_type& handle) - : basic_handle<StreamHandleService>(io_context, handle) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a basic_stream_handle from another. - /** - * This constructor moves a stream handle from one object to another. - * - * @param other The other basic_stream_handle object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_handle(io_context&) constructor. - */ - basic_stream_handle(basic_stream_handle&& other) - : basic_handle<StreamHandleService>( - BOOST_ASIO_MOVE_CAST(basic_stream_handle)(other)) - { - } - - /// Move-assign a basic_stream_handle from another. - /** - * This assignment operator moves a stream handle from one object to - * another. - * - * @param other The other basic_stream_handle object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c basic_stream_handle(io_context&) constructor. - */ - basic_stream_handle& operator=(basic_stream_handle&& other) - { - basic_handle<StreamHandleService>::operator=( - BOOST_ASIO_MOVE_CAST(basic_stream_handle)(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Write some data to the handle. - /** - * This function is used to write data to the stream handle. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the handle. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * handle.write_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().write_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "write_some"); - return s; - } - - /// Write some data to the handle. - /** - * This function is used to write data to the stream handle. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the handle. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().write_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous write. - /** - * This function is used to asynchronously write data to the stream handle. - * The function call always returns immediately. - * - * @param buffers One or more data buffers to be written to the handle. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The write operation may not transmit all of the data to the peer. - * Consider using the @ref async_write function if you need to ensure that all - * data is written before the asynchronous operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * handle.async_write_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - return this->get_service().async_write_some(this->get_implementation(), - buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); - } - - /// Read some data from the handle. - /** - * This function is used to read data from the stream handle. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The read_some operation may not read all of the requested number of - * 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. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * handle.read_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().read_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "read_some"); - return s; - } - - /// Read some data from the handle. - /** - * This function is used to read data from the stream handle. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().read_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous read. - /** - * This function is used to asynchronously read data from the stream handle. - * The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The read operation may not read all of the requested number of bytes. - * Consider using the @ref async_read function if you need to ensure that the - * requested amount of data is read before the asynchronous operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * handle.async_read_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - return this->get_service().async_read_some(this->get_implementation(), - buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); - } -}; - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_WINDOWS_BASIC_STREAM_HANDLE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/object_handle.hpp b/contrib/restricted/boost/boost/asio/windows/object_handle.hpp deleted file mode 100644 index 45eb23f4d8..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/object_handle.hpp +++ /dev/null @@ -1,383 +0,0 @@ -// -// windows/object_handle.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_OBJECT_HANDLE_HPP -#define BOOST_ASIO_WINDOWS_OBJECT_HANDLE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/async_result.hpp> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/detail/win_object_handle_service.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#if defined(BOOST_ASIO_HAS_MOVE) -# include <utility> -#endif // defined(BOOST_ASIO_HAS_MOVE) - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/windows/basic_object_handle.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#define BOOST_ASIO_SVC_T boost::asio::detail::win_object_handle_service - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -// Typedef for the typical usage of an object handle. -typedef basic_object_handle<> object_handle; -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -/// Provides object-oriented handle functionality. -/** - * The windows::object_handle class provides asynchronous and blocking - * object-oriented handle functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -class object_handle - : BOOST_ASIO_SVC_ACCESS basic_io_object<BOOST_ASIO_SVC_T> -{ -public: - /// The type of the executor associated with the object. - typedef io_context::executor_type executor_type; - - /// The native representation of a handle. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef BOOST_ASIO_SVC_T::native_handle_type native_handle_type; -#endif - - /// An object_handle is always the lowest layer. - typedef object_handle lowest_layer_type; - - /// Construct an object_handle without opening it. - /** - * This constructor creates an object handle without opening it. - * - * @param io_context The io_context object that the object handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - */ - explicit object_handle(boost::asio::io_context& io_context) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - } - - /// Construct an object_handle on an existing native handle. - /** - * This constructor creates an object handle object to hold an existing native - * handle. - * - * @param io_context The io_context object that the object handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - * - * @param native_handle The new underlying handle implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - object_handle(boost::asio::io_context& io_context, - const native_handle_type& native_handle) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), native_handle, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct an object_handle from another. - /** - * This constructor moves an object handle from one object to another. - * - * @param other The other object_handle object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c object_handle(io_context&) constructor. - */ - object_handle(object_handle&& other) - : basic_io_object<BOOST_ASIO_SVC_T>(std::move(other)) - { - } - - /// Move-assign an object_handle from another. - /** - * This assignment operator moves an object handle from one object to another. - * - * @param other The other object_handle object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c object_handle(io_context&) constructor. - */ - object_handle& operator=(object_handle&& other) - { - basic_io_object<BOOST_ASIO_SVC_T>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_context() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_service() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_executor(); - } - - /// Get a reference to the lowest layer. - /** - * This function returns a reference to the lowest layer in a stack of - * layers. Since an object_handle cannot contain any further layers, it simply - * returns a reference to itself. - * - * @return A reference to the lowest layer in the stack of layers. Ownership - * is not transferred to the caller. - */ - lowest_layer_type& lowest_layer() - { - return *this; - } - - /// Get a const reference to the lowest layer. - /** - * This function returns a const reference to the lowest layer in a stack of - * layers. Since an object_handle cannot contain any further layers, it simply - * returns a reference to itself. - * - * @return A const reference to the lowest layer in the stack of layers. - * Ownership is not transferred to the caller. - */ - const lowest_layer_type& lowest_layer() const - { - return *this; - } - - /// Assign an existing native handle to the handle. - /* - * This function opens the handle to hold an existing native handle. - * - * @param handle A native handle. - * - * @throws boost::system::system_error Thrown on failure. - */ - void assign(const native_handle_type& handle) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), handle, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - - /// Assign an existing native handle to the handle. - /* - * This function opens the handle to hold an existing native handle. - * - * @param handle A native handle. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID assign(const native_handle_type& handle, - boost::system::error_code& ec) - { - this->get_service().assign(this->get_implementation(), handle, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the handle is open. - bool is_open() const - { - return this->get_service().is_open(this->get_implementation()); - } - - /// Close the handle. - /** - * This function is used to close the handle. Any asynchronous read or write - * operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void close() - { - boost::system::error_code ec; - this->get_service().close(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "close"); - } - - /// Close the handle. - /** - * This function is used to close the handle. Any asynchronous read or write - * operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - this->get_service().close(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native handle representation. - /** - * This function may be used to obtain the underlying representation of the - * handle. This is intended to allow access to native handle functionality - * that is not otherwise provided. - */ - native_handle_type native_handle() - { - return this->get_service().native_handle(this->get_implementation()); - } - - /// Cancel all asynchronous operations associated with the handle. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all asynchronous operations associated with the handle. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Perform a blocking wait on the object handle. - /** - * This function is used to wait for the object handle to be set to the - * signalled state. This function blocks and does not return until the object - * handle has been set to the signalled state. - * - * @throws boost::system::system_error Thrown on failure. - */ - void wait() - { - boost::system::error_code ec; - this->get_service().wait(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "wait"); - } - - /// Perform a blocking wait on the object handle. - /** - * This function is used to wait for the object handle to be set to the - * signalled state. This function blocks and does not return until the object - * handle has been set to the signalled state. - * - * @param ec Set to indicate what error occurred, if any. - */ - void wait(boost::system::error_code& ec) - { - this->get_service().wait(this->get_implementation(), ec); - } - - /// Start an asynchronous wait on the object handle. - /** - * This function is be used to initiate an asynchronous wait against the - * object handle. It always returns immediately. - * - * @param handler The handler to be called when the object handle is set to - * the signalled state. Copies will be made of the handler as required. The - * function signature of the handler must be: - * @code void handler( - * const boost::system::error_code& error // Result of operation. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - boost::asio::async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - this->get_service().async_wait(this->get_implementation(), - init.completion_handler); - - return init.result.get(); - } -}; -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#undef BOOST_ASIO_SVC_T - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_WINDOWS_OBJECT_HANDLE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/object_handle_service.hpp b/contrib/restricted/boost/boost/asio/windows/object_handle_service.hpp deleted file mode 100644 index 6ff8197990..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/object_handle_service.hpp +++ /dev/null @@ -1,185 +0,0 @@ -// -// windows/object_handle_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP -#define BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/win_object_handle_service.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -/// Default service implementation for an object handle. -class object_handle_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base<object_handle_service> -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - -private: - // The type of the platform-specific implementation. - typedef detail::win_object_handle_service service_impl_type; - -public: - /// The type of an object handle implementation. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef service_impl_type::implementation_type implementation_type; -#endif - - /// The native handle type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef service_impl_type::native_handle_type native_handle_type; -#endif - - /// Construct a new object handle service for the specified io_context. - explicit object_handle_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base<object_handle_service>(io_context), - service_impl_(io_context) - { - } - - /// Construct a new object handle implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new object handle implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another object handle implementation. - void move_assign(implementation_type& impl, - object_handle_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroy an object handle implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Assign an existing native handle to an object handle. - BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, - const native_handle_type& handle, boost::system::error_code& ec) - { - service_impl_.assign(impl, handle, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the handle is open. - bool is_open(const implementation_type& impl) const - { - return service_impl_.is_open(impl); - } - - /// Close an object handle implementation. - BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.close(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native handle implementation. - native_handle_type native_handle(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - - /// Cancel all asynchronous operations associated with the handle. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - // Wait for a signaled state. - void wait(implementation_type& impl, boost::system::error_code& ec) - { - service_impl_.wait(impl, ec); - } - - /// Start an asynchronous wait. - template <typename WaitHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, - void (boost::system::error_code)) - async_wait(implementation_type& impl, - BOOST_ASIO_MOVE_ARG(WaitHandler) handler) - { - boost::asio::async_completion<WaitHandler, - void (boost::system::error_code)> init(handler); - - service_impl_.async_wait(impl, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/overlapped_handle.hpp b/contrib/restricted/boost/boost/asio/windows/overlapped_handle.hpp deleted file mode 100644 index 16dcbedbb6..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/overlapped_handle.hpp +++ /dev/null @@ -1,333 +0,0 @@ -// -// windows/overlapped_handle.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_OVERLAPPED_HANDLE_HPP -#define BOOST_ASIO_WINDOWS_OVERLAPPED_HANDLE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \ - || defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/basic_io_object.hpp> -#include <boost/asio/detail/throw_error.hpp> -#include <boost/asio/detail/win_iocp_handle_service.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#if defined(BOOST_ASIO_HAS_MOVE) -# include <utility> -#endif // defined(BOOST_ASIO_HAS_MOVE) - -#define BOOST_ASIO_SVC_T boost::asio::detail::win_iocp_handle_service - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -/// Provides Windows handle functionality for objects that support -/// overlapped I/O. -/** - * The windows::overlapped_handle class provides the ability to wrap a Windows - * handle. The underlying object referred to by the handle must support - * overlapped I/O. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -class overlapped_handle - : BOOST_ASIO_SVC_ACCESS basic_io_object<BOOST_ASIO_SVC_T> -{ -public: - /// The type of the executor associated with the object. - typedef io_context::executor_type executor_type; - - /// The native representation of a handle. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef BOOST_ASIO_SVC_T::native_handle_type native_handle_type; -#endif - - /// An overlapped_handle is always the lowest layer. - typedef overlapped_handle lowest_layer_type; - - /// Construct an overlapped_handle without opening it. - /** - * This constructor creates a handle without opening it. - * - * @param io_context The io_context object that the handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - */ - explicit overlapped_handle(boost::asio::io_context& io_context) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - } - - /// Construct an overlapped_handle on an existing native handle. - /** - * This constructor creates a handle object to hold an existing native handle. - * - * @param io_context The io_context object that the handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - * - * @param handle A native handle. - * - * @throws boost::system::system_error Thrown on failure. - */ - overlapped_handle(boost::asio::io_context& io_context, - const native_handle_type& handle) - : basic_io_object<BOOST_ASIO_SVC_T>(io_context) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), handle, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct an overlapped_handle from another. - /** - * This constructor moves a handle from one object to another. - * - * @param other The other overlapped_handle object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c overlapped_handle(io_context&) constructor. - */ - overlapped_handle(overlapped_handle&& other) - : basic_io_object<BOOST_ASIO_SVC_T>(std::move(other)) - { - } - - /// Move-assign an overlapped_handle from another. - /** - * This assignment operator moves a handle from one object to another. - * - * @param other The other overlapped_handle object from which the move will - * occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c overlapped_handle(io_context&) constructor. - */ - overlapped_handle& operator=(overlapped_handle&& other) - { - basic_io_object<BOOST_ASIO_SVC_T>::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_context() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_context(); - } - - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. - /** - * This function may be used to obtain the io_context object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_context object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_context& get_io_service() - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_io_service(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - - /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT - { - return basic_io_object<BOOST_ASIO_SVC_T>::get_executor(); - } - - /// Get a reference to the lowest layer. - /** - * This function returns a reference to the lowest layer in a stack of - * layers. Since an overlapped_handle cannot contain any further layers, it - * simply returns a reference to itself. - * - * @return A reference to the lowest layer in the stack of layers. Ownership - * is not transferred to the caller. - */ - lowest_layer_type& lowest_layer() - { - return *this; - } - - /// Get a const reference to the lowest layer. - /** - * This function returns a const reference to the lowest layer in a stack of - * layers. Since an overlapped_handle cannot contain any further layers, it - * simply returns a reference to itself. - * - * @return A const reference to the lowest layer in the stack of layers. - * Ownership is not transferred to the caller. - */ - const lowest_layer_type& lowest_layer() const - { - return *this; - } - - /// Assign an existing native handle to the handle. - /* - * This function opens the handle to hold an existing native handle. - * - * @param handle A native handle. - * - * @throws boost::system::system_error Thrown on failure. - */ - void assign(const native_handle_type& handle) - { - boost::system::error_code ec; - this->get_service().assign(this->get_implementation(), handle, ec); - boost::asio::detail::throw_error(ec, "assign"); - } - - /// Assign an existing native handle to the handle. - /* - * This function opens the handle to hold an existing native handle. - * - * @param handle A native handle. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID assign(const native_handle_type& handle, - boost::system::error_code& ec) - { - this->get_service().assign(this->get_implementation(), handle, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the handle is open. - bool is_open() const - { - return this->get_service().is_open(this->get_implementation()); - } - - /// Close the handle. - /** - * This function is used to close the handle. Any asynchronous read or write - * operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void close() - { - boost::system::error_code ec; - this->get_service().close(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "close"); - } - - /// Close the handle. - /** - * This function is used to close the handle. Any asynchronous read or write - * operations will be cancelled immediately, and will complete with the - * boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) - { - this->get_service().close(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native handle representation. - /** - * This function may be used to obtain the underlying representation of the - * handle. This is intended to allow access to native handle functionality - * that is not otherwise provided. - */ - native_handle_type native_handle() - { - return this->get_service().native_handle(this->get_implementation()); - } - - /// Cancel all asynchronous operations associated with the handle. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @throws boost::system::system_error Thrown on failure. - */ - void cancel() - { - boost::system::error_code ec; - this->get_service().cancel(this->get_implementation(), ec); - boost::asio::detail::throw_error(ec, "cancel"); - } - - /// Cancel all asynchronous operations associated with the handle. - /** - * This function causes all outstanding asynchronous read or write operations - * to finish immediately, and the handlers for cancelled operations will be - * passed the boost::asio::error::operation_aborted error. - * - * @param ec Set to indicate what error occurred, if any. - */ - BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) - { - this->get_service().cancel(this->get_implementation(), ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - -protected: - /// Protected destructor to prevent deletion through this type. - /** - * This function destroys the handle, cancelling any outstanding asynchronous - * wait operations associated with the handle as if by calling @c cancel. - */ - ~overlapped_handle() - { - } -}; - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#undef BOOST_ASIO_SVC_T - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) - // || defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_WINDOWS_OVERLAPPED_HANDLE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/overlapped_ptr.hpp b/contrib/restricted/boost/boost/asio/windows/overlapped_ptr.hpp deleted file mode 100644 index 8c95ce45f9..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/overlapped_ptr.hpp +++ /dev/null @@ -1,118 +0,0 @@ -// -// windows/overlapped_ptr.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_OVERLAPPED_PTR_HPP -#define BOOST_ASIO_WINDOWS_OVERLAPPED_PTR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR) \ - || defined(GENERATING_DOCUMENTATION) - -#include <boost/asio/detail/noncopyable.hpp> -#include <boost/asio/detail/win_iocp_overlapped_ptr.hpp> -#include <boost/asio/io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -/// Wraps a handler to create an OVERLAPPED object for use with overlapped I/O. -/** - * A special-purpose smart pointer used to wrap an application handler so that - * it can be passed as the LPOVERLAPPED argument to overlapped I/O functions. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -class overlapped_ptr - : private noncopyable -{ -public: - /// Construct an empty overlapped_ptr. - overlapped_ptr() - : impl_() - { - } - - /// Construct an overlapped_ptr to contain the specified handler. - template <typename Handler> - explicit overlapped_ptr(boost::asio::io_context& io_context, - BOOST_ASIO_MOVE_ARG(Handler) handler) - : impl_(io_context, BOOST_ASIO_MOVE_CAST(Handler)(handler)) - { - } - - /// Destructor automatically frees the OVERLAPPED object unless released. - ~overlapped_ptr() - { - } - - /// Reset to empty. - void reset() - { - impl_.reset(); - } - - /// Reset to contain the specified handler, freeing any current OVERLAPPED - /// object. - template <typename Handler> - void reset(boost::asio::io_context& io_context, - BOOST_ASIO_MOVE_ARG(Handler) handler) - { - impl_.reset(io_context, BOOST_ASIO_MOVE_CAST(Handler)(handler)); - } - - /// Get the contained OVERLAPPED object. - OVERLAPPED* get() - { - return impl_.get(); - } - - /// Get the contained OVERLAPPED object. - const OVERLAPPED* get() const - { - return impl_.get(); - } - - /// Release ownership of the OVERLAPPED object. - OVERLAPPED* release() - { - return impl_.release(); - } - - /// Post completion notification for overlapped operation. Releases ownership. - void complete(const boost::system::error_code& ec, - std::size_t bytes_transferred) - { - impl_.complete(ec, bytes_transferred); - } - -private: - detail::win_iocp_overlapped_ptr impl_; -}; - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_WINDOWS_OVERLAPPED_PTR_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/random_access_handle.hpp b/contrib/restricted/boost/boost/asio/windows/random_access_handle.hpp deleted file mode 100644 index 4ff62d39df..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/random_access_handle.hpp +++ /dev/null @@ -1,380 +0,0 @@ -// -// windows/random_access_handle.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_HPP -#define BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/windows/overlapped_handle.hpp> - -#if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/windows/basic_random_access_handle.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -// Typedef for the typical usage of a random-access handle. -typedef basic_random_access_handle<> random_access_handle; -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -/// Provides random-access handle functionality. -/** - * The windows::random_access_handle class provides asynchronous and - * blocking random-access handle functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - */ -class random_access_handle - : public overlapped_handle -{ -public: - /// Construct a random_access_handle without opening it. - /** - * This constructor creates a random-access handle without opening it. The - * handle needs to be opened before data can be written to or read from it. - * - * @param io_context The io_context object that the random-access handle will - * use to dispatch handlers for any asynchronous operations performed on the - * handle. - */ - explicit random_access_handle(boost::asio::io_context& io_context) - : overlapped_handle(io_context) - { - } - - /// Construct a random_access_handle on an existing native handle. - /** - * This constructor creates a random-access handle object to hold an existing - * native handle. - * - * @param io_context The io_context object that the random-access handle will - * use to dispatch handlers for any asynchronous operations performed on the - * handle. - * - * @param handle The new underlying handle implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - random_access_handle(boost::asio::io_context& io_context, - const native_handle_type& handle) - : overlapped_handle(io_context, handle) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a random_access_handle from another. - /** - * This constructor moves a random-access handle from one object to another. - * - * @param other The other random_access_handle object from which the - * move will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c random_access_handle(io_context&) - * constructor. - */ - random_access_handle(random_access_handle&& other) - : overlapped_handle(std::move(other)) - { - } - - /// Move-assign a random_access_handle from another. - /** - * This assignment operator moves a random-access handle from one object to - * another. - * - * @param other The other random_access_handle object from which the - * move will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c random_access_handle(io_context&) - * constructor. - */ - random_access_handle& operator=(random_access_handle&& other) - { - overlapped_handle::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Write some data to the handle at the specified offset. - /** - * This function is used to write data to the random-access handle. The - * function call will block until one or more bytes of the data has been - * written successfully, or until an error occurs. - * - * @param offset The offset at which the data will be written. - * - * @param buffers One or more data buffers to be written to the handle. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The write_some_at operation may not write all of the data. Consider - * using the @ref write_at function if you need to ensure that all data is - * written before the blocking operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * handle.write_some_at(42, boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t write_some_at(uint64_t offset, - const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().write_some_at( - this->get_implementation(), offset, buffers, ec); - boost::asio::detail::throw_error(ec, "write_some_at"); - return s; - } - - /// Write some data to the handle at the specified offset. - /** - * This function is used to write data to the random-access handle. The - * function call will block until one or more bytes of the data has been - * written successfully, or until an error occurs. - * - * @param offset The offset at which the data will be written. - * - * @param buffers One or more data buffers to be written to the handle. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write_at function if you need to ensure that - * all data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some_at(uint64_t offset, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - return this->get_service().write_some_at( - this->get_implementation(), offset, buffers, ec); - } - - /// Start an asynchronous write at the specified offset. - /** - * This function is used to asynchronously write data to the random-access - * handle. The function call always returns immediately. - * - * @param offset The offset at which the data will be written. - * - * @param buffers One or more data buffers to be written to the handle. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The write operation may not transmit all of the data to the peer. - * Consider using the @ref async_write_at function if you need to ensure that - * all data is written before the asynchronous operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * handle.async_write_some_at(42, boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some_at(uint64_t offset, - const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - boost::asio::async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_write_some_at(this->get_implementation(), - offset, buffers, init.completion_handler); - - return init.result.get(); - } - - /// Read some data from the handle at the specified offset. - /** - * This function is used to read data from the random-access handle. The - * function call will block until one or more bytes of data has been read - * successfully, or until an error occurs. - * - * @param offset The offset at which the data will be read. - * - * @param buffers One or more buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The read_some operation may not read all of the requested number of - * bytes. Consider using the @ref read_at function if you need to ensure that - * the requested amount of data is read before the blocking operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * handle.read_some_at(42, boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t read_some_at(uint64_t offset, - const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().read_some_at( - this->get_implementation(), offset, buffers, ec); - boost::asio::detail::throw_error(ec, "read_some_at"); - return s; - } - - /// Read some data from the handle at the specified offset. - /** - * This function is used to read data from the random-access handle. The - * function call will block until one or more bytes of data has been read - * successfully, or until an error occurs. - * - * @param offset The offset at which the data will be read. - * - * @param buffers One or more buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * bytes. Consider using the @ref read_at function if you need to ensure that - * the requested amount of data is read before the blocking operation - * completes. - */ - template <typename MutableBufferSequence> - std::size_t read_some_at(uint64_t offset, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - return this->get_service().read_some_at( - this->get_implementation(), offset, buffers, ec); - } - - /// Start an asynchronous read at the specified offset. - /** - * This function is used to asynchronously read data from the random-access - * handle. The function call always returns immediately. - * - * @param offset The offset at which the data will be read. - * - * @param buffers One or more buffers into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The read operation may not read all of the requested number of bytes. - * Consider using the @ref async_read_at function if you need to ensure that - * the requested amount of data is read before the asynchronous operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * handle.async_read_some_at(42, boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some_at(uint64_t offset, - const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - boost::asio::async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_read_some_at(this->get_implementation(), - offset, buffers, init.completion_handler); - - return init.result.get(); - } -}; -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/random_access_handle_service.hpp b/contrib/restricted/boost/boost/asio/windows/random_access_handle_service.hpp deleted file mode 100644 index 0ec0773acb..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/random_access_handle_service.hpp +++ /dev/null @@ -1,216 +0,0 @@ -// -// windows/random_access_handle_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_SERVICE_HPP -#define BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/cstdint.hpp> -#include <boost/asio/detail/win_iocp_handle_service.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -/// Default service implementation for a random-access handle. -class random_access_handle_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base<random_access_handle_service> -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - -private: - // The type of the platform-specific implementation. - typedef detail::win_iocp_handle_service service_impl_type; - -public: - /// The type of a random-access handle implementation. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef service_impl_type::implementation_type implementation_type; -#endif - - /// The native handle type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef service_impl_type::native_handle_type native_handle_type; -#endif - - /// Construct a new random-access handle service for the specified io_context. - explicit random_access_handle_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base< - random_access_handle_service>(io_context), - service_impl_(io_context) - { - } - - /// Construct a new random-access handle implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new random-access handle implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another random-access handle implementation. - void move_assign(implementation_type& impl, - random_access_handle_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroy a random-access handle implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Assign an existing native handle to a random-access handle. - BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, - const native_handle_type& handle, boost::system::error_code& ec) - { - service_impl_.assign(impl, handle, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the handle is open. - bool is_open(const implementation_type& impl) const - { - return service_impl_.is_open(impl); - } - - /// Close a random-access handle implementation. - BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.close(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native handle implementation. - native_handle_type native_handle(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - - /// Cancel all asynchronous operations associated with the handle. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Write the given data at the specified offset. - template <typename ConstBufferSequence> - std::size_t write_some_at(implementation_type& impl, uint64_t offset, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - return service_impl_.write_some_at(impl, offset, buffers, ec); - } - - /// Start an asynchronous write at the specified offset. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some_at(implementation_type& impl, - uint64_t offset, const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - boost::asio::async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_write_some_at(impl, - offset, buffers, init.completion_handler); - - return init.result.get(); - } - - /// Read some data from the specified offset. - template <typename MutableBufferSequence> - std::size_t read_some_at(implementation_type& impl, uint64_t offset, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - return service_impl_.read_some_at(impl, offset, buffers, ec); - } - - /// Start an asynchronous read at the specified offset. - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some_at(implementation_type& impl, - uint64_t offset, const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - boost::asio::async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_read_some_at(impl, - offset, buffers, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/stream_handle.hpp b/contrib/restricted/boost/boost/asio/windows/stream_handle.hpp deleted file mode 100644 index a8962b6b12..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/stream_handle.hpp +++ /dev/null @@ -1,364 +0,0 @@ -// -// windows/stream_handle.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_STREAM_HANDLE_HPP -#define BOOST_ASIO_WINDOWS_STREAM_HANDLE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/windows/overlapped_handle.hpp> - -#if defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -# include <boost/asio/windows/basic_stream_handle.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -// Typedef for the typical usage of a stream-oriented handle. -typedef basic_stream_handle<> stream_handle; -#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) -/// Provides stream-oriented handle functionality. -/** - * The windows::stream_handle class provides asynchronous and blocking - * stream-oriented handle functionality. - * - * @par Thread Safety - * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Unsafe. - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream. - */ -class stream_handle - : public overlapped_handle -{ -public: - /// Construct a stream_handle without opening it. - /** - * This constructor creates a stream handle without opening it. The handle - * needs to be opened and then connected or accepted before data can be sent - * or received on it. - * - * @param io_context The io_context object that the stream handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - */ - explicit stream_handle(boost::asio::io_context& io_context) - : overlapped_handle(io_context) - { - } - - /// Construct a stream_handle on an existing native handle. - /** - * This constructor creates a stream handle object to hold an existing native - * handle. - * - * @param io_context The io_context object that the stream handle will use to - * dispatch handlers for any asynchronous operations performed on the handle. - * - * @param handle The new underlying handle implementation. - * - * @throws boost::system::system_error Thrown on failure. - */ - stream_handle(boost::asio::io_context& io_context, - const native_handle_type& handle) - : overlapped_handle(io_context, handle) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a stream_handle from another. - /** - * This constructor moves a stream handle from one object to another. - * - * @param other The other stream_handle object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c stream_handle(io_context&) constructor. - */ - stream_handle(stream_handle&& other) - : overlapped_handle(std::move(other)) - { - } - - /// Move-assign a stream_handle from another. - /** - * This assignment operator moves a stream handle from one object to - * another. - * - * @param other The other stream_handle object from which the move - * will occur. - * - * @note Following the move, the moved-from object is in the same state as if - * constructed using the @c stream_handle(io_context&) constructor. - */ - stream_handle& operator=(stream_handle&& other) - { - overlapped_handle::operator=(std::move(other)); - return *this; - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Write some data to the handle. - /** - * This function is used to write data to the stream handle. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the handle. - * - * @returns The number of bytes written. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * handle.write_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().write_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "write_some"); - return s; - } - - /// Write some data to the handle. - /** - * This function is used to write data to the stream handle. The function call - * will block until one or more bytes of the data has been written - * successfully, or until an error occurs. - * - * @param buffers One or more data buffers to be written to the handle. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. Returns 0 if an error occurred. - * - * @note The write_some operation may not transmit all of the data to the - * peer. Consider using the @ref write function if you need to ensure that - * all data is written before the blocking operation completes. - */ - template <typename ConstBufferSequence> - std::size_t write_some(const ConstBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().write_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous write. - /** - * This function is used to asynchronously write data to the stream handle. - * The function call always returns immediately. - * - * @param buffers One or more data buffers to be written to the handle. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes written. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The write operation may not transmit all of the data to the peer. - * Consider using the @ref async_write function if you need to ensure that all - * data is written before the asynchronous operation completes. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * handle.async_write_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a WriteHandler. - BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; - - boost::asio::async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_write_some( - this->get_implementation(), buffers, init.completion_handler); - - return init.result.get(); - } - - /// Read some data from the handle. - /** - * This function is used to read data from the stream handle. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws boost::system::system_error Thrown on failure. An error code of - * boost::asio::error::eof indicates that the connection was closed by the - * peer. - * - * @note The read_some operation may not read all of the requested number of - * 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. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * handle.read_some(boost::asio::buffer(data, size)); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers) - { - boost::system::error_code ec; - std::size_t s = this->get_service().read_some( - this->get_implementation(), buffers, ec); - boost::asio::detail::throw_error(ec, "read_some"); - return s; - } - - /// Read some data from the handle. - /** - * This function is used to read data from the stream handle. The function - * call will block until one or more bytes of data has been read successfully, - * or until an error occurs. - * - * @param buffers One or more buffers into which the data will be read. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes read. Returns 0 if an error occurred. - * - * @note The read_some operation may not read all of the requested number of - * 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 MutableBufferSequence> - std::size_t read_some(const MutableBufferSequence& buffers, - boost::system::error_code& ec) - { - return this->get_service().read_some( - this->get_implementation(), buffers, ec); - } - - /// Start an asynchronous read. - /** - * This function is used to asynchronously read data from the stream handle. - * The function call always returns immediately. - * - * @param buffers One or more buffers into which the data will be read. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the read operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * std::size_t bytes_transferred // Number of bytes read. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation - * of the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @note The read operation may not read all of the requested number of bytes. - * Consider using the @ref async_read function if you need to ensure that the - * requested amount of data is read before the asynchronous operation - * completes. - * - * @par Example - * To read into a single data buffer use the @ref buffer function as follows: - * @code - * handle.async_read_some(boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on reading into multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - // If you get an error on the following line it means that your handler does - // not meet the documented type requirements for a ReadHandler. - BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; - - boost::asio::async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - this->get_service().async_read_some( - this->get_implementation(), buffers, init.completion_handler); - - return init.result.get(); - } -}; -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // BOOST_ASIO_WINDOWS_STREAM_HANDLE_HPP diff --git a/contrib/restricted/boost/boost/asio/windows/stream_handle_service.hpp b/contrib/restricted/boost/boost/asio/windows/stream_handle_service.hpp deleted file mode 100644 index d3d47d2236..0000000000 --- a/contrib/restricted/boost/boost/asio/windows/stream_handle_service.hpp +++ /dev/null @@ -1,212 +0,0 @@ -// -// windows/stream_handle_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WINDOWS_STREAM_HANDLE_SERVICE_HPP -#define BOOST_ASIO_WINDOWS_STREAM_HANDLE_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> - -#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#if defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \ - || defined(GENERATING_DOCUMENTATION) - -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/win_iocp_handle_service.hpp> -#include <boost/asio/error.hpp> -#include <boost/asio/io_context.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace windows { - -/// Default service implementation for a stream handle. -class stream_handle_service -#if defined(GENERATING_DOCUMENTATION) - : public boost::asio::io_context::service -#else - : public boost::asio::detail::service_base<stream_handle_service> -#endif -{ -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static boost::asio::io_context::id id; -#endif - -private: - // The type of the platform-specific implementation. - typedef detail::win_iocp_handle_service service_impl_type; - -public: - /// The type of a stream handle implementation. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined implementation_type; -#else - typedef service_impl_type::implementation_type implementation_type; -#endif - - /// The native handle type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_handle_type; -#else - typedef service_impl_type::native_handle_type native_handle_type; -#endif - - /// Construct a new stream handle service for the specified io_context. - explicit stream_handle_service(boost::asio::io_context& io_context) - : boost::asio::detail::service_base<stream_handle_service>(io_context), - service_impl_(io_context) - { - } - - /// Construct a new stream handle implementation. - void construct(implementation_type& impl) - { - service_impl_.construct(impl); - } - -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move-construct a new stream handle implementation. - void move_construct(implementation_type& impl, - implementation_type& other_impl) - { - service_impl_.move_construct(impl, other_impl); - } - - /// Move-assign from another stream handle implementation. - void move_assign(implementation_type& impl, - stream_handle_service& other_service, - implementation_type& other_impl) - { - service_impl_.move_assign(impl, other_service.service_impl_, other_impl); - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Destroy a stream handle implementation. - void destroy(implementation_type& impl) - { - service_impl_.destroy(impl); - } - - /// Assign an existing native handle to a stream handle. - BOOST_ASIO_SYNC_OP_VOID assign(implementation_type& impl, - const native_handle_type& handle, boost::system::error_code& ec) - { - service_impl_.assign(impl, handle, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Determine whether the handle is open. - bool is_open(const implementation_type& impl) const - { - return service_impl_.is_open(impl); - } - - /// Close a stream handle implementation. - BOOST_ASIO_SYNC_OP_VOID close(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.close(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Get the native handle implementation. - native_handle_type native_handle(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - - /// Cancel all asynchronous operations associated with the handle. - BOOST_ASIO_SYNC_OP_VOID cancel(implementation_type& impl, - boost::system::error_code& ec) - { - service_impl_.cancel(impl, ec); - BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); - } - - /// Write the given data to the stream. - template <typename ConstBufferSequence> - std::size_t write_some(implementation_type& impl, - const ConstBufferSequence& buffers, boost::system::error_code& ec) - { - return service_impl_.write_some(impl, buffers, ec); - } - - /// Start an asynchronous write. - template <typename ConstBufferSequence, typename WriteHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) - async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler) - { - boost::asio::async_completion<WriteHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_write_some(impl, buffers, init.completion_handler); - - return init.result.get(); - } - - /// Read some data from the stream. - template <typename MutableBufferSequence> - std::size_t read_some(implementation_type& impl, - const MutableBufferSequence& buffers, boost::system::error_code& ec) - { - return service_impl_.read_some(impl, buffers, ec); - } - - /// Start an asynchronous read. - template <typename MutableBufferSequence, typename ReadHandler> - BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, - void (boost::system::error_code, std::size_t)) - async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadHandler) handler) - { - boost::asio::async_completion<ReadHandler, - void (boost::system::error_code, std::size_t)> init(handler); - - service_impl_.async_read_some(impl, buffers, init.completion_handler); - - return init.result.get(); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown() - { - service_impl_.shutdown(); - } - - // The platform-specific implementation. - service_impl_type service_impl_; -}; - -} // namespace windows -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) - // || defined(GENERATING_DOCUMENTATION) - -#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES) - -#endif // BOOST_ASIO_WINDOWS_STREAM_HANDLE_SERVICE_HPP diff --git a/contrib/restricted/boost/boost/asio/write.hpp b/contrib/restricted/boost/boost/asio/write.hpp deleted file mode 100644 index 50095dbdf7..0000000000 --- a/contrib/restricted/boost/boost/asio/write.hpp +++ /dev/null @@ -1,929 +0,0 @@ -// -// write.hpp -// ~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WRITE_HPP -#define BOOST_ASIO_WRITE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/asio/error.hpp> - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -# include <boost/asio/basic_streambuf_fwd.hpp> -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/** - * @defgroup write boost::asio::write - * - * @brief Write a certain amount of data to a stream before returning. - */ -/*@{*/ - -/// Write all of the supplied data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * 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 - * stream. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code boost::asio::write(s, boost::asio::buffer(data, size)); @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write( - * s, buffers, - * boost::asio::transfer_all()); @endcode - */ -template <typename SyncWriteStream, typename ConstBufferSequence> -std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type* = 0); - -/// Write all of the supplied data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * 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 - * stream. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code boost::asio::write(s, boost::asio::buffer(data, size), ec); @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write( - * s, buffers, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncWriteStream, typename ConstBufferSequence> -std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, - boost::system::error_code& ec, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type* = 0); - -/// Write a certain amount of data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * 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 - * stream. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the stream's write_some function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code boost::asio::write(s, boost::asio::buffer(data, size), - * boost::asio::transfer_at_least(32)); @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename SyncWriteStream, typename ConstBufferSequence, - typename CompletionCondition> -std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type* = 0); - -/// Write a certain amount of data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * 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 - * stream. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the stream's write_some function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncWriteStream, typename ConstBufferSequence, - typename CompletionCondition> -std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, boost::system::error_code& ec, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type* = 0); - -/// Write all of the supplied data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied dynamic buffer sequence has been written. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * the SyncWriteStream concept. - * - * @param buffers The dynamic buffer sequence from which data will be written. - * Successfully written data is automatically consumed from the buffers. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write( - * s, buffers, - * boost::asio::transfer_all()); @endcode - */ -template <typename SyncWriteStream, typename DynamicBuffer> -std::size_t write(SyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -/// Write all of the supplied data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied dynamic buffer sequence has been written. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * the SyncWriteStream concept. - * - * @param buffers The dynamic buffer sequence from which data will be written. - * Successfully written data is automatically consumed from the buffers. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write( - * s, buffers, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncWriteStream, typename DynamicBuffer> -std::size_t write(SyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - boost::system::error_code& ec, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -/// Write a certain amount of data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied dynamic buffer sequence has been written. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * the SyncWriteStream concept. - * - * @param buffers The dynamic buffer sequence from which data will be written. - * Successfully written data is automatically consumed from the buffers. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the stream's write_some function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - */ -template <typename SyncWriteStream, typename DynamicBuffer, - typename CompletionCondition> -std::size_t write(SyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -/// Write a certain amount of data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied dynamic buffer sequence has been written. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * the SyncWriteStream concept. - * - * @param buffers The dynamic buffer sequence from which data will be written. - * Successfully written data is automatically consumed from the buffers. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the stream's write_some function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncWriteStream, typename DynamicBuffer, - typename CompletionCondition> -std::size_t write(SyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, boost::system::error_code& ec, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Write all of the supplied data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * the SyncWriteStream concept. - * - * @param b The basic_streambuf object from which data will be written. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write( - * s, b, - * boost::asio::transfer_all()); @endcode - */ -template <typename SyncWriteStream, typename Allocator> -std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b); - -/// Write all of the supplied data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * the SyncWriteStream concept. - * - * @param b The basic_streambuf object from which data will be written. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write( - * s, b, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncWriteStream, typename Allocator> -std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b, - boost::system::error_code& ec); - -/// Write a certain amount of data to a stream before returning. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * the SyncWriteStream concept. - * - * @param b The basic_streambuf object from which data will be written. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the stream's write_some function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - */ -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. -/** - * This function is used to write a certain number of bytes of data to a stream. - * The call will block until one of the following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * write_some function. - * - * @param s The stream to which the data is to be written. The type must support - * the SyncWriteStream concept. - * - * @param b The basic_streambuf object from which data will be written. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the stream's write_some function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncWriteStream, typename Allocator, - typename CompletionCondition> -std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, boost::system::error_code& ec); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ -/** - * @defgroup async_write boost::asio::async_write - * - * @brief Start an asynchronous operation to write a certain amount of data to a - * stream. - */ -/*@{*/ - -/// Start an asynchronous operation to write all of the supplied data to a -/// stream. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_write_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other write operations (such - * as async_write, the stream's async_write_some function, or any other composed - * operations that perform writes) until this operation completes. - * - * @param s The stream to which the data is to be written. The type must support - * 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 - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes written from the - * // buffers. If an error occurred, - * // this will be less than the sum - * // of the buffer sizes. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * boost::asio::async_write(s, boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename AsyncWriteStream, typename ConstBufferSequence, - typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type* = 0); - -/// Start an asynchronous operation to write a certain amount of data to a -/// stream. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_write_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other write operations (such - * as async_write, the stream's async_write_some function, or any other composed - * operations that perform writes) until this operation completes. - * - * @param s The stream to which the data is to be written. The type must support - * 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 - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_write_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the stream's async_write_some function. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes written from the - * // buffers. If an error occurred, - * // this will be less than the sum - * // of the buffer sizes. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code boost::asio::async_write(s, - * boost::asio::buffer(data, size), - * boost::asio::transfer_at_least(32), - * handler); @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename AsyncWriteStream, typename ConstBufferSequence, - typename CompletionCondition, typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler, - typename enable_if< - is_const_buffer_sequence<ConstBufferSequence>::value - >::type* = 0); - -/// Start an asynchronous operation to write all of the supplied data to a -/// stream. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li All of the data in the supplied dynamic buffer sequence has been written. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_write_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other write operations (such - * as async_write, the stream's async_write_some function, or any other composed - * operations that perform writes) until this operation completes. - * - * @param s The stream to which the data is to be written. The type must support - * the AsyncWriteStream concept. - * - * @param buffers The dynamic buffer sequence from which data will be written. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. Successfully written - * data is automatically consumed from the buffers. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes written from the - * // buffers. If an error occurred, - * // this will be less than the sum - * // of the buffer sizes. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -template <typename AsyncWriteStream, - typename DynamicBuffer, typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -/// Start an asynchronous operation to write a certain amount of data to a -/// stream. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li All of the data in the supplied dynamic buffer sequence has been written. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_write_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other write operations (such - * as async_write, the stream's async_write_some function, or any other composed - * operations that perform writes) until this operation completes. - * - * @param s The stream to which the data is to be written. The type must support - * the AsyncWriteStream concept. - * - * @param buffers The dynamic buffer sequence from which data will be written. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. Successfully written - * data is automatically consumed from the buffers. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_write_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the stream's async_write_some function. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes written from the - * // buffers. If an error occurred, - * // this will be less than the sum - * // of the buffer sizes. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -template <typename AsyncWriteStream, typename DynamicBuffer, - typename CompletionCondition, typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, - BOOST_ASIO_MOVE_ARG(DynamicBuffer) buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler, - typename enable_if< - is_dynamic_buffer<typename decay<DynamicBuffer>::type>::value - >::type* = 0); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Start an asynchronous operation to write all of the supplied data to a -/// stream. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_write_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other write operations (such - * as async_write, the stream's async_write_some function, or any other composed - * operations that perform writes) until this operation completes. - * - * @param s The stream to which the data is to be written. The type must support - * 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 - * remains valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes written from the - * // buffers. If an error occurred, - * // this will be less than the sum - * // of the buffer sizes. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -template <typename AsyncWriteStream, typename Allocator, typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler); - -/// Start an asynchronous operation to write a certain amount of data to a -/// stream. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a stream. The function call always returns immediately. The - * asynchronous operation will continue until one of the following conditions - * is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the stream's - * async_write_some function, and is known as a <em>composed operation</em>. The - * program must ensure that the stream performs no other write operations (such - * as async_write, the stream's async_write_some function, or any other composed - * operations that perform writes) until this operation completes. - * - * @param s The stream to which the data is to be written. The type must support - * 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 - * remains valid until the handler is called. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_write_some operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the stream's async_write_some function. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * const boost::system::error_code& error, // Result of operation. - * - * std::size_t bytes_transferred // Number of bytes written from the - * // buffers. If an error occurred, - * // this will be less than the sum - * // of the buffer sizes. - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -template <typename AsyncWriteStream, typename Allocator, - typename CompletionCondition, typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/write.hpp> - -#endif // BOOST_ASIO_WRITE_HPP diff --git a/contrib/restricted/boost/boost/asio/write_at.hpp b/contrib/restricted/boost/boost/asio/write_at.hpp deleted file mode 100644 index 766a8e89c4..0000000000 --- a/contrib/restricted/boost/boost/asio/write_at.hpp +++ /dev/null @@ -1,679 +0,0 @@ -// -// write_at.hpp -// ~~~~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_WRITE_AT_HPP -#define BOOST_ASIO_WRITE_AT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <cstddef> -#include <boost/asio/async_result.hpp> -#include <boost/asio/detail/cstdint.hpp> -#include <boost/asio/error.hpp> - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -# include <boost/asio/basic_streambuf_fwd.hpp> -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -/** - * @defgroup write_at boost::asio::write_at - * - * @brief Write a certain amount of data at a specified offset before returning. - */ -/*@{*/ - -/// Write all of the supplied data at the specified offset before returning. -/** - * This function is used to write a certain number of bytes of data to a random - * access device at a specified offset. The call will block until one of the - * following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * write_some_at function. - * - * @param d The device to which the data is to be written. The type must support - * the SyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @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 - * device. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code boost::asio::write_at(d, 42, boost::asio::buffer(data, size)); @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write_at( - * d, offset, buffers, - * boost::asio::transfer_all()); @endcode - */ -template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> -std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers); - -/// Write all of the supplied data at the specified offset before returning. -/** - * This function is used to write a certain number of bytes of data to a random - * access device at a specified offset. The call will block until one of the - * following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * write_some_at function. - * - * @param d The device to which the data is to be written. The type must support - * the SyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @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 - * device. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code boost::asio::write_at(d, 42, - * boost::asio::buffer(data, size), ec); @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write_at( - * d, offset, buffers, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> -std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - boost::system::error_code& ec); - -/// Write a certain amount of data at a specified offset before returning. -/** - * This function is used to write a certain number of bytes of data to a random - * access device at a specified offset. The call will block until one of the - * following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * write_some_at function. - * - * @param d The device to which the data is to be written. The type must support - * the SyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @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 - * device. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the device's write_some_at function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code boost::asio::write_at(d, 42, boost::asio::buffer(data, size), - * boost::asio::transfer_at_least(32)); @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, - typename CompletionCondition> -std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition); - -/// Write a certain amount of data at a specified offset before returning. -/** - * This function is used to write a certain number of bytes of data to a random - * access device at a specified offset. The call will block until one of the - * following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * write_some_at function. - * - * @param d The device to which the data is to be written. The type must support - * the SyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @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 - * device. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the device's write_some_at function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, - typename CompletionCondition> -std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, boost::system::error_code& ec); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Write all of the supplied data at the specified offset before returning. -/** - * This function is used to write a certain number of bytes of data to a random - * access device at a specified offset. The call will block until one of the - * following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * write_some_at function. - * - * @param d The device to which the data is to be written. The type must support - * the SyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @param b The basic_streambuf object from which data will be written. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write_at( - * d, 42, b, - * boost::asio::transfer_all()); @endcode - */ -template <typename SyncRandomAccessWriteDevice, typename Allocator> -std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, basic_streambuf<Allocator>& b); - -/// Write all of the supplied data at the specified offset before returning. -/** - * This function is used to write a certain number of bytes of data to a random - * access device at a specified offset. The call will block until one of the - * following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * write_some_at function. - * - * @param d The device to which the data is to be written. The type must support - * the SyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @param b The basic_streambuf object from which data will be written. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes transferred. - * - * @note This overload is equivalent to calling: - * @code boost::asio::write_at( - * d, 42, b, - * boost::asio::transfer_all(), ec); @endcode - */ -template <typename SyncRandomAccessWriteDevice, typename Allocator> -std::size_t write_at(SyncRandomAccessWriteDevice& d, - uint64_t offset, basic_streambuf<Allocator>& b, - boost::system::error_code& ec); - -/// Write a certain amount of data at a specified offset before returning. -/** - * This function is used to write a certain number of bytes of data to a random - * access device at a specified offset. The call will block until one of the - * following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * write_some_at function. - * - * @param d The device to which the data is to be written. The type must support - * the SyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @param b The basic_streambuf object from which data will be written. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the device's write_some_at function. - * - * @returns The number of bytes transferred. - * - * @throws boost::system::system_error Thrown on failure. - */ -template <typename SyncRandomAccessWriteDevice, typename Allocator, - typename CompletionCondition> -std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, - basic_streambuf<Allocator>& b, CompletionCondition completion_condition); - -/// Write a certain amount of data at a specified offset before returning. -/** - * This function is used to write a certain number of bytes of data to a random - * access device at a specified offset. The call will block until one of the - * following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * write_some_at function. - * - * @param d The device to which the data is to be written. The type must support - * the SyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @param b The basic_streambuf object from which data will be written. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest write_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the device's write_some_at function. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes written. If an error occurs, returns the total - * number of bytes successfully transferred prior to the error. - */ -template <typename SyncRandomAccessWriteDevice, typename Allocator, - typename CompletionCondition> -std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, - basic_streambuf<Allocator>& b, CompletionCondition completion_condition, - boost::system::error_code& ec); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ -/** - * @defgroup async_write_at boost::asio::async_write_at - * - * @brief Start an asynchronous operation to write a certain amount of data at - * the specified offset. - */ -/*@{*/ - -/// Start an asynchronous operation to write all of the supplied data at the -/// specified offset. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a random access device at a specified offset. The function call - * always returns immediately. The asynchronous operation will continue until - * one of the following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * async_write_some_at function, and is known as a <em>composed operation</em>. - * The program must ensure that the device performs no <em>overlapping</em> - * write operations (such as async_write_at, the device's async_write_some_at - * function, or any other composed operations that perform writes) until this - * operation completes. Operations are overlapping if the regions defined by - * their offsets, and the numbers of bytes to write, intersect. - * - * @param d The device to which the data is to be written. The type must support - * the AsyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @param buffers One or more buffers containing the data to be written. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of - * the handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // Number of bytes written from the buffers. If an error - * // occurred, this will be less than the sum of the buffer sizes. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code - * boost::asio::async_write_at(d, 42, boost::asio::buffer(data, size), handler); - * @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, - typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset, - const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler); - -/// Start an asynchronous operation to write a certain amount of data at the -/// specified offset. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a random access device at a specified offset. The function call - * always returns immediately. The asynchronous operation will continue until - * one of the following conditions is true: - * - * @li All of the data in the supplied buffers has been written. That is, the - * bytes transferred is equal to the sum of the buffer sizes. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * async_write_some_at function, and is known as a <em>composed operation</em>. - * The program must ensure that the device performs no <em>overlapping</em> - * write operations (such as async_write_at, the device's async_write_some_at - * function, or any other composed operations that perform writes) until this - * operation completes. Operations are overlapping if the regions defined by - * their offsets, and the numbers of bytes to write, intersect. - * - * @param d The device to which the data is to be written. The type must support - * the AsyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @param buffers One or more buffers containing the data to be written. - * Although the buffers object may be copied as necessary, ownership of the - * underlying memory blocks is retained by the caller, which must guarantee - * that they remain valid until the handler is called. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_write_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the device's async_write_some_at function. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // Number of bytes written from the buffers. If an error - * // occurred, this will be less than the sum of the buffer sizes. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - * - * @par Example - * To write a single data buffer use the @ref buffer function as follows: - * @code boost::asio::async_write_at(d, 42, - * boost::asio::buffer(data, size), - * boost::asio::transfer_at_least(32), - * handler); @endcode - * See the @ref buffer documentation for information on writing multiple - * buffers in one go, and how to use it with arrays, boost::array or - * std::vector. - */ -template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, - typename CompletionCondition, typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write_at(AsyncRandomAccessWriteDevice& d, - uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler); - -#if !defined(BOOST_ASIO_NO_EXTENSIONS) -#if !defined(BOOST_ASIO_NO_IOSTREAM) - -/// Start an asynchronous operation to write all of the supplied data at the -/// specified offset. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a random access device at a specified offset. The function call - * always returns immediately. The asynchronous operation will continue until - * one of the following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li An error occurred. - * - * This operation is implemented in terms of zero or more calls to the device's - * async_write_some_at function, and is known as a <em>composed operation</em>. - * The program must ensure that the device performs no <em>overlapping</em> - * write operations (such as async_write_at, the device's async_write_some_at - * function, or any other composed operations that perform writes) until this - * operation completes. Operations are overlapping if the regions defined by - * their offsets, and the numbers of bytes to write, intersect. - * - * @param d The device to which the data is to be written. The type must support - * the AsyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @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 - * remains valid until the handler is called. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // Number of bytes written from the buffers. If an error - * // occurred, this will be less than the sum of the buffer sizes. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -template <typename AsyncRandomAccessWriteDevice, typename Allocator, - typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset, - basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(WriteHandler) handler); - -/// Start an asynchronous operation to write a certain amount of data at the -/// specified offset. -/** - * This function is used to asynchronously write a certain number of bytes of - * data to a random access device at a specified offset. The function call - * always returns immediately. The asynchronous operation will continue until - * one of the following conditions is true: - * - * @li All of the data in the supplied basic_streambuf has been written. - * - * @li The completion_condition function object returns 0. - * - * This operation is implemented in terms of zero or more calls to the device's - * async_write_some_at function, and is known as a <em>composed operation</em>. - * The program must ensure that the device performs no <em>overlapping</em> - * write operations (such as async_write_at, the device's async_write_some_at - * function, or any other composed operations that perform writes) until this - * operation completes. Operations are overlapping if the regions defined by - * their offsets, and the numbers of bytes to write, intersect. - * - * @param d The device to which the data is to be written. The type must support - * the AsyncRandomAccessWriteDevice concept. - * - * @param offset The offset at which the data will be written. - * - * @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 - * remains valid until the handler is called. - * - * @param completion_condition The function object to be called to determine - * whether the write operation is complete. The signature of the function object - * must be: - * @code std::size_t completion_condition( - * // Result of latest async_write_some_at operation. - * const boost::system::error_code& error, - * - * // Number of bytes transferred so far. - * std::size_t bytes_transferred - * ); @endcode - * A return value of 0 indicates that the write operation is complete. A - * non-zero return value indicates the maximum number of bytes to be written on - * the next call to the device's async_write_some_at function. - * - * @param handler The handler to be called when the write operation completes. - * Copies will be made of the handler as required. The function signature of the - * handler must be: - * @code void handler( - * // Result of operation. - * const boost::system::error_code& error, - * - * // Number of bytes written from the buffers. If an error - * // occurred, this will be less than the sum of the buffer sizes. - * std::size_t bytes_transferred - * ); @endcode - * Regardless of whether the asynchronous operation completes immediately or - * not, the handler will not be invoked from within this function. Invocation of - * the handler will be performed in a manner equivalent to using - * boost::asio::io_context::post(). - */ -template <typename AsyncRandomAccessWriteDevice, typename Allocator, - typename CompletionCondition, typename WriteHandler> -BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, - void (boost::system::error_code, std::size_t)) -async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset, - basic_streambuf<Allocator>& b, CompletionCondition completion_condition, - BOOST_ASIO_MOVE_ARG(WriteHandler) handler); - -#endif // !defined(BOOST_ASIO_NO_IOSTREAM) -#endif // !defined(BOOST_ASIO_NO_EXTENSIONS) - -/*@}*/ - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#include <boost/asio/impl/write_at.hpp> - -#endif // BOOST_ASIO_WRITE_AT_HPP diff --git a/contrib/restricted/boost/boost/asio/yield.hpp b/contrib/restricted/boost/boost/asio/yield.hpp deleted file mode 100644 index 5ed7f9ae4f..0000000000 --- a/contrib/restricted/boost/boost/asio/yield.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// -// yield.hpp -// ~~~~~~~~~ -// -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#include "coroutine.hpp" - -#ifndef reenter -# define reenter(c) BOOST_ASIO_CORO_REENTER(c) -#endif - -#ifndef yield -# define yield BOOST_ASIO_CORO_YIELD -#endif - -#ifndef fork -# define fork BOOST_ASIO_CORO_FORK -#endif diff --git a/contrib/restricted/boost/context/CMakeLists.txt b/contrib/restricted/boost/context/CMakeLists.txt new file mode 100644 index 0000000000..c51ea1396f --- /dev/null +++ b/contrib/restricted/boost/context/CMakeLists.txt @@ -0,0 +1,10 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +add_subdirectory(fcontext_impl) +add_subdirectory(impl_common) diff --git a/contrib/restricted/boost/context/fcontext_impl/CMakeLists.darwin.txt b/contrib/restricted/boost/context/fcontext_impl/CMakeLists.darwin.txt new file mode 100644 index 0000000000..c21a82cc15 --- /dev/null +++ b/contrib/restricted/boost/context/fcontext_impl/CMakeLists.darwin.txt @@ -0,0 +1,22 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(boost-context-fcontext_impl) +target_compile_options(boost-context-fcontext_impl PRIVATE + -Wno-everything +) +target_link_libraries(boost-context-fcontext_impl PUBLIC + contrib-libs-cxxsupp + boost-context-impl_common +) +target_sources(boost-context-fcontext_impl PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/context/src/asm/jump_x86_64_sysv_macho_gas.S + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/context/src/asm/make_x86_64_sysv_macho_gas.S + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/context/src/asm/ontop_x86_64_sysv_macho_gas.S +) diff --git a/contrib/restricted/boost/context/fcontext_impl/CMakeLists.linux.txt b/contrib/restricted/boost/context/fcontext_impl/CMakeLists.linux.txt new file mode 100644 index 0000000000..37ddd9aae6 --- /dev/null +++ b/contrib/restricted/boost/context/fcontext_impl/CMakeLists.linux.txt @@ -0,0 +1,22 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(boost-context-fcontext_impl) +target_compile_options(boost-context-fcontext_impl PRIVATE + -Wno-everything +) +target_link_libraries(boost-context-fcontext_impl PUBLIC + contrib-libs-cxxsupp + boost-context-impl_common +) +target_sources(boost-context-fcontext_impl PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/context/src/asm/jump_x86_64_sysv_elf_gas.S + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/context/src/asm/make_x86_64_sysv_elf_gas.S + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/context/src/asm/ontop_x86_64_sysv_elf_gas.S +) diff --git a/contrib/restricted/boost/context/fcontext_impl/CMakeLists.txt b/contrib/restricted/boost/context/fcontext_impl/CMakeLists.txt new file mode 100644 index 0000000000..dbfe6fa2c4 --- /dev/null +++ b/contrib/restricted/boost/context/fcontext_impl/CMakeLists.txt @@ -0,0 +1,13 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +if (APPLE) + include(CMakeLists.darwin.txt) +elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE) + include(CMakeLists.linux.txt) +endif() diff --git a/contrib/restricted/boost/context/impl_common/CMakeLists.txt b/contrib/restricted/boost/context/impl_common/CMakeLists.txt new file mode 100644 index 0000000000..e2e79916bf --- /dev/null +++ b/contrib/restricted/boost/context/impl_common/CMakeLists.txt @@ -0,0 +1,30 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(boost-context-impl_common) +target_compile_options(boost-context-impl_common PRIVATE + -DBOOST_CONTEXT_SOURCE + -Wno-everything +) +target_include_directories(boost-context-impl_common PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/context/include +) +target_link_libraries(boost-context-impl_common PUBLIC + contrib-libs-cxxsupp + restricted-boost-assert + restricted-boost-config + restricted-boost-pool + restricted-boost-predef + restricted-boost-smart_ptr + restricted-boost-thread +) +target_sources(boost-context-impl_common PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/context/src/execution_context.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/context/src/posix/stack_traits.cpp +) diff --git a/contrib/restricted/boost/coroutine/CMakeLists.txt b/contrib/restricted/boost/coroutine/CMakeLists.txt new file mode 100644 index 0000000000..0bbb89d950 --- /dev/null +++ b/contrib/restricted/boost/coroutine/CMakeLists.txt @@ -0,0 +1,40 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(restricted-boost-coroutine) +target_compile_options(restricted-boost-coroutine PUBLIC + -DBOOST_COROUTINES_NO_DEPRECATION_WARNING +) +target_compile_options(restricted-boost-coroutine PRIVATE + -DBOOST_COROUTINES_SOURCE + -Wno-everything +) +target_include_directories(restricted-boost-coroutine PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/coroutine/include +) +target_link_libraries(restricted-boost-coroutine PUBLIC + contrib-libs-cxxsupp + restricted-boost-assert + restricted-boost-config + boost-context-fcontext_impl + restricted-boost-core + restricted-boost-exception + restricted-boost-move + restricted-boost-range + restricted-boost-system + restricted-boost-thread + restricted-boost-throw_exception + restricted-boost-type_traits + restricted-boost-utility +) +target_sources(restricted-boost-coroutine PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/coroutine/src/posix/stack_traits.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/coroutine/src/detail/coroutine_context.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/coroutine/src/exceptions.cpp +) |