|
IBR-DTNSuite
0.12
|
#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) |
| virtual void | raiseEvent (const dtn::core::Event *evt) throw () |
| std::vector< std::string > | getVersion () const throw () |
| void | clearStorage () const throw () |
| void | startDiscovery () const throw () |
| void | stopDiscovery () const throw () |
Public Member Functions inherited from dtn::core::EventReceiver | |
| virtual | ~EventReceiver ()=0 |
Definition at line 142 of file NativeDaemon.h.
| dtn::daemon::NativeDaemon::NativeDaemon | ( | NativeDaemonCallback * | statecb = NULL, |
| NativeEventCallback * | eventcb = NULL |
||
| ) |
Constructor
Definition at line 150 of file NativeDaemon.cpp.
|
virtual |
Destructor
Definition at line 156 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 538 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 168 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 479 of file NativeDaemon.cpp.
References dtn::core::Node::getAll(), dtn::core::BundleCore::getConnectionManager(), dtn::core::BundleCore::getInstance(), dtn::net::ConnectionManager::getNeighbor(), dtn::daemon::NativeNode::NODE_CONNECTED, dtn::core::Node::NODE_CONNECTED, dtn::core::Node::NODE_DHT_DISCOVERED, dtn::daemon::NativeNode::NODE_DISCOVERED, dtn::core::Node::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::daemon::NativeNode::type, dtn::core::Node::URI::type, and ibrcommon::Exception::what().

| std::string dtn::daemon::NativeDaemon::getLocalUri | ( | ) | const | |
| throw | ( | |||
| ) | ||||
NATIVE DAEMON METHODS Get the local EID of this node
Definition at line 438 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 523 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 688 of file NativeDaemon.cpp.
| NativeStats dtn::daemon::NativeDaemon::getStats | ( | ) | ||
| throw | ( | |||
| ) | ||||
Get statistical data
Definition at line 443 of file NativeDaemon.cpp.
References dtn::daemon::NativeStats::addData(), dtn::daemon::NativeStats::bundles_aborted, dtn::daemon::NativeStats::bundles_expired, dtn::daemon::NativeStats::bundles_generated, 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 160 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 693 of file NativeDaemon.cpp.
Referenced by __daemon_run(), and ServiceMain().
| void dtn::daemon::NativeDaemon::initiateConnection | ( | std::string | eid) |
initiate a connection to a given neighbor
Definition at line 590 of file NativeDaemon.cpp.
References dtn::core::BundleCore::getConnectionManager(), dtn::core::BundleCore::getInstance(), dtn::net::ConnectionManager::getNeighbor(), and dtn::net::ConnectionManager::open().

|
virtual | ||||||||||||||
Implements dtn::core::EventReceiver.
Definition at line 268 of file NativeDaemon.cpp.
References dtn::routing::QueueBundleEvent::bundle, dtn::net::BundleReceivedEvent::bundle, dtn::net::ConnectionEvent::CONNECTION_DOWN, dtn::net::ConnectionEvent::CONNECTION_SETUP, dtn::net::ConnectionEvent::CONNECTION_TIMEOUT, dtn::net::ConnectionEvent::CONNECTION_UP, dtn::core::CUSTODY_ACCEPT, dtn::core::CUSTODY_REJECT, dtn::net::BundleReceivedEvent::fromlocal, dtn::core::CustodyEvent::getAction(), dtn::core::NodeEvent::getAction(), dtn::core::GlobalEvent::getAction(), dtn::core::CustodyEvent::getBundle(), dtn::net::TransferCompletedEvent::getBundle(), dtn::net::TransferAbortedEvent::getBundleID(), dtn::core::Node::getEID(), dtn::core::NodeEvent::getNode(), dtn::net::ConnectionEvent::getNode(), dtn::net::TransferCompletedEvent::getPeer(), dtn::net::TransferAbortedEvent::getPeer(), dtn::net::ConnectionEvent::getState(), dtn::data::EID::getString(), 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_RELOAD, dtn::core::GlobalEvent::GLOBAL_RESUME, dtn::core::GlobalEvent::GLOBAL_SHUTDOWN, dtn::core::GlobalEvent::GLOBAL_START_DISCOVERY, dtn::core::GlobalEvent::GLOBAL_STOP_DISCOVERY, dtn::core::GlobalEvent::GLOBAL_SUSPEND, dtn::core::NODE_AVAILABLE, dtn::core::NODE_DATA_ADDED, dtn::core::NODE_DATA_REMOVED, dtn::core::NODE_UNAVAILABLE, and dtn::net::BundleReceivedEvent::peer.

| void dtn::daemon::NativeDaemon::reload | ( | ) | ||
| throw | ( | |||
| ) | ||||
Generate a reload signal
Definition at line 1525 of file NativeDaemon.cpp.
References dtn::core::GlobalEvent::GLOBAL_RELOAD, dtn::core::GlobalEvent::raise(), and ibrcommon::Logger::reload().
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 564 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::setConfigFile | ( | const std::string & | config_file) |
Set the daemon configuration
Definition at line 635 of file NativeDaemon.cpp.
References dtn::security::SecurityKeyManager::getInstance(), dtn::core::BundleCore::getInstance(), dtn::daemon::Configuration::getInstance(), ibrcommon::File::getPath(), 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 1537 of file NativeDaemon.cpp.
References IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::LogLevel::info, and ibrcommon::Logger::setVerbosity().
Referenced by func_sighandler(), and InitService().

| void dtn::daemon::NativeDaemon::setLogFile | ( | const std::string & | path, |
| int | logLevel | ||
| ) | const | ||
| throw | ( | ||
| ) | |||
Set the path to the log file
Definition at line 655 of file NativeDaemon.cpp.
References ibrcommon::Logger::LOG_DATETIME, ibrcommon::Logger::LOG_LEVEL, ibrcommon::Logger::LOG_TAG, ibrcommon::Logger::LOGGER_ALERT, ibrcommon::Logger::LOGGER_CRIT, ibrcommon::Logger::LOGGER_DEBUG, ibrcommon::Logger::LOGGER_EMERG, ibrcommon::Logger::LOGGER_ERR, ibrcommon::Logger::LOGGER_INFO, ibrcommon::Logger::LOGGER_NOTICE, ibrcommon::Logger::LOGGER_WARNING, logopts, logsys, and ibrcommon::Logger::setLogfile().
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 603 of file NativeDaemon.cpp.
References ibrcommon::Logger::enableSyslog(), ibrcommon::Logger::LOGGER_ALERT, ibrcommon::Logger::LOGGER_CRIT, ibrcommon::Logger::LOGGER_DEBUG, ibrcommon::Logger::LOGGER_EMERG, ibrcommon::Logger::LOGGER_ERR, ibrcommon::Logger::LOGGER_INFO, ibrcommon::Logger::LOGGER_NOTICE, ibrcommon::Logger::LOGGER_WARNING, logsys, and ibrcommon::Logger::setDefaultTag().
Referenced by InitService().

| void dtn::daemon::NativeDaemon::startDiscovery | ( | ) | const | |
| throw | ( | |||
| ) | ||||
Enable discovery mechanisms IPND beacons
Definition at line 173 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 178 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 822 of file NativeDaemon.cpp.