MySQL 8.0.39
Source Code Documentation
Xcom_network_provider Class Reference

#include <xcom_network_provider.h>

Inheritance diagram for Xcom_network_provider:
[legend]

Public Member Functions

 Xcom_network_provider (Xcom_network_provider &param)=delete
 
 Xcom_network_provider (Xcom_network_provider &&param)
 
 Xcom_network_provider ()
 Construct a new Xcom_network_provider object. More...
 
virtual ~Xcom_network_provider () override
 
std::pair< bool, int > start () override
 Inherited methods from Gcs_network_provider. More...
 
std::pair< bool, int > stop () override
 Stops the network provider. More...
 
enum_transport_protocol get_communication_stack () const override
 Get the communication stack implemented by this provider. More...
 
bool configure (const Network_configuration_parameters &params) override
 Configures this network provider. More...
 
bool configure_secure_connections (const Network_configuration_parameters &params) override
 Configures the active provider with all things needed to establish SSL connections. More...
 
void cleanup_secure_connections_context () override
 
bool finalize_secure_connections_context () override
 
std::unique_ptr< Network_connectionopen_connection (const std::string &address, const unsigned short port, const Network_security_credentials &security_credentials, int connection_timeout=Network_provider::default_connection_timeout(), network_provider_dynamic_log_level log_level=network_provider_dynamic_log_level::PROVIDED) override
 Opens a new connection to another XCom endpoint served by the same Network provider. More...
 
int close_connection (const Network_connection &connection) override
 Closes an open connection to another XCom endpoint served by the same Network provider. More...
 
bool wait_for_provider_ready ()
 Waits for the provider to become ready. More...
 
void notify_provider_ready (bool init_error=false)
 Notify that the provider is ready. More...
 
xcom_port get_port () const
 
void set_port (xcom_port port)
 
bool is_provider_initialized () const
 
bool should_shutdown_tcp_server () const
 
void set_shutdown_tcp_server (bool shutdown_tcp_server)
 
result get_open_server_socket () const
 
void set_open_server_socket (result open_socket)
 
- Public Member Functions inherited from Network_provider
 Network_provider ()
 
 Network_provider (Network_provider &&param)
 
Network_provideroperator= (Network_provider &param)=delete
 
 Network_provider (Network_provider &param)=delete
 
virtual ~Network_provider ()
 
virtual std::function< void()> get_secure_connections_context_cleaner ()
 
void set_new_connection (Network_connection *connection)
 Lock-free Set connection. More...
 
Network_connectionget_new_connection ()
 Get the new connection object. More...
 
void reset_new_connection ()
 

Private Attributes

xcom_port m_port
 
std::thread m_network_provider_tcp_server
 
bool m_initialized
 
bool m_init_error
 
std::mutex m_init_lock
 
std::condition_variable m_init_cond_var
 
bool m_shutdown_tcp_server
 
result m_open_server_socket
 

Additional Inherited Members

- Static Public Member Functions inherited from Network_provider
static constexpr int default_connection_timeout ()
 

Constructor & Destructor Documentation

◆ Xcom_network_provider() [1/3]

Xcom_network_provider::Xcom_network_provider ( Xcom_network_provider param)
delete

◆ Xcom_network_provider() [2/3]

Xcom_network_provider::Xcom_network_provider ( Xcom_network_provider &&  param)
inline

◆ Xcom_network_provider() [3/3]

Xcom_network_provider::Xcom_network_provider ( )
inline

Construct a new Xcom_network_provider object.

◆ ~Xcom_network_provider()

virtual Xcom_network_provider::~Xcom_network_provider ( )
inlineoverridevirtual

Member Function Documentation

◆ cleanup_secure_connections_context()

void Xcom_network_provider::cleanup_secure_connections_context ( )
overridevirtual

Implements Network_provider.

◆ close_connection()

int Xcom_network_provider::close_connection ( const Network_connection connection)
overridevirtual

Closes an open connection to another XCom endpoint served by the same Network provider.

Parameters
connectionan open and valid connection
Returns
int an error code in case of error. 0, otherwise.

Implements Network_provider.

◆ configure()

bool Xcom_network_provider::configure ( const Network_configuration_parameters params)
inlineoverridevirtual

Configures this network provider.

It is mandatory to be called in This provider, else we won't know which listen port to use.

