IBR-DTNSuite
0.12
|
#include <DTNTPWorker.h>
Classes | |
class | TimeSyncMessage |
class | TimeSyncState |
Public Member Functions | |
DTNTPWorker () | |
virtual | ~DTNTPWorker () |
void | callbackBundleReceived (const Bundle &b) |
void | raiseEvent (const dtn::core::Event *evt) throw () |
void | onUpdateBeacon (const ibrcommon::vinterface &iface, DiscoveryBeacon &announcement) throw (NoServiceHereException) |
Public Member Functions inherited from dtn::core::AbstractWorker | |
AbstractWorker () | |
virtual | ~AbstractWorker () |
virtual const EID | getWorkerURI () const |
Public Member Functions inherited from ibrcommon::Mutex | |
Mutex (MUTEX_TYPE type=MUTEX_NORMAL) | |
virtual | ~Mutex () |
virtual void | trylock () throw (MutexException) |
virtual void | enter () throw (MutexException) |
virtual void | leave () throw (MutexException) |
Public Member Functions inherited from ibrcommon::MutexInterface | |
virtual | ~MutexInterface ()=0 |
Public Member Functions inherited from dtn::core::EventReceiver | |
virtual | ~EventReceiver ()=0 |
Public Member Functions inherited from dtn::net::DiscoveryBeaconHandler | |
virtual | ~DiscoveryBeaconHandler ()=0 |
virtual void | onAdvertiseBeacon (const ibrcommon::vinterface &iface, const DiscoveryBeacon &beacon) throw () |
Static Public Member Functions | |
static const TimeSyncState & | getState () |
Additional Inherited Members | |
Public Types inherited from ibrcommon::Mutex | |
enum | MUTEX_TYPE { MUTEX_NORMAL = PTHREAD_MUTEX_NORMAL, MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE, MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK } |
Protected Member Functions inherited from dtn::core::AbstractWorker | |
void | initialize (const std::string &uri) |
void | transmit (const Bundle &bundle) |
void | shutdown () |
void | subscribe (const dtn::data::EID &endpoint) |
void | unsubscribe (const dtn::data::EID &endpoint) |
Protected Attributes inherited from dtn::core::AbstractWorker | |
dtn::data::EID | _eid |
Definition at line 35 of file DTNTPWorker.h.
dtn::daemon::DTNTPWorker::DTNTPWorker | ( | ) |
Constructor
Definition at line 68 of file DTNTPWorker.cpp.
References dtn::core::EventDispatcher< E >::add(), dtn::daemon::DTNTPWorker::TimeSyncState::base_rating, dtn::daemon::Configuration::TimeSync::doSync(), dtn::core::BundleCore::getDiscoveryAgent(), dtn::core::BundleCore::getInstance(), dtn::daemon::Configuration::getInstance(), dtn::daemon::Configuration::TimeSync::getPsi(), dtn::daemon::Configuration::TimeSync::getSigma(), dtn::daemon::Configuration::TimeSync::getSyncLevel(), dtn::utils::Clock::getTime(), dtn::daemon::Configuration::getTimeSync(), dtn::daemon::Configuration::TimeSync::hasReference(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::LogLevel::info, dtn::daemon::DTNTPWorker::TimeSyncState::psi, dtn::net::DiscoveryAgent::registerService(), dtn::daemon::Configuration::TimeSync::sendDiscoveryBeacons(), dtn::utils::Clock::setRating(), dtn::daemon::DTNTPWorker::TimeSyncState::sigma, dtn::daemon::DTNTPWorker::TimeSyncState::sync_threshold, and ibrcommon::LogLevel::warning.
|
virtual |
Destructor
Definition at line 113 of file DTNTPWorker.cpp.
References dtn::core::BundleCore::getDiscoveryAgent(), dtn::core::BundleCore::getInstance(), dtn::core::EventDispatcher< E >::remove(), and dtn::net::DiscoveryAgent::unregisterService().
|
virtual |
This method is called every time a bundles is received for this endpoint.
b |
Implements dtn::core::AbstractWorker.
Definition at line 481 of file DTNTPWorker.cpp.
References dtn::data::Bundle::begin(), dtn::data::AgeBlock::BLOCK_TYPE, ibrcommon::BLOB::iostream::clear(), dtn::data::PrimaryBlock::destination, dtn::data::PrimaryBlock::DESTINATION_IS_SINGLETON, ibrcommon::MonotonicClock::diff(), dtn::data::Bundle::end(), dtn::data::Bundle::find(), dtn::data::SDNV< E >::get(), dtn::data::PayloadBlock::getBLOB(), dtn::data::AgeBlock::getMicroseconds(), dtn::data::EID::getNode(), dtn::utils::Clock::getRating(), dtn::data::AgeBlock::getSeconds(), dtn::data::EID::getString(), ibrcommon::MonotonicClock::gettime(), dtn::utils::Clock::gettimeofday(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::LogLevel::info, ibrcommon::BLOB::iostream::iostream(), ibrcommon::BLOB::Reference::iostream(), dtn::data::PrimaryBlock::lifetime, dtn::core::BundleCore::local, dtn::data::PrimaryBlock::PRIORITY_BIT1, dtn::data::PrimaryBlock::PRIORITY_BIT2, dtn::data::Bundle::push_front(), dtn::data::PrimaryBlock::relabel(), dtn::data::EID::sameHost(), dtn::data::PrimaryBlock::set(), dtn::data::ScopeControlHopLimitBlock::setLimit(), dtn::data::BundleID::source, dtn::daemon::DTNTPWorker::TimeSyncMessage::TIMESYNC_REQUEST, dtn::daemon::DTNTPWorker::TimeSyncMessage::TIMESYNC_RESPONSE, dtn::utils::Clock::toDouble(), dtn::core::AbstractWorker::transmit(), and ibrcommon::LogLevel::warning.
|
static |
Get the global time sync state
Definition at line 666 of file DTNTPWorker.cpp.
|
virtual |
This message is called by the discovery module.
iface | |
name | |
data |
Reimplemented from dtn::net::DiscoveryBeaconHandler.
Definition at line 383 of file DTNTPWorker.cpp.
References dtn::utils::Clock::getRating(), dtn::utils::Clock::getTime(), and dtn::data::SDNV< E >::toString().
|
virtual |
This method is called by the EventSwitch.
evt |
evaluate the current local time
Implements dtn::core::EventReceiver.
Definition at line 190 of file DTNTPWorker.cpp.
References dtn::daemon::DTNTPWorker::TimeSyncState::base_rating, ibrcommon::MonotonicClock::diff(), dtn::core::TimeEvent::getAction(), dtn::core::BundleCore::getConnectionManager(), dtn::core::BundleCore::getInstance(), dtn::utils::Clock::getMonotonicTimestamp(), dtn::net::ConnectionManager::getNeighbors(), dtn::utils::Clock::getRating(), ibrcommon::MonotonicClock::gettime(), dtn::core::TimeEvent::getTimestamp(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::daemon::DTNTPWorker::TimeSyncState::last_sync_set, dtn::daemon::DTNTPWorker::TimeSyncState::last_sync_time, dtn::utils::Clock::setRating(), dtn::daemon::DTNTPWorker::TimeSyncState::sigma, dtn::core::TIME_SECOND_TICK, dtn::daemon::DTNTPWorker::TimeSyncState::toDouble(), and ibrcommon::LogLevel::warning.