MySQL 8.3.0
Source Code Documentation
routing_config.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2023, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef ROUTING_CONFIG_INCLUDED
26#define ROUTING_CONFIG_INCLUDED
27
28#include <string>
29
30#include "mysql/harness/filesystem.h" // Path
31#include "mysqlrouter/routing.h" // RoutingStrategy, Mode
32#include "protocol/protocol.h" // Protocol::Type
33#include "ssl_mode.h"
34#include "tcp_address.h"
35
36/**
37 * route specific configuration.
38 */
40 public:
41 Protocol::Type protocol{}; //!< protocol (classic, x)
42 std::string destinations; //!< destinations
43 int bind_port{}; //!< TCP port to bind to
44 mysql_harness::TCPAddress bind_address; //!< IP address to bind to
45 mysql_harness::Path named_socket; //!< unix domain socket path to bind to
46 int connect_timeout{}; //!< connect-timeout in seconds
47 routing::Mode mode{routing::Mode::kUndefined}; //!< read-only/read-write
49 routing::RoutingStrategy::kUndefined}; //!< routing strategy (next-avail,
50 //!< ...)
51 int max_connections{}; //!< max connections allowed
52 unsigned long long max_connect_errors{}; //!< max connect errors
53 unsigned int client_connect_timeout{}; //!< client connect timeout in seconds
54 unsigned int net_buffer_length{}; //!< Size of buffer to receive packets
55 unsigned int thread_stack_size{}; //!< thread stack size in kilobytes
56
57 SslMode source_ssl_mode{}; //!< SslMode of the client side connection.
58 std::string source_ssl_cert; //!< Cert file
59 std::string source_ssl_key; //!< Key file
60 std::string source_ssl_cipher; //!< allowed TLS ciphers
61 std::string source_ssl_curves; //!< allowed TLS curves
62 std::string source_ssl_dh_params; //!< DH params
63 std::string
64 source_ssl_ca_file; //!< CA file to used to verify sources' identity
65 std::string source_ssl_ca_dir; //!< directory of CA files used to verify
66 //!< sources' identity
67 std::string
68 source_ssl_crl_file; //!< CRL file used to check revoked certificates
69 std::string source_ssl_crl_dir; //!< directory of CRL files
70
71 SslMode dest_ssl_mode{}; //!< SslMode of the server side connection.
72 std::string dest_ssl_cert; //!< Cert file
73 std::string dest_ssl_key; //!< Key file
74 SslVerify dest_ssl_verify{}; //!< How to verify the server-side cert.
75 std::string dest_ssl_cipher; //!< allowed TLS ciphers
76 std::string
77 dest_ssl_ca_file; //!< CA file to used to verify destinations' identity
78 std::string dest_ssl_ca_dir; //!< directory of CA files used to verify
79 //!< destinations' identity
80 std::string
81 dest_ssl_crl_file; //!< CRL file used to check revoked certificates
82 std::string dest_ssl_crl_dir; //!< directory of CRL files
83 std::string dest_ssl_curves; //!< allowed TLS curves
84
85 bool connection_sharing{}; //!< if connection sharing is allowed.
86 std::chrono::milliseconds
87 connection_sharing_delay{}; //!< delay before an idling connection is
88 //!< moved to the pool and connection sharing
89 //!< is allowed.
90
94
98
99 std::chrono::milliseconds
100 connect_retry_timeout{}; //!< timeout of retrying after a transient
101 //!< connect-failure.
103 routing::AccessMode::kUndefined}; //!< read_write,read_only,auto
104
107 wait_for_my_writes_timeout{}; //!< how long to wait for writes to be
108 //!< applied before reads.
109
110 /*
111 * read the users routing_require attribute from
112 *
113 * information_schema.user_attributes
114 *
115 * and enforce them.
116 */
118};
119
120#endif // ROUTING_CONFIG_INCLUDED
Type
supported protocols
Definition: base_protocol.h:31
route specific configuration.
Definition: routing_config.h:39
std::string source_ssl_crl_dir
directory of CRL files
Definition: routing_config.h:69
std::chrono::seconds wait_for_my_writes_timeout
how long to wait for writes to be applied before reads.
Definition: routing_config.h:107
std::string source_ssl_key
Key file.
Definition: routing_config.h:59
std::string destinations
destinations
Definition: routing_config.h:42
unsigned int server_ssl_session_cache_timeout
Definition: routing_config.h:97
mysql_harness::Path named_socket
unix domain socket path to bind to
Definition: routing_config.h:45
bool wait_for_my_writes
Definition: routing_config.h:105
std::string source_ssl_ca_dir
directory of CA files used to verify sources' identity
Definition: routing_config.h:65
bool router_require_enforce
Definition: routing_config.h:117
unsigned int client_ssl_session_cache_timeout
Definition: routing_config.h:93
SslMode dest_ssl_mode
SslMode of the server side connection.
Definition: routing_config.h:71
unsigned int client_connect_timeout
client connect timeout in seconds
Definition: routing_config.h:53
unsigned long long max_connect_errors
max connect errors
Definition: routing_config.h:52
std::string dest_ssl_curves
allowed TLS curves
Definition: routing_config.h:83
std::string dest_ssl_ca_file
CA file to used to verify destinations' identity.
Definition: routing_config.h:77
SslMode source_ssl_mode
SslMode of the client side connection.
Definition: routing_config.h:57
std::string dest_ssl_crl_file
CRL file used to check revoked certificates.
Definition: routing_config.h:81
int connect_timeout
connect-timeout in seconds
Definition: routing_config.h:46
Protocol::Type protocol
protocol (classic, x)
Definition: routing_config.h:41
std::string dest_ssl_cert
Cert file.
Definition: routing_config.h:72
int bind_port
TCP port to bind to.
Definition: routing_config.h:43
std::string source_ssl_crl_file
CRL file used to check revoked certificates.
Definition: routing_config.h:68
std::string source_ssl_dh_params
DH params.
Definition: routing_config.h:62
size_t client_ssl_session_cache_size
Definition: routing_config.h:92
std::string source_ssl_ca_file
CA file to used to verify sources' identity.
Definition: routing_config.h:64
std::string dest_ssl_cipher
allowed TLS ciphers
Definition: routing_config.h:75
routing::RoutingStrategy routing_strategy
routing strategy (next-avail, ...)
Definition: routing_config.h:48
routing::AccessMode access_mode
read_write,read_only,auto
Definition: routing_config.h:102
unsigned int net_buffer_length
Size of buffer to receive packets.
Definition: routing_config.h:54
bool client_ssl_session_cache_mode
Definition: routing_config.h:91
routing::Mode mode
read-only/read-write
Definition: routing_config.h:47
bool connection_sharing
if connection sharing is allowed.
Definition: routing_config.h:85
std::string source_ssl_cert
Cert file.
Definition: routing_config.h:58
mysql_harness::TCPAddress bind_address
IP address to bind to.
Definition: routing_config.h:44
std::chrono::milliseconds connect_retry_timeout
timeout of retrying after a transient connect-failure.
Definition: routing_config.h:100
std::string dest_ssl_key
Key file.
Definition: routing_config.h:73
std::string source_ssl_curves
allowed TLS curves
Definition: routing_config.h:61
int max_connections
max connections allowed
Definition: routing_config.h:51
std::string dest_ssl_crl_dir
directory of CRL files
Definition: routing_config.h:82
unsigned int thread_stack_size
thread stack size in kilobytes
Definition: routing_config.h:55
std::string source_ssl_cipher
allowed TLS ciphers
Definition: routing_config.h:60
bool server_ssl_session_cache_mode
Definition: routing_config.h:95
std::chrono::milliseconds connection_sharing_delay
delay before an idling connection is moved to the pool and connection sharing is allowed.
Definition: routing_config.h:87
SslVerify dest_ssl_verify
How to verify the server-side cert.
Definition: routing_config.h:74
size_t server_ssl_session_cache_size
Definition: routing_config.h:96
std::string dest_ssl_ca_dir
directory of CA files used to verify destinations' identity
Definition: routing_config.h:78
Class representing a path in a file system.
Definition: filesystem.h:62
Defines an IP address with port number
Definition: tcp_address.h:39
AccessMode
Definition: routing.h:146
RoutingStrategy
Routing strategies supported by Routing plugin.
Definition: routing.h:152
RoutingMode
Modes supported by Routing plugin.
Definition: routing.h:133
SslMode
Definition: ssl_mode.h:28
SslVerify
Definition: ssl_mode.h:37
double seconds()
Definition: task.cc:309