Drizzled Public API Documentation

drizzle_plugin::Vio Class Reference

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

Constructor.

Parameters:
[in]sdDescriptor to use.

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_modeWhether the device should block. true sets blocking mode, false clears it.
[out]old_modeThis will be set to the previous blocking mode.
Returns:
0 on success.

Definition at line 112 of file vio.cc.

Close the connection.

Returns:
0 on success.

Definition at line 75 of file vio.cc.

Enables fast sending. Setting this sets the TCP_NODELAY socket option.

Returns:
0 on succcess.

Definition at line 140 of file vio.cc.

Returns the last error code.

Returns:
the last error code, as described in errno.h

Definition at line 233 of file vio.cc.

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.

Returns the current write position.

Definition at line 249 of file vio.cc.

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_aliveWhether 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]bufBuffer that will recieve the peer address.
[out]portPort of remote end.
[in]buflenSize 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]bufA buffer to write the new data to.
[in]sizeThe size of the buffer
Returns:
The number of bytes read.

Definition at line 92 of file vio.cc.

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_sndtimeoSet to true to change the send timeout, false to change the recieve timeout.
[in]timeoutThe new timeout to set, in seconds.

Definition at line 212 of file vio.cc.

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]bufA buffer that contains the data to send.
[in]sizeThe 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: