IBR-DTNSuite
0.8
|
#include <BundleCore.h>
Public Member Functions | |
WallClock & | getClock () |
void | setStorage (dtn::storage::BundleStorage *storage) |
dtn::storage::BundleStorage & | getStorage () |
void | setRouter (dtn::routing::BaseRouter *router) |
dtn::routing::BaseRouter & | getRouter () const |
void | transferTo (const dtn::data::EID &destination, const dtn::data::BundleID &bundle) |
void | addConvergenceLayer (dtn::net::ConvergenceLayer *cl) |
void | addConnection (const dtn::core::Node &n) |
void | removeConnection (const dtn::core::Node &n) |
void | addRoute (const dtn::data::EID &destination, const dtn::data::EID &nexthop, size_t timeout=0) |
void | removeRoute (const dtn::data::EID &destination, const dtn::data::EID &nexthop) |
const std::set< dtn::core::Node > | getNeighbors () |
bool | isNeighbor (const dtn::core::Node &node) |
const dtn::core::Node | getNeighbor (const dtn::data::EID &eid) |
void | raiseEvent (const dtn::core::Event *evt) |
virtual void | validate (const dtn::data::PrimaryBlock &obj) const throw (RejectedException) |
virtual void | validate (const dtn::data::Block &obj, const size_t length) const throw (RejectedException) |
virtual void | validate (const dtn::data::Bundle &obj) const throw (RejectedException) |
virtual const std::string | getName () const |
Static Public Member Functions | |
static BundleCore & | getInstance () |
static void | processBlocks (dtn::data::Bundle &b) |
Static Public Attributes | |
static dtn::data::EID | local |
static size_t | blocksizelimit = 0 |
static size_t | max_lifetime = 0 |
static size_t | max_timestamp_future = 0 |
static bool | forwarding = true |
Protected Member Functions | |
virtual void | componentUp () |
virtual void | componentDown () |
The BundleCore manage the Bundle Protocol basics
Definition at line 32 of file BundleCore.h.
void dtn::core::BundleCore::addConnection | ( | const dtn::core::Node & | n | ) |
Definition at line 148 of file BundleCore.cpp.
References dtn::net::ConnectionManager::addConnection().
Referenced by __daemon_run(), and dtn_dht_handle_lookup_result().
Definition at line 143 of file BundleCore.cpp.
References dtn::net::ConnectionManager::addConvergenceLayer().
Referenced by createConvergenceLayers().
void dtn::core::BundleCore::addRoute | ( | const dtn::data::EID & | destination, |
const dtn::data::EID & | nexthop, | ||
size_t | timeout = 0 |
||
) |
Add a static route to the static routing module.
destination | |
nexthop | |
timeout |
Definition at line 158 of file BundleCore.cpp.
References raiseEvent(), and dtn::routing::StaticRouteChangeEvent::ROUTE_ADD.
Referenced by dtn_dht_handle_lookup_result().
void dtn::core::BundleCore::componentDown | ( | ) | [protected, virtual] |
Implements dtn::daemon::IntegratedComponent.
Definition at line 88 of file BundleCore.cpp.
References dtn::daemon::IntegratedComponent::terminate().
void dtn::core::BundleCore::componentUp | ( | ) | [protected, virtual] |
Implements dtn::daemon::IntegratedComponent.
Definition at line 79 of file BundleCore.cpp.
References dtn::daemon::IntegratedComponent::initialize(), and dtn::daemon::IntegratedComponent::startup().
Definition at line 123 of file BundleCore.cpp.
BundleCore & dtn::core::BundleCore::getInstance | ( | ) | [static] |
Definition at line 48 of file BundleCore.cpp.
Referenced by dtn::daemon::CapsuleWorker::callbackBundleReceived(), dtn::core::FragmentManager::componentRun(), dtn::net::FileConvergenceLayer::componentRun(), dtn::dht::DHTNameService::componentRun(), dtn_dht_handle_lookup_result(), dtn::routing::RetransmissionExtension::notify(), dtn::routing::FloodRoutingExtension::notify(), dtn::routing::EpidemicRoutingExtension::notify(), dtn::routing::ProphetRoutingExtension::notify(), dtn::net::UDPConvergenceLayer::operator>>(), dtn::net::operator>>(), processBlocks(), dtn::net::UDPConvergenceLayer::queue(), dtn::net::HTTPConvergenceLayer::queue(), raiseEvent(), dtn::api::Registration::receive(), dtn::net::LOWPANConnectionSender::run(), dtn::routing::NeighborRoutingExtension::run(), dtn::api::ExtendedApiHandler::run(), dtn::net::DatagramConnection::run(), dtn::net::LOWPANConnection::run(), dtn::net::DownloadThread::run(), dtn::core::FragmentManager::setOffset(), dtn::routing::BaseRouter::Extension::transferTo(), dtn::api::BundleStreamBuf::underflow(), and dtn::api::Registration::underflow().
const std::string dtn::core::BundleCore::getName | ( | ) | const [virtual] |
Implements dtn::daemon::Component.
Definition at line 369 of file BundleCore.cpp.
const dtn::core::Node dtn::core::BundleCore::getNeighbor | ( | const dtn::data::EID & | eid | ) |
Get the neighbor with the given EID.
dtn::net::NeighborNotAvailableException | if the neighbor is not available. |
eid | The EID of the neighbor. |
Definition at line 178 of file BundleCore.cpp.
References dtn::net::ConnectionManager::getNeighbor().
const std::set< dtn::core::Node > dtn::core::BundleCore::getNeighbors | ( | ) |
get a set with all neighbors
Definition at line 168 of file BundleCore.cpp.
References dtn::net::ConnectionManager::getNeighbors().
Referenced by dtn::dht::DHTNameService::componentRun(), dtn::routing::FloodRoutingExtension::notify(), dtn::routing::EpidemicRoutingExtension::notify(), dtn::routing::ProphetRoutingExtension::notify(), dtn::routing::NeighborRoutingExtension::run(), and dtn::api::ExtendedApiHandler::run().
Definition at line 104 of file BundleCore.cpp.
Definition at line 114 of file BundleCore.cpp.
Referenced by __daemon_run(), dtn::core::FragmentManager::componentRun(), dtn::net::FileConvergenceLayer::componentRun(), dtn::dht::DHTNameService::componentRun(), dtn::net::UDPConvergenceLayer::queue(), dtn::net::HTTPConvergenceLayer::queue(), raiseEvent(), dtn::api::Registration::receive(), dtn::net::LOWPANConnectionSender::run(), dtn::api::ExtendedApiHandler::run(), dtn::core::FragmentManager::setOffset(), dtn::api::BundleStreamBuf::underflow(), and dtn::api::Registration::underflow().
bool dtn::core::BundleCore::isNeighbor | ( | const dtn::core::Node & | node | ) |
Checks if a node is already known as neighbor.
@return |
Definition at line 173 of file BundleCore.cpp.
References dtn::net::ConnectionManager::isNeighbor().
Referenced by dtn_dht_handle_lookup_result().
void dtn::core::BundleCore::processBlocks | ( | dtn::data::Bundle & | b | ) | [static] |
Definition at line 374 of file BundleCore.cpp.
References dtn::data::CompressedPayloadBlock::BLOCK_TYPE, dtn::security::PayloadConfidentialBlock::BLOCK_TYPE, dtn::data::CompressedPayloadBlock::extract(), dtn::data::Bundle::getBlocks(), getInstance(), dtn::data::Block::getType(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, and ibrcommon::Exception::what().
Referenced by dtn::api::ExtendedApiHandler::run(), and dtn::api::BundleStreamBuf::underflow().
void dtn::core::BundleCore::raiseEvent | ( | const dtn::core::Event * | evt | ) | [virtual] |
Implements dtn::core::EventReceiver.
Definition at line 183 of file BundleCore.cpp.
References dtn::data::CustodySignalBlock::_bundle_sequence, dtn::data::CustodySignalBlock::_bundle_timestamp, dtn::data::CustodySignalBlock::_fragment_length, dtn::data::CustodySignalBlock::_fragment_offset, dtn::data::CustodySignalBlock::_source, dtn::data::PrimaryBlock::_source, dtn::core::BundlePurgeEvent::bundle, dtn::routing::QueueBundleEvent::bundle, dtn::core::BUNDLE_DELETED, dtn::core::BUNDLE_DELIVERED, dtn::data::MetaBundle::destination, dtn::data::StatusReportBlock::DESTINATION_ENDPOINT_ID_UNINTELLIGIBLE, dtn::data::BundleID::fragment, dtn::storage::BundleStorage::get(), dtn::data::Bundle::getBlock(), getInstance(), getStorage(), dtn::data::SDNV::getValue(), IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, local, dtn::core::BundlePurgeEvent::raise(), dtn::core::BundleEvent::raise(), dtn::storage::BundleStorage::releaseCustody(), dtn::storage::BundleStorage::remove(), and dtn::data::Bundle::toString().
Referenced by addRoute(), and removeRoute().
void dtn::core::BundleCore::removeConnection | ( | const dtn::core::Node & | n | ) |
Definition at line 153 of file BundleCore.cpp.
References dtn::net::ConnectionManager::removeConnection().
void dtn::core::BundleCore::removeRoute | ( | const dtn::data::EID & | destination, |
const dtn::data::EID & | nexthop | ||
) |
Remove a static route from the static routing module.
destination | |
nexthop |
Definition at line 163 of file BundleCore.cpp.
References raiseEvent(), and dtn::routing::StaticRouteChangeEvent::ROUTE_DEL.
void dtn::core::BundleCore::setRouter | ( | dtn::routing::BaseRouter * | router | ) |
Definition at line 99 of file BundleCore.cpp.
Referenced by __daemon_run().
void dtn::core::BundleCore::setStorage | ( | dtn::storage::BundleStorage * | storage | ) |
Definition at line 94 of file BundleCore.cpp.
Referenced by createBundleStorage().
void dtn::core::BundleCore::transferTo | ( | const dtn::data::EID & | destination, |
const dtn::data::BundleID & | bundle | ||
) |
Definition at line 128 of file BundleCore.cpp.
References dtn::net::ConnectionManager::queue(), dtn::routing::RequeueBundleEvent::raise(), dtn::net::TransferAbortedEvent::raise(), and dtn::net::TransferAbortedEvent::REASON_CONNECTION_DOWN.
Referenced by dtn::routing::RetransmissionExtension::notify(), and dtn::routing::BaseRouter::Extension::transferTo().
void dtn::core::BundleCore::validate | ( | const dtn::data::PrimaryBlock & | obj | ) | const throw (RejectedException) [virtual] |
Implements dtn::data::Validator.
Definition at line 249 of file BundleCore.cpp.
References forwarding, dtn::utils::Clock::getTime(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, local, max_lifetime, max_timestamp_future, and dtn::utils::Clock::quality.
Referenced by dtn::daemon::CapsuleWorker::callbackBundleReceived(), dtn::net::DatagramConnection::run(), dtn::net::LOWPANConnection::run(), and dtn::net::DownloadThread::run().
void dtn::core::BundleCore::validate | ( | const dtn::data::Block & | obj, |
const size_t | length | ||
) | const throw (RejectedException) [virtual] |
Implements dtn::data::Validator.
Definition at line 299 of file BundleCore.cpp.
References blocksizelimit, IBRCOMMON_LOGGER, and IBRCOMMON_LOGGER_ENDL.
void dtn::core::BundleCore::validate | ( | const dtn::data::Bundle & | obj | ) | const throw (RejectedException) [virtual] |
Implements dtn::data::Validator.
Definition at line 318 of file BundleCore.cpp.
References dtn::data::StatusReportBlock::BLOCK_UNINTELLIGIBLE, dtn::core::BUNDLE_RECEIVED, dtn::data::Block::DELETE_BUNDLE_IF_NOT_PROCESSED, dtn::security::SecurityManager::fastverify(), dtn::data::Block::get(), dtn::security::SecurityManager::getInstance(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, dtn::utils::Clock::isExpired(), dtn::core::BundleEvent::raise(), and dtn::data::Block::TRANSMIT_STATUSREPORT_IF_NOT_PROCESSED.
size_t dtn::core::BundleCore::blocksizelimit = 0 [static] |
Define a global block size limit. This is used in the validator to reject bundles while receiving.
Definition at line 99 of file BundleCore.h.
Referenced by setGlobalVars(), and validate().
bool dtn::core::BundleCore::forwarding = true [static] |
Define if forwarding is allowed. If set to false, this daemon only accepts bundles for local applications.
Definition at line 114 of file BundleCore.h.
Referenced by validate().
Definition at line 35 of file BundleCore.h.
Referenced by dtn::storage::BundleStorage::acceptCustody(), dtn::security::SecurityManager::auth(), dtn::daemon::DTNTPWorker::callbackBundleReceived(), dtn::core::FragmentManager::componentRun(), dtn::net::FileConvergenceLayer::componentRun(), dtn::net::HTTPConvergenceLayer::componentRun(), dtn::dht::DHTNameService::componentRun(), dtn::net::TCPConvergenceLayer::componentRun(), dtn::dht::DHTNameService::componentUp(), dtn::security::SecurityManager::decrypt(), dtn::net::ConnectionManager::discovered(), dtn_dht_handle_lookup_result(), dtn::security::SecurityManager::encrypt(), dtn::core::AbstractWorker::initialize(), dtn::net::TCPConvergenceLayer::open(), dtn::routing::ProphetRoutingExtension::processHandshake(), dtn::routing::ProphetRoutingExtension::ProphetRoutingExtension(), dtn::net::HTTPConvergenceLayer::queue(), dtn::net::TCPConvergenceLayer::queue(), dtn::daemon::DTNTPWorker::raiseEvent(), raiseEvent(), dtn::dht::DHTNameService::raiseEvent(), dtn::routing::BaseRouter::raiseEvent(), dtn::storage::BundleStorage::rejectCustody(), dtn::api::OrderedStreamHandler::run(), dtn::routing::NeighborRoutingExtension::run(), dtn::api::ExtendedApiHandler::run(), dtn::routing::FloodRoutingExtension::run(), dtn::routing::StaticRoutingExtension::run(), dtn::api::BinaryStreamClient::run(), dtn::routing::EpidemicRoutingExtension::run(), dtn::net::IPNDAgent::sendAnnoucement(), dtn::net::LOWPANConvergenceLayer::sendAnnoucement(), dtn::net::DatagramConvergenceLayer::sendAnnoucement(), setGlobalVars(), dtn::security::SecurityManager::sign(), dtn::core::FragmentManager::signal(), validate(), and dtn::security::SecurityManager::verifyPIB().
size_t dtn::core::BundleCore::max_lifetime = 0 [static] |
Define the maximum lifetime for accepted bundles
Definition at line 104 of file BundleCore.h.
Referenced by setGlobalVars(), and validate().
size_t dtn::core::BundleCore::max_timestamp_future = 0 [static] |
Define the maximum offset for the timestamp of pre-dated bundles
Definition at line 109 of file BundleCore.h.
Referenced by setGlobalVars(), and validate().