32 #include <ibrcommon/net/vinterface.h>
33 #include <ibrcommon/Logger.h>
34 #include <ibrcommon/link/LinkManager.h>
37 #include <ibrcommon/link/Win32LinkManager.h>
45 #ifdef __DEVELOPMENT_ASSERTIONS__
49 using namespace dtn::net;
50 using namespace dtn::core;
51 using namespace dtn::utils;
52 using namespace ibrcommon;
58 Configuration::NetConfig::NetConfig(
const std::string &n,
NetType t)
59 : name(n), type(t), iface(ibrcommon::vinterface::ANY), mtu(0), port(0)
78 Configuration::Configuration()
79 : _filename(
"config.ini"), _doapi(true)
83 Configuration::~Configuration()
87 : _enabled(true), _interval(5), _announce(true), _short(false), _version(2), _crosslayer(false) {}
90 : _enabled(false), _quiet(false), _level(0), _profiling(false) {}
93 : _quiet(false), _options(0), _timestamps(false), _verbose(false) {}
96 : _routing(
"default"), _forwarding(true), _prefer_direct(true), _tcp_nodelay(true), _tcp_chunksize(4096), _tcp_idle_timeout(0), _keepalive_timeout(60), _default_net(
"lo"), _use_default_net(false), _auto_connect(0), _fragmentation(false), _scheduling(false), _link_request_interval(5000)
100 : _enabled(false), _tlsEnabled(false), _tlsRequired(false), _tlsOptionalOnBadClock(false), _level(SECURITY_LEVEL_NONE), _disableEncryption(false), _generate_dh_params(false)
104 : _daemonize(false), _kill(false), _threads(0)
108 : _reference(true), _sync(false), _discovery(false), _sigma(1.001f), _psi(0.8f), _sync_level(0.10f)
112 : _enabled(true), _port(0), _dnsbootstrapping(true), _ipv4(true), _ipv6(true), _blacklist(true), _selfannounce(true),
113 _minRating(1), _allowNeighbourToAnnounceMe(true), _allowNeighbourAnnouncement(true),
114 _ignoreDHTNeighbourInformations(false)
118 : _ctrl_path(
""), _enabled(false)
122 : _smtpPort(25), _smtpUseTLS(false), _smtpUseSSL(false), _smtpNeedAuth(false), _smtpInterval(60), _smtpConnectionTimeout(-1), _smtpKeepAliveTimeout(30),
123 _imapPort(143), _imapUseTLS(false), _imapUseSSL(false), _imapInterval(60), _imapConnectionTimeout(-1), _imapPurgeMail(false),
124 _availableTime(1800), _returningMailsCheck(3)
206 _daemon._threads =
static_cast<dtn::data::Size>(ibrcommon::Thread::getNumberOfProcessors());
210 static struct option long_options[] =
213 {
"noapi", no_argument, &doapi, 0},
214 {
"nodiscovery", no_argument, &disco, 0},
215 {
"timestamp", no_argument, ×tamp, 1},
216 {
"version", no_argument, &showversion, 1},
219 {
"help", no_argument, 0,
'h'},
220 #ifdef HAVE_LIBDAEMON
221 {
"daemon", no_argument, 0,
'D'},
222 {
"kill", no_argument, 0,
'k'},
223 {
"pidfile", required_argument, 0,
'p'},
226 {
"quiet", no_argument, 0,
'q'},
227 {
"interface", required_argument, 0,
'i'},
228 {
"configuration", required_argument, 0,
'c'},
229 {
"debug", required_argument, 0,
'd'},
231 {
"interfaces", no_argument, 0,
'I'},
237 int option_index = 0;
239 #ifdef HAVE_LIBDAEMON
240 c = getopt_long (argc, argv,
"qhDkp:vi:c:d:t:",
241 long_options, &option_index);
243 c = getopt_long (argc, argv,
"qhvi:c:d:t:",
244 long_options, &option_index);
255 if (long_options[option_index].flag != 0)
257 printf (
"option %s", long_options[option_index].name);
259 printf (
" with arg %s", optarg);
264 std::cout <<
"IBR-DTN version: " <<
version() << std::endl;
265 std::cout <<
"Syntax: dtnd [options]" << std::endl;
266 std::cout <<
" -h|--help display this text" << std::endl;
267 std::cout <<
" -c <file> set a configuration file" << std::endl;
268 #ifdef HAVE_LIBDAEMON
269 std::cout <<
" -D daemonize the process" << std::endl;
270 std::cout <<
" -k stop the running daemon" << std::endl;
271 std::cout <<
" -p <file> store the pid in this pidfile" << std::endl;
273 std::cout <<
" -i <interface> interface to bind on (e.g. eth0)" << std::endl;
274 std::cout <<
" -d <level> enable debugging and set a verbose level" << std::endl;
275 std::cout <<
" -q enables the quiet mode (no logging to the console)" << std::endl;
276 std::cout <<
" -t <threads> specify a number of threads for parallel event processing" << std::endl;
277 std::cout <<
" -v be verbose - show NOTICE log messages" << std::endl;
278 std::cout <<
" --version show version and exit" << std::endl;
279 std::cout <<
" --noapi disable API module" << std::endl;
280 std::cout <<
" --nodiscovery disable discovery module" << std::endl;
281 std::cout <<
" --timestamp enables timestamps for logging instead of datetime values" << std::endl;
283 std::cout <<
" --interfaces list all available interfaces" << std::endl;
307 _debug._level = atoi(optarg);
311 _daemon._daemonize =
true;
316 _daemon._daemonize =
true;
317 _daemon._kill =
true;
321 _daemon._pidfile = std::string(optarg);
325 _daemon._threads = atoi(optarg);
331 ibrcommon::LinkManager &lm = ibrcommon::LinkManager::getInstance();
333 ibrcommon::Win32LinkManager &wlm =
dynamic_cast<ibrcommon::Win32LinkManager&
>(lm);
335 std::set<ibrcommon::vinterface> ifs = wlm.getInterfaces();
337 std::cout <<
"Available interfaces:" << std::endl;
339 for (std::set<ibrcommon::vinterface>::const_iterator it = ifs.begin(); it != ifs.end(); ++it)
341 const ibrcommon::vinterface &iface = (*it);
342 std::cout << iface.toString() <<
'\t';
343 std::wcout << iface.getFriendlyName() << std::endl;
345 }
catch (
const std::bad_cast&) {
362 if (showversion == 1) {
363 std::cout <<
"IBR-DTN version: " <<
version() << std::endl;
374 load(_filename, quiet);
381 _conf = ibrcommon::ConfigFile(filename);
382 _filename = filename;
384 if (!quiet) IBRCOMMON_LOGGER_TAG(
"Configuration", info) <<
"Configuration: " << filename << IBRCOMMON_LOGGER_ENDL;
385 }
catch (
const ibrcommon::ConfigFile::file_not_found&) {
386 if (!quiet) IBRCOMMON_LOGGER_TAG(
"Configuration", info) <<
"Using default settings. Call with --help for options." << IBRCOMMON_LOGGER_ENDL;
387 _conf = ConfigFile();
390 _conf.add<std::string>(
"user",
"nobody");
397 _network.
load(_conf);
398 _security.
load(_conf);
399 _timesync.
load(_conf);
407 _interval = conf.read<
unsigned int>(
"discovery_interval", 5);
408 _announce = (conf.read<
int>(
"discovery_announce", 1) == 1);
409 _short = (conf.read<
int>(
"discovery_short", 0) == 1);
410 _version = conf.read<
int>(
"discovery_version", 2);
411 _crosslayer = (conf.read<std::string>(
"discovery_crosslayer",
"no") ==
"yes");
417 _logfile = conf.read<std::string>(
"logfile");
418 }
catch (
const ibrcommon::ConfigFile::key_not_found&) {
425 _profiling = (conf.read<std::string>(
"profiling") ==
"yes");
426 }
catch (
const ibrcommon::ConfigFile::key_not_found&) { };
436 _reference = (conf.read<std::string>(
"time_reference") ==
"yes");
437 }
catch (
const ibrcommon::ConfigFile::key_not_found&) { };
440 _sync = (conf.read<std::string>(
"time_synchronize") ==
"yes");
441 }
catch (
const ibrcommon::ConfigFile::key_not_found&) { };
444 _discovery = (conf.read<std::string>(
"time_discovery_announcements") ==
"yes");
445 }
catch (
const ibrcommon::ConfigFile::key_not_found&) { };
447 _sigma = conf.read<
float>(
"time_sigma", 1.001f);
448 _psi = conf.read<
float>(
"time_psi", 0.9f);
449 _sync_level = conf.read<
float>(
"time_sync_level", 0.15f);
457 _enabled = (conf.read<std::string> (
"dht_enabled",
"no") ==
"yes");
458 _port = conf.read<
int> (
"dht_port", 9999);
459 _id = conf.read<
string> (
"dht_id",
"");
460 _blacklist = (conf.read<std::string> (
"dht_blacklist",
"yes") ==
"yes");
461 _selfannounce = (conf.read<std::string> (
"dht_self_announce",
"yes") ==
"yes");
462 _dnsbootstrapping = (conf.read<std::string> (
"dht_bootstrapping",
"yes") ==
"yes");
463 string list = conf.read<
string> (
"dht_bootstrapping_domains",
"");
465 list = conf.read<
string> (
"dht_bootstrapping_ips",
"");
467 _ipv4bind = conf.read<
string> (
"dht_bind_ipv4",
"");
468 _ipv6bind = conf.read<
string> (
"dht_bind_ipv6",
"");
469 _nodesFilePath = conf.read<
string> (
"dht_nodes_file",
"");
470 _ipv4 = (conf.read<std::string> (
"dht_enable_ipv4",
"yes") ==
"yes");
471 _ipv6 = (conf.read<std::string> (
"dht_enable_ipv6",
"yes") ==
"yes");
472 _minRating = conf.read<
int> (
"dht_min_rating", 1);
473 _allowNeighbourToAnnounceMe = (conf.read<std::string> (
"dht_allow_neighbours_to_announce_me",
"yes") ==
"yes");
474 _allowNeighbourAnnouncement = (conf.read<std::string> (
"dht_allow_neighbour_announcement",
"yes") ==
"yes");
475 _ignoreDHTNeighbourInformations = (conf.read<std::string> (
"dht_ignore_neighbour_informations",
"no") ==
"yes");
477 if (_minRating < 0) _minRating = 0;
483 _ctrl_path = conf.read<std::string>(
"p2p_ctrlpath");
485 }
catch (
const ibrcommon::ConfigFile::key_not_found&) {
494 _address = conf.read<std::string> (
"email_address",
"root@localhost");
495 _smtpServer = conf.read<std::string> (
"email_smtp_server",
"localhost");
496 _smtpPort = conf.read<
int> (
"email_smtp_port", 25);
497 _smtpUsername = conf.read<std::string> (
"email_smtp_username",
"root");
498 _smtpPassword = conf.read<std::string> (
"email_smtp_password",
"");
499 _smtpInterval = conf.read<
size_t> (
"email_smtp_submit_interval", 60);
500 _smtpConnectionTimeout = conf.read<
size_t> (
"email_smtp_connection_timeout", -1);
501 _smtpKeepAliveTimeout = conf.read<
size_t> (
"email_smtp_keep_alive", 30);
502 _smtpNeedAuth = (conf.read<std::string> (
"email_smtp_need_authentication",
"no") ==
"yes");
503 _smtpUseTLS = (conf.read<std::string> (
"email_smtp_socket_type",
"") ==
"tls");
504 _smtpUseSSL = (conf.read<std::string> (
"email_smtp_socket_type",
"") ==
"ssl");
505 _imapServer = conf.read<std::string> (
"email_imap_server",
"localhost");
506 _imapPort = conf.read<
int> (
"email_imap_port", 143);
507 _imapUsername = conf.read<std::string> (
"email_imap_username", _smtpUsername);
508 _imapPassword = conf.read<std::string> (
"email_imap_password", _smtpPassword);
509 tmp = conf.read<
string> (
"email_imap_folder",
"");
511 _imapInterval = conf.read<
size_t> (
"email_imap_lookup_interval", 60);
512 _imapConnectionTimeout = conf.read<
size_t> (
"email_imap_connection_timeout", -1);
513 _imapUseTLS = (conf.read<std::string> (
"email_imap_socket_type",
"") ==
"tls");
514 _imapUseSSL = (conf.read<std::string> (
"email_imap_socket_type",
"") ==
"ssl");
515 _imapPurgeMail = (conf.read<std::string> (
"email_imap_purge_mail",
"no") ==
"yes");
516 tmp = conf.read<
string> (
"email_certs_ca",
"");
518 tmp = conf.read<
string> (
"email_certs_user",
"");
520 _availableTime = conf.read<
size_t> (
"email_node_available_time", 1800);
521 _returningMailsCheck = conf.read<
size_t> (
"email_returning_mails_checks", 3);
547 return _conf.read<
string>(
"local_uri");
548 }
catch (
const ibrcommon::ConfigFile::key_not_found&) {
549 std::vector<char> hostname_array(255);
550 if ( gethostname(&hostname_array[0], hostname_array.size()) != 0 )
554 bool success =
false;
556 DWORD dwType = REG_SZ;
557 DWORD dwBufSize = hostname_array.size();
559 const char* subkey =
"System\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName";
560 const char* win9x_subkey =
"System\\CurrentControlSet\\Control\\ComputerName\\ComputerName";
562 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, subkey, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
564 if ( RegQueryValueEx(hKey,
"ComputerName", NULL, &dwType, (BYTE*)&hostname_array[0], &dwBufSize) == ERROR_SUCCESS )
573 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, win9x_subkey, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
575 if ( RegQueryValueEx(hKey,
"ComputerName", NULL, &dwType, (BYTE*)&hostname_array[0], &dwBufSize) == ERROR_SUCCESS )
586 return "dtn://local";
591 return "dtn://" + std::string(&hostname_array[0]);
593 return "dtn://noname";
603 std::set<ibrcommon::vaddress> ret;
609 for (std::vector<std::string>::iterator iter = addresses.begin(); iter != addresses.end(); ++iter) {
610 ret.insert( ibrcommon::vaddress(*iter, port(), AF_UNSPEC) );
612 }
catch (
const ConfigFile::key_not_found&) {
613 throw ParameterNotFoundException();
638 nc.
port = _conf.read<
int>(
"api_port", 4550);
641 const std::string interface_name = _conf.read<std::string>(
"api_interface");
643 if (interface_name !=
"any")
645 nc.
iface = ibrcommon::vinterface(interface_name);
647 }
catch (
const ConfigFile::key_not_found&) {
648 nc.
iface = ibrcommon::vinterface(ibrcommon::vinterface::LOOPBACK);
657 return ibrcommon::File(_conf.read<std::string>(
"api_socket"));
658 }
catch (
const ConfigFile::key_not_found&) {
667 return _conf.read<std::string>(
"storage",
"default");
672 return _conf.read<std::string>(
"use_persistent_bundlesets",
"no") ==
"yes";
680 _static_routes.clear();
682 string key =
"route1";
683 unsigned int keynumber = 1;
685 while (conf.keyExists( key ))
688 _static_routes.insert( pair<std::string, std::string>( route.front(), route.back() ) );
691 stringstream ss; ss <<
"route" << keynumber; ss >> key;
701 std::string prefix =
"static1_";
703 while ( conf.keyExists(prefix +
"uri") )
705 const dtn::data::EID node_eid( conf.read<std::string>(prefix +
"uri",
"dtn:none") );
708 std::stringstream ss;
709 ss <<
"ip=" << conf.read<std::string>(prefix +
"address",
"127.0.0.1") <<
";port=" << conf.read<
unsigned int>(prefix +
"port", 4556) <<
";";
713 const std::string protocol = conf.read<std::string>(prefix +
"proto",
"tcp");
714 if (protocol ==
"tcp") p = Node::CONN_TCPIP;
715 if (protocol ==
"udp") p = Node::CONN_UDPIP;
716 if (protocol ==
"lowpan") p = Node::CONN_LOWPAN;
717 if (protocol ==
"zigbee") p = Node::CONN_LOWPAN;
718 if (protocol ==
"bluetooth") p = Node::CONN_BLUETOOTH;
719 if (protocol ==
"http") p = Node::CONN_HTTP;
720 if (protocol ==
"file") p = Node::CONN_FILE;
721 if (protocol ==
"dgram:udp") p = Node::CONN_DGRAM_UDP;
722 if (protocol ==
"dgram:ethernet") p = Node::CONN_DGRAM_ETHERNET;
723 if (protocol ==
"dgram:lowpan") p = Node::CONN_DGRAM_LOWPAN;
724 if (protocol ==
"email") {
725 p = Node::CONN_EMAIL;
727 ss <<
"email=" << conf.read<std::string>(prefix +
"email",
"root@localhost") <<
";";
730 bool node_exists =
false;
736 for (std::list<Node>::iterator iter = _nodes.begin(); iter != _nodes.end(); ++iter)
740 if (n.
getEID() == node_eid)
759 std::stringstream prefix_stream;
760 prefix_stream <<
"static" << count <<
"_";
761 prefix = prefix_stream.str();
767 _routing = conf.read<
string>(
"routing",
"default");
769 if(_routing ==
"prophet"){
771 _prophet_config.p_encounter_max = conf.read<
float>(
"prophet_p_encounter_max", 0.7f);
772 if(_prophet_config.p_encounter_max > 1 || _prophet_config.p_encounter_max <= 0)
773 _prophet_config.p_encounter_max = 0.7f;
774 _prophet_config.p_encounter_first = conf.read<
float>(
"prophet_p_encounter_first", 0.5f);
775 if(_prophet_config.p_encounter_first > 1 || _prophet_config.p_encounter_first <= 0)
776 _prophet_config.p_encounter_first = 0.5f;
777 _prophet_config.p_first_threshold = conf.read<
float>(
"prophet_p_first_threshold", 0.1f);
778 if(_prophet_config.p_first_threshold < 0 || _prophet_config.p_first_threshold >= _prophet_config.p_encounter_first)
779 _prophet_config.p_first_threshold = 0;
780 _prophet_config.beta = conf.read<
float>(
"prophet_beta", 0.9f);
781 if(_prophet_config.beta < 0 || _prophet_config.beta > 1)
782 _prophet_config.beta = 0.9f;
783 _prophet_config.gamma = conf.read<
float>(
"prophet_gamma", 0.999f);
784 if(_prophet_config.gamma <= 0 || _prophet_config.gamma > 1)
785 _prophet_config.gamma = 0.999f;
786 _prophet_config.delta = conf.read<
float>(
"prophet_delta", 0.01f);
787 if(_prophet_config.delta < 0 || _prophet_config.delta > 1)
788 _prophet_config.delta = 0.01f;
789 _prophet_config.time_unit = conf.read<ibrcommon::Timer::time_t>(
"prophet_time_unit", 1);
790 if(_prophet_config.time_unit < 1)
791 _prophet_config.time_unit = 1;
792 _prophet_config.i_typ = conf.read<ibrcommon::Timer::time_t>(
"prophet_i_typ", 300);
793 if(_prophet_config.i_typ < 1)
794 _prophet_config.i_typ = 1;
795 _prophet_config.next_exchange_timeout = conf.read<ibrcommon::Timer::time_t>(
"prophet_next_exchange_timeout", 120);
796 _prophet_config.forwarding_strategy = conf.read<std::string>(
"prophet_forwarding_strategy",
"GRTR");
797 _prophet_config.gtmx_nf_max = conf.read<
unsigned int>(
"prophet_gtmx_nf_max", 30);
803 _forwarding = (conf.read<std::string>(
"routing_forwarding",
"yes") ==
"yes");
808 _prefer_direct = (conf.read<std::string>(
"routing_prefer_direct",
"yes") ==
"yes");
815 if (_use_default_net)
821 nc.
iface = ibrcommon::vinterface(_default_net);
827 _interfaces.push_back( nc );
832 for (vector<string>::const_iterator iter = nets.begin(); iter != nets.end(); ++iter)
834 const std::string &netname = (*iter);
836 const std::string key_type =
"net_" + netname +
"_type";
837 const std::string key_port =
"net_" + netname +
"_port";
838 const std::string key_interface =
"net_" + netname +
"_interface";
839 const std::string key_address =
"net_" + netname +
"_address";
840 const std::string key_path =
"net_" + netname +
"_path";
841 const std::string key_mtu =
"net_" + netname +
"_mtu";
843 const std::string type_name = conf.read<
string>(key_type,
"tcp");
863 nc.
url = conf.read<std::string>(key_address,
"http://localhost/");
869 nc.
url = conf.read<std::string>(key_path,
"");
875 nc.
port = conf.read<
int>(key_port, 4556);
876 nc.
mtu = conf.read<
int>(key_mtu, 1280);
879 nc.
iface = ibrcommon::vinterface(conf.read<std::string>(key_interface));
880 }
catch (
const ConfigFile::key_not_found&) {
889 _interfaces.push_back(nc);
891 }
catch (
const ConfigFile::key_not_found&) {
898 _tcp_nodelay = (conf.read<std::string>(
"tcp_nodelay",
"yes") ==
"yes");
899 _tcp_chunksize = conf.read<
unsigned int>(
"tcp_chunksize", 4096);
900 _tcp_idle_timeout = conf.read<
unsigned int>(
"tcp_idle_timeout", 0);
905 _keepalive_timeout = conf.read<
unsigned int>(
"keepalive_timeout", 60);
915 _fragmentation = (conf.read<std::string>(
"fragmentation",
"yes") ==
"yes");
922 for (std::vector<string>::const_iterator iter = inets.begin(); iter != inets.end(); ++iter)
924 ibrcommon::vinterface inet_dev(*iter);
925 _internet_devices.insert(inet_dev);
927 }
catch (
const ibrcommon::ConfigFile::key_not_found&) { };
932 _scheduling = (conf.read<std::string>(
"scheduling",
"no") ==
"yes");
942 return _static_routes;
953 ss << name <<
"_path";
954 string key; ss >> key;
957 return ibrcommon::File(_conf.read<
string>(key));
958 }
catch (
const ConfigFile::key_not_found&) { }
1005 return _prefer_direct;
1010 return _fragmentation;
1020 return _tcp_nodelay;
1025 return _tcp_chunksize;
1030 return _tcp_idle_timeout;
1035 return _keepalive_timeout;
1040 return _auto_connect;
1045 return _prophet_config;
1050 return _internet_devices;
1055 return _link_request_interval;
1060 std::string unparsed = _conf.read<std::string>(
"limit_" + suffix,
"0");
1062 std::stringstream ss(unparsed);
1064 float value; ss >> value;
1065 char multiplier = 0; ss >> multiplier;
1091 bool withTLS =
false;
1095 bool activateTLS =
true;
1099 _cert = conf.read<std::string>(
"security_certificate");
1101 if (!_cert.exists())
1103 IBRCOMMON_LOGGER_TAG(
"Configuration", warning) <<
"Certificate file " << _cert.getPath() <<
" does not exists!" << IBRCOMMON_LOGGER_ENDL;
1104 activateTLS =
false;
1106 }
catch (
const ibrcommon::ConfigFile::key_not_found&) {
1107 activateTLS =
false;
1112 _key = conf.read<std::string>(
"security_key");
1116 IBRCOMMON_LOGGER_TAG(
"Configuration", warning) <<
"KEY file " << _key.getPath() <<
" does not exists!" << IBRCOMMON_LOGGER_ENDL;
1117 activateTLS =
false;
1119 }
catch (
const ibrcommon::ConfigFile::key_not_found&) {
1120 activateTLS =
false;
1125 _trustedCAPath = conf.read<std::string>(
"security_trusted_ca_path");
1126 if(!_trustedCAPath.isDirectory()){
1127 IBRCOMMON_LOGGER_TAG(
"Configuration", warning) <<
"Trusted CA Path " << _trustedCAPath.getPath() <<
" does not exists or is no directory!" << IBRCOMMON_LOGGER_ENDL;
1128 activateTLS =
false;
1130 }
catch (
const ibrcommon::ConfigFile::key_not_found&) {
1131 activateTLS =
false;
1135 _disableEncryption = (conf.read<std::string>(
"security_tls_disable_encryption",
"no") ==
"yes");
1142 _tlsRequired = (conf.read<std::string>(
"security_tls_required",
"no") ==
"yes");
1145 _tlsOptionalOnBadClock = (conf.read<std::string>(
"security_tls_fallback_badclock",
"no") ==
"yes");
1149 #ifdef IBRDTN_SUPPORT_BSP
1152 _path = conf.read<std::string>(
"security_path");
1154 if (!_path.exists())
1156 ibrcommon::File::createDirectory(_path);
1160 }
catch (
const ibrcommon::ConfigFile::key_not_found&) {
1165 _level =
Level(conf.read<
int>(
"security_level", 0));
1172 _cert = conf.read<std::string>(
"security_certificate");
1174 if (!_cert.exists())
1176 IBRCOMMON_LOGGER_TAG(
"Configuration", warning) <<
"Certificate file " << _cert.getPath() <<
" does not exists!" << IBRCOMMON_LOGGER_ENDL;
1178 }
catch (
const ibrcommon::ConfigFile::key_not_found&) { }
1182 _key = conf.read<std::string>(
"security_key");
1186 IBRCOMMON_LOGGER_TAG(
"Configuration", warning) <<
"KEY file " << _key.getPath() <<
" does not exists!" << IBRCOMMON_LOGGER_ENDL;
1188 }
catch (
const ibrcommon::ConfigFile::key_not_found&) { }
1193 _bab_default_key = conf.read<std::string>(
"security_bab_default_key");
1195 if (!_bab_default_key.exists())
1197 IBRCOMMON_LOGGER_TAG(
"Configuration", warning) <<
"KEY file " << _bab_default_key.getPath() <<
" does not exists!" << IBRCOMMON_LOGGER_ENDL;
1199 }
catch (
const ibrcommon::ConfigFile::key_not_found&) {
1204 _generate_dh_params = conf.read<std::string>(
"generate_dh_params") ==
"yes";
1205 }
catch (
const ibrcommon::ConfigFile::key_not_found&) {
1226 return _tlsRequired;
1241 return _bab_default_key;
1256 return _trustedCAPath;
1261 return _disableEncryption;
1266 return _generate_dh_params;
1378 return _dnsbootstrapping;
1383 return _bootstrappingdomains;
1388 return !_bootstrappingips.empty();
1393 return _bootstrappingips;
1407 return _nodesFilePath;
1422 return _selfannounce;
1432 return _allowNeighbourAnnouncement;
1437 return _allowNeighbourToAnnounceMe;
1447 return _ignoreDHTNeighbourInformations;
1477 return _smtpUsername;
1482 return _smtpPassword;
1487 return _smtpInterval;
1492 return _smtpConnectionTimeout;
1496 return _smtpKeepAliveTimeout * 1000;
1501 return _smtpNeedAuth;
1526 return _imapUsername;
1531 return _imapPassword;
1541 return _imapInterval;
1546 return _imapConnectionTimeout;
1561 return _imapPurgeMail;
1571 return _tlsUserCerts;
1576 return _availableTime;
1581 return _returningMailsCheck;
static Configuration & getInstance(bool reset=false)
bool isIPv6Enabled() const
const std::list< NetConfig > & getInterfaces() const
dtn::data::Timeout getKeepaliveInterval() const
const ibrcommon::File & getBABDefaultKey() const
size_t getNodeAvailableTime() const
void params(int argc, char *argv[])
const Configuration::TimeSync & getTimeSync() const
const Configuration::Security & getSecurity() const
const Configuration::Discovery & getDiscovery() const
dtn::data::Size getThreads() const
size_t getReturningMailChecks() const
void load(const ibrcommon::ConfigFile &conf)
bool isDNSBootstrappingEnabled() const
static void setModifyClock(bool val)
std::ostream & output() const
std::string getOwnAddress() const
const Configuration::Logger & getLogger() const
ibrcommon::vinterface _default_net
bool isNeighbourAllowedToAnnounceMe() const
void load(const ibrcommon::ConfigFile &conf)
bool isIPBootstrappingEnabled() const
void load(const ibrcommon::ConfigFile &conf)
bool enableCrosslayer() const
Configuration::NetConfig getAPIInterface() const
void load(const ibrcommon::ConfigFile &conf)
bool isSelfAnnouncingEnabled() const
std::string getSmtpServer() const
const std::string getCtrlPath() const
bool isIPv4Enabled() const
size_t getImapLookupInterval() const
size_t getSmtpKeepAliveTimeout() const
bool TLSRequired() const
Checks if TLS is required.
std::vector< string > getDNSBootstrappingNames() const
const ibrcommon::File & getLogfile() const
void load(const ibrcommon::ConfigFile &conf)
std::string getNodename() const
string getPathToNodeFiles() const
const ibrcommon::File & getKey() const
RoutingExtension getRoutingExtension() const
void load(const ibrcommon::ConfigFile &conf)
bool doForwarding() const
std::string getSmtpUsername() const
const Configuration::P2P & getP2P() const
bool ignoreDHTNeighbourInformations() const
const Configuration::Network & getNetwork() const
bool smtpAuthenticationNeeded() const
void load(const ibrcommon::ConfigFile &conf)
dtn::data::Size getLimit(const std::string &) const
const Configuration::DHT & getDHT() const
void load(bool quiet=false)
ibrcommon::File getPath(string name) const
bool hasReference() const
bool isBlacklistEnabled() const
bool TLSEncryptionDisabled() const
Checks if Encryption in TLS shall be disabled.
const ibrcommon::File & getCertificate() const
bool isNeighbourAnnouncementEnabled() const
string getIPv6Binding() const
const Configuration::Debug & getDebug() const
const ibrcommon::File & getTrustedCAPath() const
Read the path for trusted Certificates from the Configuration.
float getSyncLevel() const
bool isGenerateDHParamsEnabled() const
Generate DH parameters automatically if necessary.
std::vector< std::string > getImapFolder() const
unsigned int options() const
std::string getSmtpPassword() const
std::string version() const
const std::multimap< std::string, std::string > & getStaticRoutes() const
const std::list< Node > & getStaticNodes() const
ProphetConfig getProphetConfig() const
std::string getImapPassword() const
bool imapPurgeMail() const
unsigned int interval() const
const ibrcommon::File & getPidFile() const
void load(const ibrcommon::ConfigFile &conf)
int getMinimumRating() const
void load(const ibrcommon::ConfigFile &conf)
size_t getImapConnectionTimeout() const
std::string getStorage() const
std::vector< std::string > getTlsCACerts() const
std::string getImapServer() const
size_t getSmtpConnectionTimeout() const
size_t getLinkRequestInterval() const
static double getRating()
unsigned int getPort() const
bool getUsePersistentBundleSets() const
size_t getSmtpSubmitInterval() const
bool getTCPOptionNoDelay() const
const Configuration::EMail & getEMail() const
ibrcommon::vinterface iface
const dtn::data::EID & getEID() const
dtn::data::Length getTCPChunkSize() const
bool sendDiscoveryBeacons() const
const Configuration::Daemon & getDaemon() const
bool doScheduling() const
void setConnectImmediately(bool val)
bool display_timestamps() const
bool doFragmentation() const
ibrcommon::File getAPISocket() const
const ibrcommon::File & getPath() const
string getIPv4Binding() const
void load(const ibrcommon::ConfigFile &conf)
dtn::data::Timeout getTCPIdleTimeout() const
std::string getImapUsername() const
bool doTLS() const
checks if TLS shall be activated
static std::vector< std::string > tokenize(const std::string &token, const std::string &data, const std::string::size_type max=std::string::npos)
std::vector< std::string > getTlsUserCerts() const
const std::set< ibrcommon::vaddress > address() const
dtn::data::Timeout getAutoConnect() const
bool doPreferDirect() const
std::vector< string > getIPBootstrappingIPs() const
std::set< ibrcommon::vinterface > getInternetDevices() const