MySQL 8.0.40
Source Code Documentation
TlsSwitchableConnection Class Reference

a Connection that can be switched to TLS. More...

#include <basic_protocol_splicer.h>

Public Member Functions

 TlsSwitchableConnection (std::unique_ptr< ConnectionBase > conn, std::unique_ptr< RoutingConnectionBase > routing_conn, SslMode ssl_mode, std::unique_ptr< ProtocolStateBase > state)
 
 TlsSwitchableConnection (std::unique_ptr< ConnectionBase > conn, std::unique_ptr< RoutingConnectionBase > routing_conn, SslMode ssl_mode, std::unique_ptr< Channel > channel, std::unique_ptr< ProtocolStateBase > state)
 
std::vector< std::pair< std::string, std::string > > initial_connection_attributes () const
 
void assign_connection (std::unique_ptr< ConnectionBase > conn)
 assign a low-level connection. More...
 
template<class Func >
void async_recv (Func &&func)
 async receive data from connection into the channel's receive buffer. More...
 
template<class Func >
void async_send (Func &&func)
 async send data from the channel's send buffer to the connection. More...
 
template<class Func >
void async_wait_send (Func &&func)
 async wait until connection allows to send data. More...
 
template<class Func >
void async_wait_error (Func &&func)
 
Channelchannel ()
 
const Channelchannel () const
 
SslMode ssl_mode () const
 
bool is_open () const
 
net::impl::socket::native_handle_type native_handle () const
 
stdx::expected< void, std::error_code > close () const
 
stdx::expected< void, std::error_code > shutdown (net::socket_base::shutdown_type st) const
 
std::string endpoint () const
 
uint64_t reset_error_count (BlockedEndpoints &blocked_endpoints)
 
uint64_t increment_error_count (BlockedEndpoints &blocked_endpoints)
 
stdx::expected< void, std::error_code > cancel ()
 
ProtocolStateBaseprotocol ()
 
const ProtocolStateBaseprotocol () const
 
std::unique_ptr< ConnectionBase > & connection ()
 
bool is_secure_transport () const
 check if the channel is secure. More...
 

Static Public Attributes

static constexpr size_t kRecvBufferSize {16UL * 1024}
 

Private Attributes

std::unique_ptr< ConnectionBaseconn_
 
std::unique_ptr< RoutingConnectionBaserouting_conn_
 
SslMode ssl_mode_
 
std::unique_ptr< Channelchannel_
 
std::unique_ptr< ProtocolStateBaseprotocol_
 

Detailed Description

a Connection that can be switched to TLS.

wraps

  • a low-level connections (conn)
  • a routing connection (endpoints, destinations, ...)
  • a tls switchable (a SSL_CTX * wrapper)
  • protocol state (classic, xproto)

Constructor & Destructor Documentation

◆ TlsSwitchableConnection() [1/2]

TlsSwitchableConnection::TlsSwitchableConnection ( std::unique_ptr< ConnectionBase conn,
std::unique_ptr< RoutingConnectionBase routing_conn,
SslMode  ssl_mode,
std::unique_ptr< ProtocolStateBase state 
)
inline

◆ TlsSwitchableConnection() [2/2]

TlsSwitchableConnection::TlsSwitchableConnection ( std::unique_ptr< ConnectionBase conn,
std::unique_ptr< RoutingConnectionBase routing_conn,
SslMode  ssl_mode,
std::unique_ptr< Channel channel,
std::unique_ptr< ProtocolStateBase state 
)
inline

Member Function Documentation

◆ assign_connection()

void TlsSwitchableConnection::assign_connection ( std::unique_ptr< ConnectionBase conn)
inline

assign a low-level connection.

◆ async_recv()

template<class Func >
void TlsSwitchableConnection::async_recv ( Func &&  func)
inline

async receive data from connection into the channel's receive buffer.

calls func when async operation is completed.

◆ async_send()

template<class Func >
void TlsSwitchableConnection::async_send ( Func &&  func)
inline

async send data from the channel's send buffer to the connection.

calls func when async operation is completed.

◆ async_wait_error()

template<class Func >
void TlsSwitchableConnection::async_wait_error ( Func &&  func)
inline

◆ async_wait_send()

template<class Func >
void TlsSwitchableConnection::async_wait_send ( Func &&  func)
inline

async wait until connection allows to send data.

calls func when async operation is completed.

◆ cancel()

stdx::expected< void, std::error_code > TlsSwitchableConnection::cancel ( )
inline

◆ channel() [1/2]

Channel * TlsSwitchableConnection::channel ( )
inline

◆ channel() [2/2]

const Channel * TlsSwitchableConnection::channel ( ) const
inline

◆ close()

stdx::expected< void, std::error_code > TlsSwitchableConnection::close ( ) const
inline

◆ connection()

std::unique_ptr< ConnectionBase > & TlsSwitchableConnection::connection ( )
inline

◆ endpoint()

std::string TlsSwitchableConnection::endpoint ( ) const
inline

◆ increment_error_count()

uint64_t TlsSwitchableConnection::increment_error_count ( BlockedEndpoints blocked_endpoints)
inline

◆ initial_connection_attributes()

std::vector< std::pair< std::string, std::string > > TlsSwitchableConnection::initial_connection_attributes ( ) const
inline

◆ is_open()

bool TlsSwitchableConnection::is_open ( ) const
inline

◆ is_secure_transport()

bool TlsSwitchableConnection::is_secure_transport ( ) const
inline

check if the channel is secure.

  • if TLS is enabled, it the transport is secure
  • if transport is secure, the channel is secure

◆ native_handle()

net::impl::socket::native_handle_type TlsSwitchableConnection::native_handle ( ) const
inline

◆ protocol() [1/2]

ProtocolStateBase * TlsSwitchableConnection::protocol ( )
inline

◆ protocol() [2/2]

const ProtocolStateBase * TlsSwitchableConnection::protocol ( ) const
inline

◆ reset_error_count()

uint64_t TlsSwitchableConnection::reset_error_count ( BlockedEndpoints blocked_endpoints)
inline

◆ shutdown()

stdx::expected< void, std::error_code > TlsSwitchableConnection::shutdown ( net::socket_base::shutdown_type  st) const
inline

◆ ssl_mode()

SslMode TlsSwitchableConnection::ssl_mode ( ) const
inline

Member Data Documentation

◆ channel_

std::unique_ptr<Channel> TlsSwitchableConnection::channel_
private

◆ conn_

std::unique_ptr<ConnectionBase> TlsSwitchableConnection::conn_
private

◆ kRecvBufferSize

constexpr size_t TlsSwitchableConnection::kRecvBufferSize {16UL * 1024}
staticconstexpr

◆ protocol_

std::unique_ptr<ProtocolStateBase> TlsSwitchableConnection::protocol_
private

◆ routing_conn_

std::unique_ptr<RoutingConnectionBase> TlsSwitchableConnection::routing_conn_
private

◆ ssl_mode_

SslMode TlsSwitchableConnection::ssl_mode_
private

The documentation for this class was generated from the following file: