Remove previously deprecated functions and classes.
diff --git a/asio/include/Makefile.am b/asio/include/Makefile.am index 85d4c3b..bb4dccd 100644 --- a/asio/include/Makefile.am +++ b/asio/include/Makefile.am
@@ -372,10 +372,8 @@ asio/socket_acceptor_service.hpp \ asio/socket_base.hpp \ asio/spawn.hpp \ - asio/ssl/basic_context.hpp \ asio/ssl/context_base.hpp \ asio/ssl/context.hpp \ - asio/ssl/context_service.hpp \ asio/ssl/detail/buffered_handshake_op.hpp \ asio/ssl/detail/engine.hpp \ asio/ssl/detail/handshake_op.hpp \ @@ -397,17 +395,9 @@ asio/ssl/impl/error.ipp \ asio/ssl/impl/rfc2818_verification.ipp \ asio/ssl/impl/src.hpp \ - asio/ssl/old/basic_context.hpp \ - asio/ssl/old/context_service.hpp \ - asio/ssl/old/detail/openssl_context_service.hpp \ - asio/ssl/old/detail/openssl_operation.hpp \ - asio/ssl/old/detail/openssl_stream_service.hpp \ - asio/ssl/old/stream.hpp \ - asio/ssl/old/stream_service.hpp \ asio/ssl/rfc2818_verification.hpp \ asio/ssl/stream_base.hpp \ asio/ssl/stream.hpp \ - asio/ssl/stream_service.hpp \ asio/ssl/verify_context.hpp \ asio/ssl/verify_mode.hpp \ asio/steady_timer.hpp \
diff --git a/asio/include/asio/basic_datagram_socket.hpp b/asio/include/asio/basic_datagram_socket.hpp index a1356b9..04eb70a 100644 --- a/asio/include/asio/basic_datagram_socket.hpp +++ b/asio/include/asio/basic_datagram_socket.hpp
@@ -43,10 +43,6 @@ : public basic_socket<Protocol, DatagramSocketService> { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// socket. - typedef typename DatagramSocketService::native_handle_type native_type; - /// The native representation of a socket. typedef typename DatagramSocketService::native_handle_type native_handle_type;
diff --git a/asio/include/asio/basic_io_object.hpp b/asio/include/asio/basic_io_object.hpp index 0d9b2be..f4a8de6 100644 --- a/asio/include/asio/basic_io_object.hpp +++ b/asio/include/asio/basic_io_object.hpp
@@ -78,7 +78,7 @@ */ asio::io_service& get_io_service() { - return service.get_io_service(); + return service_.get_io_service(); } #endif // !defined(ASIO_NO_DEPRECATED) @@ -88,7 +88,7 @@ /// Get the executor associated with the object. executor_type get_executor() ASIO_NOEXCEPT { - return service.get_io_service().get_executor(); + return service_.get_io_service().get_executor(); } protected: @@ -98,9 +98,9 @@ * @code get_service().construct(get_implementation()); @endcode */ explicit basic_io_object(asio::io_service& io_service) - : service(asio::use_service<IoObjectService>(io_service)) + : service_(asio::use_service<IoObjectService>(io_service)) { - service.construct(implementation); + service_.construct(implementation_); } #if defined(GENERATING_DOCUMENTATION) @@ -132,47 +132,42 @@ */ ~basic_io_object() { - service.destroy(implementation); + service_.destroy(implementation_); } /// Get the service associated with the I/O object. service_type& get_service() { - return service; + return service_; } /// Get the service associated with the I/O object. const service_type& get_service() const { - return service; + return service_; } - /// (Deprecated: Use get_service().) The service associated with the I/O - /// object. - /** - * @note Available only for services that do not support movability. - */ - service_type& service; - /// Get the underlying implementation of the I/O object. implementation_type& get_implementation() { - return implementation; + return implementation_; } /// Get the underlying implementation of the I/O object. const implementation_type& get_implementation() const { - return implementation; + return implementation_; } - /// (Deprecated: Use get_implementation().) The underlying implementation of - /// the I/O object. - implementation_type implementation; - private: basic_io_object(const basic_io_object&); basic_io_object& operator=(const basic_io_object&); + + // The service associated with the I/O object. + service_type& service_; + + /// The underlying implementation of the I/O object. + implementation_type implementation_; }; #if defined(ASIO_HAS_MOVE) @@ -202,24 +197,24 @@ explicit basic_io_object(asio::io_service& io_service) : service_(&asio::use_service<IoObjectService>(io_service)) { - service_->construct(implementation); + service_->construct(implementation_); } basic_io_object(basic_io_object&& other) : service_(&other.get_service()) { - service_->move_construct(implementation, other.implementation); + service_->move_construct(implementation_, other.implementation_); } ~basic_io_object() { - service_->destroy(implementation); + service_->destroy(implementation_); } basic_io_object& operator=(basic_io_object&& other) { - service_->move_assign(implementation, - *other.service_, other.implementation); + service_->move_assign(implementation_, + *other.service_, other.implementation_); service_ = other.service_; return *this; } @@ -236,21 +231,20 @@ implementation_type& get_implementation() { - return implementation; + return implementation_; } const implementation_type& get_implementation() const { - return implementation; + return implementation_; } - implementation_type implementation; - private: basic_io_object(const basic_io_object&); void operator=(const basic_io_object&); IoObjectService* service_; + implementation_type implementation_; }; #endif // defined(ASIO_HAS_MOVE)
diff --git a/asio/include/asio/basic_raw_socket.hpp b/asio/include/asio/basic_raw_socket.hpp index b0f3f18..231472d 100644 --- a/asio/include/asio/basic_raw_socket.hpp +++ b/asio/include/asio/basic_raw_socket.hpp
@@ -43,10 +43,6 @@ : public basic_socket<Protocol, RawSocketService> { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// socket. - typedef typename RawSocketService::native_handle_type native_type; - /// The native representation of a socket. typedef typename RawSocketService::native_handle_type native_handle_type;
diff --git a/asio/include/asio/basic_seq_packet_socket.hpp b/asio/include/asio/basic_seq_packet_socket.hpp index a3d720e..34a9cde 100644 --- a/asio/include/asio/basic_seq_packet_socket.hpp +++ b/asio/include/asio/basic_seq_packet_socket.hpp
@@ -42,10 +42,6 @@ : public basic_socket<Protocol, SeqPacketSocketService> { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// socket. - typedef typename SeqPacketSocketService::native_handle_type native_type; - /// The native representation of a socket. typedef typename SeqPacketSocketService::native_handle_type native_handle_type;
diff --git a/asio/include/asio/basic_serial_port.hpp b/asio/include/asio/basic_serial_port.hpp index 007d293..1f5f3a4 100644 --- a/asio/include/asio/basic_serial_port.hpp +++ b/asio/include/asio/basic_serial_port.hpp
@@ -48,10 +48,6 @@ public serial_port_base { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// serial port. - typedef typename SerialPortService::native_handle_type native_type; - /// The native representation of a serial port. typedef typename SerialPortService::native_handle_type native_handle_type; @@ -290,18 +286,6 @@ return this->get_service().close(this->get_implementation(), ec); } - /// (Deprecated: Use native_handle().) 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_type native() - { - return this->get_service().native_handle(this->get_implementation()); - } - /// Get the native serial port representation. /** * This function may be used to obtain the underlying representation of the
diff --git a/asio/include/asio/basic_signal_set.hpp b/asio/include/asio/basic_signal_set.hpp index 2dd71ce..e3673a3 100644 --- a/asio/include/asio/basic_signal_set.hpp +++ b/asio/include/asio/basic_signal_set.hpp
@@ -123,7 +123,7 @@ : basic_io_object<SignalSetService>(io_service) { asio::error_code ec; - this->service.add(this->implementation, signal_number_1, ec); + this->get_service().add(this->get_implementation(), signal_number_1, ec); asio::detail::throw_error(ec, "add"); } @@ -148,9 +148,9 @@ : basic_io_object<SignalSetService>(io_service) { asio::error_code ec; - this->service.add(this->implementation, signal_number_1, ec); + this->get_service().add(this->get_implementation(), signal_number_1, ec); asio::detail::throw_error(ec, "add"); - this->service.add(this->implementation, signal_number_2, ec); + this->get_service().add(this->get_implementation(), signal_number_2, ec); asio::detail::throw_error(ec, "add"); } @@ -178,11 +178,11 @@ : basic_io_object<SignalSetService>(io_service) { asio::error_code ec; - this->service.add(this->implementation, signal_number_1, ec); + this->get_service().add(this->get_implementation(), signal_number_1, ec); asio::detail::throw_error(ec, "add"); - this->service.add(this->implementation, signal_number_2, ec); + this->get_service().add(this->get_implementation(), signal_number_2, ec); asio::detail::throw_error(ec, "add"); - this->service.add(this->implementation, signal_number_3, ec); + this->get_service().add(this->get_implementation(), signal_number_3, ec); asio::detail::throw_error(ec, "add"); } @@ -198,7 +198,7 @@ void add(int signal_number) { asio::error_code ec; - this->service.add(this->implementation, signal_number, ec); + this->get_service().add(this->get_implementation(), signal_number, ec); asio::detail::throw_error(ec, "add"); } @@ -214,7 +214,8 @@ asio::error_code add(int signal_number, asio::error_code& ec) { - return this->service.add(this->implementation, signal_number, ec); + return this->get_service().add( + this->get_implementation(), signal_number, ec); } /// Remove a signal from a signal_set. @@ -232,7 +233,7 @@ void remove(int signal_number) { asio::error_code ec; - this->service.remove(this->implementation, signal_number, ec); + this->get_service().remove(this->get_implementation(), signal_number, ec); asio::detail::throw_error(ec, "remove"); } @@ -251,7 +252,8 @@ asio::error_code remove(int signal_number, asio::error_code& ec) { - return this->service.remove(this->implementation, signal_number, ec); + return this->get_service().remove( + this->get_implementation(), signal_number, ec); } /// Remove all signals from a signal_set. @@ -266,7 +268,7 @@ void clear() { asio::error_code ec; - this->service.clear(this->implementation, ec); + this->get_service().clear(this->get_implementation(), ec); asio::detail::throw_error(ec, "clear"); } @@ -281,7 +283,7 @@ */ asio::error_code clear(asio::error_code& ec) { - return this->service.clear(this->implementation, ec); + return this->get_service().clear(this->get_implementation(), ec); } /// Cancel all operations associated with the signal set. @@ -308,7 +310,7 @@ void cancel() { asio::error_code ec; - this->service.cancel(this->implementation, ec); + this->get_service().cancel(this->get_implementation(), ec); asio::detail::throw_error(ec, "cancel"); } @@ -335,7 +337,7 @@ */ asio::error_code cancel(asio::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Start an asynchronous operation to wait for a signal to be delivered. @@ -372,7 +374,7 @@ // not meet the documented type requirements for a SignalHandler. ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check; - return this->service.async_wait(this->implementation, + return this->get_service().async_wait(this->get_implementation(), ASIO_MOVE_CAST(SignalHandler)(handler)); } };
diff --git a/asio/include/asio/basic_socket.hpp b/asio/include/asio/basic_socket.hpp index da223df..c2b50e9 100644 --- a/asio/include/asio/basic_socket.hpp +++ b/asio/include/asio/basic_socket.hpp
@@ -43,10 +43,6 @@ public socket_base { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// socket. - typedef typename SocketService::native_handle_type native_type; - /// The native representation of a socket. typedef typename SocketService::native_handle_type native_handle_type; @@ -385,17 +381,6 @@ return this->get_service().close(this->get_implementation(), ec); } - /// (Deprecated: Use native_handle().) Get the native socket representation. - /** - * This function may be used to obtain the underlying representation of the - * socket. This is intended to allow access to native socket functionality - * that is not otherwise provided. - */ - native_type native() - { - return this->get_service().native_handle(this->get_implementation()); - } - /// Get the native socket representation. /** * This function may be used to obtain the underlying representation of the
diff --git a/asio/include/asio/basic_socket_acceptor.hpp b/asio/include/asio/basic_socket_acceptor.hpp index a1c10ce..4494035 100644 --- a/asio/include/asio/basic_socket_acceptor.hpp +++ b/asio/include/asio/basic_socket_acceptor.hpp
@@ -56,10 +56,6 @@ public socket_base { public: - /// (Deprecated: Use native_handle_type.) The native representation of an - /// acceptor. - typedef typename SocketAcceptorService::native_handle_type native_type; - /// The native representation of an acceptor. typedef typename SocketAcceptorService::native_handle_type native_handle_type; @@ -494,17 +490,6 @@ return this->get_service().close(this->get_implementation(), ec); } - /// (Deprecated: Use native_handle().) 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_type native() - { - return this->get_service().native_handle(this->get_implementation()); - } - /// Get the native acceptor representation. /** * This function may be used to obtain the underlying representation of the
diff --git a/asio/include/asio/basic_stream_socket.hpp b/asio/include/asio/basic_stream_socket.hpp index f2d1ccf..6f6a592 100644 --- a/asio/include/asio/basic_stream_socket.hpp +++ b/asio/include/asio/basic_stream_socket.hpp
@@ -46,10 +46,6 @@ : public basic_socket<Protocol, StreamSocketService> { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// socket. - typedef typename StreamSocketService::native_handle_type native_type; - /// The native representation of a socket. typedef typename StreamSocketService::native_handle_type native_handle_type;
diff --git a/asio/include/asio/basic_waitable_timer.hpp b/asio/include/asio/basic_waitable_timer.hpp index c204ae2..9b3f860 100644 --- a/asio/include/asio/basic_waitable_timer.hpp +++ b/asio/include/asio/basic_waitable_timer.hpp
@@ -168,7 +168,7 @@ : basic_io_object<WaitableTimerService>(io_service) { asio::error_code ec; - this->service.expires_at(this->implementation, expiry_time, ec); + this->get_service().expires_at(this->get_implementation(), expiry_time, ec); asio::detail::throw_error(ec, "expires_at"); } @@ -187,7 +187,8 @@ : basic_io_object<WaitableTimerService>(io_service) { asio::error_code ec; - this->service.expires_from_now(this->implementation, expiry_time, ec); + this->get_service().expires_from_now( + this->get_implementation(), expiry_time, ec); asio::detail::throw_error(ec, "expires_from_now"); } @@ -216,7 +217,7 @@ std::size_t cancel() { asio::error_code ec; - std::size_t s = this->service.cancel(this->implementation, ec); + std::size_t s = this->get_service().cancel(this->get_implementation(), ec); asio::detail::throw_error(ec, "cancel"); return s; } @@ -245,7 +246,7 @@ */ std::size_t cancel(asio::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Cancels one asynchronous operation that is waiting on the timer. @@ -275,7 +276,8 @@ std::size_t cancel_one() { asio::error_code ec; - std::size_t s = this->service.cancel_one(this->implementation, ec); + std::size_t s = this->get_service().cancel_one( + this->get_implementation(), ec); asio::detail::throw_error(ec, "cancel_one"); return s; } @@ -306,7 +308,7 @@ */ std::size_t cancel_one(asio::error_code& ec) { - return this->service.cancel_one(this->implementation, ec); + return this->get_service().cancel_one(this->get_implementation(), ec); } /// Get the timer's expiry time as an absolute time. @@ -316,7 +318,7 @@ */ time_point expires_at() const { - return this->service.expires_at(this->implementation); + return this->get_service().expires_at(this->get_implementation()); } /// Set the timer's expiry time as an absolute time. @@ -344,8 +346,8 @@ std::size_t expires_at(const time_point& expiry_time) { asio::error_code ec; - std::size_t s = this->service.expires_at( - this->implementation, expiry_time, ec); + std::size_t s = this->get_service().expires_at( + this->get_implementation(), expiry_time, ec); asio::detail::throw_error(ec, "expires_at"); return s; } @@ -375,7 +377,8 @@ std::size_t expires_at(const time_point& expiry_time, asio::error_code& ec) { - return this->service.expires_at(this->implementation, expiry_time, ec); + return this->get_service().expires_at( + this->get_implementation(), expiry_time, ec); } /// Get the timer's expiry time relative to now. @@ -385,7 +388,7 @@ */ duration expires_from_now() const { - return this->service.expires_from_now(this->implementation); + return this->get_service().expires_from_now(this->get_implementation()); } /// Set the timer's expiry time relative to now. @@ -413,8 +416,8 @@ std::size_t expires_from_now(const duration& expiry_time) { asio::error_code ec; - std::size_t s = this->service.expires_from_now( - this->implementation, expiry_time, ec); + std::size_t s = this->get_service().expires_from_now( + this->get_implementation(), expiry_time, ec); asio::detail::throw_error(ec, "expires_from_now"); return s; } @@ -444,8 +447,8 @@ std::size_t expires_from_now(const duration& expiry_time, asio::error_code& ec) { - return this->service.expires_from_now( - this->implementation, expiry_time, ec); + return this->get_service().expires_from_now( + this->get_implementation(), expiry_time, ec); } /// Perform a blocking wait on the timer. @@ -458,7 +461,7 @@ void wait() { asio::error_code ec; - this->service.wait(this->implementation, ec); + this->get_service().wait(this->get_implementation(), ec); asio::detail::throw_error(ec, "wait"); } @@ -471,7 +474,7 @@ */ void wait(asio::error_code& ec) { - this->service.wait(this->implementation, ec); + this->get_service().wait(this->get_implementation(), ec); } /// Start an asynchronous wait on the timer. @@ -507,7 +510,7 @@ // not meet the documented type requirements for a WaitHandler. ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; - return this->service.async_wait(this->implementation, + return this->get_service().async_wait(this->get_implementation(), ASIO_MOVE_CAST(WaitHandler)(handler)); } };
diff --git a/asio/include/asio/datagram_socket_service.hpp b/asio/include/asio/datagram_socket_service.hpp index 3d70b9a..1dd85b9 100644 --- a/asio/include/asio/datagram_socket_service.hpp +++ b/asio/include/asio/datagram_socket_service.hpp
@@ -73,13 +73,6 @@ typedef typename service_impl_type::implementation_type implementation_type; #endif - /// (Deprecated: Use native_handle_type.) The native socket type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_type; -#else - typedef typename service_impl_type::native_handle_type native_type; -#endif - /// The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_handle_type; @@ -169,12 +162,6 @@ return service_impl_.close(impl, ec); } - /// (Deprecated: Use native_handle().) Get the native socket implementation. - native_type native(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - /// Get the native socket implementation. native_handle_type native_handle(implementation_type& impl) {
diff --git a/asio/include/asio/detail/io_control.hpp b/asio/include/asio/detail/io_control.hpp index 3f84c35..83bc2b8 100644 --- a/asio/include/asio/detail/io_control.hpp +++ b/asio/include/asio/detail/io_control.hpp
@@ -25,56 +25,6 @@ namespace detail { namespace io_control { -// IO control command for non-blocking I/O. -class non_blocking_io -{ -public: - // Default constructor. - non_blocking_io() - : value_(0) - { - } - - // Construct with a specific command value. - non_blocking_io(bool value) - : value_(value ? 1 : 0) - { - } - - // Get the name of the IO control command. - int name() const - { - return static_cast<int>(ASIO_OS_DEF(FIONBIO)); - } - - // Set the value of the I/O control command. - void set(bool value) - { - value_ = value ? 1 : 0; - } - - // Get the current value of the I/O control command. - bool get() const - { - return value_ != 0; - } - - // Get the address of the command data. - detail::ioctl_arg_type* data() - { - return &value_; - } - - // Get the address of the command data. - const detail::ioctl_arg_type* data() const - { - return &value_; - } - -private: - detail::ioctl_arg_type value_; -}; - // I/O control command for getting number of bytes available. class bytes_readable {
diff --git a/asio/include/asio/ip/basic_resolver.hpp b/asio/include/asio/ip/basic_resolver.hpp index 7d75d58..28a2831 100644 --- a/asio/include/asio/ip/basic_resolver.hpp +++ b/asio/include/asio/ip/basic_resolver.hpp
@@ -76,7 +76,7 @@ */ void cancel() { - return this->service.cancel(this->implementation); + return this->get_service().cancel(this->get_implementation()); } /// Perform forward resolution of a query to a list of entries. @@ -98,7 +98,7 @@ iterator resolve(const query& q) { asio::error_code ec; - iterator i = this->service.resolve(this->implementation, q, ec); + iterator i = this->get_service().resolve(this->get_implementation(), q, ec); asio::detail::throw_error(ec, "resolve"); return i; } @@ -122,7 +122,7 @@ */ iterator resolve(const query& q, asio::error_code& ec) { - return this->service.resolve(this->implementation, q, ec); + return this->get_service().resolve(this->get_implementation(), q, ec); } /// Asynchronously perform forward resolution of a query to a list of entries. @@ -162,7 +162,7 @@ ASIO_RESOLVE_HANDLER_CHECK( ResolveHandler, handler, iterator) type_check; - return this->service.async_resolve(this->implementation, q, + return this->get_service().async_resolve(this->get_implementation(), q, ASIO_MOVE_CAST(ResolveHandler)(handler)); } @@ -187,7 +187,7 @@ iterator resolve(const endpoint_type& e) { asio::error_code ec; - iterator i = this->service.resolve(this->implementation, e, ec); + iterator i = this->get_service().resolve(this->get_implementation(), e, ec); asio::detail::throw_error(ec, "resolve"); return i; } @@ -213,7 +213,7 @@ */ iterator resolve(const endpoint_type& e, asio::error_code& ec) { - return this->service.resolve(this->implementation, e, ec); + return this->get_service().resolve(this->get_implementation(), e, ec); } /// Asynchronously perform reverse resolution of an endpoint to a list of @@ -255,7 +255,7 @@ ASIO_RESOLVE_HANDLER_CHECK( ResolveHandler, handler, iterator) type_check; - return this->service.async_resolve(this->implementation, e, + return this->get_service().async_resolve(this->get_implementation(), e, ASIO_MOVE_CAST(ResolveHandler)(handler)); } };
diff --git a/asio/include/asio/posix/basic_descriptor.hpp b/asio/include/asio/posix/basic_descriptor.hpp index f06da91..d581eec 100644 --- a/asio/include/asio/posix/basic_descriptor.hpp +++ b/asio/include/asio/posix/basic_descriptor.hpp
@@ -45,10 +45,6 @@ public descriptor_base { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// descriptor. - typedef typename DescriptorService::native_handle_type native_type; - /// The native representation of a descriptor. typedef typename DescriptorService::native_handle_type native_handle_type; @@ -188,7 +184,7 @@ /// Determine whether the descriptor is open. bool is_open() const { - return this->get_service().is_open(this->implementation); + return this->get_service().is_open(this->get_implementation()); } /// Close the descriptor. @@ -221,18 +217,6 @@ return this->get_service().close(this->get_implementation(), ec); } - /// (Deprecated: Use native_handle().) 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_type native() - { - return this->get_service().native_handle(this->implementation); - } - /// Get the native descriptor representation. /** * This function may be used to obtain the underlying representation of the @@ -241,7 +225,7 @@ */ native_handle_type native_handle() { - return this->get_service().native_handle(this->implementation); + return this->get_service().native_handle(this->get_implementation()); } /// Release ownership of the native descriptor implementation. @@ -256,7 +240,7 @@ */ native_handle_type release() { - return this->get_service().release(this->implementation); + return this->get_service().release(this->get_implementation()); } /// Cancel all asynchronous operations associated with the descriptor. @@ -365,7 +349,7 @@ */ bool non_blocking() const { - return this->get_service().non_blocking(this->implementation); + return this->get_service().non_blocking(this->get_implementation()); } /// Sets the non-blocking mode of the descriptor. @@ -424,7 +408,8 @@ */ bool native_non_blocking() const { - return this->get_service().native_non_blocking(this->implementation); + return this->get_service().native_non_blocking( + this->get_implementation()); } /// Sets the non-blocking mode of the native descriptor implementation.
diff --git a/asio/include/asio/posix/basic_stream_descriptor.hpp b/asio/include/asio/posix/basic_stream_descriptor.hpp index e433c6a..ac8ec7c 100644 --- a/asio/include/asio/posix/basic_stream_descriptor.hpp +++ b/asio/include/asio/posix/basic_stream_descriptor.hpp
@@ -49,10 +49,6 @@ : public basic_descriptor<StreamDescriptorService> { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// descriptor. - typedef typename StreamDescriptorService::native_handle_type native_type; - /// The native representation of a descriptor. typedef typename StreamDescriptorService::native_handle_type native_handle_type;
diff --git a/asio/include/asio/posix/descriptor_base.hpp b/asio/include/asio/posix/descriptor_base.hpp index f9bc841..a784ca1 100644 --- a/asio/include/asio/posix/descriptor_base.hpp +++ b/asio/include/asio/posix/descriptor_base.hpp
@@ -34,28 +34,6 @@ class descriptor_base { public: - /// (Deprecated: Use non_blocking().) IO control command to set the blocking - /// mode of the descriptor. - /** - * Implements the FIONBIO IO control command. - * - * @par Example - * @code - * asio::posix::stream_descriptor descriptor(io_service); - * ... - * asio::descriptor_base::non_blocking_io command(true); - * descriptor.io_control(command); - * @endcode - * - * @par Concepts: - * IoControlCommand. - */ -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined non_blocking_io; -#else - typedef asio::detail::io_control::non_blocking_io non_blocking_io; -#endif - /// IO control command to get the amount of data that can be read without /// blocking. /**
diff --git a/asio/include/asio/posix/stream_descriptor_service.hpp b/asio/include/asio/posix/stream_descriptor_service.hpp index 1b0edb8..13540e8 100644 --- a/asio/include/asio/posix/stream_descriptor_service.hpp +++ b/asio/include/asio/posix/stream_descriptor_service.hpp
@@ -57,13 +57,6 @@ typedef service_impl_type::implementation_type implementation_type; #endif - /// (Deprecated: Use native_handle_type.) The native descriptor type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_type; -#else - typedef service_impl_type::native_handle_type native_type; -#endif - /// The native descriptor type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_handle_type; @@ -128,13 +121,6 @@ return service_impl_.close(impl, ec); } - /// (Deprecated: Use native_handle().) Get the native descriptor - /// implementation. - native_type native(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - /// Get the native descriptor implementation. native_handle_type native_handle(implementation_type& impl) {
diff --git a/asio/include/asio/raw_socket_service.hpp b/asio/include/asio/raw_socket_service.hpp index f7224c9..026d04a 100644 --- a/asio/include/asio/raw_socket_service.hpp +++ b/asio/include/asio/raw_socket_service.hpp
@@ -73,13 +73,6 @@ typedef typename service_impl_type::implementation_type implementation_type; #endif - /// (Deprecated: Use native_handle_type.) The native socket type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_type; -#else - typedef typename service_impl_type::native_handle_type native_type; -#endif - /// The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_handle_type; @@ -169,12 +162,6 @@ return service_impl_.close(impl, ec); } - /// (Deprecated: Use native_handle().) Get the native socket implementation. - native_type native(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - /// Get the native socket implementation. native_handle_type native_handle(implementation_type& impl) {
diff --git a/asio/include/asio/seq_packet_socket_service.hpp b/asio/include/asio/seq_packet_socket_service.hpp index a5284e9..43a450b 100644 --- a/asio/include/asio/seq_packet_socket_service.hpp +++ b/asio/include/asio/seq_packet_socket_service.hpp
@@ -74,13 +74,6 @@ typedef typename service_impl_type::implementation_type implementation_type; #endif - /// (Deprecated: Use native_handle_type.) The native socket type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_type; -#else - typedef typename service_impl_type::native_handle_type native_type; -#endif - /// The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_handle_type; @@ -171,12 +164,6 @@ return service_impl_.close(impl, ec); } - /// (Deprecated: Use native_handle().) Get the native socket implementation. - native_type native(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - /// Get the native socket implementation. native_handle_type native_handle(implementation_type& impl) {
diff --git a/asio/include/asio/serial_port_service.hpp b/asio/include/asio/serial_port_service.hpp index b79c38b..e22ae1b 100644 --- a/asio/include/asio/serial_port_service.hpp +++ b/asio/include/asio/serial_port_service.hpp
@@ -63,13 +63,6 @@ typedef service_impl_type::implementation_type implementation_type; #endif - /// (Deprecated: Use native_handle_type.) The native handle type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_type; -#else - typedef service_impl_type::native_handle_type native_type; -#endif - /// The native handle type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_handle_type; @@ -140,12 +133,6 @@ return service_impl_.close(impl, ec); } - /// (Deprecated: Use native_handle().) Get the native handle implementation. - native_type native(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - /// Get the native handle implementation. native_handle_type native_handle(implementation_type& impl) {
diff --git a/asio/include/asio/socket_acceptor_service.hpp b/asio/include/asio/socket_acceptor_service.hpp index 6d30f77..e81cc46 100644 --- a/asio/include/asio/socket_acceptor_service.hpp +++ b/asio/include/asio/socket_acceptor_service.hpp
@@ -72,13 +72,6 @@ typedef typename service_impl_type::implementation_type implementation_type; #endif - /// (Deprecated: Use native_handle_type.) The native acceptor type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_type; -#else - typedef typename service_impl_type::native_handle_type native_type; -#endif - /// The native acceptor type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_handle_type; @@ -186,12 +179,6 @@ return service_impl_.close(impl, ec); } - /// (Deprecated: Use native_handle().) Get the native acceptor implementation. - native_type native(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - /// Get the native acceptor implementation. native_handle_type native_handle(implementation_type& impl) {
diff --git a/asio/include/asio/socket_base.hpp b/asio/include/asio/socket_base.hpp index 5412162..2aed885 100644 --- a/asio/include/asio/socket_base.hpp +++ b/asio/include/asio/socket_base.hpp
@@ -453,28 +453,6 @@ enable_connection_aborted; #endif - /// (Deprecated: Use non_blocking().) IO control command to - /// set the blocking mode of the socket. - /** - * Implements the FIONBIO IO control command. - * - * @par Example - * @code - * asio::ip::tcp::socket socket(io_service); - * ... - * asio::socket_base::non_blocking_io command(true); - * socket.io_control(command); - * @endcode - * - * @par Concepts: - * IO_Control_Command, Boolean_IO_Control_Command. - */ -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined non_blocking_io; -#else - typedef asio::detail::io_control::non_blocking_io non_blocking_io; -#endif - /// IO control command to get the amount of data that can be read without /// blocking. /**
diff --git a/asio/include/asio/ssl.hpp b/asio/include/asio/ssl.hpp index 06102fc..d389c96 100644 --- a/asio/include/asio/ssl.hpp +++ b/asio/include/asio/ssl.hpp
@@ -15,15 +15,12 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/ssl/basic_context.hpp" #include "asio/ssl/context.hpp" #include "asio/ssl/context_base.hpp" -#include "asio/ssl/context_service.hpp" #include "asio/ssl/error.hpp" #include "asio/ssl/rfc2818_verification.hpp" #include "asio/ssl/stream.hpp" #include "asio/ssl/stream_base.hpp" -#include "asio/ssl/stream_service.hpp" #include "asio/ssl/verify_context.hpp" #include "asio/ssl/verify_mode.hpp"
diff --git a/asio/include/asio/ssl/basic_context.hpp b/asio/include/asio/ssl/basic_context.hpp deleted file mode 100644 index 17d5380..0000000 --- a/asio/include/asio/ssl/basic_context.hpp +++ /dev/null
@@ -1,40 +0,0 @@ -// -// ssl/basic_context.hpp -// ~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2014 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 ASIO_SSL_BASIC_CONTEXT_HPP -#define ASIO_SSL_BASIC_CONTEXT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" - -#if defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/old/basic_context.hpp" -#endif // defined(ASIO_ENABLE_OLD_SSL) - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { - -#if defined(ASIO_ENABLE_OLD_SSL) - -using asio::ssl::old::basic_context; - -#endif // defined(ASIO_ENABLE_OLD_SSL) - -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_BASIC_CONTEXT_HPP
diff --git a/asio/include/asio/ssl/context.hpp b/asio/include/asio/ssl/context.hpp index 87a01e7..2340c47 100644 --- a/asio/include/asio/ssl/context.hpp +++ b/asio/include/asio/ssl/context.hpp
@@ -17,33 +17,21 @@ #include "asio/detail/config.hpp" -#if defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/basic_context.hpp" -# include "asio/ssl/context_service.hpp" -#else // defined(ASIO_ENABLE_OLD_SSL) -# include <string> -# include "asio/buffer.hpp" -# include "asio/io_service.hpp" -# include "asio/ssl/context_base.hpp" -# include "asio/ssl/detail/openssl_types.hpp" -# include "asio/ssl/detail/openssl_init.hpp" -# include "asio/ssl/detail/password_callback.hpp" -# include "asio/ssl/detail/verify_callback.hpp" -# include "asio/ssl/verify_mode.hpp" -#endif // defined(ASIO_ENABLE_OLD_SSL) +#include <string> +#include "asio/buffer.hpp" +#include "asio/io_service.hpp" +#include "asio/ssl/context_base.hpp" +#include "asio/ssl/detail/openssl_types.hpp" +#include "asio/ssl/detail/openssl_init.hpp" +#include "asio/ssl/detail/password_callback.hpp" +#include "asio/ssl/detail/verify_callback.hpp" +#include "asio/ssl/verify_mode.hpp" #include "asio/detail/push_options.hpp" namespace asio { namespace ssl { -#if defined(ASIO_ENABLE_OLD_SSL) - -/// Typedef for the typical usage of context. -typedef basic_context<context_service> context; - -#else // defined(ASIO_ENABLE_OLD_SSL) - class context : public context_base, private noncopyable @@ -52,15 +40,9 @@ /// The native handle type of the SSL context. typedef SSL_CTX* native_handle_type; - /// (Deprecated: Use native_handle_type.) The native type of the SSL context. - typedef SSL_CTX* impl_type; - /// Constructor. ASIO_DECL explicit context(method m); - /// Deprecated constructor taking a reference to an io_service object. - ASIO_DECL context(asio::io_service&, method m); - #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a context from another. /** @@ -100,15 +82,6 @@ */ ASIO_DECL native_handle_type native_handle(); - /// (Deprecated: Use native_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. - */ - ASIO_DECL impl_type impl(); - /// Clear options on the context. /** * This function may be used to configure the SSL options used by the context. @@ -772,8 +745,6 @@ asio::ssl::detail::openssl_init<> init_; }; -#endif // defined(ASIO_ENABLE_OLD_SSL) - } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/context_service.hpp b/asio/include/asio/ssl/context_service.hpp deleted file mode 100644 index af293a1..0000000 --- a/asio/include/asio/ssl/context_service.hpp +++ /dev/null
@@ -1,40 +0,0 @@ -// -// ssl/context_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2014 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 ASIO_SSL_CONTEXT_SERVICE_HPP -#define ASIO_SSL_CONTEXT_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" - -#if defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/old/context_service.hpp" -#endif // defined(ASIO_ENABLE_OLD_SSL) - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { - -#if defined(ASIO_ENABLE_OLD_SSL) - -using asio::ssl::old::context_service; - -#endif // defined(ASIO_ENABLE_OLD_SSL) - -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_CONTEXT_SERVICE_HPP
diff --git a/asio/include/asio/ssl/detail/buffered_handshake_op.hpp b/asio/include/asio/ssl/detail/buffered_handshake_op.hpp index aed99dd..ecd995a 100644 --- a/asio/include/asio/ssl/detail/buffered_handshake_op.hpp +++ b/asio/include/asio/ssl/detail/buffered_handshake_op.hpp
@@ -17,9 +17,7 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/detail/engine.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/ssl/detail/engine.hpp" #include "asio/detail/push_options.hpp" @@ -27,8 +25,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - template <typename ConstBufferSequence> class buffered_handshake_op { @@ -99,8 +95,6 @@ std::size_t total_buffer_size_; }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/detail/engine.hpp b/asio/include/asio/ssl/detail/engine.hpp index 9bb42b6..2aa0d5e 100644 --- a/asio/include/asio/ssl/detail/engine.hpp +++ b/asio/include/asio/ssl/detail/engine.hpp
@@ -17,14 +17,12 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/buffer.hpp" -# include "asio/detail/static_mutex.hpp" -# include "asio/ssl/detail/openssl_types.hpp" -# include "asio/ssl/detail/verify_callback.hpp" -# include "asio/ssl/stream_base.hpp" -# include "asio/ssl/verify_mode.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/buffer.hpp" +#include "asio/detail/static_mutex.hpp" +#include "asio/ssl/detail/openssl_types.hpp" +#include "asio/ssl/detail/verify_callback.hpp" +#include "asio/ssl/stream_base.hpp" +#include "asio/ssl/verify_mode.hpp" #include "asio/detail/push_options.hpp" @@ -32,8 +30,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - class engine { public: @@ -149,8 +145,6 @@ BIO* ext_bio_; }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/detail/handshake_op.hpp b/asio/include/asio/ssl/detail/handshake_op.hpp index 25c110f..50158a2 100644 --- a/asio/include/asio/ssl/detail/handshake_op.hpp +++ b/asio/include/asio/ssl/detail/handshake_op.hpp
@@ -17,9 +17,7 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/detail/engine.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/ssl/detail/engine.hpp" #include "asio/detail/push_options.hpp" @@ -27,8 +25,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - class handshake_op { public: @@ -57,8 +53,6 @@ stream_base::handshake_type type_; }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/detail/impl/engine.ipp b/asio/include/asio/ssl/detail/impl/engine.ipp index 59f8283..3f05a2b 100644 --- a/asio/include/asio/ssl/detail/impl/engine.ipp +++ b/asio/include/asio/ssl/detail/impl/engine.ipp
@@ -17,13 +17,11 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/detail/throw_error.hpp" -# include "asio/error.hpp" -# include "asio/ssl/detail/engine.hpp" -# include "asio/ssl/error.hpp" -# include "asio/ssl/verify_context.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/detail/throw_error.hpp" +#include "asio/error.hpp" +#include "asio/ssl/detail/engine.hpp" +#include "asio/ssl/error.hpp" +#include "asio/ssl/verify_context.hpp" #include "asio/detail/push_options.hpp" @@ -31,8 +29,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - engine::engine(SSL_CTX* context) : ssl_(::SSL_new(context)) { @@ -315,8 +311,6 @@ length < INT_MAX ? static_cast<int>(length) : INT_MAX); } -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/detail/io.hpp b/asio/include/asio/ssl/detail/io.hpp index 0646ee5..c31b744 100644 --- a/asio/include/asio/ssl/detail/io.hpp +++ b/asio/include/asio/ssl/detail/io.hpp
@@ -17,11 +17,9 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/detail/engine.hpp" -# include "asio/ssl/detail/stream_core.hpp" -# include "asio/write.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/ssl/detail/engine.hpp" +#include "asio/ssl/detail/stream_core.hpp" +#include "asio/write.hpp" #include "asio/detail/push_options.hpp" @@ -29,8 +27,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - template <typename Stream, typename Operation> std::size_t io(Stream& next_layer, stream_core& core, const Operation& op, asio::error_code& ec) @@ -336,13 +332,9 @@ asio::error_code(), 0, 1); } -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl -#if !defined(ASIO_ENABLE_OLD_SSL) - template <typename Stream, typename Operation, typename Handler, typename Allocator> struct associated_allocator< @@ -371,8 +363,6 @@ } }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace asio #include "asio/detail/pop_options.hpp"
diff --git a/asio/include/asio/ssl/detail/password_callback.hpp b/asio/include/asio/ssl/detail/password_callback.hpp index 7801702..a1200b5 100644 --- a/asio/include/asio/ssl/detail/password_callback.hpp +++ b/asio/include/asio/ssl/detail/password_callback.hpp
@@ -17,11 +17,9 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include <cstddef> -# include <string> -# include "asio/ssl/context_base.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include <cstddef> +#include <string> +#include "asio/ssl/context_base.hpp" #include "asio/detail/push_options.hpp" @@ -29,8 +27,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - class password_callback_base { public: @@ -61,8 +57,6 @@ PasswordCallback callback_; }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/detail/read_op.hpp b/asio/include/asio/ssl/detail/read_op.hpp index b48efbe..8cb0885 100644 --- a/asio/include/asio/ssl/detail/read_op.hpp +++ b/asio/include/asio/ssl/detail/read_op.hpp
@@ -17,10 +17,8 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/detail/buffer_sequence_adapter.hpp" -# include "asio/ssl/detail/engine.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/detail/buffer_sequence_adapter.hpp" +#include "asio/ssl/detail/engine.hpp" #include "asio/detail/push_options.hpp" @@ -28,8 +26,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - template <typename MutableBufferSequence> class read_op { @@ -62,8 +58,6 @@ MutableBufferSequence buffers_; }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/detail/shutdown_op.hpp b/asio/include/asio/ssl/detail/shutdown_op.hpp index f220ee2..60aaacc 100644 --- a/asio/include/asio/ssl/detail/shutdown_op.hpp +++ b/asio/include/asio/ssl/detail/shutdown_op.hpp
@@ -17,9 +17,7 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/detail/engine.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/ssl/detail/engine.hpp" #include "asio/detail/push_options.hpp" @@ -27,8 +25,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - class shutdown_op { public: @@ -49,8 +45,6 @@ } }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/detail/stream_core.hpp b/asio/include/asio/ssl/detail/stream_core.hpp index b29bbfc..cfce0ff 100644 --- a/asio/include/asio/ssl/detail/stream_core.hpp +++ b/asio/include/asio/ssl/detail/stream_core.hpp
@@ -17,15 +17,13 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# if defined(ASIO_HAS_BOOST_DATE_TIME) -# include "asio/deadline_timer.hpp" -# else // defined(ASIO_HAS_BOOST_DATE_TIME) -# include "asio/steady_timer.hpp" -# endif // defined(ASIO_HAS_BOOST_DATE_TIME) -# include "asio/ssl/detail/engine.hpp" -# include "asio/buffer.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#if defined(ASIO_HAS_BOOST_DATE_TIME) +# include "asio/deadline_timer.hpp" +#else // defined(ASIO_HAS_BOOST_DATE_TIME) +# include "asio/steady_timer.hpp" +#endif // defined(ASIO_HAS_BOOST_DATE_TIME) +#include "asio/ssl/detail/engine.hpp" +#include "asio/buffer.hpp" #include "asio/detail/push_options.hpp" @@ -33,8 +31,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - struct stream_core { // According to the OpenSSL documentation, this is the buffer size that is @@ -115,8 +111,6 @@ asio::const_buffer input_; }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/detail/verify_callback.hpp b/asio/include/asio/ssl/detail/verify_callback.hpp index 48df350..48761eb 100644 --- a/asio/include/asio/ssl/detail/verify_callback.hpp +++ b/asio/include/asio/ssl/detail/verify_callback.hpp
@@ -17,9 +17,7 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/verify_context.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/ssl/verify_context.hpp" #include "asio/detail/push_options.hpp" @@ -27,8 +25,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - class verify_callback_base { public: @@ -57,8 +53,6 @@ VerifyCallback callback_; }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/detail/write_op.hpp b/asio/include/asio/ssl/detail/write_op.hpp index f95c2a8..c6a4304 100644 --- a/asio/include/asio/ssl/detail/write_op.hpp +++ b/asio/include/asio/ssl/detail/write_op.hpp
@@ -17,10 +17,8 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/detail/buffer_sequence_adapter.hpp" -# include "asio/ssl/detail/engine.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/detail/buffer_sequence_adapter.hpp" +#include "asio/ssl/detail/engine.hpp" #include "asio/detail/push_options.hpp" @@ -28,8 +26,6 @@ namespace ssl { namespace detail { -#if !defined(ASIO_ENABLE_OLD_SSL) - template <typename ConstBufferSequence> class write_op { @@ -62,8 +58,6 @@ ConstBufferSequence buffers_; }; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/impl/context.hpp b/asio/include/asio/ssl/impl/context.hpp index 115a3e4..c84755d 100644 --- a/asio/include/asio/ssl/impl/context.hpp +++ b/asio/include/asio/ssl/impl/context.hpp
@@ -18,17 +18,13 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/detail/throw_error.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/detail/throw_error.hpp" #include "asio/detail/push_options.hpp" namespace asio { namespace ssl { -#if !defined(ASIO_ENABLE_OLD_SSL) - template <typename VerifyCallback> void context::set_verify_callback(VerifyCallback callback) { @@ -61,8 +57,6 @@ new detail::password_callback<PasswordCallback>(callback), ec); } -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/impl/context.ipp b/asio/include/asio/ssl/impl/context.ipp index 785b3ee..9e3685f 100644 --- a/asio/include/asio/ssl/impl/context.ipp +++ b/asio/include/asio/ssl/impl/context.ipp
@@ -18,21 +18,17 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include <cstring> -# include "asio/detail/throw_error.hpp" -# include "asio/error.hpp" -# include "asio/ssl/context.hpp" -# include "asio/ssl/error.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include <cstring> +#include "asio/detail/throw_error.hpp" +#include "asio/error.hpp" +#include "asio/ssl/context.hpp" +#include "asio/ssl/error.hpp" #include "asio/detail/push_options.hpp" namespace asio { namespace ssl { -#if !defined(ASIO_ENABLE_OLD_SSL) - struct context::bio_cleanup { BIO* p; @@ -165,14 +161,6 @@ set_options(no_compression); } -context::context(asio::io_service&, context::method m) - : handle_(0) -{ - context tmp(m); - handle_ = tmp.handle_; - tmp.handle_ = 0; -} - #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) context::context(context&& other) { @@ -220,11 +208,6 @@ return handle_; } -context::impl_type context::impl() -{ - return handle_; -} - void context::clear_options(context::options o) { asio::error_code ec; @@ -940,8 +923,6 @@ static_cast<int>(buffer_size(b))); } -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/impl/rfc2818_verification.ipp b/asio/include/asio/ssl/impl/rfc2818_verification.ipp index 86cb23d..701ec8e 100644 --- a/asio/include/asio/ssl/impl/rfc2818_verification.ipp +++ b/asio/include/asio/ssl/impl/rfc2818_verification.ipp
@@ -17,21 +17,17 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include <cctype> -# include <cstring> -# include "asio/ip/address.hpp" -# include "asio/ssl/rfc2818_verification.hpp" -# include "asio/ssl/detail/openssl_types.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include <cctype> +#include <cstring> +#include "asio/ip/address.hpp" +#include "asio/ssl/rfc2818_verification.hpp" +#include "asio/ssl/detail/openssl_types.hpp" #include "asio/detail/push_options.hpp" namespace asio { namespace ssl { -#if !defined(ASIO_ENABLE_OLD_SSL) - bool rfc2818_verification::operator()( bool preverified, verify_context& ctx) const { @@ -156,8 +152,6 @@ return p == p_end && !*h; } -#endif // !defined(ASIO_ENABLE_OLD_SSL) - } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/old/basic_context.hpp b/asio/include/asio/ssl/old/basic_context.hpp deleted file mode 100644 index f53fddd..0000000 --- a/asio/include/asio/ssl/old/basic_context.hpp +++ /dev/null
@@ -1,434 +0,0 @@ -// -// ssl/old/basic_context.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2014 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 ASIO_SSL_OLD_BASIC_CONTEXT_HPP -#define ASIO_SSL_OLD_BASIC_CONTEXT_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" -#include <string> -#include <boost/noncopyable.hpp> -#include "asio/detail/throw_error.hpp" -#include "asio/error.hpp" -#include "asio/io_service.hpp" -#include "asio/ssl/context_base.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { -namespace old { - -/// SSL context. -template <typename Service> -class basic_context - : public context_base, - private boost::noncopyable -{ -public: - /// The type of the service that will be used to provide context operations. - typedef Service service_type; - - /// The native implementation type of the SSL context. - typedef typename service_type::impl_type impl_type; - - /// Constructor. - basic_context(asio::io_service& io_service, method m) - : service_(asio::use_service<Service>(io_service)), - impl_(service_.null()) - { - service_.create(impl_, m); - } - - /// Destructor. - ~basic_context() - { - service_.destroy(impl_); - } - - /// 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. - */ - impl_type impl() - { - return impl_; - } - - /// 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 asio::system_error Thrown on failure. - */ - void set_options(options o) - { - asio::error_code ec; - service_.set_options(impl_, o, ec); - asio::detail::throw_error(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. - * - * @param ec Set to indicate what error occurred, if any. - */ - asio::error_code set_options(options o, - asio::error_code& ec) - { - return service_.set_options(impl_, o, 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. The available verify_mode - * values are defined in the context_base class. - * - * @throws asio::system_error Thrown on failure. - */ - void set_verify_mode(verify_mode v) - { - asio::error_code ec; - service_.set_verify_mode(impl_, v, ec); - asio::detail::throw_error(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. The available verify_mode - * values are defined in the context_base class. - * - * @param ec Set to indicate what error occurred, if any. - */ - asio::error_code set_verify_mode(verify_mode v, - asio::error_code& ec) - { - return service_.set_verify_mode(impl_, v, 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 asio::system_error Thrown on failure. - */ - void load_verify_file(const std::string& filename) - { - asio::error_code ec; - service_.load_verify_file(impl_, filename, ec); - asio::detail::throw_error(ec); - } - - /// 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. - */ - asio::error_code load_verify_file(const std::string& filename, - asio::error_code& ec) - { - return service_.load_verify_file(impl_, filename, 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 asio::system_error Thrown on failure. - */ - void add_verify_path(const std::string& path) - { - asio::error_code ec; - service_.add_verify_path(impl_, path, ec); - asio::detail::throw_error(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. - * - * @param ec Set to indicate what error occurred, if any. - */ - asio::error_code add_verify_path(const std::string& path, - asio::error_code& ec) - { - return service_.add_verify_path(impl_, path, 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 asio::system_error Thrown on failure. - */ - void use_certificate_file(const std::string& filename, file_format format) - { - asio::error_code ec; - service_.use_certificate_file(impl_, filename, format, ec); - asio::detail::throw_error(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). - * - * @param ec Set to indicate what error occurred, if any. - */ - asio::error_code use_certificate_file(const std::string& filename, - file_format format, asio::error_code& ec) - { - return service_.use_certificate_file(impl_, filename, format, 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 asio::system_error Thrown on failure. - */ - void use_certificate_chain_file(const std::string& filename) - { - asio::error_code ec; - service_.use_certificate_chain_file(impl_, filename, ec); - asio::detail::throw_error(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. - * - * @param ec Set to indicate what error occurred, if any. - */ - asio::error_code use_certificate_chain_file( - const std::string& filename, asio::error_code& ec) - { - return service_.use_certificate_chain_file(impl_, filename, 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 asio::system_error Thrown on failure. - */ - void use_private_key_file(const std::string& filename, file_format format) - { - asio::error_code ec; - service_.use_private_key_file(impl_, filename, format, ec); - asio::detail::throw_error(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). - * - * @param ec Set to indicate what error occurred, if any. - */ - asio::error_code use_private_key_file(const std::string& filename, - file_format format, asio::error_code& ec) - { - return service_.use_private_key_file(impl_, filename, format, 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 asio::system_error Thrown on failure. - */ - void use_rsa_private_key_file(const std::string& filename, file_format format) - { - asio::error_code ec; - service_.use_rsa_private_key_file(impl_, filename, format, ec); - asio::detail::throw_error(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). - * - * @param ec Set to indicate what error occurred, if any. - */ - asio::error_code use_rsa_private_key_file( - const std::string& filename, file_format format, - asio::error_code& ec) - { - return service_.use_rsa_private_key_file(impl_, filename, format, 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 asio::system_error Thrown on failure. - */ - void use_tmp_dh_file(const std::string& filename) - { - asio::error_code ec; - service_.use_tmp_dh_file(impl_, filename, ec); - asio::detail::throw_error(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. - * - * @param ec Set to indicate what error occurred, if any. - */ - asio::error_code use_tmp_dh_file(const std::string& filename, - asio::error_code& ec) - { - return service_.use_tmp_dh_file(impl_, filename, 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 asio::system_error Thrown on failure. - */ - template <typename PasswordCallback> - void set_password_callback(PasswordCallback callback) - { - asio::error_code ec; - service_.set_password_callback(impl_, callback, ec); - asio::detail::throw_error(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. - * - * @param ec Set to indicate what error occurred, if any. - */ - template <typename PasswordCallback> - asio::error_code set_password_callback(PasswordCallback callback, - asio::error_code& ec) - { - return service_.set_password_callback(impl_, callback, ec); - } - -private: - /// The backend service implementation. - service_type& service_; - - /// The underlying native implementation. - impl_type impl_; -}; - -} // namespace old -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_OLD_BASIC_CONTEXT_HPP
diff --git a/asio/include/asio/ssl/old/context_service.hpp b/asio/include/asio/ssl/old/context_service.hpp deleted file mode 100644 index 34928aa..0000000 --- a/asio/include/asio/ssl/old/context_service.hpp +++ /dev/null
@@ -1,174 +0,0 @@ -// -// ssl/old/context_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2014 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 ASIO_SSL_OLD_CONTEXT_SERVICE_HPP -#define ASIO_SSL_OLD_CONTEXT_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" -#include <string> -#include <boost/noncopyable.hpp> -#include "asio/error.hpp" -#include "asio/io_service.hpp" -#include "asio/ssl/context_base.hpp" -#include "asio/ssl/old/detail/openssl_context_service.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { -namespace old { - -/// Default service implementation for a context. -class context_service -#if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service -#else - : public asio::detail::service_base<context_service> -#endif -{ -private: - // The type of the platform-specific implementation. - typedef old::detail::openssl_context_service service_impl_type; - -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static asio::io_service::id id; -#endif - - /// The type of the context. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined impl_type; -#else - typedef service_impl_type::impl_type impl_type; -#endif - - /// Constructor. - explicit context_service(asio::io_service& io_service) - : asio::detail::service_base<context_service>(io_service), - service_impl_(asio::use_service<service_impl_type>(io_service)) - { - } - - /// Return a null context implementation. - impl_type null() const - { - return service_impl_.null(); - } - - /// Create a new context implementation. - void create(impl_type& impl, context_base::method m) - { - service_impl_.create(impl, m); - } - - /// Destroy a context implementation. - void destroy(impl_type& impl) - { - service_impl_.destroy(impl); - } - - /// Set options on the context. - asio::error_code set_options(impl_type& impl, - context_base::options o, asio::error_code& ec) - { - return service_impl_.set_options(impl, o, ec); - } - - /// Set peer verification mode. - asio::error_code set_verify_mode(impl_type& impl, - context_base::verify_mode v, asio::error_code& ec) - { - return service_impl_.set_verify_mode(impl, v, ec); - } - - /// Load a certification authority file for performing verification. - asio::error_code load_verify_file(impl_type& impl, - const std::string& filename, asio::error_code& ec) - { - return service_impl_.load_verify_file(impl, filename, ec); - } - - /// Add a directory containing certification authority files to be used for - /// performing verification. - asio::error_code add_verify_path(impl_type& impl, - const std::string& path, asio::error_code& ec) - { - return service_impl_.add_verify_path(impl, path, ec); - } - - /// Use a certificate from a file. - asio::error_code use_certificate_file(impl_type& impl, - const std::string& filename, context_base::file_format format, - asio::error_code& ec) - { - return service_impl_.use_certificate_file(impl, filename, format, ec); - } - - /// Use a certificate chain from a file. - asio::error_code use_certificate_chain_file(impl_type& impl, - const std::string& filename, asio::error_code& ec) - { - return service_impl_.use_certificate_chain_file(impl, filename, ec); - } - - /// Use a private key from a file. - asio::error_code use_private_key_file(impl_type& impl, - const std::string& filename, context_base::file_format format, - asio::error_code& ec) - { - return service_impl_.use_private_key_file(impl, filename, format, ec); - } - - /// Use an RSA private key from a file. - asio::error_code use_rsa_private_key_file(impl_type& impl, - const std::string& filename, context_base::file_format format, - asio::error_code& ec) - { - return service_impl_.use_rsa_private_key_file(impl, filename, format, ec); - } - - /// Use the specified file to obtain the temporary Diffie-Hellman parameters. - asio::error_code use_tmp_dh_file(impl_type& impl, - const std::string& filename, asio::error_code& ec) - { - return service_impl_.use_tmp_dh_file(impl, filename, ec); - } - - /// Set the password callback. - template <typename PasswordCallback> - asio::error_code set_password_callback(impl_type& impl, - PasswordCallback callback, asio::error_code& ec) - { - return service_impl_.set_password_callback(impl, callback, ec); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - } - - // The service that provides the platform-specific implementation. - service_impl_type& service_impl_; -}; - -} // namespace old -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_OLD_CONTEXT_SERVICE_HPP
diff --git a/asio/include/asio/ssl/old/detail/openssl_context_service.hpp b/asio/include/asio/ssl/old/detail/openssl_context_service.hpp deleted file mode 100644 index 941ad26..0000000 --- a/asio/include/asio/ssl/old/detail/openssl_context_service.hpp +++ /dev/null
@@ -1,386 +0,0 @@ -// -// ssl/old/detail/openssl_context_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2014 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 ASIO_SSL_OLD_DETAIL_OPENSSL_CONTEXT_SERVICE_HPP -#define ASIO_SSL_OLD_DETAIL_OPENSSL_CONTEXT_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" -#include <cstring> -#include <string> -#include <boost/function.hpp> -#include "asio/detail/throw_error.hpp" -#include "asio/error.hpp" -#include "asio/io_service.hpp" -#include "asio/ssl/context_base.hpp" -#include "asio/ssl/detail/openssl_init.hpp" -#include "asio/ssl/detail/openssl_types.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { -namespace old { -namespace detail { - -class openssl_context_service - : public asio::detail::service_base<openssl_context_service> -{ -public: - // The native type of the context. - typedef ::SSL_CTX* impl_type; - - // The type for the password callback function object. - typedef boost::function<std::string(std::size_t, - context_base::password_purpose)> password_callback_type; - - // Constructor. - openssl_context_service(asio::io_service& io_service) - : asio::detail::service_base<openssl_context_service>(io_service) - { - } - - // Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - } - - // Return a null context implementation. - static impl_type null() - { - return 0; - } - - // Create a new context implementation. - void create(impl_type& impl, context_base::method m) - { - switch (m) - { -#if defined(OPENSSL_NO_SSL2) - case context_base::sslv2: - case context_base::sslv2_client: - case context_base::sslv2_server: - asio::detail::throw_error(asio::error::invalid_argument); - break; -#else // defined(OPENSSL_NO_SSL2) - case context_base::sslv2: - impl = ::SSL_CTX_new(::SSLv2_method()); - break; - case context_base::sslv2_client: - impl = ::SSL_CTX_new(::SSLv2_client_method()); - break; - case context_base::sslv2_server: - impl = ::SSL_CTX_new(::SSLv2_server_method()); - break; -#endif // defined(OPENSSL_NO_SSL2) - case context_base::sslv3: - impl = ::SSL_CTX_new(::SSLv3_method()); - break; - case context_base::sslv3_client: - impl = ::SSL_CTX_new(::SSLv3_client_method()); - break; - case context_base::sslv3_server: - impl = ::SSL_CTX_new(::SSLv3_server_method()); - break; - case context_base::tlsv1: - impl = ::SSL_CTX_new(::TLSv1_method()); - break; - case context_base::tlsv1_client: - impl = ::SSL_CTX_new(::TLSv1_client_method()); - break; - case context_base::tlsv1_server: - impl = ::SSL_CTX_new(::TLSv1_server_method()); - break; - case context_base::sslv23: - impl = ::SSL_CTX_new(::SSLv23_method()); - break; - case context_base::sslv23_client: - impl = ::SSL_CTX_new(::SSLv23_client_method()); - break; - case context_base::sslv23_server: - impl = ::SSL_CTX_new(::SSLv23_server_method()); - break; - default: - impl = ::SSL_CTX_new(0); - break; - } - } - - // Destroy a context implementation. - void destroy(impl_type& impl) - { - if (impl != null()) - { - if (impl->default_passwd_callback_userdata) - { - password_callback_type* callback = - static_cast<password_callback_type*>( - impl->default_passwd_callback_userdata); - delete callback; - impl->default_passwd_callback_userdata = 0; - } - - ::SSL_CTX_free(impl); - impl = null(); - } - } - - // Set options on the context. - asio::error_code set_options(impl_type& impl, - context_base::options o, asio::error_code& ec) - { - ::SSL_CTX_set_options(impl, o); - - ec = asio::error_code(); - return ec; - } - - // Set peer verification mode. - asio::error_code set_verify_mode(impl_type& impl, - context_base::verify_mode v, asio::error_code& ec) - { - ::SSL_CTX_set_verify(impl, v, 0); - - ec = asio::error_code(); - return ec; - } - - // Load a certification authority file for performing verification. - asio::error_code load_verify_file(impl_type& impl, - const std::string& filename, asio::error_code& ec) - { - if (::SSL_CTX_load_verify_locations(impl, filename.c_str(), 0) != 1) - { - ec = asio::error::invalid_argument; - return ec; - } - - ec = asio::error_code(); - return ec; - } - - // Add a directory containing certification authority files to be used for - // performing verification. - asio::error_code add_verify_path(impl_type& impl, - const std::string& path, asio::error_code& ec) - { - if (::SSL_CTX_load_verify_locations(impl, 0, path.c_str()) != 1) - { - ec = asio::error::invalid_argument; - return ec; - } - - ec = asio::error_code(); - return ec; - } - - // Use a certificate from a file. - asio::error_code use_certificate_file(impl_type& impl, - const std::string& filename, context_base::file_format format, - asio::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 = asio::error::invalid_argument; - return ec; - } - } - - if (::SSL_CTX_use_certificate_file(impl, filename.c_str(), file_type) != 1) - { - ec = asio::error::invalid_argument; - return ec; - } - - ec = asio::error_code(); - return ec; - } - - // Use a certificate chain from a file. - asio::error_code use_certificate_chain_file(impl_type& impl, - const std::string& filename, asio::error_code& ec) - { - if (::SSL_CTX_use_certificate_chain_file(impl, filename.c_str()) != 1) - { - ec = asio::error::invalid_argument; - return ec; - } - - ec = asio::error_code(); - return ec; - } - - // Use a private key from a file. - asio::error_code use_private_key_file(impl_type& impl, - const std::string& filename, context_base::file_format format, - asio::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 = asio::error::invalid_argument; - return ec; - } - } - - if (::SSL_CTX_use_PrivateKey_file(impl, filename.c_str(), file_type) != 1) - { - ec = asio::error::invalid_argument; - return ec; - } - - ec = asio::error_code(); - return ec; - } - - // Use an RSA private key from a file. - asio::error_code use_rsa_private_key_file(impl_type& impl, - const std::string& filename, context_base::file_format format, - asio::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 = asio::error::invalid_argument; - return ec; - } - } - - if (::SSL_CTX_use_RSAPrivateKey_file( - impl, filename.c_str(), file_type) != 1) - { - ec = asio::error::invalid_argument; - return ec; - } - - ec = asio::error_code(); - return ec; - } - - // Use the specified file to obtain the temporary Diffie-Hellman parameters. - asio::error_code use_tmp_dh_file(impl_type& impl, - const std::string& filename, asio::error_code& ec) - { - ::BIO* bio = ::BIO_new_file(filename.c_str(), "r"); - if (!bio) - { - ec = asio::error::invalid_argument; - return ec; - } - - ::DH* dh = ::PEM_read_bio_DHparams(bio, 0, 0, 0); - if (!dh) - { - ::BIO_free(bio); - ec = asio::error::invalid_argument; - return ec; - } - - ::BIO_free(bio); - int result = ::SSL_CTX_set_tmp_dh(impl, dh); - ::DH_free(dh); - if (result != 1) - { - ec = asio::error::invalid_argument; - return ec; - } - - ec = asio::error_code(); - return ec; - } - - static int password_callback(char* buf, int size, int purpose, void* data) - { - using namespace std; // For strncat and strlen. - - if (data) - { - password_callback_type* callback = - static_cast<password_callback_type*>(data); - std::string passwd = (*callback)(static_cast<std::size_t>(size), - purpose ? context_base::for_writing : context_base::for_reading); - *buf = '\0'; - strncat(buf, passwd.c_str(), size); - return strlen(buf); - } - - return 0; - } - - // Set the password callback. - template <typename Password_Callback> - asio::error_code set_password_callback(impl_type& impl, - Password_Callback callback, asio::error_code& ec) - { - // Allocate callback function object if not already present. - if (impl->default_passwd_callback_userdata) - { - password_callback_type* callback_function = - static_cast<password_callback_type*>( - impl->default_passwd_callback_userdata); - *callback_function = callback; - } - else - { - password_callback_type* callback_function = - new password_callback_type(callback); - impl->default_passwd_callback_userdata = callback_function; - } - - // Set the password callback. - SSL_CTX_set_default_passwd_cb(impl, - &openssl_context_service::password_callback); - - ec = asio::error_code(); - return ec; - } - -private: - // Ensure openssl is initialised. - asio::ssl::detail::openssl_init<> init_; -}; - -} // namespace detail -} // namespace old -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_OLD_DETAIL_OPENSSL_CONTEXT_SERVICE_HPP
diff --git a/asio/include/asio/ssl/old/detail/openssl_operation.hpp b/asio/include/asio/ssl/old/detail/openssl_operation.hpp deleted file mode 100644 index 9ea9c94..0000000 --- a/asio/include/asio/ssl/old/detail/openssl_operation.hpp +++ /dev/null
@@ -1,524 +0,0 @@ -// -// ssl/old/detail/openssl_operation.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster 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 ASIO_SSL_OLD_DETAIL_OPENSSL_OPERATION_HPP -#define ASIO_SSL_OLD_DETAIL_OPENSSL_OPERATION_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" -#include <boost/function.hpp> -#include <boost/bind.hpp> -#include "asio/buffer.hpp" -#include "asio/detail/assert.hpp" -#include "asio/detail/socket_ops.hpp" -#include "asio/placeholders.hpp" -#include "asio/ssl/detail/openssl_types.hpp" -#include "asio/ssl/error.hpp" -#include "asio/strand.hpp" -#include "asio/system_error.hpp" -#include "asio/write.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { -namespace old { -namespace detail { - -typedef boost::function<int (::SSL*)> ssl_primitive_func; -typedef boost::function<void (const asio::error_code&, int)> - user_handler_func; - -// Network send_/recv buffer implementation -// -// -class net_buffer -{ - static const int NET_BUF_SIZE = 16*1024 + 256; // SSL record size + spare - - unsigned char buf_[NET_BUF_SIZE]; - unsigned char* data_start_; - unsigned char* data_end_; - -public: - net_buffer() - { - data_start_ = data_end_ = buf_; - } - unsigned char* get_unused_start() { return data_end_; } - unsigned char* get_data_start() { return data_start_; } - size_t get_unused_len() { return (NET_BUF_SIZE - (data_end_ - buf_)); } - size_t get_data_len() { return (data_end_ - data_start_); } - void data_added(size_t count) - { - data_end_ += count; - data_end_ = data_end_ > (buf_ + NET_BUF_SIZE)? - (buf_ + NET_BUF_SIZE): - data_end_; - } - void data_removed(size_t count) - { - data_start_ += count; - if (data_start_ >= data_end_) reset(); - } - void reset() { data_start_ = buf_; data_end_ = buf_; } - bool has_data() { return (data_start_ < data_end_); } -}; // class net_buffer - -// -// Operation class -// -// -template <typename Stream> -class openssl_operation -{ -public: - - // Constructor for asynchronous operations - openssl_operation(ssl_primitive_func primitive, - Stream& socket, - net_buffer& recv_buf, - SSL* session, - BIO* ssl_bio, - user_handler_func handler, - asio::io_service::strand& strand - ) - : primitive_(primitive) - , user_handler_(handler) - , strand_(&strand) - , recv_buf_(recv_buf) - , socket_(socket) - , ssl_bio_(ssl_bio) - , session_(session) - { - write_ = boost::bind( - &openssl_operation::do_async_write, - this, boost::arg<1>(), boost::arg<2>() - ); - read_ = boost::bind( - &openssl_operation::do_async_read, - this - ); - handler_= boost::bind( - &openssl_operation::async_user_handler, - this, boost::arg<1>(), boost::arg<2>() - ); - } - - // Constructor for synchronous operations - openssl_operation(ssl_primitive_func primitive, - Stream& socket, - net_buffer& recv_buf, - SSL* session, - BIO* ssl_bio) - : primitive_(primitive) - , strand_(0) - , recv_buf_(recv_buf) - , socket_(socket) - , ssl_bio_(ssl_bio) - , session_(session) - { - write_ = boost::bind( - &openssl_operation::do_sync_write, - this, boost::arg<1>(), boost::arg<2>() - ); - read_ = boost::bind( - &openssl_operation::do_sync_read, - this - ); - handler_ = boost::bind( - &openssl_operation::sync_user_handler, - this, boost::arg<1>(), boost::arg<2>() - ); - } - - // Start operation - // In case of asynchronous it returns 0, in sync mode returns success code - // or throws an error... - int start() - { - int rc = primitive_( session_ ); - - bool is_operation_done = (rc > 0); - // For connect/accept/shutdown, the operation - // is done, when return code is 1 - // for write, it is done, when is retcode > 0 - // for read, it is done when retcode > 0 - - int error_code = !is_operation_done ? - ::SSL_get_error( session_, rc ) : - 0; - int sys_error_code = ERR_get_error(); - - if (error_code == SSL_ERROR_SSL) - return handler_(asio::error_code( - sys_error_code, asio::error::get_ssl_category()), rc); - - bool is_read_needed = (error_code == SSL_ERROR_WANT_READ); - bool is_write_needed = (error_code == SSL_ERROR_WANT_WRITE || - ::BIO_ctrl_pending( ssl_bio_ )); - bool is_shut_down_received = - ((::SSL_get_shutdown( session_ ) & SSL_RECEIVED_SHUTDOWN) == - SSL_RECEIVED_SHUTDOWN); - bool is_shut_down_sent = - ((::SSL_get_shutdown( session_ ) & SSL_SENT_SHUTDOWN) == - SSL_SENT_SHUTDOWN); - - if (is_shut_down_sent && is_shut_down_received - && is_operation_done && !is_write_needed) - // SSL connection is shut down cleanly - return handler_(asio::error_code(), 1); - - if (is_shut_down_received && !is_operation_done) - // Shutdown has been requested, while we were reading or writing... - // abort our action... - return handler_(asio::error::shut_down, 0); - - if (!is_operation_done && !is_read_needed && !is_write_needed - && !is_shut_down_sent) - { - // The operation has failed... It is not completed and does - // not want network communication nor does want to send shutdown out... - if (error_code == SSL_ERROR_SYSCALL) - { - return handler_(asio::error_code( - sys_error_code, asio::error::system_category), rc); - } - else - { - return handler_(asio::error_code( - sys_error_code, asio::error::get_ssl_category()), rc); - } - } - - if (!is_operation_done && !is_write_needed) - { - // We may have left over data that we can pass to SSL immediately - if (recv_buf_.get_data_len() > 0) - { - // Pass the buffered data to SSL - int written = ::BIO_write - ( - ssl_bio_, - recv_buf_.get_data_start(), - recv_buf_.get_data_len() - ); - - if (written > 0) - { - recv_buf_.data_removed(written); - } - else if (written < 0) - { - if (!BIO_should_retry(ssl_bio_)) - { - // Some serios error with BIO.... - return handler_(asio::error::no_recovery, 0); - } - } - - return start(); - } - else if (is_read_needed || (is_shut_down_sent && !is_shut_down_received)) - { - return read_(); - } - } - - // Continue with operation, flush any SSL data out to network... - return write_(is_operation_done, rc); - } - -// Private implementation -private: - typedef boost::function<int (const asio::error_code&, int)> - int_handler_func; - typedef boost::function<int (bool, int)> write_func; - typedef boost::function<int ()> read_func; - - ssl_primitive_func primitive_; - user_handler_func user_handler_; - asio::io_service::strand* strand_; - write_func write_; - read_func read_; - int_handler_func handler_; - - net_buffer send_buf_; // buffers for network IO - - // The recv buffer is owned by the stream, not the operation, since there can - // be left over bytes after passing the data up to the application, and these - // bytes need to be kept around for the next read operation issued by the - // application. - net_buffer& recv_buf_; - - Stream& socket_; - BIO* ssl_bio_; - SSL* session_; - - // - int sync_user_handler(const asio::error_code& error, int rc) - { - if (!error) - return rc; - - throw asio::system_error(error); - } - - int async_user_handler(asio::error_code error, int rc) - { - if (rc < 0) - { - if (!error) - error = asio::error::no_recovery; - rc = 0; - } - - user_handler_(error, rc); - return 0; - } - - // Writes bytes asynchronously from SSL to NET - int do_async_write(bool is_operation_done, int rc) - { - int len = ::BIO_ctrl_pending( ssl_bio_ ); - if ( len ) - { - // There is something to write into net, do it... - len = (int)send_buf_.get_unused_len() > len? - len: - send_buf_.get_unused_len(); - - if (len == 0) - { - // In case our send buffer is full, we have just to wait until - // previous send to complete... - return 0; - } - - // Read outgoing data from bio - len = ::BIO_read( ssl_bio_, send_buf_.get_unused_start(), len); - - if (len > 0) - { - unsigned char *data_start = send_buf_.get_unused_start(); - send_buf_.data_added(len); - - ASIO_ASSERT(strand_); - asio::async_write - ( - socket_, - asio::buffer(data_start, len), - strand_->wrap - ( - boost::bind - ( - &openssl_operation::async_write_handler, - this, - is_operation_done, - rc, - asio::placeholders::error, - asio::placeholders::bytes_transferred - ) - ) - ); - - return 0; - } - else if (!BIO_should_retry(ssl_bio_)) - { - // Seems like fatal error - // reading from SSL BIO has failed... - handler_(asio::error::no_recovery, 0); - return 0; - } - } - - if (is_operation_done) - { - // Finish the operation, with success - handler_(asio::error_code(), rc); - return 0; - } - - // OPeration is not done and writing to net has been made... - // start operation again - start(); - - return 0; - } - - void async_write_handler(bool is_operation_done, int rc, - const asio::error_code& error, size_t bytes_sent) - { - if (!error) - { - // Remove data from send buffer - send_buf_.data_removed(bytes_sent); - - if (is_operation_done) - handler_(asio::error_code(), rc); - else - // Since the operation was not completed, try it again... - start(); - } - else - handler_(error, rc); - } - - int do_async_read() - { - // Wait for new data - ASIO_ASSERT(strand_); - socket_.async_read_some - ( - asio::buffer(recv_buf_.get_unused_start(), - recv_buf_.get_unused_len()), - strand_->wrap - ( - boost::bind - ( - &openssl_operation::async_read_handler, - this, - asio::placeholders::error, - asio::placeholders::bytes_transferred - ) - ) - ); - return 0; - } - - void async_read_handler(const asio::error_code& error, - size_t bytes_recvd) - { - if (!error) - { - recv_buf_.data_added(bytes_recvd); - - // Pass the received data to SSL - int written = ::BIO_write - ( - ssl_bio_, - recv_buf_.get_data_start(), - recv_buf_.get_data_len() - ); - - if (written > 0) - { - recv_buf_.data_removed(written); - } - else if (written < 0) - { - if (!BIO_should_retry(ssl_bio_)) - { - // Some serios error with BIO.... - handler_(asio::error::no_recovery, 0); - return; - } - } - - // and try the SSL primitive again - start(); - } - else - { - // Error in network level... - // SSL can't continue either... - handler_(error, 0); - } - } - - // Syncronous functions... - int do_sync_write(bool is_operation_done, int rc) - { - int len = ::BIO_ctrl_pending( ssl_bio_ ); - if ( len ) - { - // There is something to write into net, do it... - len = (int)send_buf_.get_unused_len() > len? - len: - send_buf_.get_unused_len(); - - // Read outgoing data from bio - len = ::BIO_read( ssl_bio_, send_buf_.get_unused_start(), len); - - if (len > 0) - { - size_t sent_len = asio::write( - socket_, - asio::buffer(send_buf_.get_unused_start(), len) - ); - - send_buf_.data_added(len); - send_buf_.data_removed(sent_len); - } - else if (!BIO_should_retry(ssl_bio_)) - { - // Seems like fatal error - // reading from SSL BIO has failed... - throw asio::system_error(asio::error::no_recovery); - } - } - - if (is_operation_done) - // Finish the operation, with success - return rc; - - // Operation is not finished, start again. - return start(); - } - - int do_sync_read() - { - size_t len = socket_.read_some - ( - asio::buffer(recv_buf_.get_unused_start(), - recv_buf_.get_unused_len()) - ); - - // Write data to ssl - recv_buf_.data_added(len); - - // Pass the received data to SSL - int written = ::BIO_write - ( - ssl_bio_, - recv_buf_.get_data_start(), - recv_buf_.get_data_len() - ); - - if (written > 0) - { - recv_buf_.data_removed(written); - } - else if (written < 0) - { - if (!BIO_should_retry(ssl_bio_)) - { - // Some serios error with BIO.... - throw asio::system_error(asio::error::no_recovery); - } - } - - // Try the operation again - return start(); - } -}; // class openssl_operation - -} // namespace detail -} // namespace old -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_OLD_DETAIL_OPENSSL_OPERATION_HPP
diff --git a/asio/include/asio/ssl/old/detail/openssl_stream_service.hpp b/asio/include/asio/ssl/old/detail/openssl_stream_service.hpp deleted file mode 100644 index 11154e9..0000000 --- a/asio/include/asio/ssl/old/detail/openssl_stream_service.hpp +++ /dev/null
@@ -1,571 +0,0 @@ -// -// ssl/old/detail/stream_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2014 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 ASIO_SSL_OLD_DETAIL_OPENSSL_STREAM_SERVICE_HPP -#define ASIO_SSL_OLD_DETAIL_OPENSSL_STREAM_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" -#include <cstddef> -#include <climits> -#include <memory> -#include <boost/config.hpp> -#include <boost/noncopyable.hpp> -#include <boost/function.hpp> -#include <boost/bind.hpp> -#include "asio/detail/buffer_sequence_adapter.hpp" -#include "asio/error.hpp" -#include "asio/io_service.hpp" -#include "asio/ssl/basic_context.hpp" -#include "asio/ssl/stream_base.hpp" -#include "asio/ssl/old/detail/openssl_operation.hpp" -#include "asio/ssl/detail/openssl_types.hpp" -#include "asio/strand.hpp" -#include "asio/system_error.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { -namespace old { -namespace detail { - -class openssl_stream_service - : public asio::detail::service_base<openssl_stream_service> -{ -private: - enum { max_buffer_size = INT_MAX }; - - //Base handler for asyncrhonous operations - template <typename Stream> - class base_handler - { - public: - typedef boost::function< - void (const asio::error_code&, size_t)> func_t; - - base_handler(asio::io_service& io_service) - : op_(NULL) - , io_service_(io_service) - , work_(io_service) - {} - - void do_func(const asio::error_code& error, size_t size) - { - func_(error, size); - } - - void set_operation(openssl_operation<Stream>* op) { op_ = op; } - void set_func(func_t func) { func_ = func; } - - ~base_handler() - { - delete op_; - } - - private: - func_t func_; - openssl_operation<Stream>* op_; - asio::io_service& io_service_; - asio::io_service::work work_; - }; // class base_handler - - // Handler for asynchronous IO (write/read) operations - template<typename Stream, typename Handler> - class io_handler - : public base_handler<Stream> - { - public: - io_handler(Handler handler, asio::io_service& io_service) - : base_handler<Stream>(io_service) - , handler_(handler) - { - this->set_func(boost::bind( - &io_handler<Stream, Handler>::handler_impl, - this, boost::arg<1>(), boost::arg<2>() )); - } - - private: - Handler handler_; - void handler_impl(const asio::error_code& error, size_t size) - { - std::auto_ptr<io_handler<Stream, Handler> > this_ptr(this); - handler_(error, size); - } - }; // class io_handler - - // Handler for asyncrhonous handshake (connect, accept) functions - template <typename Stream, typename Handler> - class handshake_handler - : public base_handler<Stream> - { - public: - handshake_handler(Handler handler, asio::io_service& io_service) - : base_handler<Stream>(io_service) - , handler_(handler) - { - this->set_func(boost::bind( - &handshake_handler<Stream, Handler>::handler_impl, - this, boost::arg<1>(), boost::arg<2>() )); - } - - private: - Handler handler_; - void handler_impl(const asio::error_code& error, size_t) - { - std::auto_ptr<handshake_handler<Stream, Handler> > this_ptr(this); - handler_(error); - } - - }; // class handshake_handler - - // Handler for asyncrhonous shutdown - template <typename Stream, typename Handler> - class shutdown_handler - : public base_handler<Stream> - { - public: - shutdown_handler(Handler handler, asio::io_service& io_service) - : base_handler<Stream>(io_service), - handler_(handler) - { - this->set_func(boost::bind( - &shutdown_handler<Stream, Handler>::handler_impl, - this, boost::arg<1>(), boost::arg<2>() )); - } - - private: - Handler handler_; - void handler_impl(const asio::error_code& error, size_t) - { - std::auto_ptr<shutdown_handler<Stream, Handler> > this_ptr(this); - handler_(error); - } - }; // class shutdown_handler - -public: - // The implementation type. - typedef struct impl_struct - { - ::SSL* ssl; - ::BIO* ext_bio; - net_buffer recv_buf; - } * impl_type; - - // Construct a new stream socket service for the specified io_service. - explicit openssl_stream_service(asio::io_service& io_service) - : asio::detail::service_base<openssl_stream_service>(io_service), - strand_(io_service) - { - } - - // Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - } - - // Return a null stream implementation. - impl_type null() const - { - return 0; - } - - // Create a new stream implementation. - template <typename Stream, typename Context_Service> - void create(impl_type& impl, Stream& /*next_layer*/, - basic_context<Context_Service>& context) - { - impl = new impl_struct; - impl->ssl = ::SSL_new(context.impl()); - ::SSL_set_mode(impl->ssl, SSL_MODE_ENABLE_PARTIAL_WRITE); - ::SSL_set_mode(impl->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); - ::BIO* int_bio = 0; - impl->ext_bio = 0; - ::BIO_new_bio_pair(&int_bio, 8192, &impl->ext_bio, 8192); - ::SSL_set_bio(impl->ssl, int_bio, int_bio); - } - - // Destroy a stream implementation. - template <typename Stream> - void destroy(impl_type& impl, Stream& /*next_layer*/) - { - if (impl != 0) - { - ::BIO_free(impl->ext_bio); - ::SSL_free(impl->ssl); - delete impl; - impl = 0; - } - } - - // Perform SSL handshaking. - template <typename Stream> - asio::error_code handshake(impl_type& impl, Stream& next_layer, - stream_base::handshake_type type, asio::error_code& ec) - { - try - { - openssl_operation<Stream> op( - type == stream_base::client ? - &ssl_wrap<mutex_type>::SSL_connect: - &ssl_wrap<mutex_type>::SSL_accept, - next_layer, - impl->recv_buf, - impl->ssl, - impl->ext_bio); - op.start(); - } - catch (asio::system_error& e) - { - ec = e.code(); - return ec; - } - - ec = asio::error_code(); - return ec; - } - - // Start an asynchronous SSL handshake. - template <typename Stream, typename Handler> - void async_handshake(impl_type& impl, Stream& next_layer, - stream_base::handshake_type type, Handler handler) - { - typedef handshake_handler<Stream, Handler> connect_handler; - - connect_handler* local_handler = - new connect_handler(handler, get_io_service()); - - openssl_operation<Stream>* op = new openssl_operation<Stream> - ( - type == stream_base::client ? - &ssl_wrap<mutex_type>::SSL_connect: - &ssl_wrap<mutex_type>::SSL_accept, - next_layer, - impl->recv_buf, - impl->ssl, - impl->ext_bio, - boost::bind - ( - &base_handler<Stream>::do_func, - local_handler, - boost::arg<1>(), - boost::arg<2>() - ), - strand_ - ); - local_handler->set_operation(op); - - strand_.post(boost::bind(&openssl_operation<Stream>::start, op)); - } - - // Shut down SSL on the stream. - template <typename Stream> - asio::error_code shutdown(impl_type& impl, Stream& next_layer, - asio::error_code& ec) - { - try - { - openssl_operation<Stream> op( - &ssl_wrap<mutex_type>::SSL_shutdown, - next_layer, - impl->recv_buf, - impl->ssl, - impl->ext_bio); - op.start(); - } - catch (asio::system_error& e) - { - ec = e.code(); - return ec; - } - - ec = asio::error_code(); - return ec; - } - - // Asynchronously shut down SSL on the stream. - template <typename Stream, typename Handler> - void async_shutdown(impl_type& impl, Stream& next_layer, Handler handler) - { - typedef shutdown_handler<Stream, Handler> disconnect_handler; - - disconnect_handler* local_handler = - new disconnect_handler(handler, get_io_service()); - - openssl_operation<Stream>* op = new openssl_operation<Stream> - ( - &ssl_wrap<mutex_type>::SSL_shutdown, - next_layer, - impl->recv_buf, - impl->ssl, - impl->ext_bio, - boost::bind - ( - &base_handler<Stream>::do_func, - local_handler, - boost::arg<1>(), - boost::arg<2>() - ), - strand_ - ); - local_handler->set_operation(op); - - strand_.post(boost::bind(&openssl_operation<Stream>::start, op)); - } - - // Write some data to the stream. - template <typename Stream, typename Const_Buffers> - std::size_t write_some(impl_type& impl, Stream& next_layer, - const Const_Buffers& buffers, asio::error_code& ec) - { - size_t bytes_transferred = 0; - try - { - asio::const_buffer buffer = - asio::detail::buffer_sequence_adapter< - asio::const_buffer, Const_Buffers>::first(buffers); - - std::size_t buffer_size = asio::buffer_size(buffer); - if (buffer_size > max_buffer_size) - buffer_size = max_buffer_size; - else if (buffer_size == 0) - { - ec = asio::error_code(); - return 0; - } - - boost::function<int (SSL*)> send_func = - boost::bind(boost::type<int>(), &::SSL_write, boost::arg<1>(), - asio::buffer_cast<const void*>(buffer), - static_cast<int>(buffer_size)); - openssl_operation<Stream> op( - send_func, - next_layer, - impl->recv_buf, - impl->ssl, - impl->ext_bio - ); - bytes_transferred = static_cast<size_t>(op.start()); - } - catch (asio::system_error& e) - { - ec = e.code(); - return 0; - } - - ec = asio::error_code(); - return bytes_transferred; - } - - // Start an asynchronous write. - template <typename Stream, typename Const_Buffers, typename Handler> - void async_write_some(impl_type& impl, Stream& next_layer, - const Const_Buffers& buffers, Handler handler) - { - typedef io_handler<Stream, Handler> send_handler; - - asio::const_buffer buffer = - asio::detail::buffer_sequence_adapter< - asio::const_buffer, Const_Buffers>::first(buffers); - - std::size_t buffer_size = asio::buffer_size(buffer); - if (buffer_size > max_buffer_size) - buffer_size = max_buffer_size; - else if (buffer_size == 0) - { - get_io_service().post(asio::detail::bind_handler( - handler, asio::error_code(), 0)); - return; - } - - send_handler* local_handler = new send_handler(handler, get_io_service()); - - boost::function<int (SSL*)> send_func = - boost::bind(boost::type<int>(), &::SSL_write, boost::arg<1>(), - asio::buffer_cast<const void*>(buffer), - static_cast<int>(buffer_size)); - - openssl_operation<Stream>* op = new openssl_operation<Stream> - ( - send_func, - next_layer, - impl->recv_buf, - impl->ssl, - impl->ext_bio, - boost::bind - ( - &base_handler<Stream>::do_func, - local_handler, - boost::arg<1>(), - boost::arg<2>() - ), - strand_ - ); - local_handler->set_operation(op); - - strand_.post(boost::bind(&openssl_operation<Stream>::start, op)); - } - - // Read some data from the stream. - template <typename Stream, typename Mutable_Buffers> - std::size_t read_some(impl_type& impl, Stream& next_layer, - const Mutable_Buffers& buffers, asio::error_code& ec) - { - size_t bytes_transferred = 0; - try - { - asio::mutable_buffer buffer = - asio::detail::buffer_sequence_adapter< - asio::mutable_buffer, Mutable_Buffers>::first(buffers); - - std::size_t buffer_size = asio::buffer_size(buffer); - if (buffer_size > max_buffer_size) - buffer_size = max_buffer_size; - else if (buffer_size == 0) - { - ec = asio::error_code(); - return 0; - } - - boost::function<int (SSL*)> recv_func = - boost::bind(boost::type<int>(), &::SSL_read, boost::arg<1>(), - asio::buffer_cast<void*>(buffer), - static_cast<int>(buffer_size)); - openssl_operation<Stream> op(recv_func, - next_layer, - impl->recv_buf, - impl->ssl, - impl->ext_bio - ); - - bytes_transferred = static_cast<size_t>(op.start()); - } - catch (asio::system_error& e) - { - ec = e.code(); - return 0; - } - - ec = asio::error_code(); - return bytes_transferred; - } - - // Start an asynchronous read. - template <typename Stream, typename Mutable_Buffers, typename Handler> - void async_read_some(impl_type& impl, Stream& next_layer, - const Mutable_Buffers& buffers, Handler handler) - { - typedef io_handler<Stream, Handler> recv_handler; - - asio::mutable_buffer buffer = - asio::detail::buffer_sequence_adapter< - asio::mutable_buffer, Mutable_Buffers>::first(buffers); - - std::size_t buffer_size = asio::buffer_size(buffer); - if (buffer_size > max_buffer_size) - buffer_size = max_buffer_size; - else if (buffer_size == 0) - { - get_io_service().post(asio::detail::bind_handler( - handler, asio::error_code(), 0)); - return; - } - - recv_handler* local_handler = new recv_handler(handler, get_io_service()); - - boost::function<int (SSL*)> recv_func = - boost::bind(boost::type<int>(), &::SSL_read, boost::arg<1>(), - asio::buffer_cast<void*>(buffer), - static_cast<int>(buffer_size)); - - openssl_operation<Stream>* op = new openssl_operation<Stream> - ( - recv_func, - next_layer, - impl->recv_buf, - impl->ssl, - impl->ext_bio, - boost::bind - ( - &base_handler<Stream>::do_func, - local_handler, - boost::arg<1>(), - boost::arg<2>() - ), - strand_ - ); - local_handler->set_operation(op); - - strand_.post(boost::bind(&openssl_operation<Stream>::start, op)); - } - - // Peek at the incoming data on the stream. - template <typename Stream, typename Mutable_Buffers> - std::size_t peek(impl_type& /*impl*/, Stream& /*next_layer*/, - const Mutable_Buffers& /*buffers*/, asio::error_code& ec) - { - ec = asio::error_code(); - return 0; - } - - // Determine the amount of data that may be read without blocking. - template <typename Stream> - std::size_t in_avail(impl_type& /*impl*/, Stream& /*next_layer*/, - asio::error_code& ec) - { - ec = asio::error_code(); - return 0; - } - -private: - asio::io_service::strand strand_; - - typedef asio::detail::mutex mutex_type; - - template<typename Mutex> - struct ssl_wrap - { - static Mutex ssl_mutex_; - - static int SSL_accept(SSL *ssl) - { - typename Mutex::scoped_lock lock(ssl_mutex_); - return ::SSL_accept(ssl); - } - - static int SSL_connect(SSL *ssl) - { - typename Mutex::scoped_lock lock(ssl_mutex_); - return ::SSL_connect(ssl); - } - - static int SSL_shutdown(SSL *ssl) - { - typename Mutex::scoped_lock lock(ssl_mutex_); - return ::SSL_shutdown(ssl); - } - }; -}; - -template<typename Mutex> -Mutex openssl_stream_service::ssl_wrap<Mutex>::ssl_mutex_; - -} // namespace detail -} // namespace old -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_OLD_DETAIL_OPENSSL_STREAM_SERVICE_HPP
diff --git a/asio/include/asio/ssl/old/stream.hpp b/asio/include/asio/ssl/old/stream.hpp deleted file mode 100644 index 42ab3c2..0000000 --- a/asio/include/asio/ssl/old/stream.hpp +++ /dev/null
@@ -1,501 +0,0 @@ -// -// ssl/old/stream.hpp -// ~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2014 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 ASIO_SSL_OLD_STREAM_HPP -#define ASIO_SSL_OLD_STREAM_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" -#include <cstddef> -#include <boost/noncopyable.hpp> -#include "asio/detail/throw_error.hpp" -#include "asio/detail/type_traits.hpp" -#include "asio/error.hpp" -#include "asio/ssl/basic_context.hpp" -#include "asio/ssl/stream_base.hpp" -#include "asio/ssl/stream_service.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { -namespace old { - -/// 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. - * - * @par Example - * To use the SSL stream template with an ip::tcp::socket, you would write: - * @code - * asio::io_service io_service; - * asio::ssl::context context(io_service, asio::ssl::context::sslv23); - * asio::ssl::stream<asio::ip::tcp::socket> sock(io_service, context); - * @endcode - * - * @par Concepts: - * AsyncReadStream, AsyncWriteStream, Stream, SyncRead_Stream, SyncWriteStream. - */ -template <typename Stream, typename Service = old::stream_service> -class stream - : public stream_base, - private boost::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 service that will be used to provide stream operations. - typedef Service service_type; - - /// The native implementation type of the stream. - typedef typename service_type::impl_type impl_type; - - /// 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 context The SSL context to be used for the stream. - */ - template <typename Arg, typename Context_Service> - explicit stream(Arg& arg, basic_context<Context_Service>& context) - : next_layer_(arg), - service_(asio::use_service<Service>(next_layer_.get_io_service())), - impl_(service_.null()) - { - service_.create(impl_, next_layer_, context); - } - - /// Destructor. - ~stream() - { - service_.destroy(impl_, next_layer_); - } - - /// Get the io_service associated with the object. - /** - * This function may be used to obtain the io_service object that the stream - * uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_service object that stream will use to - * dispatch handlers. Ownership is not transferred to the caller. - */ - asio::io_service& get_io_service() - { - return next_layer_.get_io_service(); - } - - /// 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 const reference to the lowest layer. - /** - * This function returns a const reference to the lowest layer in a stack of - * stream layers. - * - * @return A const 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(); - } - - /// 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 stream functionality that is - * not otherwise provided. - */ - impl_type impl() - { - return impl_; - } - - /// 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 asio::system_error Thrown on failure. - */ - void handshake(handshake_type type) - { - asio::error_code ec; - service_.handshake(impl_, next_layer_, type, ec); - asio::detail::throw_error(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 ec Set to indicate what error occurred, if any. - */ - asio::error_code handshake(handshake_type type, - asio::error_code& ec) - { - return service_.handshake(impl_, next_layer_, type, 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 asio::error_code& error // Result of operation. - * ); @endcode - */ - template <typename HandshakeHandler> - void async_handshake(handshake_type type, HandshakeHandler handler) - { - service_.async_handshake(impl_, next_layer_, type, handler); - } - - /// 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 asio::system_error Thrown on failure. - */ - void shutdown() - { - asio::error_code ec; - service_.shutdown(impl_, next_layer_, ec); - asio::detail::throw_error(ec); - } - - /// 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. - */ - asio::error_code shutdown(asio::error_code& ec) - { - return service_.shutdown(impl_, next_layer_, 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 asio::error_code& error // Result of operation. - * ); @endcode - */ - template <typename ShutdownHandler> - void async_shutdown(ShutdownHandler handler) - { - service_.async_shutdown(impl_, next_layer_, handler); - } - - /// 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 asio::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) - { - asio::error_code ec; - std::size_t s = service_.write_some(impl_, next_layer_, buffers, ec); - asio::detail::throw_error(ec); - return s; - } - - /// 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, - asio::error_code& ec) - { - return service_.write_some(impl_, next_layer_, 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 asio::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> - void async_write_some(const ConstBufferSequence& buffers, - WriteHandler handler) - { - service_.async_write_some(impl_, next_layer_, buffers, handler); - } - - /// 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 asio::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) - { - asio::error_code ec; - std::size_t s = service_.read_some(impl_, next_layer_, buffers, ec); - asio::detail::throw_error(ec); - return s; - } - - /// 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, - asio::error_code& ec) - { - return service_.read_some(impl_, next_layer_, 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 asio::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> - void async_read_some(const MutableBufferSequence& buffers, - ReadHandler handler) - { - service_.async_read_some(impl_, next_layer_, buffers, handler); - } - - /// Peek at the incoming data on the stream. - /** - * This function is used to peek at the incoming data on the stream, without - * removing it from the input queue. The function call will block until data - * has been read successfully or an error occurs. - * - * @param buffers The buffers into which the data will be read. - * - * @returns The number of bytes read. - * - * @throws asio::system_error Thrown on failure. - */ - template <typename MutableBufferSequence> - std::size_t peek(const MutableBufferSequence& buffers) - { - asio::error_code ec; - std::size_t s = service_.peek(impl_, next_layer_, buffers, ec); - asio::detail::throw_error(ec); - return s; - } - - /// Peek at the incoming data on the stream. - /** - * This function is used to peek at the incoming data on the stream, withoutxi - * removing it from the input queue. The function call will block until data - * has been read successfully or 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. - */ - template <typename MutableBufferSequence> - std::size_t peek(const MutableBufferSequence& buffers, - asio::error_code& ec) - { - return service_.peek(impl_, next_layer_, buffers, ec); - } - - /// Determine the amount of data that may be read without blocking. - /** - * This function is used to determine the amount of data, in bytes, that may - * be read from the stream without blocking. - * - * @returns The number of bytes of data that can be read without blocking. - * - * @throws asio::system_error Thrown on failure. - */ - std::size_t in_avail() - { - asio::error_code ec; - std::size_t s = service_.in_avail(impl_, next_layer_, ec); - asio::detail::throw_error(ec); - return s; - } - - /// Determine the amount of data that may be read without blocking. - /** - * This function is used to determine the amount of data, in bytes, that may - * be read from the stream without blocking. - * - * @param ec Set to indicate what error occurred, if any. - * - * @returns The number of bytes of data that can be read without blocking. - */ - std::size_t in_avail(asio::error_code& ec) - { - return service_.in_avail(impl_, next_layer_, ec); - } - -private: - /// The next layer. - Stream next_layer_; - - /// The backend service implementation. - service_type& service_; - - /// The underlying native implementation. - impl_type impl_; -}; - -} // namespace old -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_OLD_STREAM_HPP
diff --git a/asio/include/asio/ssl/old/stream_service.hpp b/asio/include/asio/ssl/old/stream_service.hpp deleted file mode 100644 index 2c3c442..0000000 --- a/asio/include/asio/ssl/old/stream_service.hpp +++ /dev/null
@@ -1,184 +0,0 @@ -// -// ssl/old/stream_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2014 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 ASIO_SSL_OLD_STREAM_SERVICE_HPP -#define ASIO_SSL_OLD_STREAM_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" -#include <cstddef> -#include <boost/noncopyable.hpp> -#include "asio/io_service.hpp" -#include "asio/ssl/basic_context.hpp" -#include "asio/ssl/old/detail/openssl_stream_service.hpp" -#include "asio/ssl/stream_base.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { -namespace old { - -/// Default service implementation for an SSL stream. -class stream_service -#if defined(GENERATING_DOCUMENTATION) - : public asio::io_service::service -#else - : public asio::detail::service_base<stream_service> -#endif -{ -private: - // The type of the platform-specific implementation. - typedef old::detail::openssl_stream_service service_impl_type; - -public: -#if defined(GENERATING_DOCUMENTATION) - /// The unique service identifier. - static asio::io_service::id id; -#endif - - /// The type of a stream implementation. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined impl_type; -#else - typedef service_impl_type::impl_type impl_type; -#endif - - /// Construct a new stream service for the specified io_service. - explicit stream_service(asio::io_service& io_service) - : asio::detail::service_base<stream_service>(io_service), - service_impl_(asio::use_service<service_impl_type>(io_service)) - { - } - - /// Return a null stream implementation. - impl_type null() const - { - return service_impl_.null(); - } - - /// Create a new stream implementation. - template <typename Stream, typename Context_Service> - void create(impl_type& impl, Stream& next_layer, - basic_context<Context_Service>& context) - { - service_impl_.create(impl, next_layer, context); - } - - /// Destroy a stream implementation. - template <typename Stream> - void destroy(impl_type& impl, Stream& next_layer) - { - service_impl_.destroy(impl, next_layer); - } - - /// Perform SSL handshaking. - template <typename Stream> - asio::error_code handshake(impl_type& impl, Stream& next_layer, - stream_base::handshake_type type, asio::error_code& ec) - { - return service_impl_.handshake(impl, next_layer, type, ec); - } - - /// Start an asynchronous SSL handshake. - template <typename Stream, typename HandshakeHandler> - void async_handshake(impl_type& impl, Stream& next_layer, - stream_base::handshake_type type, HandshakeHandler handler) - { - service_impl_.async_handshake(impl, next_layer, type, handler); - } - - /// Shut down SSL on the stream. - template <typename Stream> - asio::error_code shutdown(impl_type& impl, Stream& next_layer, - asio::error_code& ec) - { - return service_impl_.shutdown(impl, next_layer, ec); - } - - /// Asynchronously shut down SSL on the stream. - template <typename Stream, typename ShutdownHandler> - void async_shutdown(impl_type& impl, Stream& next_layer, - ShutdownHandler handler) - { - service_impl_.async_shutdown(impl, next_layer, handler); - } - - /// Write some data to the stream. - template <typename Stream, typename ConstBufferSequence> - std::size_t write_some(impl_type& impl, Stream& next_layer, - const ConstBufferSequence& buffers, asio::error_code& ec) - { - return service_impl_.write_some(impl, next_layer, buffers, ec); - } - - /// Start an asynchronous write. - template <typename Stream, typename ConstBufferSequence, - typename WriteHandler> - void async_write_some(impl_type& impl, Stream& next_layer, - const ConstBufferSequence& buffers, WriteHandler handler) - { - service_impl_.async_write_some(impl, next_layer, buffers, handler); - } - - /// Read some data from the stream. - template <typename Stream, typename MutableBufferSequence> - std::size_t read_some(impl_type& impl, Stream& next_layer, - const MutableBufferSequence& buffers, asio::error_code& ec) - { - return service_impl_.read_some(impl, next_layer, buffers, ec); - } - - /// Start an asynchronous read. - template <typename Stream, typename MutableBufferSequence, - typename ReadHandler> - void async_read_some(impl_type& impl, Stream& next_layer, - const MutableBufferSequence& buffers, ReadHandler handler) - { - service_impl_.async_read_some(impl, next_layer, buffers, handler); - } - - /// Peek at the incoming data on the stream. - template <typename Stream, typename MutableBufferSequence> - std::size_t peek(impl_type& impl, Stream& next_layer, - const MutableBufferSequence& buffers, asio::error_code& ec) - { - return service_impl_.peek(impl, next_layer, buffers, ec); - } - - /// Determine the amount of data that may be read without blocking. - template <typename Stream> - std::size_t in_avail(impl_type& impl, Stream& next_layer, - asio::error_code& ec) - { - return service_impl_.in_avail(impl, next_layer, ec); - } - -private: - // Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - } - - // The service that provides the platform-specific implementation. - service_impl_type& service_impl_; -}; - -} // namespace old -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_OLD_STREAM_SERVICE_HPP
diff --git a/asio/include/asio/ssl/rfc2818_verification.hpp b/asio/include/asio/ssl/rfc2818_verification.hpp index acadfaa..6fe0d05 100644 --- a/asio/include/asio/ssl/rfc2818_verification.hpp +++ b/asio/include/asio/ssl/rfc2818_verification.hpp
@@ -17,19 +17,15 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include <string> -# include "asio/ssl/detail/openssl_types.hpp" -# include "asio/ssl/verify_context.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include <string> +#include "asio/ssl/detail/openssl_types.hpp" +#include "asio/ssl/verify_context.hpp" #include "asio/detail/push_options.hpp" namespace asio { namespace ssl { -#if !defined(ASIO_ENABLE_OLD_SSL) - /// Verifies a certificate against a hostname according to the rules described /// in RFC 2818. /** @@ -86,8 +82,6 @@ std::string host_; }; -#endif // defined(ASIO_ENABLE_OLD_SSL) - } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/stream.hpp b/asio/include/asio/ssl/stream.hpp index e610f27..91af9e7 100644 --- a/asio/include/asio/ssl/stream.hpp +++ b/asio/include/asio/ssl/stream.hpp
@@ -17,36 +17,26 @@ #include "asio/detail/config.hpp" -#if defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/old/stream.hpp" -#else // defined(ASIO_ENABLE_OLD_SSL) -# include "asio/async_result.hpp" -# include "asio/detail/buffer_sequence_adapter.hpp" -# include "asio/detail/handler_type_requirements.hpp" -# include "asio/detail/noncopyable.hpp" -# include "asio/detail/type_traits.hpp" -# include "asio/ssl/context.hpp" -# include "asio/ssl/detail/buffered_handshake_op.hpp" -# include "asio/ssl/detail/handshake_op.hpp" -# include "asio/ssl/detail/io.hpp" -# include "asio/ssl/detail/read_op.hpp" -# include "asio/ssl/detail/shutdown_op.hpp" -# include "asio/ssl/detail/stream_core.hpp" -# include "asio/ssl/detail/write_op.hpp" -# include "asio/ssl/stream_base.hpp" -#endif // defined(ASIO_ENABLE_OLD_SSL) +#include "asio/async_result.hpp" +#include "asio/detail/buffer_sequence_adapter.hpp" +#include "asio/detail/handler_type_requirements.hpp" +#include "asio/detail/noncopyable.hpp" +#include "asio/detail/type_traits.hpp" +#include "asio/ssl/context.hpp" +#include "asio/ssl/detail/buffered_handshake_op.hpp" +#include "asio/ssl/detail/handshake_op.hpp" +#include "asio/ssl/detail/io.hpp" +#include "asio/ssl/detail/read_op.hpp" +#include "asio/ssl/detail/shutdown_op.hpp" +#include "asio/ssl/detail/stream_core.hpp" +#include "asio/ssl/detail/write_op.hpp" +#include "asio/ssl/stream_base.hpp" #include "asio/detail/push_options.hpp" namespace asio { namespace ssl { -#if defined(ASIO_ENABLE_OLD_SSL) - -using asio::ssl::old::stream; - -#else // defined(ASIO_ENABLE_OLD_SSL) - /// Provides stream-oriented functionality using SSL. /** * The stream class template provides asynchronous and blocking stream-oriented @@ -84,9 +74,6 @@ SSL* ssl; }; - /// (Deprecated: Use native_handle_type.) The underlying implementation type. - typedef impl_struct* impl_type; - /// The type of the next layer. typedef typename remove_reference<Stream>::type next_layer_type; @@ -108,7 +95,6 @@ core_(ctx.native_handle(), next_layer_.lowest_layer().get_executor().context()) { - backwards_compatible_impl_.ssl = core_.engine_.native_handle(); } /// Destructor. @@ -158,18 +144,6 @@ return core_.engine_.native_handle(); } - /// (Deprecated: Use native_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 stream functionality that is - * not otherwise provided. - */ - impl_type impl() - { - return &backwards_compatible_impl_; - } - /// Get a reference to the next layer. /** * This function returns a reference to the next layer in a stack of stream @@ -739,11 +713,8 @@ private: Stream next_layer_; detail::stream_core core_; - impl_struct backwards_compatible_impl_; }; -#endif // defined(ASIO_ENABLE_OLD_SSL) - } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/ssl/stream_service.hpp b/asio/include/asio/ssl/stream_service.hpp deleted file mode 100644 index a3d130f..0000000 --- a/asio/include/asio/ssl/stream_service.hpp +++ /dev/null
@@ -1,40 +0,0 @@ -// -// ssl/stream_service.hpp -// ~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2014 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 ASIO_SSL_STREAM_SERVICE_HPP -#define ASIO_SSL_STREAM_SERVICE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" - -#if defined(ASIO_ENABLE_OLD_SSL) -# include "asio/ssl/old/stream_service.hpp" -#endif // defined(ASIO_ENABLE_OLD_SSL) - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace ssl { - -#if defined(ASIO_ENABLE_OLD_SSL) - -using asio::ssl::old::stream_service; - -#endif // defined(ASIO_ENABLE_OLD_SSL) - -} // namespace ssl -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_SSL_STREAM_SERVICE_HPP
diff --git a/asio/include/asio/ssl/verify_context.hpp b/asio/include/asio/ssl/verify_context.hpp index 1de681c..57d8312 100644 --- a/asio/include/asio/ssl/verify_context.hpp +++ b/asio/include/asio/ssl/verify_context.hpp
@@ -17,18 +17,14 @@ #include "asio/detail/config.hpp" -#if !defined(ASIO_ENABLE_OLD_SSL) -# include "asio/detail/noncopyable.hpp" -# include "asio/ssl/detail/openssl_types.hpp" -#endif // !defined(ASIO_ENABLE_OLD_SSL) +#include "asio/detail/noncopyable.hpp" +#include "asio/ssl/detail/openssl_types.hpp" #include "asio/detail/push_options.hpp" namespace asio { namespace ssl { -#if !defined(ASIO_ENABLE_OLD_SSL) - /// A simple wrapper around the X509_STORE_CTX type, used during verification of /// a peer certificate. /** @@ -63,8 +59,6 @@ native_handle_type handle_; }; -#endif // defined(ASIO_ENABLE_OLD_SSL) - } // namespace ssl } // namespace asio
diff --git a/asio/include/asio/stream_socket_service.hpp b/asio/include/asio/stream_socket_service.hpp index 39d3123..80ae167 100644 --- a/asio/include/asio/stream_socket_service.hpp +++ b/asio/include/asio/stream_socket_service.hpp
@@ -73,13 +73,6 @@ typedef typename service_impl_type::implementation_type implementation_type; #endif - /// (Deprecated: Use native_handle_type.) The native socket type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_type; -#else - typedef typename service_impl_type::native_handle_type native_type; -#endif - /// The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_handle_type; @@ -169,12 +162,6 @@ return service_impl_.close(impl, ec); } - /// (Deprecated: Use native_handle().) Get the native socket implementation. - native_type native(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - /// Get the native socket implementation. native_handle_type native_handle(implementation_type& impl) {
diff --git a/asio/include/asio/windows/basic_handle.hpp b/asio/include/asio/windows/basic_handle.hpp index 82d7aba..6c46a3f 100644 --- a/asio/include/asio/windows/basic_handle.hpp +++ b/asio/include/asio/windows/basic_handle.hpp
@@ -45,10 +45,6 @@ : public basic_io_object<HandleService> { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// handle. - typedef typename HandleService::native_handle_type native_type; - /// The native representation of a handle. typedef typename HandleService::native_handle_type native_handle_type; @@ -211,17 +207,6 @@ return this->get_service().close(this->get_implementation(), ec); } - /// (Deprecated: Use native_handle().) 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_type native() - { - return this->get_service().native_handle(this->get_implementation()); - } - /// Get the native handle representation. /** * This function may be used to obtain the underlying representation of the
diff --git a/asio/include/asio/windows/basic_random_access_handle.hpp b/asio/include/asio/windows/basic_random_access_handle.hpp index 4ef9874..e71804e 100644 --- a/asio/include/asio/windows/basic_random_access_handle.hpp +++ b/asio/include/asio/windows/basic_random_access_handle.hpp
@@ -46,10 +46,6 @@ : public basic_handle<RandomAccessHandleService> { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// handle. - typedef typename RandomAccessHandleService::native_handle_type native_type; - /// The native representation of a handle. typedef typename RandomAccessHandleService::native_handle_type native_handle_type;
diff --git a/asio/include/asio/windows/basic_stream_handle.hpp b/asio/include/asio/windows/basic_stream_handle.hpp index 466b307..4eea03b 100644 --- a/asio/include/asio/windows/basic_stream_handle.hpp +++ b/asio/include/asio/windows/basic_stream_handle.hpp
@@ -49,10 +49,6 @@ : public basic_handle<StreamHandleService> { public: - /// (Deprecated: Use native_handle_type.) The native representation of a - /// handle. - typedef typename StreamHandleService::native_handle_type native_type; - /// The native representation of a handle. typedef typename StreamHandleService::native_handle_type native_handle_type;
diff --git a/asio/include/asio/windows/random_access_handle_service.hpp b/asio/include/asio/windows/random_access_handle_service.hpp index 4734205..4a26580 100644 --- a/asio/include/asio/windows/random_access_handle_service.hpp +++ b/asio/include/asio/windows/random_access_handle_service.hpp
@@ -58,13 +58,6 @@ typedef service_impl_type::implementation_type implementation_type; #endif - /// (Deprecated: Use native_handle_type.) The native handle type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_type; -#else - typedef service_impl_type::native_handle_type native_type; -#endif - /// The native handle type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_handle_type; @@ -129,12 +122,6 @@ return service_impl_.close(impl, ec); } - /// (Deprecated: Use native_handle().) Get the native handle implementation. - native_type native(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - /// Get the native handle implementation. native_handle_type native_handle(implementation_type& impl) {
diff --git a/asio/include/asio/windows/stream_handle_service.hpp b/asio/include/asio/windows/stream_handle_service.hpp index 5c8c788..9251946 100644 --- a/asio/include/asio/windows/stream_handle_service.hpp +++ b/asio/include/asio/windows/stream_handle_service.hpp
@@ -57,13 +57,6 @@ typedef service_impl_type::implementation_type implementation_type; #endif - /// (Deprecated: Use native_handle_type.) The native handle type. -#if defined(GENERATING_DOCUMENTATION) - typedef implementation_defined native_type; -#else - typedef service_impl_type::native_handle_type native_type; -#endif - /// The native handle type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_handle_type; @@ -127,12 +120,6 @@ return service_impl_.close(impl, ec); } - /// (Deprecated: Use native_handle().) Get the native handle implementation. - native_type native(implementation_type& impl) - { - return service_impl_.native_handle(impl); - } - /// Get the native handle implementation. native_handle_type native_handle(implementation_type& impl) {
diff --git a/asio/src/tests/Makefile.am b/asio/src/tests/Makefile.am index f3d601e..8fa3035 100644 --- a/asio/src/tests/Makefile.am +++ b/asio/src/tests/Makefile.am
@@ -115,13 +115,10 @@ if HAVE_OPENSSL check_PROGRAMS += \ - unit/ssl/basic_context \ unit/ssl/context_base \ - unit/ssl/context_service \ unit/ssl/context \ unit/ssl/rfc2818_verification \ unit/ssl/stream_base \ - unit/ssl/stream_service \ unit/ssl/stream endif @@ -215,13 +212,10 @@ if HAVE_OPENSSL TESTS += \ - unit/ssl/basic_context \ unit/ssl/context_base \ - unit/ssl/context_service \ unit/ssl/context \ unit/ssl/rfc2818_verification \ unit/ssl/stream_base \ - unit/ssl/stream_service \ unit/ssl/stream endif @@ -337,13 +331,10 @@ unit_write_at_SOURCES = unit/write_at.cpp unit/unit_test.cpp if HAVE_OPENSSL -unit_ssl_basic_context_SOURCES = unit/ssl/basic_context.cpp unit/unit_test.cpp unit_ssl_context_base_SOURCES = unit/ssl/context_base.cpp unit/unit_test.cpp -unit_ssl_context_service_SOURCES = unit/ssl/context_service.cpp unit/unit_test.cpp unit_ssl_context_SOURCES = unit/ssl/context.cpp unit/unit_test.cpp unit_ssl_stream_base_SOURCES = unit/ssl/stream_base.cpp unit/unit_test.cpp unit_ssl_rfc2818_verification_SOURCES = unit/ssl/rfc2818_verification.cpp unit/unit_test.cpp -unit_ssl_stream_service_SOURCES = unit/ssl/stream_service.cpp unit/unit_test.cpp unit_ssl_stream_SOURCES = unit/ssl/stream.cpp unit/unit_test.cpp endif
diff --git a/asio/src/tests/latency/tcp_client.cpp b/asio/src/tests/latency/tcp_client.cpp index 65b51d6..0bccdc4 100644 --- a/asio/src/tests/latency/tcp_client.cpp +++ b/asio/src/tests/latency/tcp_client.cpp
@@ -64,8 +64,7 @@ if (spin) { - tcp::socket::non_blocking_io nbio(true); - s->io_control(nbio); + s->non_blocking(true); } sockets.push_back(s);
diff --git a/asio/src/tests/latency/tcp_server.cpp b/asio/src/tests/latency/tcp_server.cpp index ffb0041..01dab85 100644 --- a/asio/src/tests/latency/tcp_server.cpp +++ b/asio/src/tests/latency/tcp_server.cpp
@@ -27,7 +27,7 @@ public: tcp_server(tcp::acceptor& acceptor, std::size_t buf_size) : acceptor_(acceptor), - socket_(acceptor_.get_io_service()), + socket_(acceptor_.get_executor().context()), buffer_(buf_size) { }
diff --git a/asio/src/tests/latency/udp_client.cpp b/asio/src/tests/latency/udp_client.cpp index 1524018..f3d1ce6 100644 --- a/asio/src/tests/latency/udp_client.cpp +++ b/asio/src/tests/latency/udp_client.cpp
@@ -45,8 +45,7 @@ if (spin) { - udp::socket::non_blocking_io nbio(true); - socket.io_control(nbio); + socket.non_blocking(true); } udp::endpoint target(asio::ip::address::from_string(ip), first_port);
diff --git a/asio/src/tests/unit/generic/datagram_protocol.cpp b/asio/src/tests/unit/generic/datagram_protocol.cpp index 8655154..cd1969d 100644 --- a/asio/src/tests/unit/generic/datagram_protocol.cpp +++ b/asio/src/tests/unit/generic/datagram_protocol.cpp
@@ -117,7 +117,7 @@ socket1.close(); socket1.close(ec); - dp::socket::native_type native_socket4 = socket1.native(); + dp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel();
diff --git a/asio/src/tests/unit/generic/raw_protocol.cpp b/asio/src/tests/unit/generic/raw_protocol.cpp index d749f1e..02d2dc0 100644 --- a/asio/src/tests/unit/generic/raw_protocol.cpp +++ b/asio/src/tests/unit/generic/raw_protocol.cpp
@@ -117,7 +117,7 @@ socket1.close(); socket1.close(ec); - rp::socket::native_type native_socket4 = socket1.native(); + rp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel();
diff --git a/asio/src/tests/unit/generic/seq_packet_protocol.cpp b/asio/src/tests/unit/generic/seq_packet_protocol.cpp index 4312994..a22b1e8 100644 --- a/asio/src/tests/unit/generic/seq_packet_protocol.cpp +++ b/asio/src/tests/unit/generic/seq_packet_protocol.cpp
@@ -113,7 +113,7 @@ socket1.close(); socket1.close(ec); - spp::socket::native_type native_socket4 = socket1.native(); + spp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel();
diff --git a/asio/src/tests/unit/generic/stream_protocol.cpp b/asio/src/tests/unit/generic/stream_protocol.cpp index a8b6c1f..d63f0ee 100644 --- a/asio/src/tests/unit/generic/stream_protocol.cpp +++ b/asio/src/tests/unit/generic/stream_protocol.cpp
@@ -133,7 +133,7 @@ socket1.close(); socket1.close(ec); - sp::socket::native_type native_socket4 = socket1.native(); + sp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel();
diff --git a/asio/src/tests/unit/ip/icmp.cpp b/asio/src/tests/unit/ip/icmp.cpp index 3e14731..b903a29 100644 --- a/asio/src/tests/unit/ip/icmp.cpp +++ b/asio/src/tests/unit/ip/icmp.cpp
@@ -123,12 +123,9 @@ socket1.close(); socket1.close(ec); - ip::icmp::socket::native_type native_socket4 = socket1.native(); - (void)native_socket4; - - ip::icmp::socket::native_handle_type native_socket5 + ip::icmp::socket::native_handle_type native_socket4 = socket1.native_handle(); - (void)native_socket5; + (void)native_socket4; socket1.cancel(); socket1.cancel(ec);
diff --git a/asio/src/tests/unit/ip/tcp.cpp b/asio/src/tests/unit/ip/tcp.cpp index d77a918..145337b 100644 --- a/asio/src/tests/unit/ip/tcp.cpp +++ b/asio/src/tests/unit/ip/tcp.cpp
@@ -249,12 +249,9 @@ socket1.close(); socket1.close(ec); - ip::tcp::socket::native_type native_socket4 = socket1.native(); - (void)native_socket4; - - ip::tcp::socket::native_handle_type native_socket5 + ip::tcp::socket::native_handle_type native_socket4 = socket1.native_handle(); - (void)native_socket5; + (void)native_socket4; socket1.cancel(); socket1.cancel(ec); @@ -700,12 +697,9 @@ acceptor1.close(); acceptor1.close(ec); - ip::tcp::acceptor::native_type native_acceptor4 = acceptor1.native(); - (void)native_acceptor4; - - ip::tcp::acceptor::native_handle_type native_acceptor5 + ip::tcp::acceptor::native_handle_type native_acceptor4 = acceptor1.native_handle(); - (void)native_acceptor5; + (void)native_acceptor4; acceptor1.cancel(); acceptor1.cancel(ec); @@ -807,9 +801,6 @@ ip::tcp::endpoint client_endpoint; acceptor.accept(server_side_socket, client_endpoint); - ip::tcp::acceptor::non_blocking_io command(false); - acceptor.io_control(command); - ip::tcp::endpoint client_side_local_endpoint = client_side_socket.local_endpoint(); ASIO_CHECK(client_side_local_endpoint.port() == client_endpoint.port());
diff --git a/asio/src/tests/unit/ip/udp.cpp b/asio/src/tests/unit/ip/udp.cpp index 6a7c188..f8b62e0 100644 --- a/asio/src/tests/unit/ip/udp.cpp +++ b/asio/src/tests/unit/ip/udp.cpp
@@ -131,12 +131,9 @@ socket1.close(); socket1.close(ec); - ip::udp::socket::native_type native_socket4 = socket1.native(); - (void)native_socket4; - - ip::udp::socket::native_handle_type native_socket5 + ip::udp::socket::native_handle_type native_socket4 = socket1.native_handle(); - (void)native_socket5; + (void)native_socket4; socket1.cancel(); socket1.cancel(ec);
diff --git a/asio/src/tests/unit/local/datagram_protocol.cpp b/asio/src/tests/unit/local/datagram_protocol.cpp index d190ab8..45bd72a 100644 --- a/asio/src/tests/unit/local/datagram_protocol.cpp +++ b/asio/src/tests/unit/local/datagram_protocol.cpp
@@ -91,7 +91,7 @@ socket1.close(); socket1.close(ec); - dp::socket::native_type native_socket4 = socket1.native(); + dp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel();
diff --git a/asio/src/tests/unit/local/stream_protocol.cpp b/asio/src/tests/unit/local/stream_protocol.cpp index a2a11fa..6a5e5ea 100644 --- a/asio/src/tests/unit/local/stream_protocol.cpp +++ b/asio/src/tests/unit/local/stream_protocol.cpp
@@ -99,7 +99,7 @@ socket1.close(); socket1.close(ec); - sp::socket::native_type native_socket4 = socket1.native(); + sp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel();
diff --git a/asio/src/tests/unit/posix/stream_descriptor.cpp b/asio/src/tests/unit/posix/stream_descriptor.cpp index 72e1f95..7d7ffbd 100644 --- a/asio/src/tests/unit/posix/stream_descriptor.cpp +++ b/asio/src/tests/unit/posix/stream_descriptor.cpp
@@ -95,17 +95,13 @@ descriptor1.close(); descriptor1.close(ec); - posix::stream_descriptor::native_type native_descriptor3 - = descriptor1.native(); + posix::stream_descriptor::native_handle_type native_descriptor3 + = descriptor1.native_handle(); (void)native_descriptor3; posix::stream_descriptor::native_handle_type native_descriptor4 - = descriptor1.native_handle(); - (void)native_descriptor4; - - posix::stream_descriptor::native_handle_type native_descriptor5 = descriptor1.release(); - (void)native_descriptor5; + (void)native_descriptor4; descriptor1.cancel(); descriptor1.cancel(ec);
diff --git a/asio/src/tests/unit/serial_port.cpp b/asio/src/tests/unit/serial_port.cpp index 233d29a..0e4dd2c 100644 --- a/asio/src/tests/unit/serial_port.cpp +++ b/asio/src/tests/unit/serial_port.cpp
@@ -98,12 +98,9 @@ port1.close(); port1.close(ec); - serial_port::native_type native_port4 = port1.native(); + serial_port::native_handle_type native_port4 = port1.native_handle(); (void)native_port4; - serial_port::native_handle_type native_port5 = port1.native_handle(); - (void)native_port5; - port1.cancel(); port1.cancel(ec);
diff --git a/asio/src/tests/unit/socket_base.cpp b/asio/src/tests/unit/socket_base.cpp index 149f5de..206467b 100644 --- a/asio/src/tests/unit/socket_base.cpp +++ b/asio/src/tests/unit/socket_base.cpp
@@ -166,11 +166,6 @@ (void)static_cast<bool>(!enable_connection_aborted1); (void)static_cast<bool>(enable_connection_aborted1.value()); - // non_blocking_io class. - - socket_base::non_blocking_io non_blocking_io(true); - sock.io_control(non_blocking_io); - // bytes_readable class. socket_base::bytes_readable bytes_readable; @@ -625,16 +620,6 @@ ASIO_CHECK(!static_cast<bool>(enable_connection_aborted4)); ASIO_CHECK(!enable_connection_aborted4); - // non_blocking_io class. - - socket_base::non_blocking_io non_blocking_io1(true); - tcp_sock.io_control(non_blocking_io1, ec); - ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message()); - - socket_base::non_blocking_io non_blocking_io2(false); - tcp_sock.io_control(non_blocking_io2, ec); - ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message()); - // bytes_readable class. socket_base::bytes_readable bytes_readable;
diff --git a/asio/src/tests/unit/ssl/.gitignore b/asio/src/tests/unit/ssl/.gitignore index a467254..5c2ad3e 100644 --- a/asio/src/tests/unit/ssl/.gitignore +++ b/asio/src/tests/unit/ssl/.gitignore
@@ -7,11 +7,8 @@ *.manifest *.pdb *.tds -basic_context context context_base -context_service rfc2818_verification stream stream_base -stream_service
diff --git a/asio/src/tests/unit/ssl/basic_context.cpp b/asio/src/tests/unit/ssl/basic_context.cpp deleted file mode 100644 index c38d686..0000000 --- a/asio/src/tests/unit/ssl/basic_context.cpp +++ /dev/null
@@ -1,25 +0,0 @@ -// -// basic_context.cpp -// ~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2014 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) -// - -// Disable autolinking for unit tests. -#if !defined(BOOST_ALL_NO_LIB) -#define BOOST_ALL_NO_LIB 1 -#endif // !defined(BOOST_ALL_NO_LIB) - -// Test that header file is self-contained. -#include "asio/ssl/basic_context.hpp" - -#include "../unit_test.hpp" - -ASIO_TEST_SUITE -( - "ssl/basic_context", - ASIO_TEST_CASE(null_test) -)
diff --git a/asio/src/tests/unit/ssl/context_service.cpp b/asio/src/tests/unit/ssl/context_service.cpp deleted file mode 100644 index 9989d16..0000000 --- a/asio/src/tests/unit/ssl/context_service.cpp +++ /dev/null
@@ -1,25 +0,0 @@ -// -// context_service.cpp -// ~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2014 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) -// - -// Disable autolinking for unit tests. -#if !defined(BOOST_ALL_NO_LIB) -#define BOOST_ALL_NO_LIB 1 -#endif // !defined(BOOST_ALL_NO_LIB) - -// Test that header file is self-contained. -#include "asio/ssl/context_service.hpp" - -#include "../unit_test.hpp" - -ASIO_TEST_SUITE -( - "ssl/context_service", - ASIO_TEST_CASE(null_test) -)
diff --git a/asio/src/tests/unit/ssl/stream.cpp b/asio/src/tests/unit/ssl/stream.cpp index a122113..3e2ed49 100644 --- a/asio/src/tests/unit/ssl/stream.cpp +++ b/asio/src/tests/unit/ssl/stream.cpp
@@ -30,12 +30,10 @@ namespace ssl_stream_compile { -#if !defined(ASIO_ENABLE_OLD_SSL) bool verify_callback(bool, asio::ssl::verify_context&) { return false; } -#endif // !defined(ASIO_ENABLE_OLD_SSL) void handshake_handler(const asio::error_code&) { @@ -67,7 +65,7 @@ io_service ios; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; - asio::ssl::context context(ios, asio::ssl::context::sslv23); + asio::ssl::context context(asio::ssl::context::sslv23); archetypes::lazy_handler lazy; asio::error_code ec; @@ -84,13 +82,8 @@ // ssl::stream functions. -#if !defined(ASIO_ENABLE_OLD_SSL) SSL* ssl1 = stream1.native_handle(); (void)ssl1; -#endif // !defined(ASIO_ENABLE_OLD_SSL) - - SSL* ssl2 = stream1.impl()->ssl; - (void)ssl2; ssl::stream<ip::tcp::socket>::lowest_layer_type& lowest_layer = stream1.lowest_layer(); @@ -101,7 +94,6 @@ = stream3.lowest_layer(); (void)lowest_layer2; -#if !defined(ASIO_ENABLE_OLD_SSL) stream1.set_verify_mode(ssl::verify_none); stream1.set_verify_mode(ssl::verify_none, ec); @@ -110,14 +102,12 @@ stream1.set_verify_callback(verify_callback); stream1.set_verify_callback(verify_callback, ec); -#endif // !defined(ASIO_ENABLE_OLD_SSL) stream1.handshake(ssl::stream_base::client); stream1.handshake(ssl::stream_base::server); stream1.handshake(ssl::stream_base::client, ec); stream1.handshake(ssl::stream_base::server, ec); -#if !defined(ASIO_ENABLE_OLD_SSL) stream1.handshake(ssl::stream_base::client, buffer(mutable_char_buffer)); stream1.handshake(ssl::stream_base::server, buffer(mutable_char_buffer)); stream1.handshake(ssl::stream_base::client, buffer(const_char_buffer)); @@ -130,7 +120,6 @@ buffer(const_char_buffer), ec); stream1.handshake(ssl::stream_base::server, buffer(const_char_buffer), ec); -#endif // !defined(ASIO_ENABLE_OLD_SSL) stream1.async_handshake(ssl::stream_base::client, handshake_handler); stream1.async_handshake(ssl::stream_base::server, handshake_handler); @@ -139,7 +128,6 @@ int i2 = stream1.async_handshake(ssl::stream_base::server, lazy); (void)i2; -#if !defined(ASIO_ENABLE_OLD_SSL) stream1.async_handshake(ssl::stream_base::client, buffer(mutable_char_buffer), buffered_handshake_handler); stream1.async_handshake(ssl::stream_base::server, @@ -160,7 +148,6 @@ int i6 = stream1.async_handshake(ssl::stream_base::server, buffer(const_char_buffer), lazy); (void)i6; -#endif // !defined(ASIO_ENABLE_OLD_SSL) stream1.shutdown(); stream1.shutdown(ec); @@ -187,16 +174,6 @@ stream1.async_read_some(buffer(mutable_char_buffer), read_some_handler); int i10 = stream1.async_read_some(buffer(mutable_char_buffer), lazy); (void)i10; - -#if defined(ASIO_ENABLE_OLD_SSL) - stream1.peek(buffer(mutable_char_buffer)); - stream1.peek(buffer(mutable_char_buffer), ec); - - std::size_t in_avail1 = stream1.in_avail(); - (void)in_avail1; - std::size_t in_avail2 = stream1.in_avail(ec); - (void)in_avail2; -#endif // defined(ASIO_ENABLE_OLD_SSL) } catch (std::exception&) {
diff --git a/asio/src/tests/unit/ssl/stream_service.cpp b/asio/src/tests/unit/ssl/stream_service.cpp deleted file mode 100644 index 475ccf4..0000000 --- a/asio/src/tests/unit/ssl/stream_service.cpp +++ /dev/null
@@ -1,25 +0,0 @@ -// -// stream_service.cpp -// ~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2014 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) -// - -// Disable autolinking for unit tests. -#if !defined(BOOST_ALL_NO_LIB) -#define BOOST_ALL_NO_LIB 1 -#endif // !defined(BOOST_ALL_NO_LIB) - -// Test that header file is self-contained. -#include "asio/ssl/stream_service.hpp" - -#include "../unit_test.hpp" - -ASIO_TEST_SUITE -( - "ssl/stream_service", - ASIO_TEST_CASE(null_test) -)
diff --git a/asio/src/tests/unit/windows/random_access_handle.cpp b/asio/src/tests/unit/windows/random_access_handle.cpp index 3af1ce1..58f25a3 100644 --- a/asio/src/tests/unit/windows/random_access_handle.cpp +++ b/asio/src/tests/unit/windows/random_access_handle.cpp
@@ -95,12 +95,9 @@ handle1.close(); handle1.close(ec); - win::random_access_handle::native_type native_handle3 = handle1.native(); - (void)native_handle3; - - win::random_access_handle::native_handle_type native_handle4 + win::random_access_handle::native_handle_type native_handle3 = handle1.native_handle(); - (void)native_handle4; + (void)native_handle3; handle1.cancel(); handle1.cancel(ec);
diff --git a/asio/src/tests/unit/windows/stream_handle.cpp b/asio/src/tests/unit/windows/stream_handle.cpp index cc4e05e..c1cd85b 100644 --- a/asio/src/tests/unit/windows/stream_handle.cpp +++ b/asio/src/tests/unit/windows/stream_handle.cpp
@@ -94,12 +94,9 @@ handle1.close(); handle1.close(ec); - win::stream_handle::native_type native_handle3 = handle1.native(); - (void)native_handle3; - - win::stream_handle::native_handle_type native_handle4 + win::stream_handle::native_handle_type native_handle3 = handle1.native_handle(); - (void)native_handle4; + (void)native_handle3; handle1.cancel(); handle1.cancel(ec);