MySQL 8.0.29
Source Code Documentation
plugin_config.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2015, 2021, 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 PLUGIN_CONFIG_ROUTING_INCLUDED
26#define PLUGIN_CONFIG_ROUTING_INCLUDED
27
29
30#include <string>
31
33#include "mysql/harness/filesystem.h" // Path
35#include "mysqlrouter/routing.h" // RoutingStrategy, AccessMode
36#include "protocol/protocol.h" // Protocol::Type
37#include "ssl_mode.h"
38#include "tcp_address.h"
39
40extern const std::array<const char *, 29> routing_supported_options;
41
42/**
43 * route specific configuration.
44 */
47 private:
48 // is this [routing] entry for static routing or metadata-cache ?
49 // it's mutable because we discover it while calling getter for
50 // option destinations
51 mutable bool metadata_cache_;
52
53 public:
54 /** Constructor.
55 *
56 * @param section from configuration file provided as ConfigSection
57 */
59
60 std::string get_default(const std::string &option) const override;
61 bool is_required(const std::string &option) const override;
62
64 const mysql_harness::ConfigSection *section);
65
66 const Protocol::Type protocol; //!< protocol (classic, x)
67 const std::string destinations; //!< destinations
68 const int bind_port; //!< TCP port to bind to
69 const mysql_harness::TCPAddress bind_address; //!< IP address to bind to
71 named_socket; //!< unix domain socket path to bind to
72 const int connect_timeout; //!< connect-timeout in seconds
73 const routing::AccessMode mode; //!< read-only/read-write
75 routing_strategy; //!< routing strategy (next-avail, ...)
76 const int max_connections; //!< max connections allowed
77 const unsigned long long max_connect_errors; //!< max connect errors
78 const unsigned int
79 client_connect_timeout; //!< client connect timeout in seconds
80 const unsigned int net_buffer_length; //!< Size of buffer to receive packets
81 const unsigned int thread_stack_size; //!< thread stack size in kilobytes
82
83 SslMode source_ssl_mode; //!< SslMode of the client side connection.
84 const std::string source_ssl_cert; //!< Cert file
85 const std::string source_ssl_key; //!< Key file
86 const std::string source_ssl_cipher; //!< allowed TLS ciphers
87 const std::string source_ssl_curves; //!< allowed TLS curves
88 const std::string source_ssl_dh_params; //!< DH params
89
90 const SslMode dest_ssl_mode; //!< SslMode of the server side connection.
91 const SslVerify dest_ssl_verify; //!< How to verify the server-side cert.
92 const std::string dest_ssl_cipher; //!< allowed TLS ciphers
93 const std::string
94 dest_ssl_ca_file; //!< CA file to used to verify destinations' identity
95 const std::string dest_ssl_ca_dir; //!< directory of CA files used to verify
96 //!< destinations' identity
97 const std::string
98 dest_ssl_crl_file; //!< CRL file used to check revoked certificates
99 const std::string dest_ssl_crl_dir; //!< directory of CRL files
100 const std::string dest_ssl_curves; //!< allowed TLS curves
101
103};
104
105#endif // PLUGIN_CONFIG_ROUTING_INCLUDED
Type
supported protocols
Definition: base_protocol.h:31
route specific configuration.
Definition: plugin_config.h:46
const int connect_timeout
connect-timeout in seconds
Definition: plugin_config.h:72
const int bind_port
TCP port to bind to.
Definition: plugin_config.h:68
const mysql_harness::TCPAddress bind_address
IP address to bind to.
Definition: plugin_config.h:69
const std::string source_ssl_cert
Cert file.
Definition: plugin_config.h:84
const Protocol::Type protocol
protocol (classic, x)
Definition: plugin_config.h:66
const std::string dest_ssl_cipher
allowed TLS ciphers
Definition: plugin_config.h:92
const std::string dest_ssl_ca_dir
directory of CA files used to verify destinations' identity
Definition: plugin_config.h:95
const SslVerify dest_ssl_verify
How to verify the server-side cert.
Definition: plugin_config.h:91
const std::string destinations
destinations
Definition: plugin_config.h:67
const std::string dest_ssl_crl_file
CRL file used to check revoked certificates.
Definition: plugin_config.h:98
const std::string dest_ssl_curves
allowed TLS curves
Definition: plugin_config.h:100
SslMode source_ssl_mode
SslMode of the client side connection.
Definition: plugin_config.h:83
bool metadata_cache_
Definition: plugin_config.h:51
const std::string dest_ssl_crl_dir
directory of CRL files
Definition: plugin_config.h:99
const std::string source_ssl_cipher
allowed TLS ciphers
Definition: plugin_config.h:86
const std::chrono::seconds unreachable_destination_refresh_interval
Definition: plugin_config.h:102
const mysql_harness::Path named_socket
unix domain socket path to bind to
Definition: plugin_config.h:71
const int max_connections
max connections allowed
Definition: plugin_config.h:76
const std::string dest_ssl_ca_file
CA file to used to verify destinations' identity.
Definition: plugin_config.h:94
routing::RoutingStrategy routing_strategy
routing strategy (next-avail, ...)
Definition: plugin_config.h:75
const std::string source_ssl_key
Key file.
Definition: plugin_config.h:85
const std::string source_ssl_dh_params
DH params.
Definition: plugin_config.h:88
const unsigned long long max_connect_errors
max connect errors
Definition: plugin_config.h:77
const std::string source_ssl_curves
allowed TLS curves
Definition: plugin_config.h:87
const unsigned int thread_stack_size
thread stack size in kilobytes
Definition: plugin_config.h:81
const unsigned int net_buffer_length
Size of buffer to receive packets.
Definition: plugin_config.h:80
uint16_t get_option_max_connections(const mysql_harness::ConfigSection *section)
const unsigned int client_connect_timeout
client connect timeout in seconds
Definition: plugin_config.h:79
const routing::AccessMode mode
read-only/read-write
Definition: plugin_config.h:73
const SslMode dest_ssl_mode
SslMode of the server side connection.
Definition: plugin_config.h:90
Retrieve and manage plugin configuration.
Definition: plugin_config.h:61
virtual bool is_required(const std::string &option) const =0
Returns whether the given option is required.
virtual std::string get_default(const std::string &option) const =0
Gets the default for the given option.
Configuration section.
Definition: config_parser.h:140
Class representing a path in a file system.
Definition: filesystem.h:61
Defines an IP address with port number
Definition: tcp_address.h:39
AccessMode
Modes supported by Routing plugin.
Definition: routing.h:97
RoutingStrategy
Routing strategies supported by Routing plugin.
Definition: routing.h:104
const std::array< const char *, 29 > routing_supported_options
Definition: plugin_config.cc:53
#define ROUTING_PLUGIN_EXPORT
Definition: routing_plugin_export.h:15
SslMode
Definition: ssl_mode.h:28
SslVerify
Definition: ssl_mode.h:37
double seconds()
Definition: task.cc:309