IBR-DTNSuite  0.8
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 std::char_traits< char >
::int_type 
overflow (std::char_traits< char >::int_type=std::char_traits< char >::eof())
virtual std::char_traits< char >
::int_type 
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 25 of file tcpstream.cpp.

References _interrupt_pipe_read, _interrupt_pipe_write, _socket, BUFF_SIZE, close(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, and ibrcommon::vsocket::set_non_blocking().

Here is the call graph for this function:

Definition at line 64 of file tcpstream.cpp.

References _interrupt_pipe_read, _interrupt_pipe_write, and close().

Here is the call graph for this function:


Member Function Documentation

Definition at line 402 of file tcpstream.cpp.

References _socket.

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

Definition at line 411 of file tcpstream.cpp.

References _socket.

Definition at line 79 of file tcpstream.cpp.

References _socket.

Definition at line 88 of file tcpstream.cpp.

References _socket.

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

Definition at line 97 of file tcpstream.cpp.

References _interrupt_pipe_read, and _interrupt_pipe_write.

Referenced by close().

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

Definition at line 258 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 135 of file tcpstream.cpp.

References ibrcommon::__nonlinux_select(), 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 397 of file tcpstream.cpp.

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

Definition at line 126 of file tcpstream.cpp.

References overflow().

Here is the call graph for this function:

std::char_traits< char >::int_type ibrcommon::tcpstream::underflow ( ) [protected, virtual]

Definition at line 348 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(), underflow(), and ~tcpstream().

Definition at line 87 of file tcpstream.h.

Referenced by interrupt(), overflow(), tcpstream(), 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: