IBR-DTNSuite  0.10
dtn::net::TCPConnection Class Reference

#include <TCPConnection.h>

Inheritance diagram for dtn::net::TCPConnection:
Inheritance graph
Collaboration diagram for dtn::net::TCPConnection:
Collaboration graph

Public Member Functions

 TCPConnection (TCPConvergenceLayer &tcpsrv, const dtn::core::Node &node, ibrcommon::clientsocket *sock, const size_t timeout=10)
 
virtual ~TCPConnection ()
 
virtual void initialize () throw ()
 
void shutdown () throw ()
 
const
dtn::streams::StreamContactHeader
getHeader () const
 
const dtn::core::NodegetNode () const
 
virtual void eventShutdown (dtn::streams::StreamConnection::ConnectionShutdownCases csc) throw ()
 
virtual void eventTimeout () throw ()
 
virtual void eventError () throw ()
 
virtual void eventConnectionUp (const dtn::streams::StreamContactHeader &header) throw ()
 
virtual void eventConnectionDown () throw ()
 
virtual void eventBundleRefused () throw ()
 
virtual void eventBundleForwarded () throw ()
 
virtual void eventBundleAck (const dtn::data::Length &ack) throw ()
 
dtn::core::Node::Protocol getDiscoveryProtocol () const
 
void queue (const dtn::net::BundleTransfer &job)
 
bool match (const dtn::core::Node &n) const
 
bool match (const dtn::data::EID &destination) const
 
bool match (const dtn::core::NodeEvent &evt) const
 
size_t getTrafficStats (int index)
 
void resetTrafficStats ()
 
- Public Member Functions inherited from ibrcommon::DetachedThread
virtual ~DetachedThread ()=0
 
void start (int priority=0) throw (ThreadException)
 
void stop () throw (ThreadException)
 

Protected Member Functions

void rejectTransmission ()
 
void setup () throw ()
 
void connect ()
 
void run () throw ()
 
void finally () throw ()
 
void __cancellation () throw ()
 
void clearQueue ()
 
void keepalive ()
 
bool good () const
 
void initiateExtendedHandshake () throw (ibrcommon::Exception)
 
- Protected Member Functions inherited from ibrcommon::DetachedThread
 DetachedThread (size_t size=DEFAULT_STACKSIZE)
 
- Protected Member Functions inherited from ibrcommon::Thread
virtual ~Thread ()=0
 
void reset () throw (ThreadException)
 
bool isFinalized () throw ()
 
bool operator== (const ibrcommon::Thread &other)
 
 Thread (size_t stack=DEFAULT_STACKSIZE)
 
int kill (int sig)
 
void cancel () throw ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from ibrcommon::Thread
static size_t getNumberOfProcessors ()
 
static void yield (void)
 
static void sleep (time_t timeout)
 
static void concurrency (int level)
 
static bool equal (pthread_t thread1, pthread_t thread2)
 
static void * __execute__ (void *obj) throw ()
 

Detailed Description

Definition at line 48 of file TCPConnection.h.

Constructor & Destructor Documentation

dtn::net::TCPConnection::TCPConnection ( TCPConvergenceLayer tcpsrv,
const dtn::core::Node node,
ibrcommon::clientsocket sock,
const size_t  timeout = 10 
)

Constructor for a new TCPConnection object.

Parameters
tcpsrv
streamTCP stream to talk to the other peer.
name
timeout
Returns

Definition at line 64 of file TCPConnection.cpp.

dtn::net::TCPConnection::~TCPConnection ( )
virtual

Destructor

Returns

Definition at line 71 of file TCPConnection.cpp.

References ibrcommon::RWMutex::LOCK_READWRITE.

Member Function Documentation

void dtn::net::TCPConnection::__cancellation ( ) throw ()
protectedvirtual

Implements ibrcommon::Thread.

Definition at line 338 of file TCPConnection.cpp.

References ibrcommon::socketstream::close().

Here is the call graph for this function:

