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>

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, size_t buflen, uint16_t &port) const
 
void timeout (bool is_sndtimeo, int32_t timeout)
 
int get_errno () const
 
int get_fd () const
 

Private Attributes

int sd
 
int fcntl_mode
 

Detailed Description

Virtual I/O layer, only used with TCP/IP sockets at the moment.

Definition at line 27 of file vio.h.

Constructor & Destructor Documentation

drizzle_plugin::Vio::Vio ( int  sd)

Constructor.

Parameters
[in]sdDescriptor to use.

Definition at line 45 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 92 of file vio.cc.

Referenced by drizzle_plugin::drizzleclient_net_real_write().

int drizzle_plugin::Vio::close ( void  )

Close the connection.

Returns
0 on success.

Definition at line 67 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 120 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 189 of file vio.cc.

Referenced by drizzle_plugin::drizzleclient_net_real_write(), and drizzle_plugin::my_real_read().

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 194 of file vio.cc.

Referenced by drizzle_plugin::my_real_read().

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 129 of file vio.cc.

bool drizzle_plugin::Vio::peer_addr ( char *  buf,
size_t  buflen,
uint16_t &  port 
) 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 153 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 82 of file vio.cc.

Referenced by drizzle_plugin::my_real_read().

bool drizzle_plugin::Vio::should_retry ( ) const
Returns
true if the caller should retry the last operation.

Definition at line 141 of file vio.cc.

Referenced by drizzle_plugin::drizzleclient_net_real_write(), and drizzle_plugin::my_real_read().

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 172 of file vio.cc.

bool drizzle_plugin::Vio::was_interrupted ( ) const
Returns
true if the last operation was interrupted.

Definition at line 147 of file vio.cc.

Referenced by drizzle_plugin::my_real_read().

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 87 of file vio.cc.

Referenced by drizzle_plugin::drizzleclient_net_real_write().


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