SysSocketConnection Class Reference

#include <SysCSStream.hpp>

Inheritance diagram for SysSocketConnection:
[legend]

Public Member Functions

 SysSocketConnection ()
 
 SysSocketConnection (int sock)
 
 ~SysSocketConnection ()
 
CSErrorCodeT getError (void)
 
bool read (void *buf, size_t bufsize, size_t *bytesread)
 
bool write (void *buf, size_t bufsize, size_t *byteswritten)
 
bool write (void *buf, size_t bufsize, void *buf2, size_t buf2size, size_t *byteswritten)
 
 SysSocketConnection ()
 
 SysSocketConnection (SOCKET sock)
 
 ~SysSocketConnection ()
 
CSErrorCodeT getError (void)
 
bool read (void *buf, size_t bufsize, size_t *bytesread)
 
bool write (void *buf, size_t bufsize, size_t *byteswritten)
 
bool write (void *buf, size_t bufsize, void *buf2, size_t buf2size, size_t *byteswritten)
 

Protected Types

enum  { MAX_CACHED_BUFFER = 4096 }
 
enum  { MAX_CACHED_BUFFER = 4096 }
 

Protected Member Functions

char * getMessageBuffer (size_t size)
 
void returnMessageBuffer (void *)
 
char * getMessageBuffer (size_t size)
 
void returnMessageBuffer (void *)
 

Protected Attributes

int c
 
CSErrorCodeT errcode
 
char * messageBuffer
 
SOCKET c
 

Detailed Description

Definition at line 58 of file unix/SysCSStream.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
MAX_CACHED_BUFFER 

Definition at line 73 of file unix/SysCSStream.hpp.

◆ anonymous enum

anonymous enum
protected
Enumerator
MAX_CACHED_BUFFER 

Definition at line 69 of file windows/SysCSStream.hpp.

Constructor & Destructor Documentation

◆ SysSocketConnection() [1/4]

SysSocketConnection::SysSocketConnection ( )
inline

Definition at line 61 of file unix/SysCSStream.hpp.

◆ SysSocketConnection() [2/4]

SysSocketConnection::SysSocketConnection ( int  sock)
inline

Definition at line 62 of file unix/SysCSStream.hpp.

◆ ~SysSocketConnection() [1/2]

SysSocketConnection::~SysSocketConnection ( )
inline

Definition at line 63 of file unix/SysCSStream.hpp.

References messageBuffer.

◆ SysSocketConnection() [3/4]

SysSocketConnection::SysSocketConnection ( )
inline

Definition at line 57 of file windows/SysCSStream.hpp.

◆ SysSocketConnection() [4/4]

SysSocketConnection::SysSocketConnection ( SOCKET  sock)
inline

Definition at line 58 of file windows/SysCSStream.hpp.

◆ ~SysSocketConnection() [2/2]

SysSocketConnection::~SysSocketConnection ( )
inline

Definition at line 59 of file windows/SysCSStream.hpp.

References messageBuffer.

Member Function Documentation

◆ getError() [1/2]

CSErrorCodeT SysSocketConnection::getError ( void  )
inline

Definition at line 64 of file unix/SysCSStream.hpp.

References errcode.

◆ getError() [2/2]

CSErrorCodeT SysSocketConnection::getError ( void  )
inline

Definition at line 60 of file windows/SysCSStream.hpp.

References errcode.

◆ getMessageBuffer() [1/2]

char * SysSocketConnection::getMessageBuffer ( size_t  size)
protected

Get a buffer for sending a buffered message.

Parameters
sizeThe required size.
Returns
A pointer to a buffer, or NULL if unable to allocate.

Definition at line 194 of file unix/SysCSStream.cpp.

References MAX_CACHED_BUFFER, messageBuffer, and SERVER_FAILURE.

Referenced by write().

◆ getMessageBuffer() [2/2]

char* SysSocketConnection::getMessageBuffer ( size_t  size)
protected

◆ read() [1/2]

bool SysSocketConnection::read ( void *  buf,
size_t  bufsize,
size_t *  bytesread 
)

Read from the connection.

Parameters
bufTarget buffer for the read operation.
bufsizeSize of the target buffer.
bytesreadNumber of bytes actually read.
Returns
True on an error, otherwise false

Definition at line 70 of file unix/SysCSStream.cpp.

References c, CSERROR_IO_FAILED, CSERROR_OK, and errcode.

Referenced by ServiceMessage::readMessage(), and ServiceMessage::readResult().

◆ read() [2/2]

bool SysSocketConnection::read ( void *  buf,
size_t  bufsize,
size_t *  bytesread 
)

◆ returnMessageBuffer() [1/2]

void SysSocketConnection::returnMessageBuffer ( void *  buffer)
protected

Return a message buffer after sending a message. This will either cache the buffer, or release it, depending upon how it was obtained in the first place.

Parameters
bufferThe buffer to release.

Definition at line 226 of file unix/SysCSStream.cpp.

References messageBuffer.

Referenced by write().

◆ returnMessageBuffer() [2/2]

void SysSocketConnection::returnMessageBuffer ( void *  )
protected

◆ write() [1/4]

bool SysSocketConnection::write ( void *  buf,
size_t  bufsize,
size_t *  byteswritten 
)

Write a buffer to the connection.

Parameters
bufSource buffer for the write operation.
bufsizeSize of the source buffer.
byteswrittenNumber of bytes actually written to the connection.
Returns
True on an error, otherwise false

Definition at line 101 of file unix/SysCSStream.cpp.

References c, CSERROR_IO_FAILED, CSERROR_OK, and errcode.

Referenced by write(), ServiceMessage::writeMessage(), and ServiceMessage::writeResult().

◆ write() [2/4]

bool SysSocketConnection::write ( void *  buf,
size_t  bufsize,
size_t *  byteswritten 
)

◆ write() [3/4]

bool SysSocketConnection::write ( void *  buf,
size_t  bufsize,
void *  buf2,
size_t  buf2size,
size_t *  byteswritten 
)

Write a multi-buffer message to the connection.

Parameters
bufSource buffer for the write operation.
bufsizeSize of the source buffer.
byteswrittenNumber of bytes actually written to the connection.
Returns
True on an error, otherwise false

Definition at line 132 of file unix/SysCSStream.cpp.

References c, CSERROR_IO_FAILED, CSERROR_OK, errcode, getMessageBuffer(), returnMessageBuffer(), and write().

◆ write() [4/4]

bool SysSocketConnection::write ( void *  buf,
size_t  bufsize,
void *  buf2,
size_t  buf2size,
size_t *  byteswritten 
)

Member Data Documentation

◆ c [1/2]

◆ c [2/2]

SOCKET SysSocketConnection::c
protected

Definition at line 78 of file windows/SysCSStream.hpp.

◆ errcode

◆ messageBuffer

char * SysSocketConnection::messageBuffer
protected

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