IBR-DTNSuite 0.6

dtn::net::TCPConnection Class Reference

#include <TCPConvergenceLayer.h>

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

List of all members.

Classes

class  Sender

Public Member Functions

 TCPConnection (TCPConvergenceLayer &tcpsrv, ibrcommon::tcpstream *stream, const dtn::data::EID &name, const size_t timeout=10)
 TCPConnection (TCPConvergenceLayer &tcpsrv, const dtn::core::Node &node, const dtn::data::EID &name, const size_t timeout=10)
virtual ~TCPConnection ()
virtual void initialize ()
void shutdown ()
const StreamContactHeader & getHeader () const
const dtn::core::NodegetNode () const
virtual void eventShutdown (StreamConnection::ConnectionShutdownCases csc)
virtual void eventTimeout ()
virtual void eventError ()
virtual void eventConnectionUp (const StreamContactHeader &header)
virtual void eventConnectionDown ()
virtual void eventBundleRefused ()
virtual void eventBundleForwarded ()
virtual void eventBundleAck (size_t ack)
dtn::core::Node::Protocol getDiscoveryProtocol () const
void queue (const dtn::data::BundleID &bundle)
bool match (const dtn::core::Node &n) const
bool match (const dtn::data::EID &destination) const
bool match (const dtn::core::NodeEvent &evt) const

Protected Member Functions

void rejectTransmission ()
void setup ()
void run ()
void finally ()
bool __cancellation ()
void clearQueue ()
void keepalive ()
bool good () const

Friends

TCPConnectionoperator>> (TCPConnection &conn, dtn::data::Bundle &bundle)
TCPConnectionoperator<< (TCPConnection &conn, const dtn::data::Bundle &bundle)

Detailed Description

Definition at line 41 of file TCPConvergenceLayer.h.


Constructor & Destructor Documentation

