]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // |
92f5a8d4 | 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) |
7c673cae FG |
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 | // | |
b32b8144 FG |
7 | // Official repository: https://github.com/boostorg/beast |
8 | // | |
7c673cae | 9 | |
b32b8144 FG |
10 | #ifndef BOOST_BEAST_WEBSOCKET_SSL_HPP |
11 | #define BOOST_BEAST_WEBSOCKET_SSL_HPP | |
7c673cae | 12 | |
b32b8144 FG |
13 | #include <boost/beast/core/detail/config.hpp> |
14 | #include <boost/beast/websocket/teardown.hpp> | |
7c673cae FG |
15 | #include <boost/asio/ip/tcp.hpp> |
16 | #include <boost/asio/ssl/stream.hpp> | |
7c673cae | 17 | |
b32b8144 | 18 | namespace boost { |
7c673cae | 19 | namespace beast { |
7c673cae | 20 | |
92f5a8d4 | 21 | /** Tear down a `net::ssl::stream`. |
7c673cae FG |
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 | |
92f5a8d4 TL |
26 | type, and not a `net::ip::tcp::socket` or any |
27 | `net::ssl::stream`, callers are responsible for | |
7c673cae FG |
28 | providing a suitable overload of this function. |
29 | ||
b32b8144 FG |
30 | @param role The role of the local endpoint |
31 | ||
7c673cae FG |
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 | |
b32b8144 FG |
38 | teardown( |
39 | role_type role, | |
92f5a8d4 | 40 | net::ssl::stream<SyncStream>& stream, |
b32b8144 | 41 | error_code& ec); |
7c673cae | 42 | |
92f5a8d4 | 43 | /** Start tearing down a `net::ssl::stream`. |
7c673cae FG |
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 | |
92f5a8d4 | 49 | `net::ip::tcp::socket` or any `net::ssl::stream`, |
7c673cae FG |
50 | callers are responsible for providing a suitable overload |
51 | of this function. | |
52 | ||
b32b8144 FG |
53 | @param role The role of the local endpoint |
54 | ||
7c673cae FG |
55 | @param stream The stream to tear down. |
56 | ||
92f5a8d4 TL |
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( | |
7c673cae | 63 | error_code const& error // result of operation |
92f5a8d4 TL |
64 | ); |
65 | @endcode | |
7c673cae FG |
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 | |
92f5a8d4 | 69 | manner equivalent to using `net::post`. |
7c673cae FG |
70 | |
71 | */ | |
72 | template<class AsyncStream, class TeardownHandler> | |
7c673cae | 73 | void |
b32b8144 FG |
74 | async_teardown( |
75 | role_type role, | |
92f5a8d4 | 76 | net::ssl::stream<AsyncStream>& stream, |
b32b8144 | 77 | TeardownHandler&& handler); |
7c673cae | 78 | |
7c673cae | 79 | } // beast |
b32b8144 | 80 | } // boost |
7c673cae | 81 | |
92f5a8d4 | 82 | #include <boost/beast/websocket/impl/ssl.hpp> |
7c673cae FG |
83 | |
84 | #endif |