MySQL  8.0.28
Source Code Documentation
violite.h
Go to the documentation of this file.
1 /* Copyright (c) 2000, 2021, 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 /**
24  @file include/violite.h
25  Vio Lite.
26  Purpose: include file for Vio that will work with C and C++.
27 */
28 
29 #ifndef vio_violite_h_
30 #define vio_violite_h_
31 
32 #include "my_config.h"
33 
34 #include <stddef.h>
35 #ifdef HAVE_SYS_SOCKET_H
36 #include <sys/socket.h>
37 #endif
38 #include <sys/types.h>
39 
40 #include <string>
41 
42 #include "my_inttypes.h"
43 #include "my_psi_config.h" // IWYU pragma: keep
47 
48 #include "mysql/psi/mysql_socket.h"
49 
50 struct Vio;
51 
52 /* Simple vio interface in C; The functions are implemented in violite.c */
53 
54 #if !defined(_WIN32) && !defined(HAVE_KQUEUE)
55 #define USE_PPOLL_IN_VIO
56 #endif
57 
58 #if defined(__cplusplus) && defined(USE_PPOLL_IN_VIO)
59 #include <signal.h>
60 #include <atomic>
61 #elif defined(__cplusplus) && defined(HAVE_KQUEUE)
62 #include <sys/event.h>
63 #include <atomic>
64 #endif
65 
66 #ifdef HAVE_PSI_INTERFACE
67 void init_vio_psi_keys();
68 #endif
69 
70 #ifndef MYSQL_VIO
71 struct Vio;
72 
73 typedef Vio Vio;
74 #define MYSQL_VIO Vio *
75 #endif
76 
77 enum enum_vio_type : int {
78  /**
79  Type of the connection is unknown.
80  */
82  /**
83  Used in case of TCP/IP connections.
84  */
86  /**
87  Used for Unix Domain socket connections. Unix only.
88  */
90  /**
91  Used for named pipe connections. Windows only.
92  */
94  /**
95  Used in case of SSL connections.
96  */
98  /**
99  Used for shared memory connections. Windows only.
100  */
102  /**
103  Used internally by the prepared statements
104  */
106  /**
107  Implicitly used by plugins that doesn't support any other VIO_TYPE.
108  */
110 
112  /*
113  If a new type is added, please update LAST_VIO_TYPE. In addition, please
114  change get_vio_type_name() in vio/vio.c to return correct name for it.
115  */
117 };
118 
119 /**
120  Convert a vio type to a printable string.
121  @param vio_type the type
122  @param[out] str the string
123  @param[out] len the string length
124 */
125 void get_vio_type_name(enum enum_vio_type vio_type, const char **str, int *len);
126 
127 /**
128  VIO I/O events.
129 */
134 };
135 
136 #define VIO_SOCKET_ERROR ((size_t)-1)
137 #define VIO_SOCKET_WANT_READ ((size_t)-2)
138 #define VIO_SOCKET_WANT_WRITE ((size_t)-3)
139 
140 #define VIO_LOCALHOST 1 /* a localhost connection */
141 #define VIO_BUFFERED_READ 2 /* use buffered read */
142 #define VIO_READ_BUFFER_SIZE 16384 /* size of read buffer */
143 #define OPENSSL_ERROR_LENGTH 512 /* Openssl error code max length */
144 
147  enum enum_vio_type type, uint flags);
148 
149 #ifdef _WIN32
150 MYSQL_VIO vio_new_win32pipe(HANDLE hPipe);
151 MYSQL_VIO vio_new_win32shared_memory(HANDLE handle_file_map, HANDLE handle_map,
152  HANDLE event_server_wrote,
153  HANDLE event_server_read,
154  HANDLE event_client_wrote,
155  HANDLE event_client_read,
156  HANDLE event_conn_closed);
157 #else
158 #define HANDLE void *
159 #endif /* _WIN32 */
160 
163 bool vio_reset(MYSQL_VIO vio, enum enum_vio_type type, my_socket sd, void *ssl,
164  uint flags);
165 bool vio_is_blocking(Vio *vio);
166 int vio_set_blocking(Vio *vio, bool set_blocking_mode);
168 size_t vio_read(MYSQL_VIO vio, uchar *buf, size_t size);
169 size_t vio_read_buff(MYSQL_VIO vio, uchar *buf, size_t size);
170 size_t vio_write(MYSQL_VIO vio, const uchar *buf, size_t size);
171 /* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
173 /* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */
174 int vio_keepalive(MYSQL_VIO vio, bool onoff);
175 /* Whenever we should retry the last read/write operation. */
177 /* Check that operation was timed out */
179 #ifndef NDEBUG
180 /* Short text description of the socket for those, who are curious.. */
181 #define VIO_DESCRIPTION_SIZE 30 /* size of description */
182 void vio_description(MYSQL_VIO vio, char *buf);
183 #endif // NDEBUG
184 /* Return the type of the connection */
185 enum enum_vio_type vio_type(const MYSQL_VIO vio);
186 /* Return last error number */
188 /* Get socket number */
190 /* Remote peer's address and name in text form */
191 bool vio_peer_addr(MYSQL_VIO vio, char *buf, uint16 *port, size_t buflen);
192 /* Wait for an I/O event notification. */
195 #ifndef NDEBUG
196 ssize_t vio_pending(MYSQL_VIO vio);
197 #endif
198 /* Set timeout for a network operation. */
199 int vio_timeout(MYSQL_VIO vio, uint which, int timeout_sec);
200 /* Connect to a peer. */
201 bool vio_socket_connect(MYSQL_VIO vio, struct sockaddr *addr, socklen_t len,
202  bool nonblocking, int timeout,
203  bool *connect_done = nullptr);
204 
205 bool vio_get_normalized_ip_string(const struct sockaddr *addr,
206  size_t addr_length, char *ip_string,
207  size_t ip_string_size);
208 
209 bool vio_is_no_name_error(int err_code);
210 
211 int vio_getnameinfo(const struct sockaddr *sa, char *hostname,
212  size_t hostname_size, char *port, size_t port_size,
213  int flags);
214 
215 extern "C" {
216 #include <openssl/opensslv.h>
217 }
218 #if OPENSSL_VERSION_NUMBER < 0x0090700f
219 #define DES_cblock des_cblock
220 #define DES_key_schedule des_key_schedule
221 #define DES_set_key_unchecked(k, ks) des_set_key_unchecked((k), *(ks))
222 #define DES_ede3_cbc_encrypt(i, o, l, k1, k2, k3, iv, e) \
223  des_ede3_cbc_encrypt((i), (o), (l), *(k1), *(k2), *(k3), (iv), (e))
224 #endif
225 
226 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
227 #define HAVE_OPENSSL11 1
228 #endif // OPENSSL_VERSION_NUMBER
229 
230 #define HEADER_DES_LOCL_H dummy_something
231 
232 #include <openssl/err.h>
233 #include <openssl/ssl.h>
234 
251 };
252 const char *sslGetErrString(enum enum_ssl_init_error err);
253 
254 struct st_VioSSLFd {
255  SSL_CTX *ssl_context;
256 };
257 
259  unsigned long *errptr);
261  unsigned long *errptr, SSL **ssl);
262 
264  const char *key_file, const char *cert_file, const char *ca_file,
265  const char *ca_path, const char *cipher, const char *ciphersuites,
266  enum enum_ssl_init_error *error, const char *crl_file, const char *crl_path,
267  const long ssl_ctx_flags, const char *server_host);
268 
269 long process_tls_version(const char *tls_version);
270 
271 int set_fips_mode(const uint fips_mode, char *err_string);
272 
274 
275 int test_ssl_fips_mode(char *err_string);
276 
278  const char *key_file, const char *cert_file, const char *ca_file,
279  const char *ca_path, const char *cipher, const char *ciphersuites,
280  enum enum_ssl_init_error *error, const char *crl_file, const char *crl_path,
281  const long ssl_ctx_flags);
282 void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
283 
284 void vio_ssl_end();
285 
286 void ssl_start(void);
287 void vio_end(void);
288 
289 #if !defined(DONT_MAP_VIO)
290 #define vio_delete(vio) (vio)->viodelete(vio)
291 #define vio_errno(vio) (vio)->vioerrno(vio)
292 #define vio_read(vio, buf, size) ((vio)->read)(vio, buf, size)
293 #define vio_write(vio, buf, size) ((vio)->write)(vio, buf, size)
294 #define vio_fastsend(vio) (vio)->fastsend(vio)
295 #define vio_keepalive(vio, set_keep_alive) \
296  (vio)->viokeepalive(vio, set_keep_alive)
297 #define vio_should_retry(vio) (vio)->should_retry(vio)
298 #define vio_was_timeout(vio) (vio)->was_timeout(vio)
299 #define vio_shutdown(vio) ((vio)->vioshutdown)(vio)
300 #define vio_peer_addr(vio, buf, prt, buflen) \
301  (vio)->peer_addr(vio, buf, prt, buflen)
302 #define vio_io_wait(vio, event, timeout) (vio)->io_wait(vio, event, timeout)
303 #define vio_is_connected(vio) (vio)->is_connected(vio)
304 #define vio_is_blocking(vio) (vio)->is_blocking(vio)
305 #define vio_set_blocking(vio, val) (vio)->set_blocking(vio, val)
306 #define vio_set_blocking_flag(vio, val) (vio)->set_blocking_flag(vio, val)
307 #endif /* !defined(DONT_MAP_VIO) */
308 
309 /* This enumerator is used in parser - should be always visible */
310 enum SSL_type {
316 };
317 
318 /*
319  This structure is for every connection on both sides.
320  Note that it has a non-default move assignment operator, so if adding more
321  members, you'll need to update operator=.
322 */
323 struct Vio {
324  MYSQL_SOCKET mysql_socket; /* Instrumented socket */
325  bool localhost = {false}; /* Are we from localhost? */
326  enum_vio_type type = {NO_VIO_TYPE}; /* Type of connection */
327 
328  int read_timeout = {-1}; /* Timeout value (ms) for read ops. */
329  int write_timeout = {-1}; /* Timeout value (ms) for write ops. */
330  int retry_count = {1}; /* Retry count */
331  bool inactive = {false}; /* Connection has been shutdown */
332 
333  struct sockaddr_storage local; /* Local internet address */
334  struct sockaddr_storage remote; /* Remote internet address */
335  size_t addrLen = {0}; /* Length of remote address */
336  char *read_buffer = {nullptr}; /* buffer for vio_read_buff */
337  char *read_pos = {nullptr}; /* start of unfetched data in the
338  read buffer */
339  char *read_end = {nullptr}; /* end of unfetched data */
340 
341 #ifdef USE_PPOLL_IN_VIO
342  my_thread_t thread_id = {0}; // Thread PID
343  sigset_t signal_mask; // Signal mask
344  /*
345  Flag to indicate whether we are in poll or shutdown.
346  A true value of flag indicates either the socket
347  has called shutdown or it is sleeping on a poll call.
348  False value of this flag means that the socket is
349  not sleeping on a poll call.
350  This flag provides synchronization between two threads
351  one entering vio_io_wait and another entering vio_shutdown
352  for the same socket. If the other thread is waiting on poll
353  sleep, it wakes up the thread by sending a signal via
354  pthread_kill. Also it ensures that no other thread enters in
355  to a poll call if it's socket has undergone shutdown.
356 
357  */
358  std::atomic_flag poll_shutdown_flag = ATOMIC_FLAG_INIT;
359 #elif defined HAVE_KQUEUE
360  int kq_fd = {-1};
361  std::atomic_flag kevent_wakeup_flag = ATOMIC_FLAG_INIT;
362 #endif
363 
364 #ifdef HAVE_SETNS
365  /**
366  Socket network namespace.
367  */
368  char network_namespace[256];
369 #endif
370  /*
371  VIO vtable interface to be implemented by VIO's like SSL, Socket,
372  Named Pipe, etc.
373  */
374 
375  /*
376  viodelete is responsible for cleaning up the VIO object by freeing
377  internal buffers, closing descriptors, handles.
378  */
379  void (*viodelete)(MYSQL_VIO) = {nullptr};
380  int (*vioerrno)(MYSQL_VIO) = {nullptr};
381  size_t (*read)(MYSQL_VIO, uchar *, size_t) = {nullptr};
382  size_t (*write)(MYSQL_VIO, const uchar *, size_t) = {nullptr};
383  int (*timeout)(MYSQL_VIO, uint, bool) = {nullptr};
384  int (*viokeepalive)(MYSQL_VIO, bool) = {nullptr};
385  int (*fastsend)(MYSQL_VIO) = {nullptr};
386  bool (*peer_addr)(MYSQL_VIO, char *, uint16 *, size_t) = {nullptr};
387  void (*in_addr)(MYSQL_VIO, struct sockaddr_storage *) = {nullptr};
388  bool (*should_retry)(MYSQL_VIO) = {nullptr};
389  bool (*was_timeout)(MYSQL_VIO) = {nullptr};
390  /*
391  vioshutdown is resposnible to shutdown/close the channel, so that no
392  further communications can take place, however any related buffers,
393  descriptors, handles can remain valid after a shutdown.
394  */
395  int (*vioshutdown)(MYSQL_VIO) = {nullptr};
396  bool (*is_connected)(MYSQL_VIO) = {nullptr};
397  bool (*has_data)(MYSQL_VIO) = {nullptr};
398  int (*io_wait)(MYSQL_VIO, enum enum_vio_io_event, int) = {nullptr};
399  bool (*connect)(MYSQL_VIO, struct sockaddr *, socklen_t, int) = {nullptr};
400 #ifdef _WIN32
401 #ifdef __clang__
402  OVERLAPPED overlapped = {0, 0, {{0, 0}}, nullptr};
403 #else
404  // MSVC, at least up to 2015, gives an internal error on the above.
405  OVERLAPPED overlapped = {0};
406 #endif
407  HANDLE hPipe{nullptr};
408 #endif
409  void *ssl_arg = {nullptr};
414 #if defined(_WIN32)
415  HANDLE handle_file_map = {nullptr};
416  char *handle_map = {nullptr};
417  HANDLE event_server_wrote = {nullptr};
418  HANDLE event_server_read = {nullptr};
419  HANDLE event_client_wrote = {nullptr};
420  HANDLE event_client_read = {nullptr};
421  HANDLE event_conn_closed = {nullptr};
422  size_t shared_memory_remain = {0};
423  char *shared_memory_pos = {nullptr};
424 
425 #endif /* _WIN32 */
426  bool (*is_blocking)(Vio *vio) = {nullptr};
427  int (*set_blocking)(Vio *vio, bool val) = {nullptr};
428  int (*set_blocking_flag)(Vio *vio, bool val) = {nullptr};
429  /* Indicates whether socket or SSL based communication is blocking or not. */
430  bool is_blocking_flag = {true};
431 
432  private:
434  friend void internal_vio_delete(Vio *vio);
435  friend bool vio_reset(Vio *vio, enum_vio_type type, my_socket sd, void *ssl,
436  uint flags);
437 
438  explicit Vio(uint flags);
439  ~Vio();
440 
441  public:
442  Vio(const Vio &) = delete;
443  Vio &operator=(const Vio &) = delete;
444  Vio &operator=(Vio &&vio);
445 };
446 
447 #define SSL_handle SSL *
448 
449 #endif /* vio_violite_h_ */
struct PSI_socket_locker PSI_socket_locker
Definition: psi_socket_bits.h:76
static int flags[50]
Definition: hp_test1.cc:39
static int kq_fd
Definition: kqueue_timers.cc:44
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:51
uint16_t uint16
Definition: my_inttypes.h:64
Types to make file and socket I/O compatible.
int my_socket
Definition: my_io_bits.h:59
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
Types to make different thread packages compatible.
pthread_t my_thread_t
Definition: my_thread_bits.h:47
Log error(cerr, "ERROR")
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1053
Definition: buf0block_hint.cc:29
constexpr value_type ssl
Definition: classic_protocol_constants.h:48
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:908
Definition: local.h:59
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:493
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:32
required string type
Definition: replication_group_member_actions.proto:33
required string event
Definition: replication_group_member_actions.proto:31
struct sockaddr sockaddr
Definition: sock_probe_win32.h:62
struct in_addr in_addr
Definition: sock_probe_win32.h:64
An instrumented socket.
Definition: mysql_socket_bits.h:34
State data storage for start_socket_wait_v1_t.
Definition: psi_socket_bits.h:157
Definition: violite.h:323
size_t(* read)(MYSQL_VIO, uchar *, size_t)
Definition: violite.h:381
PSI_socket_locker_state m_psi_write_state
Definition: violite.h:413
friend Vio * internal_vio_create(uint flags)
Definition: vio.cc:409
char * read_end
Definition: violite.h:339
bool localhost
Definition: violite.h:325
friend bool vio_reset(Vio *vio, enum_vio_type type, my_socket sd, void *ssl, uint flags)
int(* vioshutdown)(MYSQL_VIO)
Definition: violite.h:395
int write_timeout
Definition: violite.h:329
int(* fastsend)(MYSQL_VIO)
Definition: violite.h:385
sigset_t signal_mask
Definition: violite.h:343
char * read_buffer
Definition: violite.h:336
int(* set_blocking)(Vio *vio, bool val)
Definition: violite.h:427
PSI_socket_locker_state m_psi_read_state
Definition: violite.h:411
bool(* should_retry)(MYSQL_VIO)
Definition: violite.h:388
std::atomic_flag poll_shutdown_flag
Definition: violite.h:358
char network_namespace[256]
Socket network namespace.
Definition: violite.h:368
char * read_pos
Definition: violite.h:337
int(* set_blocking_flag)(Vio *vio, bool val)
Definition: violite.h:428
int(* vioerrno)(MYSQL_VIO)
Definition: violite.h:380
bool(* is_blocking)(Vio *vio)
Definition: violite.h:426
size_t(* write)(MYSQL_VIO, const uchar *, size_t)
Definition: violite.h:382
bool is_blocking_flag
Definition: violite.h:430
bool(* peer_addr)(MYSQL_VIO, char *, uint16 *, size_t)
Definition: violite.h:386
enum_vio_type type
Definition: violite.h:326
bool(* connect)(MYSQL_VIO, struct sockaddr *, socklen_t, int)
Definition: violite.h:399
friend void internal_vio_delete(Vio *vio)
Definition: vio.cc:538
void(* viodelete)(MYSQL_VIO)
Definition: violite.h:379
bool inactive
Definition: violite.h:331
my_thread_t thread_id
Definition: violite.h:342
Vio & operator=(const Vio &)=delete
~Vio()
Definition: vio.cc:114
int(* viokeepalive)(MYSQL_VIO, bool)
Definition: violite.h:384
struct PSI_socket_locker * m_psi_write_locker
Definition: violite.h:412
size_t addrLen
Definition: violite.h:335
Vio(const Vio &)=delete
MYSQL_SOCKET mysql_socket
Definition: violite.h:324
bool(* was_timeout)(MYSQL_VIO)
Definition: violite.h:389
struct PSI_socket_locker * m_psi_read_locker
Definition: violite.h:410
int retry_count
Definition: violite.h:330
void * ssl_arg
Definition: violite.h:409
Vio(uint flags)
Definition: vio.cc:100
int read_timeout
Definition: violite.h:328
int(* io_wait)(MYSQL_VIO, enum enum_vio_io_event, int)
Definition: violite.h:398
int(* timeout)(MYSQL_VIO, uint, bool)
Definition: violite.h:383
struct sockaddr_storage remote
Definition: violite.h:334
bool(* is_connected)(MYSQL_VIO)
Definition: violite.h:396
bool(* has_data)(MYSQL_VIO)
Definition: violite.h:397
Definition: violite.h:254
SSL_CTX * ssl_context
Definition: violite.h:255
unsigned int uint
Definition: uca-dump.cc:29
void vio_ssl_end()
Definition: viosslfactories.cc:438
#define vio_errno(vio)
Definition: violite.h:291
my_socket vio_fd(MYSQL_VIO vio)
int test_ssl_fips_mode(char *err_string)
Toggle FIPS mode, to see whether it is available with the current SSL library.
Definition: viosslfactories.cc:534
SSL_type
Definition: violite.h:310
@ SSL_TYPE_NOT_SPECIFIED
Definition: violite.h:311
@ SSL_TYPE_NONE
Definition: violite.h:312
@ SSL_TYPE_ANY
Definition: violite.h:313
@ SSL_TYPE_X509
Definition: violite.h:314
@ SSL_TYPE_SPECIFIED
Definition: violite.h:315
#define vio_is_blocking(vio)
Definition: violite.h:304
#define vio_keepalive(vio, set_keep_alive)
Definition: violite.h:295
MYSQL_VIO vio_new(my_socket sd, enum enum_vio_type type, uint flags)
Definition: vio.cc:436
bool vio_reset(MYSQL_VIO vio, enum enum_vio_type type, my_socket sd, void *ssl, uint flags)
long process_tls_version(const char *tls_version)
Definition: viosslfactories.cc:544
enum enum_vio_type vio_type(const MYSQL_VIO vio)
struct st_VioSSLFd * new_VioSSLConnectorFd(const char *key_file, const char *cert_file, const char *ca_file, const char *ca_path, const char *cipher, const char *ciphersuites, enum enum_ssl_init_error *error, const char *crl_file, const char *crl_path, const long ssl_ctx_flags, const char *server_host)
Definition: viosslfactories.cc:809
void ssl_start(void)
Definition: viosslfactories.cc:460
int set_fips_mode(const uint fips_mode, char *err_string)
struct st_VioSSLFd * new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, const char *ca_file, const char *ca_path, const char *cipher, const char *ciphersuites, enum enum_ssl_init_error *error, const char *crl_file, const char *crl_path, const long ssl_ctx_flags)
Definition: viosslfactories.cc:837
int sslaccept(struct st_VioSSLFd *, MYSQL_VIO, long timeout, unsigned long *errptr)
void vio_end(void)
Definition: vio.cc:552
int vio_timeout(MYSQL_VIO vio, uint which, int timeout_sec)
#define MYSQL_VIO
Definition: violite.h:74
#define vio_should_retry(vio)
Definition: violite.h:297
#define vio_set_blocking_flag(vio, val)
Definition: violite.h:306
void get_vio_type_name(enum enum_vio_type vio_type, const char **str, int *len)
Convert a vio type to a printable string.
Definition: vio.cc:573
void vio_description(MYSQL_VIO vio, char *buf)
enum_ssl_init_error
Definition: violite.h:235
@ SSL_FIPS_MODE_INVALID
Definition: violite.h:246
@ SSL_INITERR_NO_USABLE_CTX
Definition: violite.h:243
@ SSL_FIPS_MODE_FAILED
Definition: violite.h:247
@ SSL_INITERR_X509_VERIFY_PARAM
Definition: violite.h:249
@ SSL_INITERR_KEY
Definition: violite.h:238
@ SSL_INITERR_LASTERR
Definition: violite.h:250
@ SSL_INITERR_CERT
Definition: violite.h:237
@ SSL_INITERR_BAD_PATHS
Definition: violite.h:240
@ SSL_INITERR_NOMATCH
Definition: violite.h:239
@ SSL_INITERR_MEMFAIL
Definition: violite.h:242
@ SSL_INITERR_ECDHFAIL
Definition: violite.h:248
@ SSL_INITERR_CIPHERS
Definition: violite.h:241
@ SSL_TLS_VERSION_INVALID
Definition: violite.h:245
@ SSL_INITERR_NOERROR
Definition: violite.h:236
@ SSL_INITERR_DHFAIL
Definition: violite.h:244
void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd)
Definition: viosslfactories.cc:866
bool vio_is_no_name_error(int err_code)
Checks if the error code, returned by vio_getnameinfo(), means it was the "No-name" error.
Definition: viosocket.cc:1215
const char * sslGetErrString(enum enum_ssl_init_error err)
Definition: viosslfactories.cc:236
enum_vio_io_event
VIO I/O events.
Definition: violite.h:130
@ VIO_IO_EVENT_WRITE
Definition: violite.h:132
@ VIO_IO_EVENT_CONNECT
Definition: violite.h:133
@ VIO_IO_EVENT_READ
Definition: violite.h:131
#define vio_fastsend(vio)
Definition: violite.h:294
uint get_fips_mode()
Get fips mode from openssl library,.
Definition: viosslfactories.cc:527
#define vio_set_blocking(vio, val)
Definition: violite.h:305
#define vio_shutdown(vio)
Definition: violite.h:299
size_t vio_read_buff(MYSQL_VIO vio, uchar *buf, size_t size)
#define vio_delete(vio)
Definition: violite.h:290
bool vio_socket_connect(MYSQL_VIO vio, struct sockaddr *addr, socklen_t len, bool nonblocking, int timeout, bool *connect_done=nullptr)
void init_vio_psi_keys()
Definition: vio.cc:61
#define HANDLE
Definition: violite.h:158
#define vio_peer_addr(vio, buf, prt, buflen)
Definition: violite.h:300
ssize_t vio_pending(MYSQL_VIO vio)
Vio Vio
Definition: violite.h:71
#define vio_was_timeout(vio)
Definition: violite.h:298
#define vio_read(vio, buf, size)
Definition: violite.h:292
#define vio_write(vio, buf, size)
Definition: violite.h:293
#define vio_io_wait(vio, event, timeout)
Definition: violite.h:302
enum_vio_type
Definition: violite.h:77
@ LAST_VIO_TYPE
Definition: violite.h:116
@ VIO_TYPE_SHARED_MEMORY
Used for shared memory connections.
Definition: violite.h:101
@ NO_VIO_TYPE
Type of the connection is unknown.
Definition: violite.h:81
@ FIRST_VIO_TYPE
Definition: violite.h:111
@ VIO_TYPE_PLUGIN
Implicitly used by plugins that doesn't support any other VIO_TYPE.
Definition: violite.h:109
@ VIO_TYPE_SSL
Used in case of SSL connections.
Definition: violite.h:97
@ VIO_TYPE_NAMEDPIPE
Used for named pipe connections.
Definition: violite.h:93
@ VIO_TYPE_TCPIP
Used in case of TCP/IP connections.
Definition: violite.h:85
@ VIO_TYPE_LOCAL
Used internally by the prepared statements.
Definition: violite.h:105
@ VIO_TYPE_SOCKET
Used for Unix Domain socket connections.
Definition: violite.h:89
int sslconnect(struct st_VioSSLFd *, MYSQL_VIO, long timeout, unsigned long *errptr, SSL **ssl)
bool vio_get_normalized_ip_string(const struct sockaddr *addr, size_t addr_length, char *ip_string, size_t ip_string_size)
Return the normalized IP address string for a sock-address.
Definition: viosocket.cc:625
#define vio_is_connected(vio)
Definition: violite.h:303
MYSQL_VIO mysql_socket_vio_new(MYSQL_SOCKET mysql_socket, enum enum_vio_type type, uint flags)
Definition: vio.cc:417
int vio_getnameinfo(const struct sockaddr *sa, char *hostname, size_t hostname_size, char *port, size_t port_size, int flags)
This is a wrapper for the system getnameinfo(), because different OS differ in the getnameinfo() impl...
Definition: viosocket.cc:1236