dtn::net::TCPConnection::TCPConnection ( TCPConvergenceLayer tcpsrv,
ibrcommon::tcpstream stream,
const dtn::data::EID name,
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 40 of file TCPConnection.cpp.

References dtn::core::Node::add(), ibrcommon::tcpstream::enableKeepalive(), ibrcommon::tcpstream::enableLinger(), ibrcommon::tcpstream::enableNoDelay(), and dtn::daemon::Configuration::getInstance().

Here is the call graph for this function:

dtn::net::TCPConnection::TCPConnection ( TCPConvergenceLayer tcpsrv,
const dtn::core::Node node,
const dtn::data::EID name,
const size_t  timeout = 10 
)

Constructor for a new TCPConnection object.

Parameters:
tcpsrv
nodeThe node to talk to.
name
timeout
Returns:

Definition at line 58 of file TCPConnection.cpp.

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

Destructor

Returns:

Definition at line 65 of file TCPConnection.cpp.


Member Function Documentation

bool dtn::net::TCPConnection::__cancellation ( ) [protected, virtual]

Reimplemented from ibrcommon::Thread.

Definition at line 207 of file TCPConnection.cpp.

void dtn::net::TCPConnection::clearQueue ( ) [protected]

Definition at line 475 of file TCPConnection.cpp.

References dtn::routing::RequeueBundleEvent::raise().

Referenced by finally().

Here is the call graph for this function:

void dtn::net::TCPConnection::eventBundleAck ( size_t  ack) [virtual]

This method is called if a ACK is received.

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

Definition at line 179 of file TCPConnection.cpp.

void dtn::net::TCPConnection::eventBundleForwarded ( ) [virtual]

This method is called if a bundle is refused by the peer.

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

Definition at line 160 of file TCPConnection.cpp.

References dtn::core::BUNDLE_FORWARDED, dtn::core::Node::getEID(), ibrcommon::Queue< T >::getnpop(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, dtn::core::BundleEvent::raise(), and dtn::net::TransferCompletedEvent::raise().

Here is the call graph for this function:

void dtn::net::TCPConnection::eventBundleRefused ( ) [virtual]

This method is called if a bundle is refused by the peer.

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

Definition at line 143 of file TCPConnection.cpp.

References dtn::core::Node::getEID(), ibrcommon::Queue< T >::getnpop(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, dtn::net::TransferAbortedEvent::raise(), and dtn::net::TransferAbortedEvent::REASON_REFUSED.

Here is the call graph for this function:

void dtn::net::TCPConnection::eventConnectionDown ( ) [virtual]

This method is called if a connection went down.

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

Definition at line 125 of file TCPConnection.cpp.

References dtn::net::ConnectionEvent::CONNECTION_DOWN, IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, dtn::net::ConnectionEvent::raise(), and ibrcommon::Exception::what().

Here is the call graph for this function:

void dtn::net::TCPConnection::eventConnectionUp ( const StreamContactHeader &  header) [virtual]

This method is called if a handshake was successful.

Parameters:
header

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

Definition at line 108 of file TCPConnection.cpp.

References dtn::net::ConnectionEvent::CONNECTION_UP, dtn::net::ConnectionEvent::raise(), and dtn::core::Node::setEID().

Here is the call graph for this function:

void dtn::net::TCPConnection::eventError ( ) [virtual]

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

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

Definition at line 104 of file TCPConnection.cpp.

void dtn::net::TCPConnection::eventShutdown ( StreamConnection::ConnectionShutdownCases  csc) [virtual]

callback methods for tcpstream

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

Definition at line 91 of file TCPConnection.cpp.

void dtn::net::TCPConnection::eventTimeout ( ) [virtual]

This method is called if the stream is closed by a TIMEOUT.

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

Definition at line 95 of file TCPConnection.cpp.

References dtn::net::ConnectionEvent::CONNECTION_TIMEOUT, dtn::net::ConnectionEvent::raise(), and ibrcommon::DetachedThread::stop().

Here is the call graph for this function:

void dtn::net::TCPConnection::finally ( void  ) [protected, virtual]

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

Reimplemented from ibrcommon::Thread.

Definition at line 217 of file TCPConnection.cpp.

References clearQueue(), IBRCOMMON_LOGGER_DEBUG, and IBRCOMMON_LOGGER_ENDL.

Here is the call graph for this function:

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

Get the header of this connection

Returns:

Definition at line 76 of file TCPConnection.cpp.

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

Get the associated Node object

Returns:

Definition at line 81 of file TCPConnection.cpp.

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

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

Definition at line 521 of file TCPConnection.cpp.

void dtn::net::TCPConnection::initialize ( ) [virtual]
void dtn::net::TCPConnection::keepalive ( ) [protected]

Definition at line 516 of file TCPConnection.cpp.

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

Definition at line 540 of file TCPConnection.cpp.

References dtn::data::EID::getNode().

Here is the call graph for this function:

bool dtn::net::TCPConnection::match ( const dtn::core::NodeEvent evt) const
bool dtn::net::TCPConnection::match ( const dtn::core::Node n) const
void dtn::net::TCPConnection::queue ( const dtn::data::BundleID bundle)

queue a bundle for this connection

Parameters:
bundle

Definition at line 71 of file TCPConnection.cpp.

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

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

Definition at line 86 of file TCPConnection.cpp.

Referenced by run().

void dtn::net::TCPConnection::run ( ) [protected, virtual]
void dtn::net::TCPConnection::setup ( void  ) [protected, virtual]
void dtn::net::TCPConnection::shutdown ( )

shutdown the whole tcp connection

Definition at line 194 of file TCPConnection.cpp.

References IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, ibrcommon::DetachedThread::stop(), and ibrcommon::Exception::what().

Here is the call graph for this function:


Friends And Related Function Documentation

TCPConnection& operator<< ( TCPConnection conn,
const dtn::data::Bundle bundle 
) [friend]

Definition at line 346 of file TCPConnection.cpp.

TCPConnection& operator>> ( TCPConnection conn,
dtn::data::Bundle bundle 
) [friend]

Definition at line 335 of file TCPConnection.cpp.


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