24#ifndef GCS_MYSQL_NETWORK_PROVIDER_INCLUDED
25#define GCS_MYSQL_NETWORK_PROVIDER_INCLUDED
110 const char *
user,
const char *passwd,
111 const char *db,
unsigned int port,
112 const char *unix_socket,
113 unsigned long clientflag) = 0;
127 const unsigned char *arg,
size_t length,
128 bool skip_check) = 0;
190 const void *arg) = 0;
206 const char *ca,
const char *capath,
207 const char *cipher) = 0;
229 const char *passwd,
const char *db,
230 unsigned int port,
const char *unix_socket,
231 unsigned long clientflag)
override;
237 const unsigned char *arg,
size_t length,
238 bool skip_check)
override;
281 const void *arg)
override;
288 const char *ca,
const char *capath,
289 const char *cipher)
override;
366 [
this](
const auto &client_connection) {
367 m_native_interface->mysql_close(client_connection.second);
368 m_native_interface->mysql_free(client_connection.second);
378 std::pair<bool, int>
start()
override;
383 std::pair<bool, int>
stop()
override;
413 const std::string &address,
const unsigned short port,
450 switch (net_provider_log_level) {
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Implementation of Gcs_mysql_network_provider_auth_interface that retrieves auth data from MySQL.
Definition: gcs_mysql_network_provider.h:70
Gcs_mysql_network_provider_auth_interface_impl()
Definition: gcs_mysql_network_provider.h:72
Replication_thread_api m_recovery_channel
Definition: gcs_mysql_network_provider.h:84
virtual ~Gcs_mysql_network_provider_auth_interface_impl() override
Definition: gcs_mysql_network_provider.h:74
bool get_credentials(std::string &username, std::string &password) override
Get the user credentials needed to establish MySQL connections.
Definition: gcs_mysql_network_provider.cc:41
IoC interface to allow abstraction of the retrieval of Security Credentials.
Definition: gcs_mysql_network_provider.h:44
virtual bool get_credentials(std::string &username, std::string &password)=0
Get the user credentials needed to establish MySQL connections.
virtual ~Gcs_mysql_network_provider_auth_interface()
Definition: gcs_mysql_network_provider.h:46
Internal implementation of Gcs_mysql_network_provider_native_interface_impl that serves as a proxy fo...
Definition: gcs_mysql_network_provider.h:218
MYSQL * mysql_init(MYSQL *sock) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:60
bool restore_original_network_namespace() override
Implementation of.
Definition: gcs_mysql_network_provider.cc:122
int channel_get_network_namespace(std::string &net_ns) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:94
bool set_network_namespace(const std::string &network_namespace) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:107
void mysql_free(void *ptr) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:74
virtual ~Gcs_mysql_network_provider_native_interface_impl() override
Definition: gcs_mysql_network_provider.h:222
Gcs_mysql_network_provider_native_interface_impl()
Definition: gcs_mysql_network_provider.h:220
int mysql_options(MYSQL *mysql, enum mysql_option option, const void *arg) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:78
bool mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:83
Replication_thread_api m_recovery_channel
Definition: gcs_mysql_network_provider.h:292
MYSQL * mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:46
bool send_command(MYSQL *mysql, enum enum_server_command command, const unsigned char *arg, size_t length, bool skip_check) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:54
void mysql_close(MYSQL *sock) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:65
IoC interface to allow abstraction of MySQL Client API.
Definition: gcs_mysql_network_provider.h:91
virtual MYSQL * mysql_init(MYSQL *sock)=0
Proxy method to mysql_init from the MySQL Client API.
virtual int channel_get_network_namespace(std::string &net_ns)=0
Method to get the network namespace configured for a channel.
virtual bool send_command(MYSQL *mysql, enum enum_server_command command, const unsigned char *arg, size_t length, bool skip_check)=0
Proxy method to simple_command from the MySQL client API.
virtual void mysql_close(MYSQL *sock)=0
Proxy method to mysql_close from the MySQL Client API.
virtual int mysql_options(MYSQL *mysql, enum mysql_option option, const void *arg)=0
Proxy method to mysql_options from the MySQL Memory API.
virtual bool restore_original_network_namespace()=0
Restore original network namespace used to be active before a new network namespace has been set.
virtual void mysql_free(void *ptr)=0
Proxy method to mysql_free from the MySQL Memory API.
virtual bool set_network_namespace(const std::string &network_namespace)=0
Set active network namespace specified by a name.
virtual MYSQL * mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag)=0
Proxy method to mysql_real_connect from the MySQL client API.
virtual ~Gcs_mysql_network_provider_native_interface()
Definition: gcs_mysql_network_provider.h:93
virtual bool mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher)=0
Proxy method to mysql_ssl_set from the MySQL Memory API.
Utilitarian class for Gcs_mysql_network_provider.
Definition: gcs_mysql_network_provider.h:434
static constexpr int OUT_OF_RANGE_LOG_LEVEL
Definition: gcs_mysql_network_provider.h:437
static int log_level_adaptation(int coded_log_level, network_provider_dynamic_log_level log_level)
Converts from the intended developer fixed level to a dynamic level provided from the API call,...
Definition: gcs_mysql_network_provider.h:492
static int from_network_provider_dynamic_log_level_mapping(network_provider_dynamic_log_level net_provider_log_level)
Maps between Network Provider generic log level and MySQL error Log level.
Definition: gcs_mysql_network_provider.h:448
Implementation of a.
Definition: gcs_mysql_network_provider.h:299
std::map< int, THD * > m_incoming_connection_map
A map that holds THD's for all open MySQL Server connections.
Definition: gcs_mysql_network_provider.h:320
Network_configuration_parameters m_config_parameters
Definition: gcs_mysql_network_provider.h:326
enum_transport_protocol get_communication_stack() const override
Get the communication stack implemented by this class.
Definition: gcs_mysql_network_provider.h:390
mysql_mutex_t m_GR_LOCK_connection_map_mutex
Definition: gcs_mysql_network_provider.h:323
int close_connection(const Network_connection &connection) override
Closes an open connection to another XCom endpoint served by the same Network provider.
Definition: gcs_mysql_network_provider.cc:342
Gcs_mysql_network_provider_auth_interface * m_auth_provider
External IoC dependencies.
Definition: gcs_mysql_network_provider.h:333
std::pair< bool, int > stop() override
See.
Definition: gcs_mysql_network_provider.cc:136
bool configure_secure_connections(const Network_configuration_parameters ¶ms) override
See.
Definition: gcs_mysql_network_provider.cc:164
std::pair< bool, int > start() override
See.
Definition: gcs_mysql_network_provider.cc:130
bool finalize_secure_connections_context() override
Definition: gcs_mysql_network_provider.cc:193
bool configure(const Network_configuration_parameters ¶ms) override
See.
Definition: gcs_mysql_network_provider.cc:159
std::unique_ptr< Network_connection > 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) override
See.
Definition: gcs_mysql_network_provider.cc:197
virtual ~Gcs_mysql_network_provider() override
Definition: gcs_mysql_network_provider.h:362
void cleanup_secure_connections_context() override
Definition: gcs_mysql_network_provider.cc:187
Gcs_mysql_network_provider_native_interface * m_native_interface
Definition: gcs_mysql_network_provider.h:334
std::map< int, MYSQL * > m_connection_map
A map that holds all open MySQL client connections.
Definition: gcs_mysql_network_provider.h:310
void set_new_connection(THD *thd, Network_connection *connection)
Set the new connection coming form MySQL server.
Definition: gcs_mysql_network_provider.cc:375
Gcs_mysql_network_provider(Gcs_mysql_network_provider_auth_interface *auth_provider, Gcs_mysql_network_provider_native_interface *native_interface)
Construct a new Gcs_mysql_network_provider.
Definition: gcs_mysql_network_provider.h:345
Class that provides Network Namespace services.
Definition: network_provider.h:242
Base class for External Network Providers.
Definition: network_provider.h:295
static constexpr int default_connection_timeout()
Definition: network_provider.h:457
Definition: replication_threads_api.h:37
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
#define mysql_mutex_destroy(M)
Definition: mysql_mutex.h:46
#define mysql_mutex_init(K, M, A)
Definition: mysql_mutex.h:41
enum_server_command
A list of all MySQL protocol commands.
Definition: my_command.h:48
@ WARNING_LEVEL
Definition: my_loglevel.h:44
@ ERROR_LEVEL
Definition: my_loglevel.h:43
@ INFORMATION_LEVEL
Definition: my_loglevel.h:45
@ SYSTEM_LEVEL
Definition: my_loglevel.h:42
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
mysql_option
Definition: mysql.h:170
static char * password
Definition: mysql_secure_installation.cc:58
char * user
Definition: mysqladmin.cc:66
const char * host
Definition: mysqladmin.cc:65
static MYSQL * sock
Definition: mysqlcheck.cc:57
void for_each(const Shards< COUNT > &shards, Function &&f) noexcept
Iterate over the shards.
Definition: ut0counter.h:323
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
static loglevel log_level(const Sql_condition *condition)
Definition: histogram.cc:1643
Definition: instrumented_condition_variable.h:32
enum_transport_protocol
Enum that describes the available XCom Communication Stacks.
Definition: network_provider.h:45
@ MYSQL_PROTOCOL
Definition: network_provider.h:48
@ SSL_DISABLED
Definition: network_provider.h:57
network_provider_dynamic_log_level
Dynamic log level enum values.
Definition: network_provider.h:103
PSI_mutex_key key_GR_LOCK_connection_map
Definition: plugin_psi.h:133
required string key
Definition: replication_asynchronous_connection_failover.proto:60
required string network_namespace
Definition: replication_asynchronous_connection_failover.proto:34
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
Possible configuration parameters.
Definition: network_provider.h:191
struct ssl_parameters ssl_params
Definition: network_provider.h:194
Represents an open connection.
Definition: network_provider.h:201
Security credentials to establish a connection.
Definition: network_provider.h:134
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
int ssl_mode
Definition: network_provider.h:172
#define MY_MUTEX_INIT_FAST
Definition: thr_mutex.h:68
command
Definition: version_token.cc:280