void dtn::net::TCPConnection::eventBundleAck ( const dtn::data::Length ack) throw ()
virtual

This method is called if a ACK is received.

Implements dtn::streams::StreamConnection::Callback.

Definition at line 308 of file TCPConnection.cpp.

void dtn::net::TCPConnection::eventBundleForwarded ( ) throw ()
virtual
void dtn::net::TCPConnection::eventBundleRefused ( ) throw ()
virtual
void dtn::net::TCPConnection::eventConnectionDown ( ) throw ()
virtual
void dtn::net::TCPConnection::eventConnectionUp ( const dtn::streams::StreamContactHeader header) throw ()
virtual
void dtn::net::TCPConnection::eventError ( ) throw ()
virtual

This method is called if a error occured in the stream.

Implements dtn::streams::StreamConnection::Callback.

Definition at line 134 of file TCPConnection.cpp.

void dtn::net::TCPConnection::eventShutdown ( dtn::streams::StreamConnection::ConnectionShutdownCases  csc) throw ()
virtual

callback methods for tcpstream

Implements dtn::streams::StreamConnection::Callback.

Definition at line 117 of file TCPConnection.cpp.

void dtn::net::TCPConnection::eventTimeout ( ) throw ()
virtual
void dtn::net::TCPConnection::finally ( void  ) throw ()
protectedvirtual

This method is called when the run() method finishes.

Reimplemented from ibrcommon::Thread.

Definition at line 347 of file TCPConnection.cpp.

References clearQueue(), ibrcommon::socketstream::close(), IBRCOMMON_LOGGER_DEBUG_TAG, and IBRCOMMON_LOGGER_ENDL.

Here is the call graph for this function:

dtn::core::Node::Protocol dtn::net::TCPConnection::getDiscoveryProtocol ( ) const
const dtn::streams::StreamContactHeader & dtn::net::TCPConnection::getHeader ( ) const

Get the header of this connection

Returns

Definition at line 102 of file TCPConnection.cpp.

const dtn::core::Node & dtn::net::TCPConnection::getNode ( ) const

Get the associated Node object

Returns

Definition at line 107 of file TCPConnection.cpp.

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

size_t dtn::net::TCPConnection::getTrafficStats ( int  index)

Definition at line 770 of file TCPConnection.cpp.

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

bool dtn::net::TCPConnection::good ( ) const
protected

Definition at line 745 of file TCPConnection.cpp.

void dtn::net::TCPConnection::initialize ( ) throw ()
virtual
void dtn::net::TCPConnection::keepalive ( )
protected

Definition at line 740 of file TCPConnection.cpp.

bool dtn::net::TCPConnection::match ( const dtn::core::Node n) const
bool dtn::net::TCPConnection::match ( const dtn::data::EID destination) const

Definition at line 759 of file TCPConnection.cpp.

References dtn::core::Node::getEID(), and dtn::data::EID::getNode().

Here is the call graph for this function:

bool dtn::net::TCPConnection::match ( const dtn::core::NodeEvent evt) const

Definition at line 764 of file TCPConnection.cpp.

References dtn::core::NodeEvent::getNode(), and match().

Here is the call graph for this function:

void dtn::net::TCPConnection::queue ( const dtn::net::BundleTransfer job)

queue a bundle for this connection

Parameters
bundle

Definition at line 97 of file TCPConnection.cpp.

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

void dtn::net::TCPConnection::rejectTransmission ( )
protected

Definition at line 112 of file TCPConnection.cpp.

Referenced by run().

void dtn::net::TCPConnection::resetTrafficStats ( )
void dtn::net::TCPConnection::setup ( void  ) throw ()
protectedvirtual
void dtn::net::TCPConnection::shutdown ( ) throw ()

shutdown the whole tcp connection

Definition at line 323 of file TCPConnection.cpp.

References dtn::streams::StreamConnection::CONNECTION_SHUTDOWN_ERROR, ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::DetachedThread::stop(), and ibrcommon::Exception::what().

Referenced by connect(), and run().

Here is the call graph for this function:


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