Virtual I/O layer, only used with TCP/IP sockets at the moment.
More...
#include <vio.h>
List of all members.
Public Member Functions |
| Vio (int sd) |
int | close () |
size_t | read (unsigned char *buf, size_t size) |
size_t | write (const unsigned char *buf, size_t size) |
int | blocking (bool set_blocking_mode, bool *old_mode) |
int | fastsend () |
int32_t | keepalive (bool set_keep_alive) |
bool | should_retry () const |
bool | was_interrupted () const |
bool | peer_addr (char *buf, uint16_t *port, size_t buflen) const |
void | timeout (bool is_sndtimeo, int32_t timeout) |
int | get_errno () const |
int | get_fd () const |
char * | get_read_pos () const |
char * | get_read_end () const |
Private Attributes |
bool | closed |
int | sd |
int | fcntl_mode |
struct sockaddr_storage | local |
struct sockaddr_storage | remote |
char * | read_pos |
char * | read_end |
Detailed Description
Virtual I/O layer, only used with TCP/IP sockets at the moment.
Definition at line 28 of file vio.h.
Constructor & Destructor Documentation
drizzle_plugin::Vio::Vio |
( |
int |
sd | ) |
|
Constructor.
- Parameters:
-
Definition at line 46 of file vio.cc.
Member Function Documentation
int drizzle_plugin::Vio::blocking |
( |
bool |
set_blocking_mode, |
|
|
bool * |
old_mode |
|
) |
| |
Set device blocking mode.
- Parameters:
-
[in] | set_blocking_mode | Whether the device should block. true sets blocking mode, false clears it. |
[out] | old_mode | This will be set to the previous blocking mode. |
- Returns:
- 0 on success.
Definition at line 112 of file vio.cc.
int drizzle_plugin::Vio::close |
( |
void |
| ) |
|
Close the connection.
- Returns:
- 0 on success.
Definition at line 75 of file vio.cc.
int drizzle_plugin::Vio::fastsend |
( |
| ) |
|
Enables fast sending. Setting this sets the TCP_NODELAY socket option.
- Returns:
- 0 on succcess.
Definition at line 140 of file vio.cc.
int drizzle_plugin::Vio::get_errno |
( |
| ) |
const |
Returns the last error code.
- Returns:
- the last error code, as described in errno.h
Definition at line 233 of file vio.cc.
int drizzle_plugin::Vio::get_fd |
( |
| ) |
const |
Get the underlying descriptor this class is using.
- Returns:
- The descriptor passed in to the constructor of this class.
Definition at line 238 of file vio.cc.
char * drizzle_plugin::Vio::get_read_end |
( |
| ) |
const |
Returns the current write position.
Definition at line 249 of file vio.cc.
char * drizzle_plugin::Vio::get_read_pos |
( |
| ) |
const |
Returns the current read position.
Definition at line 244 of file vio.cc.
int32_t drizzle_plugin::Vio::keepalive |
( |
bool |
set_keep_alive | ) |
|
Sets or clears the keepalive option.
- Parameters:
-
[in] | set_keep_alive | Whether to set or clear the flag. True Sets keepalive, false clears it. |
- Returns:
- 0 on success.
Definition at line 155 of file vio.cc.
bool drizzle_plugin::Vio::peer_addr |
( |
char * |
buf, |
|
|
uint16_t * |
port, |
|
|
size_t |
buflen |
|
) |
| const |
Gets the address details of the peer.
- Parameters:
-
[out] | buf | Buffer that will recieve the peer address. |
[out] | port | Port of remote end. |
[in] | buflen | Size of buf. |
- Returns:
- True on success, false otherwise.
Definition at line 187 of file vio.cc.
size_t drizzle_plugin::Vio::read |
( |
unsigned char * |
buf, |
|
|
size_t |
size |
|
) |
| |
Read some data from the remote end.
- Parameters:
-
[out] | buf | A buffer to write the new data to. |
[in] | size | The size of the buffer |
- Returns:
- The number of bytes read.
Definition at line 92 of file vio.cc.
bool drizzle_plugin::Vio::should_retry |
( |
| ) |
const |
- Returns:
- true if the caller should retry the last operation.
Definition at line 173 of file vio.cc.
void drizzle_plugin::Vio::timeout |
( |
bool |
is_sndtimeo, |
|
|
int32_t |
timeout |
|
) |
| |
Sets either the send, or recieve timeouts for the socket.
- Parameters:
-
[in] | is_sndtimeo | Set to true to change the send timeout, false to change the recieve timeout. |
[in] | timeout | The new timeout to set, in seconds. |
Definition at line 212 of file vio.cc.
bool drizzle_plugin::Vio::was_interrupted |
( |
| ) |
const |
- Returns:
- true if the last operation was interrupted.
Definition at line 180 of file vio.cc.
size_t drizzle_plugin::Vio::write |
( |
const unsigned char * |
buf, |
|
|
size_t |
size |
|
) |
| |
Write some data to the remote end.
- Parameters:
-
[in] | buf | A buffer that contains the data to send. |
[in] | size | The size of the buffer |
- Returns:
- The number of bytes written.
Definition at line 103 of file vio.cc.
The documentation for this class was generated from the following files:
- plugin/mysql_protocol/vio.h
- plugin/mysql_protocol/vio.cc