ibrcommon::tcpstream Class Reference

#include <tcpstream.h>

Inheritance diagram for ibrcommon::tcpstream:

ibrcommon::tcpclient

List of all members.

Public Types

enum  stream_state { TCPSTREAM_CONNECTED = 0, TCPSTREAM_HALF_CLOSED = 1, TCPSTREAM_CLOSED = 2 }
enum  stream_error {
  ERROR_NONE = 0, ERROR_EPIPE = 1, ERROR_CLOSED = 2, ERROR_WRITE = 3,
  ERROR_READ = 4, ERROR_RESET = 5
}

Public Member Functions

 tcpstream (int socket=0)
virtual ~tcpstream ()
string getAddress () const
int getPort () const
void close ()
void done ()
void enableKeepalive ()

Public Attributes

stream_error errmsg

Static Public Attributes

static const size_t BUFF_SIZE = 2048

Protected Member Functions

virtual int sync ()
virtual int overflow (int=std::char_traits< char >::eof())
virtual int underflow ()

Protected Attributes

int _socket


Detailed Description

Definition at line 34 of file tcpstream.h.


Member Enumeration Documentation

Enumerator:
TCPSTREAM_CONNECTED 
TCPSTREAM_HALF_CLOSED 
TCPSTREAM_CLOSED 

Definition at line 37 of file tcpstream.h.

Enumerator:
ERROR_NONE 
ERROR_EPIPE 
ERROR_CLOSED 
ERROR_WRITE 
ERROR_READ 
ERROR_RESET 

Definition at line 43 of file tcpstream.h.


Constructor & Destructor Documentation

ibrcommon::tcpstream::tcpstream ( int  socket = 0  ) 

Definition at line 19 of file tcpstream.cpp.

References _socket, and BUFF_SIZE.

ibrcommon::tcpstream::~tcpstream (  )  [virtual]

Definition at line 36 of file tcpstream.cpp.

References _socket, and close().


Member Function Documentation

string ibrcommon::tcpstream::getAddress (  )  const

Definition at line 45 of file tcpstream.cpp.

References _socket.

int ibrcommon::tcpstream::getPort (  )  const

Definition at line 54 of file tcpstream.cpp.

References _socket.

void ibrcommon::tcpstream::close (  ) 

void ibrcommon::tcpstream::done (  ) 

This method close the connection for writing.

Definition at line 79 of file tcpstream.cpp.

References _socket, and TCPSTREAM_HALF_CLOSED.

Referenced by dtn::api::Client::eventShutdown(), and dtn::api::Client::eventTimeout().

void ibrcommon::tcpstream::enableKeepalive (  ) 

Definition at line 189 of file tcpstream.cpp.

References _socket.

Referenced by dtn::net::TCPConvergenceLayer::TCPConnection::TCPConnection().

int ibrcommon::tcpstream::sync (  )  [protected, virtual]

Definition at line 86 of file tcpstream.cpp.

References overflow().

int ibrcommon::tcpstream::overflow ( int  c = std::char_traits<char>::eof()  )  [protected, virtual]

Definition at line 95 of file tcpstream.cpp.

References _socket, BUFF_SIZE, errmsg, ERROR_EPIPE, ERROR_RESET, ERROR_WRITE, and TCPSTREAM_HALF_CLOSED.

Referenced by sync().

int ibrcommon::tcpstream::underflow (  )  [protected, virtual]

Definition at line 147 of file tcpstream.cpp.

References _socket, BUFF_SIZE, errmsg, ERROR_CLOSED, ERROR_EPIPE, ERROR_READ, and TCPSTREAM_CLOSED.


Member Data Documentation

const size_t ibrcommon::tcpstream::BUFF_SIZE = 2048 [static]

Definition at line 53 of file tcpstream.h.

Referenced by overflow(), tcpstream(), and underflow().

Definition at line 68 of file tcpstream.h.

Referenced by overflow(), and underflow().


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

Generated on Fri Jul 30 09:15:36 2010 for IBR-DTNSuite by  doxygen 1.5.6