IBR-DTNSuite
0.8
|
#include "config.h"
#include <ibrcommon/data/BLOB.h>
#include <ibrcommon/data/File.h>
#include <ibrcommon/net/vinterface.h>
#include <ibrcommon/Logger.h>
#include <ibrcommon/net/LinkManager.h>
#include <ibrdtn/utils/Clock.h>
#include <list>
#include "StandByManager.h"
#include "core/BundleCore.h"
#include "core/FragmentManager.h"
#include "core/EventSwitch.h"
#include "storage/BundleStorage.h"
#include "storage/MemoryBundleStorage.h"
#include "storage/SimpleBundleStorage.h"
#include "core/Node.h"
#include "core/GlobalEvent.h"
#include "core/NodeEvent.h"
#include "routing/BaseRouter.h"
#include "routing/epidemic/EpidemicRoutingExtension.h"
#include "routing/prophet/ProphetRoutingExtension.h"
#include "routing/flooding/FloodRoutingExtension.h"
#include "net/UDPConvergenceLayer.h"
#include "net/TCPConvergenceLayer.h"
#include "net/FileConvergenceLayer.h"
#include "net/FileMonitor.h"
#include "net/DatagramConvergenceLayer.h"
#include "net/UDPDatagramService.h"
#include "storage/SQLiteBundleStorage.h"
#include "net/HTTPConvergenceLayer.h"
#include "net/LOWPANConvergenceLayer.h"
#include "net/LOWPANDatagramService.h"
#include "net/IPNDAgent.h"
#include "api/ApiServer.h"
#include "Configuration.h"
#include "EchoWorker.h"
#include "CapsuleWorker.h"
#include "DTNTPWorker.h"
#include "Notifier.h"
#include "DevNull.h"
#include "StatisticLogger.h"
#include "Component.h"
#include "security/SecurityManager.h"
#include "security/SecurityKeyManager.h"
#include "security/SecurityCertificateManager.h"
#include "security/TLSStreamComponent.h"
#include <libdaemon/daemon.h>
#include <string.h>
#include <csignal>
#include <sys/types.h>
#include <syslog.h>
#include <set>
#include <pwd.h>
#include <unistd.h>
#include "net/DHTNameService.h"
#include "Debugger.h"
Go to the source code of this file.
int __daemon_run | ( | Configuration & | conf | ) |
initialize all components!
run all components!
terminate all components!
Definition at line 521 of file Main.cpp.
References _debug, dtn::core::BundleCore::addConnection(), dtn::routing::BaseRouter::addExtension(), dtn::daemon::Configuration::Discovery::address(), dtn::daemon::Configuration::Statistic::address(), dtn::net::DiscoveryAgent::addService(), ibrcommon::Logger::addStream(), dtn::daemon::StandByManager::adopt(), dtn::daemon::Configuration::Network::ProphetConfig::beta, dtn::net::IPNDAgent::bind(), createBundleStorage(), createConvergenceLayers(), dtn::daemon::Configuration::Daemon::daemonize(), dtn::daemon::Configuration::Network::ProphetConfig::delta, dtn::daemon::Configuration::Logger::display_timestamps(), dtn::daemon::Configuration::doAPI(), dtn::daemon::Configuration::Network::doDynamicRebind(), dtn::daemon::Configuration::Network::doForwarding(), dtn::daemon::Configuration::Network::doFragmentation(), dtn::daemon::Configuration::Security::doTLS(), ibrcommon::vinterface::empty(), ibrcommon::Logger::enableAsync(), ibrcommon::Logger::enableBuffer(), dtn::daemon::Configuration::Discovery::enabled(), dtn::daemon::Configuration::Statistic::enabled(), dtn::daemon::Configuration::Debug::enabled(), dtn::daemon::Configuration::Security::enabled(), dtn::daemon::Configuration::DHT::enabled(), ibrcommon::Logger::enableSyslog(), dtn::daemon::Configuration::Network::ProphetConfig::forwarding_strategy, dtn::daemon::Configuration::Network::ProphetConfig::gamma, dtn::daemon::Configuration::getAPIInterface(), dtn::daemon::Configuration::getAPISocket(), dtn::daemon::Configuration::getDaemon(), dtn::daemon::Configuration::getDebug(), dtn::daemon::Configuration::getDHT(), dtn::daemon::Configuration::getDiscovery(), dtn::security::SecurityKeyManager::getInstance(), dtn::core::EventSwitch::getInstance(), dtn::daemon::Configuration::Network::getInterfaces(), dtn::daemon::Configuration::Logger::getLogfile(), dtn::daemon::Configuration::getLogger(), dtn::daemon::Configuration::getNetwork(), dtn::daemon::Configuration::getNotifyCommand(), ibrcommon::File::getPath(), dtn::daemon::Configuration::Network::getProphetConfig(), dtn::daemon::Configuration::Network::getRoutingExtension(), dtn::daemon::Configuration::getSecurity(), dtn::daemon::Configuration::Network::getStaticNodes(), dtn::daemon::Configuration::getStatistic(), dtn::core::BundleCore::getStorage(), dtn::daemon::Configuration::Daemon::getThreads(), dtn::core::GlobalEvent::GLOBAL_SHUTDOWN, dtn::daemon::Configuration::Network::ProphetConfig::gtmx_nf_max, dtn::daemon::Configuration::Network::ProphetConfig::i_typ, IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, dtn::security::SecurityKeyManager::initialize(), ibrcommon::LinkManager::initialize(), dtn::daemon::IntegratedComponent::initialize(), dtn::daemon::Configuration::NetConfig::interface, dtn::daemon::Configuration::Statistic::interval(), ibrcommon::vaddress::isMulticast(), dtn::daemon::Configuration::Debug::level(), dtn::daemon::Configuration::load(), ibrcommon::Logger::LOG_DATETIME, ibrcommon::Logger::LOG_TIMESTAMP, logerr, dtn::daemon::Configuration::Statistic::logfile(), ibrcommon::Logger::LOGGER_ALL, ibrcommon::Logger::LOGGER_DEBUG, dtn::daemon::StatisticLogger::LOGGER_FILE_CSV, dtn::daemon::StatisticLogger::LOGGER_FILE_PLAIN, dtn::daemon::StatisticLogger::LOGGER_FILE_STAT, dtn::daemon::StatisticLogger::LOGGER_STDOUT, dtn::daemon::StatisticLogger::LOGGER_SYSLOG, dtn::daemon::StatisticLogger::LOGGER_UDP, logopts, logstd, logsys, dtn::core::EventSwitch::loop(), dtn::daemon::Configuration::Network::ProphetConfig::next_exchange_timeout, dtn::daemon::Configuration::Network::ProphetConfig::p_encounter_first, dtn::daemon::Configuration::Network::ProphetConfig::p_encounter_max, dtn::daemon::Configuration::Network::ProphetConfig::p_first_threshold, dtn::daemon::Configuration::NetConfig::port, dtn::daemon::Configuration::Discovery::port(), dtn::daemon::Configuration::Statistic::port(), dtn::daemon::Configuration::Debug::quiet(), dtn::core::GlobalEvent::raise(), setGlobalVars(), ibrcommon::Logger::setLogfile(), dtn::core::BundleCore::setRouter(), ibrcommon::Logger::setVerbosity(), sighandler(), dtn::daemon::IntegratedComponent::startup(), ibrcommon::Logger::stop(), switchUser(), dtn::daemon::IntegratedComponent::terminate(), dtn::daemon::Configuration::Network::ProphetConfig::time_unit, ibrcommon::vinterface::toString(), dtn::daemon::Configuration::Statistic::type(), ibrcommon::vaddress::VADDRESS_INET, and dtn::daemon::Configuration::version().
Referenced by main().
void createBundleStorage | ( | BundleCore & | core, |
Configuration & | conf, | ||
std::list< dtn::daemon::Component * > & | components | ||
) |
Definition at line 260 of file Main.cpp.
References ibrcommon::BLOB::changeProvider(), ibrcommon::File::createDirectory(), ibrcommon::File::exists(), dtn::daemon::Configuration::getLimit(), ibrcommon::File::getPath(), dtn::daemon::Configuration::getPath(), dtn::daemon::Configuration::getStorage(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, initialize_blobs(), and dtn::core::BundleCore::setStorage().
Referenced by __daemon_run().
void createConvergenceLayers | ( | BundleCore & | core, |
Configuration & | conf, | ||
std::list< dtn::daemon::Component * > & | components, | ||
dtn::net::IPNDAgent * | ipnd, | ||
dtn::daemon::StandByManager * | standby | ||
) |
Definition at line 338 of file Main.cpp.
References dtn::core::BundleCore::addConvergenceLayer(), dtn::net::DiscoveryAgent::addService(), dtn::daemon::StandByManager::adopt(), dtn::net::TCPConvergenceLayer::bind(), ibrcommon::File::exists(), dtn::daemon::Configuration::Network::getInterfaces(), dtn::daemon::Configuration::getNetwork(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, dtn::daemon::Configuration::NetConfig::interface, dtn::daemon::Configuration::NetConfig::mtu, dtn::daemon::Configuration::NetConfig::port, ibrcommon::vinterface::toString(), dtn::daemon::Configuration::NetConfig::type, dtn::daemon::Configuration::NetConfig::url, dtn::net::FileMonitor::watch(), and ibrcommon::Exception::what().
Referenced by __daemon_run().
void initialize_blobs | ( | Configuration & | config | ) |
Definition at line 222 of file Main.cpp.
References blob_path, ibrcommon::BLOB::changeProvider(), ibrcommon::File::createDirectory(), ibrcommon::File::exists(), ibrcommon::File::getPath(), dtn::daemon::Configuration::getPath(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, and ibrcommon::File::isDirectory().
Referenced by createBundleStorage().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 960 of file Main.cpp.
References __daemon_run(), dtn::daemon::Configuration::Daemon::daemonize(), dtn::daemon::Configuration::getDaemon(), ibrcommon::File::getPath(), dtn::daemon::Configuration::Daemon::getPidFile(), dtn::daemon::Configuration::Daemon::kill_daemon(), and dtn::daemon::Configuration::params().
void setGlobalVars | ( | Configuration & | config | ) |
Definition at line 191 of file Main.cpp.
References dtn::core::BundleCore::blocksizelimit, dtn::daemon::Configuration::getLimit(), dtn::daemon::Configuration::getNodename(), dtn::daemon::Configuration::getTimezone(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, dtn::core::BundleCore::local, dtn::core::BundleCore::max_lifetime, dtn::core::BundleCore::max_timestamp_future, and dtn::utils::Clock::timezone.
Referenced by __daemon_run().
void sighandler | ( | int | signal | ) |
Definition at line 122 of file Main.cpp.
References _debug, ibrcommon::Logger::addStream(), dtn::core::GlobalEvent::GLOBAL_RELOAD, dtn::core::GlobalEvent::GLOBAL_SHUTDOWN, IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, ibrcommon::Logger::LOGGER_DEBUG, logopts, dtn::core::GlobalEvent::raise(), ibrcommon::Logger::reload(), and ibrcommon::Logger::setVerbosity().
Referenced by __daemon_run().
void switchUser | ( | Configuration & | config | ) |
Definition at line 161 of file Main.cpp.
References dtn::daemon::Configuration::getGID(), dtn::daemon::Configuration::getUID(), dtn::daemon::Configuration::getUser(), IBRCOMMON_LOGGER, and IBRCOMMON_LOGGER_ENDL.
Referenced by __daemon_run().
bool _debug = false |
Definition at line 119 of file Main.cpp.
Referenced by __daemon_run(), dtn::daemon::Configuration::load(), dtn::daemon::Configuration::params(), and sighandler().
const unsigned char logerr = ibrcommon::Logger::LOGGER_ERR | ibrcommon::Logger::LOGGER_CRIT |
Definition at line 110 of file Main.cpp.
Referenced by __daemon_run().
unsigned char logopts = ibrcommon::Logger::LOG_DATETIME | ibrcommon::Logger::LOG_LEVEL |
setup logging capabilities
Definition at line 107 of file Main.cpp.
Referenced by __daemon_run(), main(), and sighandler().
const unsigned char logstd = ibrcommon::Logger::LOGGER_ALL ^ (ibrcommon::Logger::LOGGER_DEBUG | logerr) |
Definition at line 113 of file Main.cpp.
Referenced by __daemon_run().
const unsigned char logsys = ibrcommon::Logger::LOGGER_ALL ^ (ibrcommon::Logger::LOGGER_DEBUG | ibrcommon::Logger::LOGGER_NOTICE) |
Definition at line 116 of file Main.cpp.
Referenced by __daemon_run().