5 #ifndef PACKIO_EXTRA_SSL_H 
    6 #define PACKIO_EXTRA_SSL_H 
   15 #include "../internal/config.h" 
   16 #include "../internal/utils.h" 
   18 #if PACKIO_STANDALONE_ASIO 
   19 #include <asio/ssl.hpp> 
   21 #include <boost/asio/ssl.hpp> 
   30 template <
typename SslStream>
 
   33     using protocol_type = 
typename SslStream::lowest_layer_type::protocol_type;
 
   35     using SslStream::SslStream;
 
   38     bool is_open()
 const { 
return this->lowest_layer().is_open(); }
 
   41     template <
typename... Args>
 
   44         return this->lowest_layer().close(std::forward<Args>(args)...);
 
   49     template <
typename... Args>
 
   53             internal::always_false_v<Args...>,
 
   54             "websockets do not support cancel operations");
 
   63 template <
typename Acceptor, 
typename SslStreamAdapter>
 
   66     template <
typename Arg>
 
   68         : Acceptor(std::forward<Arg>(
arg)), context_(context)
 
   76     template <
typename Handler>
 
   79         Acceptor::async_accept([
this, handler = std::forward<Handler>(handler)](
 
   80                                    auto ec, 
auto sock) 
mutable {
 
   82                 handler(ec, SslStreamAdapter(std::move(sock), context_));
 
   85             auto stream = std::make_unique<SslStreamAdapter>(
 
   86                 std::move(sock), context_);
 
   87             stream->async_handshake(
 
   89                 [handler = std::forward<Handler>(handler),
 
   90                  stream = std::move(stream)](
auto ec) 
mutable {
 
   91                     handler(ec, std::move(*stream));
 
   97     packio::net::ssl::context& context_;
 
A named argument.
Definition: arg.h:17
 
::packio::server< rpc, Acceptor, Dispatcher > server
The server for JSON-RPC.
Definition: json_rpc.h:42
 
The packio namespace.
Definition: arg.h:14