]>
Commit | Line | Data |
---|---|---|
1 | // | |
2 | // Copyright (c) 2013-2017 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 | ||
8 | #ifndef BEAST_WEBSOCKET_SSL_HPP | |
9 | #define BEAST_WEBSOCKET_SSL_HPP | |
10 | ||
11 | #include <beast/config.hpp> | |
12 | #include <beast/websocket/teardown.hpp> | |
13 | #include <boost/asio/ip/tcp.hpp> | |
14 | #include <boost/asio/ssl/stream.hpp> | |
15 | #include <memory> | |
16 | ||
17 | namespace beast { | |
18 | namespace websocket { | |
19 | ||
20 | /** Tear down a `boost::asio::ssl::stream`. | |
21 | ||
22 | This tears down a connection. The implementation will call | |
23 | the overload of this function based on the `Stream` parameter | |
24 | used to consruct the socket. When `Stream` is a user defined | |
25 | type, and not a `boost::asio::ip::tcp::socket` or any | |
26 | `boost::asio::ssl::stream`, callers are responsible for | |
27 | providing a suitable overload of this function. | |
28 | ||
29 | @param stream The stream to tear down. | |
30 | ||
31 | @param ec Set to the error if any occurred. | |
32 | */ | |
33 | template<class SyncStream> | |
34 | void | |
35 | teardown(teardown_tag, | |
36 | boost::asio::ssl::stream<SyncStream>& stream, | |
37 | error_code& ec); | |
38 | ||
39 | /** Start tearing down a `boost::asio::ssl::stream`. | |
40 | ||
41 | This begins tearing down a connection asynchronously. | |
42 | The implementation will call the overload of this function | |
43 | based on the `Stream` parameter used to consruct the socket. | |
44 | When `Stream` is a user defined type, and not a | |
45 | `boost::asio::ip::tcp::socket` or any `boost::asio::ssl::stream`, | |
46 | callers are responsible for providing a suitable overload | |
47 | of this function. | |
48 | ||
49 | @param stream The stream to tear down. | |
50 | ||
51 | @param handler The handler to be called when the request completes. | |
52 | Copies will be made of the handler as required. The equivalent | |
53 | function signature of the handler must be: | |
54 | @code void handler( | |
55 | error_code const& error // result of operation | |
56 | ); @endcode | |
57 | Regardless of whether the asynchronous operation completes | |
58 | immediately or not, the handler will not be invoked from within | |
59 | this function. Invocation of the handler will be performed in a | |
60 | manner equivalent to using boost::asio::io_service::post(). | |
61 | ||
62 | */ | |
63 | template<class AsyncStream, class TeardownHandler> | |
64 | inline | |
65 | void | |
66 | async_teardown(teardown_tag, | |
67 | boost::asio::ssl::stream<AsyncStream>& stream, | |
68 | TeardownHandler&& handler); | |
69 | ||
70 | } // websocket | |
71 | } // beast | |
72 | ||
73 | #include <beast/websocket/impl/ssl.ipp> | |
74 | ||
75 | #endif |