22 #ifndef CONFIGURATION_H_
23 #define CONFIGURATION_H_
25 #include "ibrcommon/data/ConfigFile.h"
28 #include <ibrcommon/Exceptions.h>
29 #include <ibrcommon/net/vinterface.h>
32 #include <ibrcommon/thread/Timer.h>
34 using namespace dtn::net;
35 using namespace dtn::core;
36 using namespace dtn::data;
68 NETWORK_DGRAM_UDP = 6,
69 NETWORK_DGRAM_LOWPAN = 7,
70 NETWORK_DGRAM_ETHERNET = 8,
74 NetConfig(
const std::string &name, NetType type);
98 void load(
bool quiet =
false);
99 void load(
const std::string &filename,
bool quiet =
false);
101 void params(
int argc,
char *argv[]);
106 std::string getNodename()
const;
114 ibrcommon::File getPath(
string name)
const;
123 ibrcommon::File getAPISocket()
const;
129 std::string version()
const;
135 std::string getStorage()
const;
141 bool getUsePersistentBundleSets()
const;
146 EPIDEMIC_ROUTING = 1,
162 virtual void load(
const ibrcommon::ConfigFile &conf) = 0;
171 void load(
const ibrcommon::ConfigFile &conf);
181 bool enabled()
const;
182 bool announce()
const;
183 bool shortbeacon()
const;
187 unsigned int interval() const;
188 bool enableCrosslayer() const;
197 void load(
const ibrcommon::ConfigFile &conf);
213 bool enabled()
const;
225 bool profiling()
const;
234 void load(
const ibrcommon::ConfigFile &conf);
253 const ibrcommon::File& getLogfile()
const;
264 unsigned int options()
const;
269 std::ostream &output()
const;
274 bool display_timestamps()
const;
279 bool verbose()
const;
290 : p_encounter_max(0), p_encounter_first(0), p_first_threshold(0), beta(0), gamma(0), delta(0),
291 time_unit(0), i_typ(0), next_exchange_timeout(0), forwarding_strategy(), gtmx_nf_max(0)
311 void load(
const ibrcommon::ConfigFile &conf);
337 const std::list<NetConfig>& getInterfaces()
const;
342 const std::list<Node>& getStaticNodes()
const;
347 const std::multimap<std::string, std::string>& getStaticRoutes()
const;
358 bool doForwarding()
const;
365 bool doPreferDirect()
const;
370 bool getTCPOptionNoDelay()
const;
395 bool doFragmentation()
const;
405 bool doScheduling()
const;
410 std::set<ibrcommon::vinterface> getInternetDevices()
const;
415 size_t getLinkRequestInterval()
const;
425 bool _tlsOptionalOnBadClock;
426 bool _generate_dh_params;
431 void load(
const ibrcommon::ConfigFile &conf);
434 bool enabled()
const;
449 bool TLSRequired()
const;
453 SECURITY_LEVEL_NONE = 0,
454 SECURITY_LEVEL_AUTHENTICATED = 1,
455 SECURITY_LEVEL_ENCRYPTED = 2,
456 SECURITY_LEVEL_SIGNED = 4
462 int getLevel()
const;
467 const ibrcommon::File& getPath()
const;
472 const ibrcommon::File& getBABDefaultKey()
const;
477 const ibrcommon::File& getCertificate()
const;
482 const ibrcommon::File& getKey()
const;
488 const ibrcommon::File& getTrustedCAPath()
const;
494 bool TLSEncryptionDisabled()
const;
500 bool isGenerateDHParamsEnabled()
const;
504 ibrcommon::File _path;
510 ibrcommon::File _bab_default_key;
513 ibrcommon::File _cert;
516 ibrcommon::File _key;
519 ibrcommon::File _trustedCAPath;
522 bool _disableEncryption;
530 ibrcommon::File _pidfile;
537 void load(
const ibrcommon::ConfigFile &conf);
540 bool daemonize()
const;
541 const ibrcommon::File& getPidFile()
const;
542 bool kill_daemon()
const;
552 void load(
const ibrcommon::ConfigFile &conf);
562 bool hasReference()
const;
564 bool sendDiscoveryBeacons()
const;
566 float getSigma()
const;
567 float getPsi()
const;
568 float getSyncLevel()
const;
577 void load(
const ibrcommon::ConfigFile &conf);
585 std::vector<string> _bootstrappingdomains;
586 bool _dnsbootstrapping;
587 std::vector<string> _bootstrappingips;
588 string _nodesFilePath;
593 std::vector<int> _portFilter;
595 bool _allowNeighbourToAnnounceMe;
596 bool _allowNeighbourAnnouncement;
597 bool _ignoreDHTNeighbourInformations;
603 bool enabled()
const;
608 bool randomPort()
const;
613 unsigned int getPort()
const;
618 string getID()
const;
623 bool randomID()
const;
628 bool isDNSBootstrappingEnabled()
const;
633 std::vector<string> getDNSBootstrappingNames()
const;
638 bool isIPBootstrappingEnabled()
const;
643 std::vector<string> getIPBootstrappingIPs()
const;
648 string getIPv4Binding()
const;
653 string getIPv6Binding()
const;
662 string getPathToNodeFiles()
const;
667 bool isIPv4Enabled()
const;
672 bool isIPv6Enabled()
const;
677 std::vector<int> getPortFilter()
const;
682 bool isBlacklistEnabled()
const;
687 bool isSelfAnnouncingEnabled()
const;
692 int getMinimumRating()
const;
697 bool isNeighbourAnnouncementEnabled()
const;
702 bool isNeighbourAllowedToAnnounceMe()
const;
713 bool ignoreDHTNeighbourInformations()
const;
722 void load(
const ibrcommon::ConfigFile &conf);
728 const std::string getCtrlPath()
const;
729 bool enabled()
const;
738 void load(
const ibrcommon::ConfigFile &conf);
740 std::string _address;
741 std::string _smtpServer;
743 std::string _smtpUsername;
744 std::string _smtpPassword;
748 size_t _smtpInterval;
749 size_t _smtpConnectionTimeout;
750 size_t _smtpKeepAliveTimeout;
751 std::string _imapServer;
753 std::string _imapUsername;
754 std::string _imapPassword;
757 std::vector<std::string> _imapFolder;
758 size_t _imapInterval;
759 size_t _imapConnectionTimeout;
761 std::vector<std::string> _tlsCACerts;
762 std::vector<std::string> _tlsUserCerts;
763 size_t _availableTime;
764 size_t _returningMailsCheck;
773 std::string getOwnAddress()
const;
781 std::string getSmtpServer()
const;
789 int getSmtpPort()
const;
797 std::string getSmtpUsername()
const;
805 std::string getSmtpPassword()
const;
815 size_t getSmtpSubmitInterval()
const;
820 size_t getSmtpConnectionTimeout()
const;
830 size_t getSmtpKeepAliveTimeout()
const;
836 bool smtpAuthenticationNeeded()
const;
842 bool smtpUseTLS()
const;
848 bool smtpUseSSL()
const;
856 std::string getImapServer()
const;
864 int getImapPort()
const;
872 std::string getImapUsername()
const;
880 std::string getImapPassword()
const;
889 std::vector<std::string> getImapFolder()
const;
899 size_t getImapLookupInterval()
const;
904 size_t getImapConnectionTimeout()
const;
910 bool imapUseTLS()
const;
916 bool imapUseSSL()
const;
921 bool imapPurgeMail()
const;
927 std::vector<std::string> getTlsCACerts()
const;
933 std::vector<std::string> getTlsUserCerts()
const;
939 size_t getNodeAvailableTime()
const;
944 size_t getReturningMailChecks()
const;
959 ibrcommon::ConfigFile _conf;
971 std::string _filename;
dtn::data::Timeout _keepalive_timeout
ibrcommon::vinterface _default_net
dtn::data::Timeout _tcp_idle_timeout
ibrcommon::Timer::time_t time_unit
ibrcommon::Timer::time_t i_typ
std::list< NetConfig > _interfaces
size_t _link_request_interval
dtn::data::Timeout _auto_connect
ibrcommon::Timer::time_t next_exchange_timeout
ibrcommon::vinterface iface
dtn::data::Length _tcp_chunksize
std::set< ibrcommon::vinterface > _internet_devices
ProphetConfig _prophet_config
std::string forwarding_strategy
bool _managed_connectivity
std::multimap< std::string, std::string > _static_routes