IBR-DTNSuite
0.10
|
#include <DatagramConvergenceLayer.h>
Public Types | |
enum | HEADER_FLAGS { HEADER_UNKOWN = 0, HEADER_BROADCAST = 1, HEADER_SEGMENT = 2, HEADER_ACK = 4, HEADER_NACK = 8 } |
Public Types inherited from dtn::net::ConvergenceLayer | |
typedef std::map< std::string, size_t > | stats_map |
Public Member Functions | |
DatagramConvergenceLayer (DatagramService *ds) | |
virtual | ~DatagramConvergenceLayer () |
dtn::core::Node::Protocol | getDiscoveryProtocol () const |
void | queue (const dtn::core::Node &n, const dtn::net::BundleTransfer &job) |
virtual const std::string | getName () const |
virtual void | raiseEvent (const dtn::core::Event *evt) throw () |
Public Member Functions inherited from dtn::net::ConvergenceLayer | |
virtual | ~ConvergenceLayer ()=0 |
virtual void | open (const dtn::core::Node &) |
virtual void | resetStats () |
virtual const stats_map & | getStats () |
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::DatagramConnectionCallback | |
virtual | ~DatagramConnectionCallback () |
Static Public Attributes | |
static const std::string | TAG = "DatagramConvergenceLayer" |
Protected Member Functions | |
virtual void | componentUp () throw () |
virtual void | componentRun () throw () |
virtual void | componentDown () throw () |
void | __cancellation () throw () |
void | sendAnnoucement () |
void | callback_send (DatagramConnection &connection, const char &flags, const unsigned int &seqno, const std::string &destination, const char *buf, const dtn::data::Length &len) throw (DatagramException) |
void | callback_ack (DatagramConnection &connection, const unsigned int &seqno, const std::string &destination) throw (DatagramException) |
void | connectionUp (const DatagramConnection *conn) |
void | connectionDown (const DatagramConnection *conn) |
Protected Member Functions inherited from dtn::net::ConvergenceLayer | |
virtual void | addStats (const std::string &tag, const size_t value) |
virtual void | setStats (const std::string &tag, const size_t value) |
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) | |
Additional Inherited Members |
Definition at line 41 of file DatagramConvergenceLayer.h.
Enumerator | |
---|---|
HEADER_UNKOWN | |
HEADER_BROADCAST | |
HEADER_SEGMENT | |
HEADER_ACK | |
HEADER_NACK |
Definition at line 47 of file DatagramConvergenceLayer.h.
dtn::net::DatagramConvergenceLayer::DatagramConvergenceLayer | ( | DatagramService * | ds | ) |
Definition at line 43 of file DatagramConvergenceLayer.cpp.
References dtn::net::ConvergenceLayer::addStats().
|
virtual |
Definition at line 51 of file DatagramConvergenceLayer.cpp.
References ibrcommon::JoinableThread::join(), and ibrcommon::Conditional::wait().
|
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 332 of file DatagramConvergenceLayer.cpp.
References dtn::net::DatagramService::shutdown().
|
protectedvirtual |
Implements dtn::net::DatagramConnectionCallback.
Definition at line 80 of file DatagramConvergenceLayer.cpp.
|
protectedvirtual |
callback send for connections
connection | |
destination | |
buf | |
len |
Implements dtn::net::DatagramConnectionCallback.
Definition at line 68 of file DatagramConvergenceLayer.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 177 of file DatagramConvergenceLayer.cpp.
References ibrcommon::RWMutex::LOCK_READONLY, and dtn::core::EventDispatcher< E >::remove().
|
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 218 of file DatagramConvergenceLayer.cpp.
References dtn::net::DatagramConnection::ack(), dtn::core::Node::add(), dtn::net::ConvergenceLayer::addStats(), ibrcommon::LogLevel::error, dtn::core::BundleCore::getConnectionManager(), dtn::core::BundleCore::getInstance(), dtn::net::DiscoveryService::getName(), dtn::net::DatagramService::getParameter(), dtn::net::DiscoveryService::getParameters(), dtn::net::DatagramService::getProtocol(), HEADER_ACK, HEADER_BROADCAST, HEADER_SEGMENT, IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::core::BundleCore::local, ibrcommon::RWMutex::LOCK_READONLY, dtn::net::DatagramService::Parameter::max_msg_length, dtn::net::DatagramConnection::queue(), dtn::net::DatagramService::recvfrom(), dtn::net::DatagramConnection::setPeerEID(), dtn::net::DatagramConnection::shutdown(), TAG, dtn::net::ConnectionManager::updateNeighbor(), ibrcommon::Exception::what(), and ibrcommon::Thread::yield().
|
protectedvirtual |
Is called in preparation of the component. Before componentRun() is called.
Implements dtn::daemon::IndependentComponent.
Definition at line 163 of file DatagramConvergenceLayer.cpp.
References dtn::core::EventDispatcher< E >::add(), dtn::net::DatagramService::bind(), ibrcommon::LogLevel::error, dtn::net::DatagramService::getInterface(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, TAG, and ibrcommon::vinterface::toString().
|
protectedvirtual |
Implements dtn::net::DatagramConnectionCallback.
Definition at line 143 of file DatagramConvergenceLayer.cpp.
References ibrcommon::LogLevel::error, dtn::net::DatagramConnection::getIdentifier(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READWRITE, ibrcommon::Conditional::signal(), and TAG.
|
protectedvirtual |
Implements dtn::net::DatagramConnectionCallback.
Definition at line 138 of file DatagramConvergenceLayer.cpp.
References dtn::net::DatagramConnection::getIdentifier(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, and TAG.
|
virtual |
Returns the protocol identifier
Implements dtn::net::ConvergenceLayer.
Definition at line 63 of file DatagramConvergenceLayer.cpp.
References dtn::net::DatagramService::getProtocol().
|
virtual |
Implements dtn::daemon::Component.
Definition at line 338 of file DatagramConvergenceLayer.cpp.
References TAG.
|
virtual |
Queueing a job for a specific node. Starting point for the DTN core to submit bundles to nodes behind the convergence layer
n | Node reference |
job | Job reference |
Implements dtn::net::ConvergenceLayer.
Definition at line 89 of file DatagramConvergenceLayer.cpp.
References dtn::core::Node::get(), dtn::core::Node::getEID(), dtn::net::DatagramService::getProtocol(), dtn::data::EID::getString(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, ibrcommon::RWMutex::LOCK_READONLY, dtn::net::DatagramConnection::queue(), TAG, and dtn::core::Node::URI::value.
|
virtual |
Public method for event callbacks
evt |
Implements dtn::core::EventReceiver.
Definition at line 321 of file DatagramConvergenceLayer.cpp.
References dtn::data::SDNV< E >::get(), dtn::core::TimeEvent::getAction(), dtn::core::TimeEvent::getTimestamp(), and dtn::core::TIME_SECOND_TICK.
|
protected |
Definition at line 190 of file DatagramConvergenceLayer.cpp.
References dtn::net::DiscoveryAnnouncement::clearServices(), dtn::net::DiscoveryAnnouncement::DISCO_VERSION_01, HEADER_BROADCAST, dtn::core::BundleCore::local, dtn::net::DatagramService::send(), and dtn::net::DiscoveryAnnouncement::setSequencenumber().
|
static |
Definition at line 45 of file DatagramConvergenceLayer.h.
Referenced by componentRun(), componentUp(), connectionDown(), connectionUp(), getName(), and queue().