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