MySQL 8.0.33
Source Code Documentation
network_management_interface.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2023, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef NETWORK_MANAGEMENT_INTERFACE_H
24#define NETWORK_MANAGEMENT_INTERFACE_H
25
27
28#include <functional>
29
30/**
31 * @brief Inversion of Control interface to manage Network providers
32 */
34 public:
37
40 delete; // Copy construct
42 Network_provider_management_interface const &) = delete; // Copy assign
43
45 Network_provider_management_interface &&) = default; // Move construct
47 Network_provider_management_interface &&) = default; // Move assign
48
49 /**
50 * @brief Initialize the network manager. It also creates the default XCom
51 * provider and adds it to the manager.
52 *
53 * @return true in case of error. false otherwise.
54 */
55 virtual bool initialize() = 0;
56
57 /**
58 * @brief Finalize the network manager. It removes the default XCom
59 * provider,
60 *
61 * @return true in case of error. false otherwise.
62 */
63 virtual bool finalize() = 0;
64
65 /**
66 * @brief Sets the running Communication Stack, thus defining the active
67 * provider.
68 *
69 * In runtime, this is will change the way we establish connections.
70 *
71 * @param new_value value of the Communication Stack
72 */
73 virtual void set_running_protocol(enum_transport_protocol new_value) = 0;
74
75 /**
76 * @brief Gets the configured running protocol
77 *
78 * It returns the value that is currently configured in the Running
79 * Communication Stack
80 *
81 * Since this value is dynamic, it can cause a mismatch from the provider
82 * that we are actively receiving connections and the provider that we use
83 * to establish new connections
84 *
85 * @return CommunicationStack value.
86 */
88
89 /**
90 * @brief Get the incoming connections Communication Stack
91 *
92 * This is the value that is used to report upwards the protocol in * which
93 * we are currently accepting connections.
94 *
95 * @return CommunicationStack
96 */
98
99 /**
100 * @brief Add a new Gcs_network_provider instance
101 *
102 * @param provider an already instantiated shared_ptr object of a
103 * Gcs_network_provider
104 */
106 std::shared_ptr<Network_provider> provider) = 0;
107
108 virtual void remove_all_network_provider() = 0;
109
111 enum_transport_protocol provider_key) = 0;
112
113 // SSL RELATED OPERATIONS
114 /**
115 Return whether the SSL will be used to encrypt data or not.
116
117 Return 1 if it is enabled 0 otherwise.
118*/
119 virtual int is_xcom_using_ssl() const = 0;
120
121 /**
122 Set the operation mode which might be the following:
123
124 . SSL_DISABLED (1): The SSL mode will be disabled and this is the default
125 value.
126
127 . SSL_PREFERRED (2): The SSL mode will be always disabled if this value is
128 provided and is only allowed to keep the solution compatibility with
129 MySQL server.
130
131 . SSL_REQUIRED (4): The SSL mode will be enabled but the verifications
132 described in the next modes are not performed.
133
134 . SSL_VERIFY_CA (4) - Verify the server TLS certificate against the
135 configured Certificate Authority (CA) certificates. The connection attempt
136 fails if no valid matching CA certificates are found.
137
138 . SSL_VERIFY_IDENTITY (5): Like VERIFY_CA, but additionally verify that the
139 server certificate matches the host to which the connection is attempted.
140
141 If a different value is provide, INVALID_SSL_MODE (-1) is returned.
142*/
143 virtual int xcom_set_ssl_mode(int mode) = 0;
144
145 /**
146 Return the operation mode as an integer from an operation mode provided
147 as a string. Note that the string must be provided in upper case letters
148 and the possible values are: "DISABLED", "PREFERRED", "REQUIRED",
149 "VERIFY_CA" or "VERIFY_IDENTITY".
150
151 If a different value is provide, INVALID_SSL_MODE (-1) is returned.
152 */
153 virtual int xcom_get_ssl_mode(const char *mode) = 0;
154
155 /**
156 Return the configured value into SSL mode
157 */
158 virtual int xcom_get_ssl_mode() = 0;
159
160 /**
161 Set the operation fips mode which might be the following:
162
163 . SSL_FIPS_MODE_OFF (0): This will set openssl fips mode value to 0
164
165 . SSL_FIPS_MODE_ON (1): This will set openssl fips mode value to 1
166
167 . SSL_FIPS_MODE_STRICT (2): This will set openssl fips mode value to 2
168
169 If a different value is provide, INVALID_SSL_FIPS_MODE (-1) is returned.
170 */
171 virtual int xcom_set_ssl_fips_mode(int mode) = 0;
172
173 /**
174 Return the operation fips mode as an integer from an operation fips mode
175 provided as a string. Note that the string must be provided in upper case
176 letters and the possible values are: "OFF", "ON", "STRICT",
177
178 If a different value is provide, INVALID_SSL_MODE (-1) is returned.
179 */
180 virtual int xcom_get_ssl_fips_mode(const char *mode) = 0;
181
182 /**
183 Returns the configured FIPS mode
184 */
185 virtual int xcom_get_ssl_fips_mode() = 0;
186
187 /**
188 * @brief Cleans up SSL context.
189 */
191
192 /**
193 * @brief Destroys all things SSL related
194 */
196};
197
198/**
199 * @brief Inversion of Control proxy interface to operate Network providers
200 *
201 * For full documentation @see Network_provider_manager
202 */
204 public:
207
210 delete; // Copy construct
212 Network_provider_operations_interface const &) = delete; // Copy assign
213 /**
214 * @brief Start the active provider.
215 *
216 * @return true In case of success.
217 * @return false In case of failure.
218 */
220
221 /**
222 * @brief Stops all network providers.
223 *
224 * @return true In case of success stopping ALL network providers
225 * @return false In case of failure in stopping AT LEAST ONE network provider
226 */
227 virtual bool stop_all_network_providers() = 0;
228
229 /**
230 * @brief Stops the active provider.
231 *
232 * @return true In case of success.
233 * @return false In case of failure.
234 */
236
237 /**
238 * @brief Configures the active provider
239 *
240 * @param params configuration parameters.
241 *
242 * @return true In case of success.
243 * @return false In case of failure.
244 */
247
248 /**
249 * @brief COnfigures the active provider SSL parameters
250 *
251 * @param params the security parameters.
252 *
253 * @return true in case of error. false otherwise.
254 */
257};
258
259#endif // NETWORK_MANAGEMENT_INTERFACE_H
Inversion of Control interface to manage Network providers.
Definition: network_management_interface.h:33
Network_provider_management_interface(Network_provider_management_interface &&)=default
virtual int xcom_get_ssl_fips_mode(const char *mode)=0
Return the operation fips mode as an integer from an operation fips mode provided as a string.
Network_provider_management_interface & operator=(Network_provider_management_interface const &)=delete
virtual void finalize_secure_connections_context()=0
Destroys all things SSL related.
virtual int is_xcom_using_ssl() const =0
Return whether the SSL will be used to encrypt data or not.
virtual int xcom_get_ssl_mode(const char *mode)=0
Return the operation mode as an integer from an operation mode provided as a string.
virtual int xcom_get_ssl_fips_mode()=0
Returns the configured FIPS mode.
virtual void remove_all_network_provider()=0
Network_provider_management_interface()
Definition: network_management_interface.h:35
virtual bool initialize()=0
Initialize the network manager.
virtual int xcom_set_ssl_fips_mode(int mode)=0
Set the operation fips mode which might be the following:
virtual enum_transport_protocol get_running_protocol() const =0
Gets the configured running protocol.
virtual ~Network_provider_management_interface()
Definition: network_management_interface.h:36
virtual int xcom_get_ssl_mode()=0
Return the configured value into SSL mode.
virtual void set_running_protocol(enum_transport_protocol new_value)=0
Sets the running Communication Stack, thus defining the active provider.
virtual enum_transport_protocol get_incoming_connections_protocol() const =0
Get the incoming connections Communication Stack.
virtual int xcom_set_ssl_mode(int mode)=0
Set the operation mode which might be the following:
virtual bool finalize()=0
Finalize the network manager.
virtual void cleanup_secure_connections_context()=0
Cleans up SSL context.
Network_provider_management_interface(Network_provider_management_interface const &)=delete
virtual void remove_network_provider(enum_transport_protocol provider_key)=0
Network_provider_management_interface & operator=(Network_provider_management_interface &&)=default
virtual void add_network_provider(std::shared_ptr< Network_provider > provider)=0
Add a new Gcs_network_provider instance.
Inversion of Control proxy interface to operate Network providers.
Definition: network_management_interface.h:203
virtual ~Network_provider_operations_interface()
Definition: network_management_interface.h:206
virtual bool start_active_network_provider()=0
Start the active provider.
virtual bool stop_all_network_providers()=0
Stops all network providers.
Network_provider_operations_interface & operator=(Network_provider_operations_interface const &)=delete
Network_provider_operations_interface(Network_provider_operations_interface const &)=delete
virtual bool stop_active_network_provider()=0
Stops the active provider.
virtual bool configure_active_provider_secure_connections(Network_configuration_parameters &params)=0
COnfigures the active provider SSL parameters.
Network_provider_operations_interface()
Definition: network_management_interface.h:205
virtual bool configure_active_provider(Network_configuration_parameters &params)=0
Configures the active provider.
mode
Definition: file_handle.h:59
enum_transport_protocol
Enum that describes the available XCom Communication Stacks.
Definition: network_provider.h:42
Possible configuration parameters.
Definition: network_provider.h:151