Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CfgMgr.h
Go to the documentation of this file.
1 /*
2  * Dibbler - a portable DHCPv6
3  *
4  * authors: Tomasz Mrugalski <thomson@klub.com.pl>
5  * Marek Senderski <msend@o2.pl>
6  *
7  * released under GNU GPL v2 only licence
8  *
9  */
10 
11 #ifndef CFGMGR_H
12 #define CFGMGR_H
13 #include <string>
14 #include "SmartPtr.h"
15 #include "DUID.h"
16 #include "IfaceMgr.h"
17 #include "Key.h"
18 
19 /* shared by server and relay */
20 #define RELAY_MIN_IFINDEX 1024
21 
22 /* Defined DUID types */
23 
24 enum EDUIDType{
29 };
30 
31 class TCfgMgr
32 {
33  public:
35  DNSUPDATE_TCP, /* TCP only */
36  DNSUPDATE_UDP, /* UDP only */
37  DNSUPDATE_ANY /* try UDP first, if response truncated, switch to TCP */
38  };
39 
40  TCfgMgr();
41  virtual ~TCfgMgr();
42 
43  bool compareConfigs(const std::string& cfgFile, const std::string& oldCfgFile);
44  void copyFile(const std::string& cfgFile, const std::string& oldCfgFile);
46  void setWorkdir(std::string workdir);
47  int getLogLevel();
48  std::string getWorkDir();
49  std::string getLogName();
52  void setDDNSTimeout(unsigned int timeout) { DDNSTimeout_ = timeout; }
53  unsigned int getDDNSTimeout() { return DDNSTimeout_; }
54 
55 #if !defined(MOD_SRV_DISABLE_DNSUPDATE) && !defined(MOD_CLNT_DISABLE_DNSUPDATE)
56  void addKey(SPtr<TSIGKey> key);
58 #endif
59 
60 #ifndef MOD_DISABLE_AUTH
61  void setAuthProtocol(AuthProtocols proto);
62  void setAuthReplay(AuthReplay replay_detection_mode);
63  void setAuthAlgorithm(uint8_t algorithm); // protocol specific value
66  uint8_t getAuthAlgorithm();
67  void setAuthDropUnauthenticated(bool drop);
69  void setAuthRealm(const std::string& realm);
70  std::string getAuthRealm();
71 #endif
72 
73  protected:
75  bool setDUID(const std::string& duidFile, TIfaceMgr &ifaceMgr);
76  bool loadDUID(const std::string& filename);
77  bool generateDUID(const std::string& duidFile,char * mac,int macLen, int macType);
78  std::string Workdir;
79  std::string LogName;
80  int LogLevel;
81  bool IsDone;
86  unsigned int DDNSTimeout_;
87 
88 #ifndef MOD_DISABLE_AUTH
90  uint8_t AuthAlgorithm_;
92  std::string AuthRealm_;
93 
95 #endif
96 
97  // for TSIG in DDNS
99  private:
100 
101 };
102 #endif
103