IBR-DTNSuite
0.8
|
#include <tcpstream.h>
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] |
Definition at line 28 of file tcpstream.h.
Definition at line 31 of file tcpstream.h.
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().
ibrcommon::tcpstream::~tcpstream | ( | ) | [virtual] |
Definition at line 64 of file tcpstream.cpp.
References _interrupt_pipe_read, _interrupt_pipe_write, and close().
void ibrcommon::tcpstream::close | ( | bool | errorcheck = false | ) |
Definition at line 103 of file tcpstream.cpp.
References _socket, and interrupt().
Referenced by dtn::api::OrderedStreamHandler::__cancellation(), dtn::api::ExtendedApiHandler::__cancellation(), dtn::api::BinaryStreamClient::__cancellation(), dtn::api::ApiServer::componentRun(), dtn::api::OrderedStreamHandler::finally(), dtn::api::ExtendedApiHandler::finally(), dtn::api::BinaryStreamClient::finally(), main(), overflow(), tcpstream(), term(), underflow(), dtn::api::Client::~Client(), and ~tcpstream().
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.
void ibrcommon::tcpstream::enableNoDelay | ( | ) |
Definition at line 421 of file tcpstream.cpp.
References _socket.
Referenced by dtn::api::ClientHandler::ClientHandler(), main(), and dtn::net::TCPConnection::TCPConnection().
string ibrcommon::tcpstream::getAddress | ( | ) | const |
Definition at line 79 of file tcpstream.cpp.
References _socket.
int ibrcommon::tcpstream::getPort | ( | ) | const |
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().
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().
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().
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().
int ibrcommon::tcpstream::_interrupt_pipe_read[2] [protected] |
Definition at line 86 of file tcpstream.h.
Referenced by interrupt(), tcpstream(), underflow(), and ~tcpstream().
int ibrcommon::tcpstream::_interrupt_pipe_write[2] [protected] |
Definition at line 87 of file tcpstream.h.
Referenced by interrupt(), overflow(), tcpstream(), and ~tcpstream().
int ibrcommon::tcpstream::_socket [protected] |
Definition at line 66 of file tcpstream.h.
Referenced by close(), enableKeepalive(), enableLinger(), enableNoDelay(), getAddress(), getPort(), ibrcommon::tcpclient::open(), overflow(), tcpstream(), and underflow().
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().