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
18namespace boost {
19namespace 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 @note
31
32 This function serves as a customization point and is not intended
33 to be called directly.
34
35 @param role The role of the local endpoint
36
37 @param stream The stream to tear down.
38
39 @param ec Set to the error if any occurred.
40*/
41template<class SyncStream>
42void
43teardown(
44 role_type role,
45 net::ssl::stream<SyncStream>& stream,
46 error_code& ec);
47
48/** Start tearing down a `net::ssl::stream`.
49
50 This begins tearing down a connection asynchronously.
51 The implementation will call the overload of this function
52 based on the `Stream` parameter used to consruct the socket.
53 When `Stream` is a user defined type, and not a
54 `net::ip::tcp::socket` or any `net::ssl::stream`,
55 callers are responsible for providing a suitable overload
56 of this function.
57
58 @note
59
60 This function serves as a customization point and is not intended
61 to be called directly.
62
63 @param role The role of the local endpoint
64
65 @param stream The stream to tear down.
66
67 @param handler The completion handler to invoke when the operation
68 completes. The implementation takes ownership of the handler by
69 performing a decay-copy. The equivalent function signature of
70 the handler must be:
71 @code
72 void handler(
73 error_code const& error // result of operation
74 );
75 @endcode
76 If the handler has an associated immediate executor,
77 an immediate completion will be dispatched to it.
78 Otherwise, the handler will not be invoked from within
79 this function. Invocation of the handler will be performed in a
80 manner equivalent to using `net::post`.
81
82 @par Per-Operation Cancellation
83
84 This asynchronous operation supports cancellation for the following
85 net::cancellation_type values:
86
87 @li @c net::cancellation_type::terminal
88 @li @c net::cancellation_type::partial
89 @li @c net::cancellation_type::total
90
91 if they are also supported by the socket's @c async_teardown
92 and @c async_shutdown operation.
93
94*/
95template<class AsyncStream, class TeardownHandler>
96void
97async_teardown(
98 role_type role,
99 net::ssl::stream<AsyncStream>& stream,
100 TeardownHandler&& handler);
101
102} // beast
103} // boost
104
105#include <boost/beast/websocket/impl/ssl.hpp>
106
107#endif
108

source code of boost/libs/beast/include/boost/beast/websocket/ssl.hpp