Files
boost_beast/include/boost/beast/ssl/ssl_stream.hpp
T

66 lines
1.9 KiB
C++
Raw Normal View History

2018-04-29 19:41:26 -07:00
//
2019-02-21 07:00:31 -08:00
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
2018-04-29 19:41:26 -07:00
//
// 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)
//
// Official repository: https://github.com/boostorg/beast
//
#ifndef BOOST_BEAST_CORE_SSL_STREAM_HPP
#define BOOST_BEAST_CORE_SSL_STREAM_HPP
#include <boost/beast/core/detail/config.hpp>
2018-04-29 19:41:26 -07:00
// This include is necessary to work with `ssl::stream` and `boost::beast::websocket::stream`
#include <boost/beast/websocket/ssl.hpp>
2019-02-23 09:56:52 -08:00
// VFALCO We include this because anyone who uses ssl will
// very likely need to check for ssl::error::stream_truncated
2019-03-14 17:40:41 +01:00
#include <boost/asio/ssl/error.hpp>
2019-02-23 09:56:52 -08:00
2018-04-29 19:41:26 -07:00
#include <boost/asio/ssl/stream.hpp>
namespace boost {
namespace beast {
2024-05-30 11:51:55 +00:00
/** (Deprecated: Use asio::ssl::stream instead.) Provides stream-oriented functionality using OpenSSL
2018-04-29 19:41:26 -07:00
*/
template<class NextLayer>
2024-05-30 06:58:07 +00:00
struct ssl_stream : net::ssl::stream<NextLayer>
2018-04-29 19:41:26 -07:00
{
2024-05-30 06:58:07 +00:00
using net::ssl::stream<NextLayer>::stream;
2018-04-29 19:41:26 -07:00
};
2019-04-08 15:12:51 -07:00
#if ! BOOST_BEAST_DOXYGEN
template<class SyncStream>
void
teardown(
boost::beast::role_type role,
ssl_stream<SyncStream>& stream,
boost::system::error_code& ec)
{
// Just forward it to the underlying ssl::stream
using boost::beast::websocket::teardown;
2024-05-30 06:58:07 +00:00
teardown(role, static_cast<net::ssl::stream<SyncStream>&>(stream), ec);
2019-04-08 15:12:51 -07:00
}
2022-10-11 18:01:48 +08:00
template<class AsyncStream,
typename TeardownHandler = net::default_completion_token_t<beast::executor_type<AsyncStream>>>
2019-04-08 15:12:51 -07:00
void
async_teardown(
boost::beast::role_type role,
ssl_stream<AsyncStream>& stream,
2022-10-11 18:01:48 +08:00
TeardownHandler&& handler = net::default_completion_token_t<beast::executor_type<AsyncStream>>{})
2019-04-08 15:12:51 -07:00
{
// Just forward it to the underlying ssl::stream
using boost::beast::websocket::async_teardown;
2024-05-30 06:58:07 +00:00
async_teardown(role, static_cast<net::ssl::stream<AsyncStream>&>(stream),
2019-04-08 15:12:51 -07:00
std::forward<TeardownHandler>(handler));
}
#endif
2018-04-29 19:41:26 -07:00
} // beast
} // boost
#endif