IBR-DTNSuite 0.6

ibrcommon::tcpstream Class Reference

#include <tcpstream.h>

Inheritance diagram for ibrcommon::tcpstream:

List of all members.

Classes

class  select_exception

Public Types

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=-1)
virtual ~tcpstream ()
string getAddress () const
int getPort () const
void close (bool errorcheck=false)
void enableKeepalive ()
void enableLinger (int linger)
void enableNoDelay ()
void setTimeout (unsigned int value)

Public Attributes

stream_error errmsg

Static Public Attributes

static const size_t BUFF_SIZE = 5120

Protected Member Functions

virtual int sync ()
virtual int overflow (int=std::char_traits< char >::eof())
virtual int underflow ()
void interrupt ()
int select (int int_pipe, bool &read, bool &write, bool &error, int timeout=0) throw (select_exception)

Protected Attributes

int _socket
int _interrupt_pipe_read [2]
int _interrupt_pipe_write [2]

Detailed Description

Definition at line 28 of file tcpstream.h.


Member Enumeration Documentation

Enumerator:
ERROR_NONE 
ERROR_EPIPE 
ERROR_CLOSED 
ERROR_WRITE 
ERROR_READ 
ERROR_RESET 

Definition at line 31 of file tcpstream.h.


Constructor & Destructor Documentation

ibrcommon::tcpstream::tcpstream ( int  socket = -1)

Definition at line 24 of file tcpstream.cpp.

References _interrupt_pipe_read, _interrupt_pipe_write, BUFF_SIZE, and ibrcommon::vsocket::set_non_blocking().

Here is the call graph for this function:

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

Definition at line 52 of file tcpstream.cpp.

References close().

Here is the call graph for this function:


Member Function Documentation

void ibrcommon::tcpstream::close ( bool  errorcheck = false)

Definition at line 85 of file tcpstream.cpp.

References _socket, and interrupt().

Referenced by main(), overflow(), term(), underflow(), dtn::api::Client::~Client(), and ~tcpstream().

Here is the call graph for this function:

void ibrcommon::tcpstream::enableKeepalive ( )

Definition at line 371 of file tcpstream.cpp.

References _socket.

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

void ibrcommon::tcpstream::enableLinger ( int  linger)

Definition at line 380 of file tcpstream.cpp.

References _socket.

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

void ibrcommon::tcpstream::enableNoDelay ( )
string ibrcommon::tcpstream::getAddress ( ) const

Definition at line 61 of file tcpstream.cpp.

References _socket.

int ibrcommon::tcpstream::getPort ( ) const

Definition at line 70 of file tcpstream.cpp.

References _socket.

void ibrcommon::tcpstream::interrupt ( ) [protected]

Definition at line 79 of file tcpstream.cpp.

References _interrupt_pipe_read, and _interrupt_pipe_write.

Referenced by close().

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

Definition at line 236 of file tcpstream.cpp.

References _interrupt_pipe_write, _socket, BUFF_SIZE, close(), errmsg, ERROR_EPIPE, ERROR_RESET, ERROR_WRITE, IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, and select().

Referenced by sync().

Here is the call graph for this function:

int ibrcommon::tcpstream::select ( int  int_pipe,
bool &  read,
bool &  write,
bool &  error,
int  timeout = 0 
) throw (select_exception) [protected]

Definition at line 117 of file tcpstream.cpp.

References IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, and ibrcommon::vsocket::set_non_blocking().

Referenced by overflow(), and underflow().

Here is the call graph for this function:

void ibrcommon::tcpstream::setTimeout ( unsigned int  value)

Definition at line 366 of file tcpstream.cpp.

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

Definition at line 108 of file tcpstream.cpp.

References overflow().

Here is the call graph for this function:

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

Definition at line 318 of file tcpstream.cpp.

References _interrupt_pipe_read, _socket, BUFF_SIZE, close(), errmsg, ERROR_CLOSED, ERROR_EPIPE, ERROR_READ, IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, and select().

Here is the call graph for this function:


Member Data Documentation

Definition at line 86 of file tcpstream.h.

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

Definition at line 87 of file tcpstream.h.

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

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

Definition at line 42 of file tcpstream.h.

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

Definition at line 52 of file tcpstream.h.

Referenced by overflow(), and underflow().


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