IBR-DTNSuite
0.12
|
#include <TCPConvergenceLayer.h>
Public Member Functions | |
TCPConvergenceLayer () | |
virtual | ~TCPConvergenceLayer () |
void | add (const ibrcommon::vinterface &net, int port) throw () |
void | queue (const dtn::core::Node &n, const dtn::net::BundleTransfer &job) |
void | open (const dtn::core::Node &n) |
virtual const std::string | getName () const |
dtn::core::Node::Protocol | getDiscoveryProtocol () const |
void | onUpdateBeacon (const ibrcommon::vinterface &iface, DiscoveryBeacon &beacon) throw (NoServiceHereException) |
void | eventNotify (const ibrcommon::LinkEvent &evt) |
void | raiseEvent (const dtn::core::Event *evt) throw () |
virtual void | resetStats () |
virtual void | getStats (ConvergenceLayer::stats_data &data) const |
Public Member Functions inherited from dtn::daemon::IndependentComponent | |
IndependentComponent () | |
virtual | ~IndependentComponent () |
virtual void | initialize () throw () |
virtual void | startup () throw () |
virtual void | terminate () throw () |
Public Member Functions inherited from dtn::daemon::Component | |
virtual | ~Component ()=0 |
Public Member Functions inherited from dtn::core::EventReceiver | |
virtual | ~EventReceiver ()=0 |
Public Member Functions inherited from dtn::net::ConvergenceLayer | |
virtual | ~ConvergenceLayer ()=0 |
Public Member Functions inherited from dtn::net::DiscoveryBeaconHandler | |
virtual | ~DiscoveryBeaconHandler ()=0 |
virtual void | onAdvertiseBeacon (const ibrcommon::vinterface &iface, const DiscoveryBeacon &beacon) throw () |
Public Member Functions inherited from ibrcommon::LinkManager::EventCallback | |
virtual | ~EventCallback () |
Protected Member Functions | |
void | __cancellation () throw () |
void | componentUp () throw () |
void | componentRun () throw () |
void | componentDown () throw () |
Protected Member Functions inherited from dtn::daemon::IndependentComponent | |
void | run () throw () |
Protected Member Functions inherited from ibrcommon::JoinableThread | |
virtual | ~JoinableThread ()=0 |
void | join (void) throw (ThreadException) |
bool | isRunning (void) |
void | start (int priority=0) throw (ThreadException) |
void | stop () throw () |
JoinableThread (size_t size=DEFAULT_STACKSIZE) | |
Friends | |
class | TCPConnection |
Additional Inherited Members | |
Public Types inherited from dtn::net::ConvergenceLayer | |
typedef std::pair< string, string > | stats_pair |
typedef std::map< string, string > | stats_data |
This class implement a ConvergenceLayer for TCP/IP. http://tools.ietf.org/html/draft-irtf-dtnrg-tcp-clayer-02
Definition at line 51 of file TCPConvergenceLayer.h.
dtn::net::TCPConvergenceLayer::TCPConvergenceLayer | ( | ) |
Constructor
[in] | bind_addr | The address to bind. |
[in] | port | The port to use. |
Definition at line 56 of file TCPConvergenceLayer.cpp.
|
virtual |
Destructor
Definition at line 61 of file TCPConvergenceLayer.cpp.
References ibrcommon::vsocket::destroy(), dtn::core::BundleCore::getDiscoveryAgent(), ibrcommon::LinkManager::getInstance(), dtn::core::BundleCore::getInstance(), ibrcommon::JoinableThread::join(), ibrcommon::LinkManager::removeEventListener(), and dtn::net::DiscoveryAgent::unregisterService().
|
protectedvirtual |
This method is called after componentDown() and should should guarantee that blocking calls in componentRun() will unblock.
Implements dtn::daemon::IndependentComponent.
Definition at line 578 of file TCPConvergenceLayer.cpp.
References ibrcommon::vsocket::down().
void dtn::net::TCPConvergenceLayer::add | ( | const ibrcommon::vinterface & | net, |
int | port | ||
) | |||
throw | ( | ||
) |
Add an interface to this convergence layer
net | Interface to listen on |
port | Port to listen on |
Definition at line 75 of file TCPConvergenceLayer.cpp.
|
protectedvirtual |
This method is called if the component should stop. Clean-up code should be inserted here.
Implements dtn::daemon::IndependentComponent.
Definition at line 611 of file TCPConvergenceLayer.cpp.
References ibrcommon::vsocket::down(), ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::core::EventDispatcher< E >::remove(), ibrcommon::Conditional::wait(), and ibrcommon::Exception::what().
|
protectedvirtual |
This is the run method. The component should loop in there until componentDown() or __cancellation() is called.
Implements dtn::daemon::IndependentComponent.
Definition at line 519 of file TCPConvergenceLayer.cpp.
References ibrcommon::serversocket::accept(), ibrcommon::vaddress::address(), dtn::net::TCPConnection::initialize(), ibrcommon::TLSStream::isInitialized(), ibrcommon::vsocket::select(), ibrcommon::vaddress::service(), TCPConnection, and ibrcommon::Thread::yield().
|
protectedvirtual |
Is called in preparation of the component. Before componentRun() is called.
Implements dtn::daemon::IndependentComponent.
Definition at line 596 of file TCPConvergenceLayer.cpp.
References dtn::core::EventDispatcher< E >::add(), ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::vsocket::up(), and ibrcommon::Exception::what().
|
virtual |
Implements ibrcommon::LinkManager::EventCallback.
Definition at line 308 of file TCPConvergenceLayer.cpp.
References ibrcommon::LinkEvent::ACTION_ADDRESS_ADDED, ibrcommon::LinkEvent::ACTION_ADDRESS_REMOVED, ibrcommon::LinkEvent::ACTION_LINK_DOWN, ibrcommon::vsocket::add(), ibrcommon::vaddress::address(), ibrcommon::tcpserversocket::down(), ibrcommon::vsocket::get(), ibrcommon::tcpserversocket::get_address(), ibrcommon::LinkEvent::getAction(), ibrcommon::LinkEvent::getAddress(), ibrcommon::vsocket::getAll(), ibrcommon::LinkEvent::getInterface(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::vsocket::remove(), ibrcommon::vaddress::setService(), ibrcommon::tcpserversocket::up(), ibrcommon::LogLevel::warning, and ibrcommon::Exception::what().
|
virtual |
Returns the discovery protocol type
Implements dtn::net::ConvergenceLayer.
Definition at line 176 of file TCPConvergenceLayer.cpp.
References dtn::core::Node::CONN_TCPIP.
|
virtual |
Implements dtn::daemon::Component.
Definition at line 260 of file TCPConvergenceLayer.cpp.
|
virtual |
Reimplemented from dtn::net::ConvergenceLayer.
Definition at line 636 of file TCPConvergenceLayer.cpp.
References dtn::core::Node::toString().
|
virtual |
this method updates the given values
Reimplemented from dtn::net::DiscoveryBeaconHandler.
Definition at line 181 of file TCPConvergenceLayer.cpp.
References ibrcommon::vaddress::address(), dtn::daemon::Configuration::Discovery::enableCrosslayer(), ibrcommon::vaddress::family(), ibrcommon::vinterface::getAddresses(), dtn::daemon::Configuration::getDiscovery(), dtn::daemon::Configuration::getInstance(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, ibrcommon::vaddress::scope(), ibrcommon::vaddress::SCOPE_GLOBAL, and ibrcommon::Exception::what().
|
virtual |
Open a connection to the given node.
n |
Reimplemented from dtn::net::ConvergenceLayer.
Definition at line 376 of file TCPConvergenceLayer.cpp.
References dtn::net::ConnectionEvent::CONNECTION_SETUP, dtn::net::TCPConnection::initialize(), ibrcommon::TLSStream::isInitialized(), dtn::net::TCPConnection::match(), dtn::net::ConnectionEvent::raise(), ibrcommon::Conditional::signal(), and TCPConnection.
|
virtual |
Queue a new transmission job for this convergence layer.
job |
Implements dtn::net::ConvergenceLayer.
Definition at line 419 of file TCPConvergenceLayer.cpp.
References dtn::net::ConnectionEvent::CONNECTION_SETUP, dtn::net::TCPConnection::getNode(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, dtn::net::TCPConnection::initialize(), ibrcommon::TLSStream::isInitialized(), dtn::net::TCPConnection::match(), dtn::net::TCPConnection::queue(), dtn::net::ConnectionEvent::raise(), ibrcommon::Conditional::signal(), TCPConnection, and dtn::core::Node::toString().
|
virtual |
Implements dtn::core::EventReceiver.
Definition at line 265 of file TCPConvergenceLayer.cpp.
References dtn::core::BundleCore::getDiscoveryAgent(), ibrcommon::LinkManager::getInstance(), dtn::core::BundleCore::getInstance(), dtn::net::P2PDialupEvent::iface, dtn::net::P2PDialupEvent::INTERFACE_DOWN, dtn::net::P2PDialupEvent::INTERFACE_UP, ibrcommon::LinkManager::removeEventListener(), dtn::net::P2PDialupEvent::type, and dtn::net::DiscoveryAgent::unregisterService().
|
virtual |
Reimplemented from dtn::net::ConvergenceLayer.
Definition at line 651 of file TCPConvergenceLayer.cpp.
|
friend |
Definition at line 53 of file TCPConvergenceLayer.h.
Referenced by componentRun(), open(), and queue().