MySQL 8.4.3
Source Code Documentation
vio.cc File Reference
#include <sys/types.h>
#include <new>
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_psi_config.h"
#include "mysql/psi/mysql_memory.h"
#include "mysql/psi/mysql_socket.h"
#include "mysql/psi/psi_memory.h"
#include "mysql/service_mysql_alloc.h"
#include "string_with_len.h"
#include "template_utils.h"
#include "vio/vio_priv.h"

Classes

struct  vio_string
 

Functions

void init_vio_psi_keys ()
 
Viointernal_vio_create (uint flags)
 
void internal_vio_delete (Vio *vio)
 
static bool has_no_data (Vio *vio)
 
static bool vio_init (Vio *vio, enum enum_vio_type type, my_socket sd, uint flags)
 
bool vio_reset (Vio *vio, enum enum_vio_type type, my_socket sd, void *ssl, uint flags)
 Reinitialize an existing Vio object. More...
 
Viomysql_socket_vio_new (MYSQL_SOCKET mysql_socket, enum_vio_type type, uint flags)
 
Viovio_new (my_socket sd, enum enum_vio_type type, uint flags)
 
int vio_timeout (Vio *vio, uint which, int timeout_sec)
 Set timeout for a network send or receive operation. More...
 
void vio_delete (Vio *vio)
 
void vio_end ()
 
void get_vio_type_name (enum enum_vio_type vio_type, const char **str, int *len)
 Convert a vio type to a printable string. More...
 

Variables

PSI_memory_key key_memory_vio_ssl_fd
 
PSI_memory_key key_memory_vio
 
PSI_memory_key key_memory_vio_read_buffer
 
static PSI_memory_info all_vio_memory []
 
static const vio_string vio_type_names []
 Names for each VIO TYPE. More...
 

Function Documentation

◆ get_vio_type_name()

void get_vio_type_name ( enum enum_vio_type  vio_type,
const char **  str,
int *  len 
)

Convert a vio type to a printable string.

Parameters
vio_typethe type
[out]strthe string
[out]lenthe string length

◆ has_no_data()

static bool has_no_data ( Vio vio)
static

◆ init_vio_psi_keys()

void init_vio_psi_keys ( )

◆ internal_vio_create()

Vio * internal_vio_create ( uint  flags)

◆ internal_vio_delete()

void internal_vio_delete ( Vio vio)

◆ mysql_socket_vio_new()

Vio * mysql_socket_vio_new ( MYSQL_SOCKET  mysql_socket,
enum_vio_type  type,
uint  flags 
)

◆ vio_delete()

void vio_delete ( Vio vio)

◆ vio_end()

void vio_end ( void  )

◆ vio_init()

static bool vio_init ( Vio vio,
enum enum_vio_type  type,
my_socket  sd,
uint  flags 
)
static

◆ vio_new()

Vio * vio_new ( my_socket  sd,
enum enum_vio_type  type,
uint  flags 
)

◆ vio_reset()

bool vio_reset ( Vio vio,
enum enum_vio_type  type,
my_socket  sd,
void *  ssl,
uint  flags 
)

Reinitialize an existing Vio object.

Remarks
Used to rebind an initialized socket-based Vio object to another socket-based transport type. For example, rebind a TCP/IP transport to SSL.
If new socket handle passed to vio_reset() is not equal to the socket handle stored in Vio then socket handle will be closed before storing new value. If handles are equal then old socket is not closed. This is important for vio_reset() usage in ssl_do().
If any error occurs then Vio members won't be altered thus preserving socket handle stored in Vio and not taking ownership over socket handle passed as parameter.
Parameters
vioA VIO object.
typeA socket-based transport type.
sdThe socket.
sslAn optional SSL structure.
flagsFlags passed to new_vio.
Returns
Return value is zero on success.

◆ vio_timeout()

int vio_timeout ( Vio vio,
uint  which,
int  timeout_sec 
)

Set timeout for a network send or receive operation.

Note
A non-infinite timeout causes the socket to be set to non-blocking mode. On infinite timeouts, the socket is set to blocking mode.
A negative timeout means an infinite timeout.
Parameters
vioA VIO object.
whichWhether timeout is for send (1) or receive (0).
timeout_secTimeout interval in seconds.
Returns
false on success, true otherwise.

Variable Documentation

◆ all_vio_memory

PSI_memory_info all_vio_memory[]
static
Initial value:
= {
{&key_memory_vio, "vio", 0, 0, PSI_DOCUMENT_ME},
{&key_memory_vio_read_buffer, "read_buffer", 0, 0, PSI_DOCUMENT_ME},
}
#define PSI_DOCUMENT_ME
Definition: component_common.h:29
PSI_memory_key key_memory_vio_ssl_fd
Definition: vio.cc:52
PSI_memory_key key_memory_vio_read_buffer
Definition: vio.cc:54
PSI_memory_key key_memory_vio
Definition: vio.cc:53

◆ key_memory_vio

PSI_memory_key key_memory_vio

◆ key_memory_vio_read_buffer

PSI_memory_key key_memory_vio_read_buffer

◆ key_memory_vio_ssl_fd

PSI_memory_key key_memory_vio_ssl_fd

◆ vio_type_names

const vio_string vio_type_names[]
static
Initial value:
= {{"", 0},
{STRING_WITH_LEN("TCP/IP")},
{STRING_WITH_LEN("Socket")},
{STRING_WITH_LEN("Named Pipe")},
{STRING_WITH_LEN("SSL/TLS")},
{STRING_WITH_LEN("Shared Memory")},
{STRING_WITH_LEN("Internal")},
{STRING_WITH_LEN("Plugin")}}
#define STRING_WITH_LEN(X)
Definition: string_with_len.h:29

Names for each VIO TYPE.

Indexed by enum_vio_type. If you add more, please update audit_log.cc