1 // 2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) 3 // 4 // Distributed under the Boost Software License, Version 1.0. (See accompanying 5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 // 7 // Official repository: https://github.com/boostorg/beast 8 // 9 10 #ifndef BOOST_BEAST_WEBSOCKET_SSL_HPP 11 #define BOOST_BEAST_WEBSOCKET_SSL_HPP 12 13 #include <boost/beast/core/detail/config.hpp> 14 #include <boost/beast/websocket/teardown.hpp> 15 #include <boost/asio/ip/tcp.hpp> 16 #include <boost/asio/ssl/stream.hpp> 17 18 namespace boost { 19 namespace beast { 20 21 /** Tear down a `net::ssl::stream`. 22 23 This tears down a connection. The implementation will call 24 the overload of this function based on the `Stream` parameter 25 used to consruct the socket. When `Stream` is a user defined 26 type, and not a `net::ip::tcp::socket` or any 27 `net::ssl::stream`, callers are responsible for 28 providing a suitable overload of this function. 29 30 @param role The role of the local endpoint 31 32 @param stream The stream to tear down. 33 34 @param ec Set to the error if any occurred. 35 */ 36 template<class SyncStream> 37 void 38 teardown( 39 role_type role, 40 net::ssl::stream<SyncStream>& stream, 41 error_code& ec); 42 43 /** Start tearing down a `net::ssl::stream`. 44 45 This begins tearing down a connection asynchronously. 46 The implementation will call the overload of this function 47 based on the `Stream` parameter used to consruct the socket. 48 When `Stream` is a user defined type, and not a 49 `net::ip::tcp::socket` or any `net::ssl::stream`, 50 callers are responsible for providing a suitable overload 51 of this function. 52 53 @param role The role of the local endpoint 54 55 @param stream The stream to tear down. 56 57 @param handler The completion handler to invoke when the operation 58 completes. The implementation takes ownership of the handler by 59 performing a decay-copy. The equivalent function signature of 60 the handler must be: 61 @code 62 void handler( 63 error_code const& error // result of operation 64 ); 65 @endcode 66 Regardless of whether the asynchronous operation completes 67 immediately or not, the handler will not be invoked from within 68 this function. Invocation of the handler will be performed in a 69 manner equivalent to using `net::post`. 70 71 */ 72 template<class AsyncStream, class TeardownHandler> 73 void 74 async_teardown( 75 role_type role, 76 net::ssl::stream<AsyncStream>& stream, 77 TeardownHandler&& handler); 78 79 } // beast 80 } // boost 81 82 #include <boost/beast/websocket/impl/ssl.hpp> 83 84 #endif 85