MySQL 9.1.0
Source Code Documentation
network_management_interface.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
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, version 2.0, 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#ifndef NETWORK_MANAGEMENT_INTERFACE_H
25#define NETWORK_MANAGEMENT_INTERFACE_H
26
28
29#include <functional>
30
31/**
32 * @brief Inversion of Control interface to manage Network providers
33 */
35 public:
38
41 delete; // Copy construct
43 Network_provider_management_interface const &) = delete; // Copy assign
44
46 Network_provider_management_interface &&) = default; // Move construct
48 Network_provider_management_interface &&) = default; // Move assign
49
50 /**
51 * @brief Initialize the network manager. It also creates the default XCom
52 * provider and adds it to the manager.
53 *
54 * @return true in case of error. false otherwise.
55 */
56 virtual bool initialize() = 0;
57
58 /**
59 * @brief Finalize the network manager. It removes the default XCom
60 * provider,
61 *
62 * @return true in case of error. false otherwise.
63 */
64 virtual bool finalize() = 0;
65
66 /**
67 * @brief Sets the running Communication Stack, thus defining the active
68 * provider.
69 *
70 * In runtime, this is will change the way we establish connections.
71 *
72 * @param new_value value of the Communication Stack
73 */
74 virtual void set_running_protocol(enum_transport_protocol new_value) = 0;
75
76 /**
77 * @brief Gets the configured running protocol
78 *
79 * It returns the value that is currently configured in the Running
80 * Communication Stack
81 *
82 * Since this value is dynamic, it can cause a mismatch from the provider
83 * that we are actively receiving connections and the provider that we use
84 * to establish new connections
85 *
86 * @return CommunicationStack value.
87 */
89
90 /**
91 * @brief Get the incoming connections Communication Stack
92 *
93 * This is the value that is used to report upwards the protocol in * which
94 * we are currently accepting connections.
95 *
96 * @return CommunicationStack
97 */
99
100 /**
101 * @brief Add a new Gcs_network_provider instance
102 *
103 * @param provider an already instantiated shared_ptr object of a
104 * Gcs_network_provider
105 */
107 std::shared_ptr<Network_provider> provider) = 0;
108
109 virtual void remove_all_network_provider() = 0;
110
112 enum_transport_protocol provider_key) = 0;
113
114 // SSL RELATED OPERATIONS
115 /**
116 Return whether the SSL will be used to encrypt data or not.
117
118 Return 1 if it is enabled 0 otherwise.
119*/
120 virtual int is_xcom_using_ssl() const = 0;
121
122 /**
123 Set the operation mode which might be the following:
124
125 . SSL_DISABLED (1): The SSL mode will be disabled and this is the default
126 value.
127
128 . SSL_PREFERRED (2): The SSL mode will be always disabled if this value is
129 provided and is only allowed to keep the solution compatibility with
130 MySQL server.
131
132 . SSL_REQUIRED (4): The SSL mode will be enabled but the verifications
133 described in the next modes are not performed.
134
135 . SSL_VERIFY_CA (4) - Verify the server TLS certificate against the
136 configured Certificate Authority (CA) certificates. The connection attempt
137 fails if no valid matching CA certificates are found.
138
139 . SSL_VERIFY_IDENTITY (5): Like VERIFY_CA, but additionally verify that the
140 server certificate matches the host to which the connection is attempted.
141
142 If a different value is provide, INVALID_SSL_MODE (-1) is returned.
143*/
144 virtual int xcom_set_ssl_mode(int mode) = 0;
145
146 /**
147 Return the operation mode as an integer from an operation mode provided
148 as a string. Note that the string must be provided in upper case letters
149 and the possible values are: "DISABLED", "PREFERRED", "REQUIRED",
150 "VERIFY_CA" or "VERIFY_IDENTITY".
151
152 If a different value is provide, INVALID_SSL_MODE (-1) is returned.
153 */
154 virtual int xcom_get_ssl_mode(const char *mode) = 0;
155
156 /**
157 Return the configured value into SSL mode
158 */
159 virtual int xcom_get_ssl_mode() = 0;
160
161 /**
162 Set the operation fips mode which might be the following:
163
164 . SSL_FIPS_MODE_OFF (0): This will set openssl fips mode value to 0
165
166 . SSL_FIPS_MODE_ON (1): This will set openssl fips mode value to 1
167
168 . SSL_FIPS_MODE_STRICT (2): This will set openssl fips mode value to 2
169
170 If a different value is provide, INVALID_SSL_FIPS_MODE (-1) is returned.
171 */
172 virtual int xcom_set_ssl_fips_mode(int mode) = 0;
173
174 /**
175 Return the operation fips mode as an integer from an operation fips mode
176 provided as a string. Note that the string must be provided in upper case
177 letters and the possible values are: "OFF", "ON", "STRICT",
178
179 If a different value is provide, INVALID_SSL_MODE (-1) is returned.
180 */
181 virtual int xcom_get_ssl_fips_mode(const char *mode) = 0;
182
183 /**
184 Returns the configured FIPS mode
185 */
186 virtual int xcom_get_ssl_fips_mode() = 0;
187
188 /**
189 * @brief Cleans up SSL context directly into the active network
190 * provider.
191 */
193
194 /**
195 * @brief Cleans up SSL context indirectly from the last active network
196 * provider.
197 */
199
200 /**
201 * @brief Destroys all things SSL related
202 */
204};
205
206/**
207 * @brief Inversion of Control proxy interface to operate Network providers
208 *
209 * For full documentation @see Network_provider_manager
210 */
212 public:
215
218 delete; // Copy construct
220 Network_provider_operations_interface const &) = delete; // Copy assign
221 /**
222 * @brief Start the active provider.
223 *
224 * @return true In case of success.
225 * @return false In case of failure.
226 */
228
229 /**
230 * @brief Stops all network providers.
231 *
232 * @return true In case of success stopping ALL network providers
233 * @return false In case of failure in stopping AT LEAST ONE network provider
234 */
235 virtual bool stop_all_network_providers() = 0;
236
237 /**
238 * @brief Stops the active provider.
239 *
240 * @return true In case of success.
241 * @return false In case of failure.
242 */
244
245 /**
246 * @brief Configures the active provider
247 *
248 * @param params configuration parameters.
249 *
250 * @return true In case of success.
251 * @return false In case of failure.
252 */
255
256 /**
257 * @brief COnfigures the active provider SSL parameters
258 *
259 * @param params the security parameters.
260 *
261 * @return true in case of error. false otherwise.
262 */
265};
266
267#endif // NETWORK_MANAGEMENT_INTERFACE_H
Inversion of Control interface to manage Network providers.
Definition: network_management_interface.h:34
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:36
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:37
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 directly into the active network provider.
virtual void delayed_cleanup_secure_connections_context()=0
Cleans up SSL context indirectly from the last active network provider.
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:211
virtual ~Network_provider_operations_interface()
Definition: network_management_interface.h:214
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:213
virtual bool configure_active_provider(Network_configuration_parameters &params)=0
Configures the active provider.
mode
Definition: file_handle.h:61
enum_transport_protocol
Enum that describes the available XCom Communication Stacks.
Definition: network_provider.h:45
Possible configuration parameters.
Definition: network_provider.h:191