IBR-DTN
1.0.0
|
#include <TCPConnection.h>
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::Node & | getNode () 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 () |
virtual void | addTrafficIn (size_t) throw () |
virtual void | addTrafficOut (size_t) 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 |
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) |
Definition at line 48 of file TCPConnection.h.
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.
tcpsrv | |
stream | TCP stream to talk to the other peer. |
name | |
timeout |
Definition at line 61 of file TCPConnection.cpp.
|
virtual |
|
protected |
Definition at line 358 of file TCPConnection.cpp.
|
virtual |
Reports inbound traffic amount
Reimplemented from dtn::streams::StreamConnection::Callback.
Definition at line 323 of file TCPConnection.cpp.
|
virtual |
Reports outbound traffic amount
Reimplemented from dtn::streams::StreamConnection::Callback.
Definition at line 328 of file TCPConnection.cpp.
|
protected |
Definition at line 763 of file TCPConnection.cpp.
References dtn::streams::StreamContactHeader::_flags, dtn::data::Bitset< E >::getBit(), dtn::net::BundleTransfer::getBundle(), dtn::streams::StreamContactHeader::getEID(), dtn::streams::StreamContactHeader::REQUEST_FRAGMENTATION, and dtn::core::FragmentManager::setOffset().
Referenced by finally().
|
protected |
Definition at line 432 of file TCPConnection.cpp.
References dtn::core::Node::add(), dtn::core::Node::clear(), dtn::core::Node::CONN_TCPIP, dtn::streams::StreamConnection::CONNECTION_SHUTDOWN_ERROR, dtn::core::Node::URI::decode(), dtn::core::Node::get(), shutdown(), dtn::core::Node::toString(), and dtn::core::Node::URI::value.
Referenced by run().
|
virtual |
This method is called if a ACK is received.
Implements dtn::streams::StreamConnection::Callback.
Definition at line 318 of file TCPConnection.cpp.
|
virtual |
This method is called if a bundle is refused by the peer.
Implements dtn::streams::StreamConnection::Callback.
Definition at line 295 of file TCPConnection.cpp.
References dtn::net::BundleTransfer::complete().
|
virtual |
This method is called if a bundle is refused by the peer.
Implements dtn::streams::StreamConnection::Callback.
Definition at line 272 of file TCPConnection.cpp.
References dtn::net::BundleTransfer::abort(), and dtn::net::TransferAbortedEvent::REASON_REFUSED.
|
virtual |
This method is called if a connection went down.
Implements dtn::streams::StreamConnection::Callback.
Definition at line 251 of file TCPConnection.cpp.
References dtn::streams::StreamContactHeader::_localeid, dtn::net::ConnectionEvent::CONNECTION_DOWN, and dtn::net::ConnectionEvent::raise().
|
virtual |
This method is called if a handshake was successful.
header |
Implements dtn::streams::StreamConnection::Callback.
Definition at line 193 of file TCPConnection.cpp.
References dtn::net::ConnectionEvent::CONNECTION_UP, dtn::core::BundleCore::getInstance(), dtn::daemon::Configuration::getInstance(), dtn::daemon::Configuration::getNetwork(), dtn::daemon::Configuration::Network::getTCPIdleTimeout(), dtn::core::BundleCore::local, and dtn::net::ConnectionEvent::raise().
|
virtual |
This method is called if a error occured in the stream.
Implements dtn::streams::StreamConnection::Callback.
Definition at line 131 of file TCPConnection.cpp.
|
virtual |
callback methods for tcpstream
Implements dtn::streams::StreamConnection::Callback.
Definition at line 114 of file TCPConnection.cpp.
|
virtual |
This method is called if the stream is closed by a TIMEOUT.
Implements dtn::streams::StreamConnection::Callback.
Definition at line 118 of file TCPConnection.cpp.
References dtn::net::ConnectionEvent::CONNECTION_TIMEOUT, and dtn::net::ConnectionEvent::raise().
|
protected |
Definition at line 367 of file TCPConnection.cpp.
References clearQueue().
dtn::core::Node::Protocol dtn::net::TCPConnection::getDiscoveryProtocol | ( | ) | const |
const dtn::streams::StreamContactHeader & dtn::net::TCPConnection::getHeader | ( | ) | const |
const dtn::core::Node & dtn::net::TCPConnection::getNode | ( | ) | const |
Get the associated Node object
Definition at line 104 of file TCPConnection.cpp.
Referenced by dtn::net::TCPConvergenceLayer::queue().
|
protected |
Definition at line 800 of file TCPConnection.cpp.
|
virtual |
This method is called after accept()
Definition at line 333 of file TCPConnection.cpp.
Referenced by dtn::net::TCPConvergenceLayer::componentRun(), dtn::net::TCPConvergenceLayer::open(), and dtn::net::TCPConvergenceLayer::queue().
|
protected |
Definition at line 135 of file TCPConnection.cpp.
References dtn::streams::StreamContactHeader::_flags, dtn::data::Bitset< E >::getBit(), dtn::streams::StreamContactHeader::getEID(), dtn::data::EID::getHost(), dtn::daemon::Configuration::getInstance(), dtn::daemon::Configuration::getSecurity(), dtn::data::EID::getString(), dtn::streams::StreamContactHeader::REQUEST_TLS, dtn::daemon::Configuration::Security::TLSRequired(), and dtn::security::SecurityCertificateManager::validateSubject().
|
protected |
Definition at line 795 of file TCPConnection.cpp.
bool dtn::net::TCPConnection::match | ( | const dtn::core::Node & | n | ) | const |
Definition at line 809 of file TCPConnection.cpp.
Referenced by match(), dtn::net::TCPConvergenceLayer::open(), and dtn::net::TCPConvergenceLayer::queue().
bool dtn::net::TCPConnection::match | ( | const dtn::data::EID & | destination | ) | const |
Definition at line 814 of file TCPConnection.cpp.
References dtn::core::Node::getEID(), and dtn::data::EID::sameHost().
bool dtn::net::TCPConnection::match | ( | const dtn::core::NodeEvent & | evt | ) | const |
Definition at line 819 of file TCPConnection.cpp.
References dtn::core::NodeEvent::getNode(), and match().
void dtn::net::TCPConnection::queue | ( | const dtn::net::BundleTransfer & | job | ) |
queue a bundle for this connection
bundle |
Definition at line 94 of file TCPConnection.cpp.
Referenced by dtn::net::TCPConvergenceLayer::queue().
|
protected |
Definition at line 109 of file TCPConnection.cpp.
Referenced by run().
|
protected |
Definition at line 503 of file TCPConnection.cpp.
References dtn::streams::StreamContactHeader::_flags, dtn::streams::StreamContactHeader::_localeid, connect(), dtn::streams::StreamConnection::CONNECTION_SHUTDOWN_ERROR, dtn::core::BundleCore::filter(), dtn::data::Bitset< E >::getBit(), dtn::net::TCPConvergenceLayer::getDiscoveryProtocol(), dtn::core::BundleCore::getInstance(), dtn::core::BundleFilter::INPUT, dtn::core::BundleCore::local, dtn::net::BundleReceivedEvent::raise(), rejectTransmission(), dtn::streams::StreamContactHeader::REQUEST_FRAGMENTATION, dtn::core::FilterContext::setBundle(), dtn::data::DefaultDeserializer::setFragmentationSupport(), dtn::core::FilterContext::setPeer(), dtn::core::FilterContext::setProtocol(), and shutdown().
|
protected |
Definition at line 390 of file TCPConnection.cpp.
References dtn::daemon::Configuration::getInstance(), dtn::streams::StreamContactHeader::REQUEST_ACKNOWLEDGMENTS, dtn::streams::StreamContactHeader::REQUEST_FRAGMENTATION, and dtn::streams::StreamContactHeader::REQUEST_NEGATIVE_ACKNOWLEDGMENTS.
void dtn::net::TCPConnection::shutdown | ( | ) | ||
throw | ( | |||
) |
shutdown the whole tcp connection
Definition at line 343 of file TCPConnection.cpp.
References dtn::streams::StreamConnection::CONNECTION_SHUTDOWN_ERROR.