Work busy, study busy, but still have to write a little.
St_vio, as the name implies, should refer to the virtual IO, which is VM io. According to the comments in the code, this is a highly abstract interprocess communication interface structure, MySQL, if it is not used in C + + class to abstract, then is the structure with function pointers to abstract, which is the C language most commonly used habits.
structSt_vio{my_socket SD; /*my_socket-real or imaginary sockets*/HANDLE hpipe/*look at style should only be used for Windows systems*/; my_bool localhost; /*is we from localhost? Is this network interface a local connection?? */intFcntl_mode;/*Buffered fcntl (SD,F_GETFL) cache fcntl Flag*/structSockaddr_storage Local;/*Local Internet address connection to the local port*/structSockaddr_storage remote;/*Remote Internet address connects to the remote location*/intAddrlen;/*length of remote address remote lengths*/enumEnum_vio_type type;/*Type of connection connection types, including whether the connection is closed, TCPIP connection, socket, pipe, SSL connection, shared memory, from the type, should be used to flag the communication mode of the connection*/Chardesc[ -];/*String Description describes*/Char*read_buffer;/*buffer for Vio_read_buff read Cache*/Char*read_pos;/*Start of unfetched data in Theread buffer begin reading Offset*/Char*read_end;/*End of unfetched data read ending position*//*function pointers. They is similar for socket/ssl/whatever the following is the corresponding "member function" of this struct.*/void(*viodelete) (vio*);/*Free vio structure body storage*/int(*vioerrno) (vio*);/*get the corresponding error code*/size_t (*read) (vio*, Uchar *, size_t);/*Read*/size_t (*write) (vio*,ConstUchar *, size_t);/*Write*/int(*vioblocking) (vio*, My_bool, My_bool *);/*blocked? I don't know what to do with it .*/My_bool (*is_blocking) (vio*);/*whether it has been blocked*/int(*viokeepalive) (vio*, My_bool);/*keep the Alive, the heartbeat? */int(*fastsend) (vio*);/*Quick Send*//*the following basic can be words too literally*/My_bool (*PEER_ADDR) (vio*,Char*, uint16*, size_t); void(*IN_ADDR) (vio*,structsockaddr_storage*); My_bool (*should_retry) (vio*); My_bool (*was_interrupted) (vio*);int(*vioclose) (vio*);void(*timeout) (vio*, unsignedintwhich, unsignedinttimeout); My_bool (*poll_read) (Vio *vio,UINTtimeout); My_bool (*is_connected) (vio*); My_bool (*has_data) (vio*); #ifdef Have_opensslvoid*ssl_arg;/*SSL Parameters*/#endif};
st_vio--inter-process communication interface abstract structural body