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