Kea  1.5.0
d2_cfg_mgr.h
Go to the documentation of this file.
1 // Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef D2_CFG_MGR_H
8 #define D2_CFG_MGR_H
9 
10 #include <asiolink/io_service.h>
11 #include <cc/data.h>
12 #include <exceptions/exceptions.h>
13 #include <d2/d2_config.h>
14 #include <process/d_cfg_mgr.h>
15 
16 #include <stdint.h>
17 #include <string>
18 
19 namespace isc {
20 namespace d2 {
21 
24 typedef boost::shared_ptr<D2CfgContext> D2CfgContextPtr;
25 
34 public:
36  D2CfgContext();
37 
39  virtual ~D2CfgContext();
40 
45  return (process::ConfigPtr(new D2CfgContext(*this)));
46  }
47 
50  return (d2_params_);
51  }
52 
57  return (forward_mgr_);
58  }
59 
62  void setForwardMgr(DdnsDomainListMgrPtr forward_mgr) {
63  forward_mgr_ = forward_mgr;
64  }
65 
70  return (reverse_mgr_);
71  }
72 
75  void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr) {
76  reverse_mgr_ = reverse_mgr;
77  }
78 
83  return (keys_);
84  }
85 
89  void setKeys(const TSIGKeyInfoMapPtr& keys) {
90  keys_ = keys;
91  }
92 
96  virtual isc::data::ElementPtr toElement() const;
97 
98 protected:
100  D2CfgContext(const D2CfgContext& rhs);
101 
102 private:
104  D2CfgContext& operator=(const D2CfgContext& rhs);
105 
107  D2ParamsPtr d2_params_;
108 
110  DdnsDomainListMgrPtr forward_mgr_;
111 
113  DdnsDomainListMgrPtr reverse_mgr_;
114 
116  TSIGKeyInfoMapPtr keys_;
117 };
118 
120 typedef boost::shared_ptr<DdnsDomainListMgr> DdnsDomainListMgrPtr;
121 
122 
123 
131 public:
134  static const char* IPV4_REV_ZONE_SUFFIX;
135 
138  static const char* IPV6_REV_ZONE_SUFFIX;
139 
141  D2CfgMgr();
142 
144  virtual ~D2CfgMgr();
145 
150  return (boost::dynamic_pointer_cast<D2CfgContext>(getContext()));
151  }
152 
161  bool forwardUpdatesEnabled();
162 
171  bool reverseUpdatesEnabled();
172 
184  bool matchForward(const std::string& fqdn, DdnsDomainPtr& domain);
185 
197  bool matchReverse(const std::string& ip_address, DdnsDomainPtr& domain);
198 
212  static std::string reverseIpAddress(const std::string& address);
213 
231  static std::string reverseV4Address(const isc::asiolink::IOAddress& ioaddr);
232 
251  static std::string reverseV6Address(const isc::asiolink::IOAddress& ioaddr);
252 
255  const D2ParamsPtr& getD2Params();
256 
263  virtual std::string getConfigSummary(const uint32_t selection);
264 
265 protected:
266 
274  parse(isc::data::ConstElementPtr config, bool check_only);
275 
282  virtual void setCfgDefaults(isc::data::ElementPtr mutable_config);
283 
294 };
295 
297 typedef boost::shared_ptr<D2CfgMgr> D2CfgMgrPtr;
298 
299 
300 }; // end of isc::d2 namespace
301 }; // end of isc namespace
302 
303 #endif // D2_CFG_MGR_H
boost::shared_ptr< D2Params > D2ParamsPtr
Defines a pointer for D2Params instances.
Definition: d2_config.h:251
boost::shared_ptr< TSIGKeyInfoMap > TSIGKeyInfoMapPtr
Defines a pointer to map of TSIGkeyInfos.
Definition: d2_config.h:407
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only)
Parses configuration of the D2.
Definition: d2_cfg_mgr.cc:252
boost::shared_ptr< DdnsDomainListMgr > DdnsDomainListMgrPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_cfg_mgr.h:120
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:159
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:586
Base class for all configurations.
Definition: config_base.h:31
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr)
Sets the reverse domain list manager.
Definition: d2_cfg_mgr.h:75
Configuration Manager.
Definition: d_cfg_mgr.h:106
D2CfgMgr()
Constructor.
Definition: d2_cfg_mgr.cc:110
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_cfg_mgr.cc:59
virtual std::string getConfigSummary(const uint32_t selection)
Returns configuration summary in the textual format.
Definition: d2_cfg_mgr.cc:242
const D2ParamsPtr & getD2Params()
Convenience method fetches the D2Params from context.
Definition: d2_cfg_mgr.cc:237
DdnsDomainListMgrPtr getReverseMgr()
Fetches the reverse DNS domain list manager.
Definition: d2_cfg_mgr.h:69
TSIGKeyInfoMapPtr getKeys()
Fetches the map of TSIG keys.
Definition: d2_cfg_mgr.h:82
virtual ~D2CfgContext()
Destructor.
Definition: d2_cfg_mgr.cc:55
virtual ~D2CfgMgr()
Destructor.
Definition: d2_cfg_mgr.cc:113
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition: d2_cfg_mgr.h:44
D2CfgContextPtr getD2CfgContext()
Convenience method that returns the D2 configuration context.
Definition: d2_cfg_mgr.h:149
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:297
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
DHCP-DDNS Configuration Context.
Definition: d2_cfg_mgr.h:33
boost::shared_ptr< D2CfgContext > D2CfgContextPtr
Pointer to a configuration context.
Definition: d2_cfg_mgr.h:22
D2ParamsPtr & getD2Params()
Fetches a reference to the D2Params.
Definition: d2_cfg_mgr.h:49
static std::string reverseV6Address(const isc::asiolink::IOAddress &ioaddr)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:207
virtual void setCfgDefaults(isc::data::ElementPtr mutable_config)
Adds default values to the given config.
Definition: d2_cfg_mgr.cc:247
static const char * IPV6_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv6 addresses for reverse lookups.
Definition: d2_cfg_mgr.h:138
Defines the logger used by the top-level component of kea-dhcp-ddns.
bool forwardUpdatesEnabled()
Returns whether or not forward updates are enabled.
Definition: d2_cfg_mgr.cc:122
void setKeys(const TSIGKeyInfoMapPtr &keys)
Sets the map of TSIG keys.
Definition: d2_cfg_mgr.h:89
void setForwardMgr(DdnsDomainListMgrPtr forward_mgr)
Sets the forward domain list manager.
Definition: d2_cfg_mgr.h:62
bool matchReverse(const std::string &ip_address, DdnsDomainPtr &domain)
Matches a given IP address to a reverse domain.
Definition: d2_cfg_mgr.cc:148
bool matchForward(const std::string &fqdn, DdnsDomainPtr &domain)
Matches a given FQDN to a forward domain.
Definition: d2_cfg_mgr.cc:134
D2CfgContext()
Constructor.
Definition: d2_cfg_mgr.cc:33
DdnsDomainListMgrPtr getForwardMgr()
Fetches the forward DNS domain list manager.
Definition: d2_cfg_mgr.h:56
bool reverseUpdatesEnabled()
Returns whether or not reverse updates are enabled.
Definition: d2_cfg_mgr.cc:128
A collection of classes for housing and parsing the application configuration necessary for the DHCP-...
DHCP-DDNS Configuration Manager.
Definition: d2_cfg_mgr.h:130
virtual process::ConfigPtr createNewContext()
Creates an new, blank D2CfgContext context.
Definition: d2_cfg_mgr.cc:117
static std::string reverseV4Address(const isc::asiolink::IOAddress &ioaddr)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:177
static const char * IPV4_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv4 addresses for reverse lookups.
Definition: d2_cfg_mgr.h:134
ConfigPtr & getContext()
Fetches the configuration context.
Definition: d_cfg_mgr.h:149
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the SrvConfig.
Definition: config_base.h:119