VMime
SASLSocket Class Reference
Inheritance diagram for SASLSocket:
Collaboration diagram for SASLSocket:

Public Member Functions

 SASLSocket (shared_ptr< SASLSession > sess, shared_ptr< net::socket > wrapped)
 
 ~SASLSocket ()
 
void connect (const string &address, const port_t port)
 
void disconnect ()
 
bool isConnected () const
 
bool waitForRead (const int msecs=30000)
 
bool waitForWrite (const int msecs=30000)
 
void receive (string &buffer)
 
size_t receiveRaw (byte_t *buffer, const size_t count)
 
void send (const string &buffer)
 
void send (const char *str)
 
void sendRaw (const byte_t *buffer, const size_t count)
 
size_t sendRawNonBlocking (const byte_t *buffer, const size_t count)
 
size_t getBlockSize () const
 
unsigned int getStatus () const
 
const string getPeerName () const
 
const string getPeerAddress () const
 
shared_ptr< net::timeoutHandlergetTimeoutHandler ()
 
void setTracer (shared_ptr< net::tracer > tracer)
 
shared_ptr< net::tracergetTracer ()
 
- Public Member Functions inherited from socket
virtual ~socket ()
 
virtual void setTracer (shared_ptr< tracer > tracer)=0
 

Additional Inherited Members

- Public Types inherited from socket
enum  Status { STATUS_WOULDBLOCK = 0xf, STATUS_WANT_READ = 0x1, STATUS_WANT_WRITE = 0x2 }
 
- Protected Member Functions inherited from socket
 socket ()
 
- Protected Member Functions inherited from object
 object ()
 
 object (const object &)
 
objectoperator= (const object &)
 
virtual ~object ()
 

Detailed Description

A socket which provides data integrity and/or privacy protection.

Constructor & Destructor Documentation

SASLSocket ( shared_ptr< SASLSession sess,
shared_ptr< net::socket wrapped 
)
~SASLSocket ( )

Member Function Documentation

void connect ( const string address,
const port_t  port 
)
virtual

Connect to the specified address and port.

Parameters
addressserver address (this can be a full qualified domain name or an IP address, doesn't matter)
portserver port

Implements socket.

void disconnect ( )
virtual

Disconnect from the server.

Implements socket.

size_t getBlockSize ( ) const
virtual

Return the preferred maximum block size when reading from or writing to this stream.

Returns
block size, in bytes

Implements socket.

const string getPeerAddress ( ) const
virtual

Return the address of peer this socket is connected to.

Returns
numeric address of the peer

Implements socket.

const string getPeerName ( ) const
virtual

Return the hostname of peer this socket is connected to.

Returns
name of the peer, or numeric address if it cannot be found

Implements socket.

unsigned int getStatus ( ) const
virtual

Return the current status of this socket.

Returns
status flags for this socket

Implements socket.

shared_ptr< net::timeoutHandler > getTimeoutHandler ( )
virtual

Return the timeout handler associated with this socket.

Returns
timeout handler, or NULL if none is set

Implements socket.

shared_ptr< net::tracer > getTracer ( )
virtual

Return the tracer used by this socket.

Returns
tracer, or NULL if none is set

Implements socket.

bool isConnected ( ) const
virtual

Test whether this socket is connected.

Returns
true if the socket is connected, false otherwise

Implements socket.

void receive ( string buffer)
virtual

Receive text data from the socket.

Parameters
bufferbuffer in which to write received data

Implements socket.

References stringUtils::makeStringFromBytes(), and SASLSocket::receiveRaw().

size_t receiveRaw ( byte_t buffer,
const size_t  count 
)
virtual

Receive raw data from the socket.

Parameters
bufferbuffer in which to write received data
countmaximum number of bytes to receive (size of buffer)
Returns
number of bytes received/written into output buffer

Implements socket.

References vmime::count().

Referenced by SASLSocket::receive().

void send ( const string buffer)
virtual

Send text data to the socket.

Parameters
bufferdata to send

Implements socket.

References SASLSocket::sendRaw().

void send ( const char *  str)
virtual

Send text data to the socket.

Parameters
strnull-terminated string

Implements socket.

References SASLSocket::sendRaw().

void sendRaw ( const byte_t buffer,
const size_t  count 
)
virtual

Send raw data to the socket.

Parameters
bufferdata to send
countnumber of bytes to send (size of buffer)

Implements socket.

Referenced by SASLSocket::send().

size_t sendRawNonBlocking ( const byte_t buffer,
const size_t  count 
)
virtual

Send raw data to the socket.

Function may returns before all data is sent.

Parameters
bufferdata to send
countnumber of bytes to send (size of buffer)
Returns
number of bytes sent

Implements socket.

void setTracer ( shared_ptr< net::tracer tracer)
bool waitForRead ( const int  msecs = 30000)
virtual

Block until new data is available for reading.

The function will timeout after msecs milliseconds.

Parameters
timeoutmaximum wait time, in milliseconds (default is 30000); resolution is 10ms
Returns
true if data is available, or false if the operation timed out

Implements socket.

bool waitForWrite ( const int  msecs = 30000)
virtual

Block until pending data has been written and new data can be written.

The function will timeout after msecs milliseconds.

Parameters
timeoutmaximum wait time, in milliseconds (default is 30000); resolution is 10ms
Returns
true if new data can be written immediately, or false if the operation timed out

Implements socket.


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