MySQL 8.0.39
Source Code Documentation
server_mock::ProtocolBase Class Referenceabstract

#include <statement_reader.h>

Inheritance diagram for server_mock::ProtocolBase:
[legend]

Classes

class  SSL_Deleter
 

Public Types

using protocol_type = net::ip::tcp
 
using socket_type = typename protocol_type::socket
 
using endpoint_type = typename protocol_type::endpoint
 

Public Member Functions

 ProtocolBase (socket_type client_sock, endpoint_type client_ep, TlsServerContext &tls_ctx)
 
 ProtocolBase (const ProtocolBase &)=delete
 
 ProtocolBase (ProtocolBase &&)=delete
 
ProtocolBaseoperator= (const ProtocolBase &)=delete
 
ProtocolBaseoperator= (ProtocolBase &&rhs)=delete
 
virtual ~ProtocolBase ()=default
 
virtual void encode_error (const ErrorResponse &resp)=0
 
virtual void encode_ok (const uint64_t affected_rows=0, const uint64_t last_insert_id=0, const uint16_t server_status=0, const uint16_t warning_count=0)=0
 
void encode_ok (const OkResponse &resp)
 
virtual void encode_resultset (const ResultsetResponse &response)=0
 
stdx::expected< size_t, std::error_code > read_ssl (const net::mutable_buffer &buf)
 
stdx::expected< size_t, std::error_code > write_ssl (const net::const_buffer &buf)
 
stdx::expected< size_t, std::error_code > avail_ssl ()
 
template<class CompletionToken >
void async_send_tls (CompletionToken &&token)
 
template<class CompletionToken >
void async_send (CompletionToken &&token)
 
template<class CompletionToken >
void async_receive_tls (CompletionToken &&token)
 
template<class CompletionToken >
void async_receive (CompletionToken &&token)
 
template<class CompletionToken >
void async_tls_accept (CompletionToken &&token)
 
const std::vector< uint8_t > & send_buffer () const
 
const net::ip::tcp::socketclient_socket () const
 
void username (const std::string &username)
 
std::string username () const
 
void auth_method_name (const std::string &auth_method_name)
 
std::string auth_method_name () const
 
void auth_method_data (const std::string &auth_method_data)
 
std::string auth_method_data () const
 
void init_tls ()
 
bool is_tls ()
 
const SSL * ssl () const
 
stdx::expected< void, std::error_code > tls_accept ()
 
net::steady_timerexec_timer ()
 
void cancel ()
 
void terminate ()
 terminate the current connection. More...
 
net::io_contextio_context ()
 

Static Public Member Functions

static std::error_code map_tls_error_code (std::error_code ec)
 
static bool authenticate (const std::string &auth_method_name, const std::string &auth_method_data, const std::string &password, const std::vector< uint8_t > &auth_response)
 

Protected Attributes

socket_type client_socket_
 
endpoint_type client_ep_
 
net::steady_timer exec_timer_ {io_context()}
 
std::string username_ {}
 
std::string auth_method_name_ {}
 
std::string auth_method_data_ {}
 
TlsServerContexttls_ctx_
 
std::unique_ptr< SSL, SSL_Deleterssl_
 
std::vector< uint8_t > recv_buffer_
 
std::vector< uint8_t > send_buffer_
 

Private Attributes

Monitor< bool > is_terminated_ {false}
 

Member Typedef Documentation

◆ endpoint_type

◆ protocol_type

◆ socket_type

Constructor & Destructor Documentation

◆ ProtocolBase() [1/3]

server_mock::ProtocolBase::ProtocolBase ( ProtocolBase::socket_type  client_sock,
ProtocolBase::endpoint_type  client_ep,
TlsServerContext tls_ctx 
)

◆ ProtocolBase() [2/3]

server_mock::ProtocolBase::ProtocolBase ( const ProtocolBase )
delete

◆ ProtocolBase() [3/3]

server_mock::ProtocolBase::ProtocolBase ( ProtocolBase &&  )
delete

◆ ~ProtocolBase()

virtual server_mock::ProtocolBase::~ProtocolBase ( )
virtualdefault

Member Function Documentation

◆ async_receive()

template<class CompletionToken >
void server_mock::ProtocolBase::async_receive ( CompletionToken &&  token)
inline

◆ async_receive_tls()

template<class CompletionToken >
void server_mock::ProtocolBase::async_receive_tls ( CompletionToken &&  token)
inline

◆ async_send()

template<class CompletionToken >
void server_mock::ProtocolBase::async_send ( CompletionToken &&  token)
inline

◆ async_send_tls()

template<class CompletionToken >
void server_mock::ProtocolBase::async_send_tls ( CompletionToken &&  token)
inline

◆ async_tls_accept()

