TCPBuffer Class Reference

A generic tcp socket class that offers i/o buffering. More...

#include <buffer.h>

Inheritance diagram for TCPBuffer:
Inheritance graph
[legend]

Public Member Functions

void close (void)
 Close active connection.
void open (const char *host, const char *service, size_t size=536)
 Connect a tcp client session to a specific host uri.
void open (const TCPServer *server, size_t size=536)
 Connect a tcp socket to a client from a listener.
 TCPBuffer (const char *host, const char *service, size_t size=536)
 Construct a tcp client session connected to a specific host uri.
 TCPBuffer (const TCPServer *server, size_t size=536)
 Construct a tcp server session from a listening socket.
 TCPBuffer ()
 Construct an unconnected tcp client and specify our service profile.
virtual ~TCPBuffer ()
 Destroy the tcp socket and release all resources.

Protected Member Functions

bool _blocking (void)
void _buffer (size_t size)
void _clear (void)
int _err (void) const
virtual bool _pending (void)
 Check for pending tcp or ssl data.
virtual size_t _pull (char *address, size_t size)
virtual size_t _push (const char *address, size_t size)
socket_t getsocket (void) const
 Get the low level socket object.

Detailed Description

A generic tcp socket class that offers i/o buffering.

All user i/o operations are directly inherited from the IOBuffer base class public members. Some additional members are added for layering ssl services.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 58 of file buffer.h.


Constructor & Destructor Documentation

TCPBuffer::TCPBuffer ( const TCPServer *  server,
size_t  size = 536 
)

Construct a tcp server session from a listening socket.

Parameters:
server socket we are created from.
size of buffer and tcp fragments.
TCPBuffer::TCPBuffer ( const char *  host,
const char *  service,
size_t  size = 536 
)

Construct a tcp client session connected to a specific host uri.

Parameters:
host and optional :port we are connecting to.
service identifier of our client.
size of buffer and tcp fragments.

Member Function Documentation

virtual bool TCPBuffer::_pending ( void   )  [protected, virtual]

Check for pending tcp or ssl data.

Returns:
true if data pending.

Reimplemented in ucommon::SSLBuffer.

socket_t TCPBuffer::getsocket ( void   )  const [inline, protected]

Get the low level socket object.

Returns:
socket we are using.

Definition at line 73 of file buffer.h.

void TCPBuffer::open ( const char *  host,
const char *  service,
size_t  size = 536 
)

Connect a tcp client session to a specific host uri.

If the socket was already connected, it is automatically closed first.

Parameters:
host we are connecting.
service to connect to.
size of buffer and tcp fragments.

Reimplemented in ucommon::SSLBuffer.

void TCPBuffer::open ( const TCPServer *  server,
size_t  size = 536 
)

Connect a tcp socket to a client from a listener.

If the socket was already connected, it is automatically closed first.

Parameters:
server we are connected from.
size of buffer and tcp fragments.

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

Generated on 24 Sep 2014 for ucommon by  doxygen 1.6.1