MySQL 8.4.3
Source Code Documentation
Vio Struct Reference

#include <violite.h>

Public Member Functions

 Vio (const Vio &)=delete
 
Viooperator= (const Vio &)=delete
 
Viooperator= (Vio &&vio)
 

Public Attributes

MYSQL_SOCKET mysql_socket
 
bool localhost = {false}
 
enum_vio_type type = {NO_VIO_TYPE}
 
int read_timeout = {-1}
 
int write_timeout = {-1}
 
int retry_count = {1}
 
bool inactive = {false}
 
struct sockaddr_storage local
 
struct sockaddr_storage remote
 
size_t addrLen = {0}
 
char * read_buffer = {nullptr}
 
char * read_pos = {nullptr}
 
char * read_end = {nullptr}
 
std::optional< my_thread_tthread_id = 0
 Thread PID which is to be sent SIGALRM to terminate ppoll wait when shutting down vio. More...
 
sigset_t signal_mask
 
std::atomic_flag poll_shutdown_flag = ATOMIC_FLAG_INIT
 
char network_namespace [256]
 Socket network namespace. More...
 
void(* viodelete )(MYSQL_VIO) = {nullptr}
 
int(* vioerrno )(MYSQL_VIO) = {nullptr}
 
size_t(* read )(MYSQL_VIO, uchar *, size_t) = {nullptr}
 
size_t(* write )(MYSQL_VIO, const uchar *, size_t) = {nullptr}
 
int(* timeout )(MYSQL_VIO, uint, bool) = {nullptr}
 
int(* viokeepalive )(MYSQL_VIO, bool) = {nullptr}
 
int(* fastsend )(MYSQL_VIO) = {nullptr}
 
bool(* peer_addr )(MYSQL_VIO, char *, uint16 *, size_t) = {nullptr}
 
void(* in_addr )(MYSQL_VIO, struct sockaddr_storage *) = {nullptr}
 
bool(* should_retry )(MYSQL_VIO) = {nullptr}
 
bool(* was_timeout )(MYSQL_VIO) = {nullptr}
 
int(* vioshutdown )(MYSQL_VIO) = {nullptr}
 
bool(* is_connected )(MYSQL_VIO) = {nullptr}
 
bool(* has_data )(MYSQL_VIO) = {nullptr}
 
int(* io_wait )(MYSQL_VIO, enum enum_vio_io_event, int) = {nullptr}
 
bool(* connect )(MYSQL_VIO, struct sockaddr *, socklen_t, int) = {nullptr}
 
void * ssl_arg = {nullptr}
 
struct PSI_socket_lockerm_psi_read_locker = {nullptr}
 
PSI_socket_locker_state m_psi_read_state
 
struct PSI_socket_lockerm_psi_write_locker = {nullptr}
 
PSI_socket_locker_state m_psi_write_state
 
bool(* is_blocking )(Vio *vio) = {nullptr}
 
int(* set_blocking )(Vio *vio, bool val) = {nullptr}
 
int(* set_blocking_flag )(Vio *vio, bool val) = {nullptr}
 
bool is_blocking_flag = {true}
 

Private Member Functions

 Vio (uint flags)
 
 ~Vio ()
 

Friends

Viointernal_vio_create (uint flags)
 
void internal_vio_delete (Vio *vio)
 
bool vio_reset (Vio *vio, enum_vio_type type, my_socket sd, void *ssl, uint flags)
 Reinitialize an existing Vio object. More...
 

Constructor & Destructor Documentation

◆ Vio() [1/2]

Vio::Vio ( uint  flags)
explicitprivate

◆ ~Vio()

Vio::~Vio ( )
private

◆ Vio() [2/2]

Vio::Vio ( const Vio )
delete

Member Function Documentation

◆ operator=() [1/2]

Vio & Vio::operator= ( const Vio )
delete

◆ operator=() [2/2]

Vio & Vio::operator= ( Vio &&  vio)

Friends And Related Function Documentation

◆ internal_vio_create

Vio * internal_vio_create ( uint  flags)
friend

◆ internal_vio_delete

void internal_vio_delete ( Vio vio)
friend

◆ vio_reset

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

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.

Member Data Documentation

◆ addrLen

size_t Vio::addrLen = {0}

◆ connect