template<class CompletionToken >
void server_mock::ProtocolBase::async_tls_accept ( CompletionToken &&  token)
inline

◆ auth_method_data() [1/2]

std::string server_mock::ProtocolBase::auth_method_data ( ) const
inline

◆ auth_method_data() [2/2]

void server_mock::ProtocolBase::auth_method_data ( const std::string &  auth_method_data)
inline

◆ auth_method_name() [1/2]

std::string server_mock::ProtocolBase::auth_method_name ( ) const
inline

◆ auth_method_name() [2/2]

void server_mock::ProtocolBase::auth_method_name ( const std::string &  auth_method_name)
inline

◆ authenticate()

bool server_mock::ProtocolBase::authenticate ( const std::string &  auth_method_name,
const std::string &  auth_method_data,
const std::string &  password,
const std::vector< uint8_t > &  auth_response 
)
static

◆ avail_ssl()

stdx::expected< size_t, std::error_code > server_mock::ProtocolBase::avail_ssl ( )

◆ cancel()

void server_mock::ProtocolBase::cancel ( )

◆ client_socket()

const net::ip::tcp::socket & server_mock::ProtocolBase::client_socket ( ) const
inline

◆ encode_error()

virtual void server_mock::ProtocolBase::encode_error ( const ErrorResponse resp)
pure virtual

◆ encode_ok() [1/2]

void server_mock::ProtocolBase::encode_ok ( const OkResponse resp)
inline

◆ encode_ok() [2/2]

virtual void server_mock::ProtocolBase::encode_ok ( const uint64_t  affected_rows = 0,
const uint64_t  last_insert_id = 0,
const uint16_t  server_status = 0,
const uint16_t  warning_count = 0 
)
pure virtual

◆ encode_resultset()

virtual void server_mock::ProtocolBase::encode_resultset ( const ResultsetResponse response)
pure virtual

◆ exec_timer()

net::steady_timer & server_mock::ProtocolBase::exec_timer ( )
inline

◆ init_tls()

void server_mock::ProtocolBase::init_tls ( )

◆ io_context()

net::io_context & server_mock::ProtocolBase::io_context ( )
inline

◆ is_tls()

bool server_mock::ProtocolBase::is_tls ( )
inline

◆ map_tls_error_code()

static std::error_code server_mock::ProtocolBase::map_tls_error_code ( std::error_code  ec)
inlinestatic

◆ operator=() [1/2]

ProtocolBase & server_mock::ProtocolBase::operator= ( const ProtocolBase )
delete

◆ operator=() [2/2]

ProtocolBase & server_mock::ProtocolBase::operator= ( ProtocolBase &&  rhs)
delete

◆ read_ssl()

stdx::expected< size_t, std::error_code > server_mock::ProtocolBase::read_ssl ( const net::mutable_buffer buf)

◆ send_buffer()

const std::vector< uint8_t > & server_mock::ProtocolBase::send_buffer ( ) const
inline

◆ ssl()

const SSL * server_mock::ProtocolBase::ssl ( ) const
inline

◆ terminate()

void server_mock::ProtocolBase::terminate ( )

terminate the current connection.

sets is_terminated(true) and cancels the current operation.

may be called from another thread.

◆ tls_accept()

stdx::expected< void, std::error_code > server_mock::ProtocolBase::tls_accept ( )

◆ username() [1/2]

std::string server_mock::ProtocolBase::username ( ) const
inline

◆ username() [2/2]

void server_mock::ProtocolBase::username ( const std::string &  username)
inline

◆ write_ssl()

stdx::expected< size_t, std::error_code > server_mock::ProtocolBase::write_ssl ( const net::const_buffer buf)

Member Data Documentation

◆ auth_method_data_

std::string server_mock::ProtocolBase::auth_method_data_ {}
protected

◆ auth_method_name_

std::string server_mock::ProtocolBase::auth_method_name_ {}
protected

◆ client_ep_

endpoint_type server_mock::ProtocolBase::client_ep_
protected

◆ client_socket_

socket_type server_mock::ProtocolBase::client_socket_
protected

◆ exec_timer_

net::steady_timer server_mock::ProtocolBase::exec_timer_ {io_context()}
protected

◆ is_terminated_

Monitor<bool> server_mock::ProtocolBase::is_terminated_ {false}
private

◆ recv_buffer_

std::vector<uint8_t> server_mock::ProtocolBase::recv_buffer_
protected

◆ send_buffer_

std::vector<uint8_t> server_mock::ProtocolBase::send_buffer_
protected

◆ ssl_

std::unique_ptr<SSL, SSL_Deleter> server_mock::ProtocolBase::ssl_
protected

◆ tls_ctx_

TlsServerContext& server_mock::ProtocolBase::tls_ctx_
protected

◆ username_

std::string server_mock::ProtocolBase::username_ {}
protected

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