Parameters
paramsNetwork_configuration_parameters with the listen port configured
Returns
true if configure went well. False otherwise.

Implements Network_provider.

◆ configure_secure_connections()

bool Xcom_network_provider::configure_secure_connections ( const Network_configuration_parameters params)
inlineoverridevirtual

Configures the active provider with all things needed to establish SSL connections.

Parameters
paramsconfiguration parameters for SSL.
Returns
true In case of success.
false In case of failure.

Implements Network_provider.

◆ finalize_secure_connections_context()

bool Xcom_network_provider::finalize_secure_connections_context ( )
overridevirtual

Implements Network_provider.

◆ get_communication_stack()

enum_transport_protocol Xcom_network_provider::get_communication_stack ( ) const
inlineoverridevirtual

Get the communication stack implemented by this provider.

Return a valid value withint the range of RunningProtocol enum.

Returns
RunningProtocol valid value

Implements Network_provider.

◆ get_open_server_socket()

result Xcom_network_provider::get_open_server_socket ( ) const
inline

◆ get_port()

xcom_port Xcom_network_provider::get_port ( ) const
inline

◆ is_provider_initialized()

bool Xcom_network_provider::is_provider_initialized ( ) const
inline

◆ notify_provider_ready()

void Xcom_network_provider::notify_provider_ready ( bool  init_error = false)

Notify that the provider is ready.

It unblocks wait_for_provider_ready()

Parameters
init_errorsets the error state of this notifier

◆ open_connection()

std::unique_ptr< Network_connection > Xcom_network_provider::open_connection ( const std::string &  address,
const unsigned short  port,
const Network_security_credentials security_credentials,
int  connection_timeout = Network_provider::default_connection_timeout(),
network_provider_dynamic_log_level  log_level = network_provider_dynamic_log_level::PROVIDED 
)
overridevirtual

Opens a new connection to another XCom endpoint served by the same Network provider.

Parameters
addressaddress of the remote endpoint
portport of the remote endpoint
security_credentialssecurity credentials to connect to the remote endpoint
connection_timeoutconnection timeout
log_levellog level
See also
network_provider_dynamic_log_level for more information
Returns
std::unique_ptr<Network_connection> an established connection. nullptr in case of failure.

Implements Network_provider.

◆ set_open_server_socket()

void Xcom_network_provider::set_open_server_socket ( result  open_socket)
inline

◆ set_port()

void Xcom_network_provider::set_port ( xcom_port  port)
inline

◆ set_shutdown_tcp_server()

void Xcom_network_provider::set_shutdown_tcp_server ( bool  shutdown_tcp_server)
inline

◆ should_shutdown_tcp_server()

bool Xcom_network_provider::should_shutdown_tcp_server ( ) const
inline

◆ start()

std::pair< bool, int > Xcom_network_provider::start ( )
overridevirtual

Inherited methods from Gcs_network_provider.

Implements Network_provider.

◆ stop()

std::pair< bool, int > Xcom_network_provider::stop ( )
overridevirtual

Stops the network provider.

Each implementation will place here any code that it needs to stop a network provider.

stop() is synchronous. After stop() succeeded, it is assumed that XCom shall not receive any new connection.

Returns
a pair of <bool,int> bool indicates the success of the operation. false means success. int returns an error code.

Implements Network_provider.

◆ wait_for_provider_ready()

bool Xcom_network_provider::wait_for_provider_ready ( )

Waits for the provider to become ready.

This call is blocking.

Returns
true in case of error or timeout
false in case of success
true
false

Member Data Documentation

◆ m_init_cond_var

std::condition_variable Xcom_network_provider::m_init_cond_var
mutableprivate

◆ m_init_error

bool Xcom_network_provider::m_init_error
private

◆ m_init_lock

std::mutex Xcom_network_provider::m_init_lock
mutableprivate

◆ m_initialized

bool Xcom_network_provider::m_initialized
private

◆ m_network_provider_tcp_server

std::thread Xcom_network_provider::m_network_provider_tcp_server
private

◆ m_open_server_socket

result Xcom_network_provider::m_open_server_socket
private

◆ m_port

xcom_port Xcom_network_provider::m_port
private

◆ m_shutdown_tcp_server

bool Xcom_network_provider::m_shutdown_tcp_server
private

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