IBR-DTN
1.0.0
|
#include <NativeDaemon.h>
Public Member Functions | |
NativeDaemon (NativeDaemonCallback *statecb=NULL, NativeEventCallback *eventcb=NULL) | |
virtual | ~NativeDaemon () |
DaemonRunLevel | getRunLevel () const throw () |
void | init (DaemonRunLevel rl) throw (NativeDaemonException) |
void | wait (DaemonRunLevel rl) throw () |
void | reload () throw () |
void | setDebug (int level) throw () |
void | setLogging (const std::string &defaultTag, int logLevel) const throw () |
void | setLogFile (const std::string &path, int logLevel) const throw () |
void | setConfigFile (const std::string &config_file) |
std::string | getLocalUri () const throw () |
std::vector< std::string > | getNeighbors () const throw () |
NativeNode | getInfo (const std::string &neighbor_eid) const throw (NativeDaemonException) |
NativeStats | getStats () throw () |
void | addConnection (std::string eid, std::string protocol, std::string address, std::string service, bool local=false) const throw () |
void | removeConnection (std::string eid, std::string protocol, std::string address, std::string service, bool local=false) const throw () |
void | initiateConnection (std::string eid) const |
void | setGloballyConnected (bool connected) const |
void | onKeyExchangeBegin (std::string eid, int protocol, std::string password) const |
void | onKeyExchangeResponse (std::string eid, int protocol, int session, int step, std::string data) const |
NativeKeyInfo | getKeyInfo (std::string eid) const throw (NativeDaemonException) |
void | removeKey (std::string eid) const throw (NativeDaemonException) |
virtual void | raiseEvent (const dtn::core::NodeEvent &evt) throw () |
virtual void | raiseEvent (const dtn::core::GlobalEvent &evt) throw () |
virtual void | raiseEvent (const dtn::core::CustodyEvent &evt) throw () |
virtual void | raiseEvent (const dtn::net::BundleReceivedEvent &evt) throw () |
virtual void | raiseEvent (const dtn::net::TransferAbortedEvent &evt) throw () |
virtual void | raiseEvent (const dtn::net::TransferCompletedEvent &evt) throw () |
virtual void | raiseEvent (const dtn::net::ConnectionEvent &evt) throw () |
virtual void | raiseEvent (const dtn::routing::QueueBundleEvent &evt) throw () |
std::vector< std::string > | getVersion () const throw () |
void | clearStorage () const throw () |
void | startDiscovery () const throw () |
void | stopDiscovery () const throw () |
void | setLeMode (bool low_energy) const throw () |
![]() | |
virtual | ~EventReceiver () |
![]() | |
virtual | ~EventReceiver () |
![]() | |
virtual | ~EventReceiver () |
![]() | |
virtual | ~EventReceiver () |
![]() | |
virtual | ~EventReceiver () |
![]() | |
virtual | ~EventReceiver () |
![]() | |
virtual | ~EventReceiver () |
![]() | |
virtual | ~EventReceiver () |
Definition at line 165 of file NativeDaemon.h.
dtn::daemon::NativeDaemon::NativeDaemon | ( | NativeDaemonCallback * | statecb = NULL , |
NativeEventCallback * | eventcb = NULL |
||
) |
Constructor
Definition at line 147 of file NativeDaemon.cpp.
|
virtual |
Destructor
Definition at line 153 of file NativeDaemon.cpp.
void dtn::daemon::NativeDaemon::addConnection | ( | std::string | eid, |
std::string | protocol, | ||
std::string | address, | ||
std::string | service, | ||
bool | local = false |
||
) | const | ||
throw | ( | ||
) |
Add a static connection to the neighbor with the given EID
Definition at line 635 of file NativeDaemon.cpp.
References dtn::net::ConnectionManager::add(), dtn::core::Node::add(), dtn::core::Node::CONN_FILE, dtn::core::Node::CONN_TCPIP, dtn::core::Node::CONN_UDPIP, dtn::core::BundleCore::getConnectionManager(), dtn::core::BundleCore::getInstance(), dtn::core::Node::NODE_STATIC_GLOBAL, and dtn::core::Node::NODE_STATIC_LOCAL.
void dtn::daemon::NativeDaemon::clearStorage | ( | ) | const | |
throw | ( | |||
) |
Delete all bundles in the storage
Definition at line 165 of file NativeDaemon.cpp.
References dtn::storage::BundleStorage::clear(), dtn::core::BundleCore::getInstance(), and dtn::core::BundleCore::getStorage().
NativeNode dtn::daemon::NativeDaemon::getInfo | ( | const std::string & | neighbor_eid | ) | const |
throw | ( | NativeDaemonException | |||
) |
Get neighbor info
Definition at line 576 of file NativeDaemon.cpp.
References dtn::core::Node::getAll(), dtn::core::BundleCore::getConnectionManager(), dtn::core::BundleCore::getInstance(), dtn::net::ConnectionManager::getNeighbor(), dtn::core::Node::NODE_CONNECTED, dtn::daemon::NativeNode::NODE_CONNECTED, dtn::core::Node::NODE_DHT_DISCOVERED, dtn::core::Node::NODE_DISCOVERED, dtn::daemon::NativeNode::NODE_DISCOVERED, dtn::daemon::NativeNode::NODE_INTERNET, dtn::daemon::NativeNode::NODE_P2P, dtn::core::Node::NODE_P2P_DIALUP, dtn::daemon::NativeNode::NODE_STATIC, dtn::core::Node::NODE_STATIC_GLOBAL, dtn::core::Node::NODE_STATIC_LOCAL, dtn::core::Node::NODE_UNAVAILABLE, dtn::core::Node::URI::type, and dtn::daemon::NativeNode::type.
NativeKeyInfo dtn::daemon::NativeDaemon::getKeyInfo | ( | std::string | eid | ) | const |
throw | ( | NativeDaemonException | |||
) |
Returns security key data
Definition at line 734 of file NativeDaemon.cpp.
References dtn::daemon::NativeKeyInfo::data, dtn::daemon::NativeKeyInfo::endpoint, dtn::daemon::NativeKeyInfo::fingerprint, dtn::security::SecurityKey::flags, dtn::daemon::NativeKeyInfo::flags, dtn::security::SecurityKeyManager::get(), dtn::data::SDNV< E >::get(), dtn::security::SecurityKey::getData(), dtn::security::SecurityKey::getFingerprint(), dtn::security::SecurityKeyManager::getInstance(), dtn::data::EID::getString(), dtn::security::SecurityKey::KEY_PUBLIC, dtn::security::SecurityKey::reference, dtn::security::SecurityKey::trustlevel, and dtn::daemon::NativeKeyInfo::trustlevel.
std::string dtn::daemon::NativeDaemon::getLocalUri | ( | ) | const | |
throw | ( | |||
) |
NATIVE DAEMON METHODS Get the local EID of this node
Definition at line 536 of file NativeDaemon.cpp.
References dtn::data::EID::getString(), and dtn::core::BundleCore::local.
std::vector< std::string > dtn::daemon::NativeDaemon::getNeighbors | ( | ) | const | |
throw | ( | |||
) |
Get the neighbors
Definition at line 620 of file NativeDaemon.cpp.
References dtn::core::BundleCore::getConnectionManager(), dtn::core::Node::getEID(), dtn::core::BundleCore::getInstance(), dtn::net::ConnectionManager::getNeighbors(), and dtn::data::EID::getString().
DaemonRunLevel dtn::daemon::NativeDaemon::getRunLevel | ( | ) | const | |
throw | ( | |||
) |
Get the current runlevel
Definition at line 863 of file NativeDaemon.cpp.
NativeStats dtn::daemon::NativeDaemon::getStats | ( | ) | ||
throw | ( | |||
) |
Get statistical data
Definition at line 541 of file NativeDaemon.cpp.
References dtn::daemon::NativeStats::addData(), dtn::daemon::NativeStats::bundles_aborted, dtn::daemon::NativeStats::bundles_expired, dtn::daemon::NativeStats::bundles_queued, dtn::daemon::NativeStats::bundles_received, dtn::daemon::NativeStats::bundles_requeued, dtn::daemon::NativeStats::bundles_stored, dtn::daemon::NativeStats::bundles_transmitted, dtn::storage::BundleStorage::count(), dtn::data::SDNV< E >::get(), dtn::core::BundleCore::getConnectionManager(), dtn::core::EventDispatcher< E >::getCounter(), dtn::core::BundleCore::getInstance(), dtn::net::ConnectionManager::getNeighbors(), dtn::utils::Clock::getOffset(), dtn::utils::Clock::getRating(), dtn::net::ConnectionManager::getStats(), dtn::core::BundleCore::getStorage(), dtn::utils::Clock::getTime(), dtn::utils::Clock::getUptime(), dtn::daemon::NativeStats::neighbors, dtn::storage::BundleStorage::size(), dtn::daemon::NativeStats::storage_size, dtn::daemon::NativeStats::time_adjustments, dtn::daemon::NativeStats::time_offset, dtn::daemon::NativeStats::time_rating, dtn::daemon::NativeStats::timestamp, dtn::utils::Clock::toDouble(), and dtn::daemon::NativeStats::uptime.
std::vector< std::string > dtn::daemon::NativeDaemon::getVersion | ( | ) | const | |
throw | ( | |||
) |
Returns version information about the native daemon
Definition at line 157 of file NativeDaemon.cpp.
References BUILD_NUMBER, and VERSION.
void dtn::daemon::NativeDaemon::init | ( | DaemonRunLevel | rl | ) | |
throw | ( | NativeDaemonException | |||
) |
Switch the runlevel of the daemon
Definition at line 868 of file NativeDaemon.cpp.
Referenced by __daemon_run(), and ServiceMain().
void dtn::daemon::NativeDaemon::initiateConnection | ( | std::string | eid | ) | const |
initiate a connection to a given neighbor
Definition at line 687 of file NativeDaemon.cpp.
References dtn::core::BundleCore::getConnectionManager(), dtn::core::BundleCore::getInstance(), dtn::net::ConnectionManager::getNeighbor(), and dtn::net::ConnectionManager::open().
void dtn::daemon::NativeDaemon::onKeyExchangeBegin | ( | std::string | eid, |
int | protocol, | ||
std::string | password | ||
) | const |
Start the key exchange with the given neighbor and protocol
Definition at line 705 of file NativeDaemon.cpp.
References dtn::security::KeyExchangeEvent::raise(), and dtn::security::KeyExchangeData::START.
void dtn::daemon::NativeDaemon::onKeyExchangeResponse | ( | std::string | eid, |
int | protocol, | ||
int | session, | ||
int | step, | ||
std::string | data | ||
) | const |
Respond to a exchange request
Definition at line 719 of file NativeDaemon.cpp.
References dtn::security::KeyExchangeEvent::raise(), dtn::security::KeyExchangeData::RESPONSE, dtn::security::KeyExchangeData::setSessionId(), and dtn::security::KeyExchangeData::setStep().
|
virtual |
Implements dtn::core::EventReceiver< dtn::core::NodeEvent >.
Definition at line 280 of file NativeDaemon.cpp.
References dtn::core::NODE_AVAILABLE, dtn::core::NODE_DATA_ADDED, dtn::core::NODE_DATA_REMOVED, and dtn::core::NODE_UNAVAILABLE.
|
virtual |
Implements dtn::core::EventReceiver< dtn::core::GlobalEvent >.
Definition at line 312 of file NativeDaemon.cpp.
References dtn::core::GlobalEvent::GLOBAL_BUSY, dtn::core::GlobalEvent::GLOBAL_IDLE, dtn::core::GlobalEvent::GLOBAL_INTERNET_AVAILABLE, dtn::core::GlobalEvent::GLOBAL_INTERNET_UNAVAILABLE, dtn::core::GlobalEvent::GLOBAL_LOW_ENERGY, dtn::core::GlobalEvent::GLOBAL_NORMAL, dtn::core::GlobalEvent::GLOBAL_RELOAD, dtn::core::GlobalEvent::GLOBAL_SHUTDOWN, dtn::core::GlobalEvent::GLOBAL_START_DISCOVERY, and dtn::core::GlobalEvent::GLOBAL_STOP_DISCOVERY.
|
virtual |
Implements dtn::core::EventReceiver< dtn::core::CustodyEvent >.
Definition at line 378 of file NativeDaemon.cpp.
References dtn::core::CUSTODY_ACCEPT, and dtn::core::CUSTODY_REJECT.
|
virtual |
Implements dtn::core::EventReceiver< dtn::net::BundleReceivedEvent >.
Definition at line 359 of file NativeDaemon.cpp.
|
virtual |
Implements dtn::core::EventReceiver< dtn::net::TransferAbortedEvent >.
Definition at line 404 of file NativeDaemon.cpp.
|
virtual |
Implements dtn::core::EventReceiver< dtn::net::TransferCompletedEvent >.
Definition at line 422 of file NativeDaemon.cpp.
|
virtual |
Implements dtn::core::EventReceiver< dtn::net::ConnectionEvent >.
Definition at line 440 of file NativeDaemon.cpp.
References dtn::net::ConnectionEvent::CONNECTION_DOWN, dtn::net::ConnectionEvent::CONNECTION_SETUP, dtn::net::ConnectionEvent::CONNECTION_TIMEOUT, and dtn::net::ConnectionEvent::CONNECTION_UP.
|
virtual |
Implements dtn::core::EventReceiver< dtn::routing::QueueBundleEvent >.
Definition at line 472 of file NativeDaemon.cpp.
void dtn::daemon::NativeDaemon::reload | ( | ) | ||
throw | ( | |||
) |
Generate a reload signal
Definition at line 1708 of file NativeDaemon.cpp.
References dtn::core::GlobalEvent::GLOBAL_RELOAD, and dtn::core::GlobalEvent::raise().
Referenced by func_sighandler().
void dtn::daemon::NativeDaemon::removeConnection | ( | std::string | eid, |
std::string | protocol, | ||
std::string | address, | ||
std::string | service, | ||
bool | local = false |
||
) | const | ||
throw | ( | ||
) |
Remove a static connection of the neighbor with the given EID
Definition at line 661 of file NativeDaemon.cpp.
References dtn::core::Node::add(), dtn::core::Node::CONN_FILE, dtn::core::Node::CONN_TCPIP, dtn::core::Node::CONN_UDPIP, dtn::core::BundleCore::getConnectionManager(), dtn::core::BundleCore::getInstance(), dtn::core::Node::NODE_STATIC_GLOBAL, dtn::core::Node::NODE_STATIC_LOCAL, and dtn::net::ConnectionManager::remove().
void dtn::daemon::NativeDaemon::removeKey | ( | std::string | eid | ) | const |
throw | ( | NativeDaemonException | |||
) |
Remove an existing key
Definition at line 760 of file NativeDaemon.cpp.
References dtn::security::SecurityKeyManager::get(), dtn::security::SecurityKeyManager::getInstance(), dtn::security::SecurityKey::KEY_PUBLIC, and dtn::security::SecurityKeyManager::remove().
void dtn::daemon::NativeDaemon::setConfigFile | ( | const std::string & | config_file | ) |
Set the daemon configuration
Definition at line 810 of file NativeDaemon.cpp.
References dtn::security::SecurityKeyManager::getInstance(), dtn::core::BundleCore::getInstance(), dtn::daemon::Configuration::getInstance(), dtn::daemon::Configuration::load(), dtn::security::SecurityKeyManager::onConfigurationChanged(), and dtn::core::BundleCore::onConfigurationChanged().
Referenced by InitService().
void dtn::daemon::NativeDaemon::setDebug | ( | int | level | ) | |
throw | ( | ||||
) |
Enable / disable debugging at runtime
Definition at line 1720 of file NativeDaemon.cpp.
Referenced by func_sighandler(), and InitService().
void dtn::daemon::NativeDaemon::setGloballyConnected | ( | bool | connected | ) | const |
Set the globally connected state
Definition at line 700 of file NativeDaemon.cpp.
References dtn::core::BundleCore::getInstance(), and dtn::core::BundleCore::setGloballyConnected().
void dtn::daemon::NativeDaemon::setLeMode | ( | bool | low_energy | ) | const |
throw | ( | ||||
) |
Control the Low-energy mode of the daemon
Definition at line 170 of file NativeDaemon.cpp.
References dtn::core::GlobalEvent::GLOBAL_LOW_ENERGY, dtn::core::GlobalEvent::GLOBAL_NORMAL, and dtn::core::GlobalEvent::raise().
void dtn::daemon::NativeDaemon::setLogFile | ( | const std::string & | path, |
int | logLevel | ||
) | const | ||
throw | ( | ||
) |
Set the path to the log file
Definition at line 830 of file NativeDaemon.cpp.
References logopts, and logsys.
Referenced by InitService().
void dtn::daemon::NativeDaemon::setLogging | ( | const std::string & | defaultTag, |
int | logLevel | ||
) | const | ||
throw | ( | ||
) |
Set the config file and enable default logging capabilities
setup logging capabilities
Definition at line 778 of file NativeDaemon.cpp.
References logsys.
Referenced by InitService().
void dtn::daemon::NativeDaemon::startDiscovery | ( | ) | const | |
throw | ( | |||
) |
Enable discovery mechanisms IPND beacons
Definition at line 175 of file NativeDaemon.cpp.
References dtn::core::GlobalEvent::GLOBAL_START_DISCOVERY, and dtn::core::GlobalEvent::raise().
void dtn::daemon::NativeDaemon::stopDiscovery | ( | ) | const | |
throw | ( | |||
) |
Disable discovery mechanism like IPND beacons
Definition at line 180 of file NativeDaemon.cpp.
References dtn::core::GlobalEvent::GLOBAL_STOP_DISCOVERY, and dtn::core::GlobalEvent::raise().
void dtn::daemon::NativeDaemon::wait | ( | DaemonRunLevel | rl | ) | |
throw | ( | ||||
) |
Wait until the runlevel is reached
Definition at line 997 of file NativeDaemon.cpp.