bool(* Vio::connect) (MYSQL_VIO, struct sockaddr *, socklen_t, int) = {nullptr}

◆ fastsend

int(* Vio::fastsend) (MYSQL_VIO) = {nullptr}

◆ has_data

bool(* Vio::has_data) (MYSQL_VIO) = {nullptr}

◆ in_addr

void(* Vio::in_addr) (MYSQL_VIO, struct sockaddr_storage *) = {nullptr}

◆ inactive

bool Vio::inactive = {false}

◆ io_wait

int(* Vio::io_wait) (MYSQL_VIO, enum enum_vio_io_event, int) = {nullptr}

◆ is_blocking

bool(* Vio::is_blocking) (Vio *vio) = {nullptr}

◆ is_blocking_flag

bool Vio::is_blocking_flag = {true}

◆ is_connected

bool(* Vio::is_connected) (MYSQL_VIO) = {nullptr}

◆ local

struct sockaddr_storage Vio::local

◆ localhost

bool Vio::localhost = {false}

◆ m_psi_read_locker

struct PSI_socket_locker* Vio::m_psi_read_locker = {nullptr}

◆ m_psi_read_state

PSI_socket_locker_state Vio::m_psi_read_state

◆ m_psi_write_locker

struct PSI_socket_locker* Vio::m_psi_write_locker = {nullptr}

◆ m_psi_write_state

PSI_socket_locker_state Vio::m_psi_write_state

◆ mysql_socket

MYSQL_SOCKET Vio::mysql_socket

◆ network_namespace

char Vio::network_namespace[256]

Socket network namespace.

◆ peer_addr

bool(* Vio::peer_addr) (MYSQL_VIO, char *, uint16 *, size_t) = {nullptr}

◆ poll_shutdown_flag

std::atomic_flag Vio::poll_shutdown_flag = ATOMIC_FLAG_INIT

◆ read

size_t(* Vio::read) (MYSQL_VIO, uchar *, size_t) = {nullptr}

◆ read_buffer

char* Vio::read_buffer = {nullptr}

◆ read_end

char* Vio::read_end = {nullptr}

◆ read_pos

char* Vio::read_pos = {nullptr}

◆ read_timeout

int Vio::read_timeout = {-1}

◆ remote

struct sockaddr_storage Vio::remote

◆ retry_count

int Vio::retry_count = {1}

◆ set_blocking

int(* Vio::set_blocking) (Vio *vio, bool val) = {nullptr}

◆ set_blocking_flag

int(* Vio::set_blocking_flag) (Vio *vio, bool val) = {nullptr}

◆ should_retry

bool(* Vio::should_retry) (MYSQL_VIO) = {nullptr}

◆ signal_mask

sigset_t Vio::signal_mask

◆ ssl_arg

void* Vio::ssl_arg = {nullptr}

◆ thread_id

std::optional<my_thread_t> Vio::thread_id = 0

Thread PID which is to be sent SIGALRM to terminate ppoll wait when shutting down vio.

It is made an std::optional so that server code has the ability to set this to an illegal value and thereby ensure that it is set before shutting down vio. In the server the THD and thereby the Vio can switch between OS threads, so it does not make sense to assign the thread id when creating the THD/Vio.

It is initialized to 0 here, meaning don't attempt to send a signal, to keep non-server code unaffected.

◆ timeout

int(* Vio::timeout) (MYSQL_VIO, uint, bool) = {nullptr}

◆ type

enum_vio_type Vio::type = {NO_VIO_TYPE}

◆ viodelete

void(* Vio::viodelete) (MYSQL_VIO) = {nullptr}

◆ vioerrno

int(* Vio::vioerrno) (MYSQL_VIO) = {nullptr}

◆ viokeepalive

int(* Vio::viokeepalive) (MYSQL_VIO, bool) = {nullptr}

◆ vioshutdown

int(* Vio::vioshutdown) (MYSQL_VIO) = {nullptr}

◆ was_timeout

bool(* Vio::was_timeout) (MYSQL_VIO) = {nullptr}

◆ write

size_t(* Vio::write) (MYSQL_VIO, const uchar *, size_t) = {nullptr}

◆ write_timeout

int Vio::write_timeout = {-1}

The documentation for this struct was generated from the following files: