Kea: d2_cfg_mgr.h Source File

| 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
22 class D2CfgContext;
24 typedef boost::shared_ptr<D2CfgContext> D2CfgContextPtr;
25
33 class D2CfgContext : public process::ConfigBase {
34 public:
36 D2CfgContext();
37
39 virtual ~D2CfgContext();
40
44 virtual process::ConfigPtr clone() {
45 return (process::ConfigPtr(new D2CfgContext(*this)));
46 }
47
49 D2ParamsPtr& getD2Params() {
50 return (d2_params_);
51 }
52
56 DdnsDomainListMgrPtr getForwardMgr() {
57 return (forward_mgr_);
58 }
59
62 void setForwardMgr(DdnsDomainListMgrPtr forward_mgr) {
63 forward_mgr_ = forward_mgr;
64 }
65
69 DdnsDomainListMgrPtr getReverseMgr() {
70 return (reverse_mgr_);
71 }
72
75 void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr) {
76 reverse_mgr_ = reverse_mgr;
77 }
78
82 TSIGKeyInfoMapPtr getKeys() {
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
130 class D2CfgMgr : public process::DCfgMgrBase {
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
149 D2CfgContextPtr getD2CfgContext() {
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
273 virtual isc::data::ConstElementPtr
274 parse(isc::data::ConstElementPtr config, bool check_only);
275
282 virtual void setCfgDefaults(isc::data::ElementPtr mutable_config);
283
293 virtual process::ConfigPtr createNewContext();
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
isc::process::ConfigBase
Base class for all configurations.
Definition: config_base.h:31
isc::d2::D2CfgContext::getD2Params
D2ParamsPtr & getD2Params()
Fetches a reference to the D2Params.
Definition: d2_cfg_mgr.h:49
isc::process::DCfgMgrBase
Configuration Manager.
Definition: d_cfg_mgr.h:106
isc::d2::DdnsDomainListMgrPtr
boost::shared_ptr< DdnsDomainListMgr > DdnsDomainListMgrPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_cfg_mgr.h:120
isc::d2::D2CfgContext::setForwardMgr
void setForwardMgr(DdnsDomainListMgrPtr forward_mgr)
Sets the forward domain list manager.
Definition: d2_cfg_mgr.h:62
isc::d2::D2CfgMgrPtr
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:297
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic)
Definition: io_address.h:45
isc::d2::D2CfgContext::setReverseMgr
void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr)
Sets the reverse domain list manager.
Definition: d2_cfg_mgr.h:75
isc::d2::D2CfgMgr::parse
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only)
Parses configuration of the D2.
Definition: d2_cfg_mgr.cc:252
isc::d2::D2CfgMgr::D2CfgMgr
D2CfgMgr()
Constructor.
Definition: d2_cfg_mgr.cc:110
isc::d2::D2CfgMgr::reverseV6Address
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
io_service.h
isc::d2::D2CfgMgr::getD2Params
const D2ParamsPtr & getD2Params()
Convenience method fetches the D2Params from context.
Definition: d2_cfg_mgr.cc:237
isc::process::ConfigPtr
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the SrvConfig.
Definition: config_base.h:119
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::d2::D2CfgMgr::matchReverse
bool matchReverse(const std::string &ip_address, DdnsDomainPtr &domain)
Matches a given IP address to a reverse domain.
Definition: d2_cfg_mgr.cc:148
isc::d2::D2CfgMgr::reverseV4Address
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
isc::d2::D2CfgMgr::getD2CfgContext
D2CfgContextPtr getD2CfgContext()
Convenience method that returns the D2 configuration context.
Definition: d2_cfg_mgr.h:149
isc::d2::D2CfgMgr::createNewContext
virtual process::ConfigPtr createNewContext()
Creates an new, blank D2CfgContext context.
Definition: d2_cfg_mgr.cc:117
isc::d2::D2CfgContext::getReverseMgr
DdnsDomainListMgrPtr getReverseMgr()
Fetches the reverse DNS domain list manager.
Definition: d2_cfg_mgr.h:69
isc::d2::D2CfgMgr::setCfgDefaults
virtual void setCfgDefaults(isc::data::ElementPtr mutable_config)
Adds default values to the given config.
Definition: d2_cfg_mgr.cc:247
isc::d2::D2ParamsPtr
boost::shared_ptr< D2Params > D2ParamsPtr
Defines a pointer for D2Params instances.
Definition: d2_config.h:251
isc::d2::D2CfgContext::getForwardMgr
DdnsDomainListMgrPtr getForwardMgr()
Fetches the forward DNS domain list manager.
Definition: d2_cfg_mgr.h:56
d2_config.h
A collection of classes for housing and parsing the application configuration necessary for the DHCP-...
isc::d2::D2CfgMgr::~D2CfgMgr
virtual ~D2CfgMgr()
Destructor.
Definition: d2_cfg_mgr.cc:113
isc::d2::D2CfgContext::~D2CfgContext
virtual ~D2CfgContext()
Destructor.
Definition: d2_cfg_mgr.cc:55
isc::d2::D2CfgMgr::matchForward
bool matchForward(const std::string &fqdn, DdnsDomainPtr &domain)
Matches a given FQDN to a forward domain.
Definition: d2_cfg_mgr.cc:134
isc::d2::D2CfgContext::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_cfg_mgr.cc:59
isc::d2::D2CfgContext::D2CfgContext
D2CfgContext()
Constructor.
Definition: d2_cfg_mgr.cc:33
isc::d2::D2CfgMgr::IPV4_REV_ZONE_SUFFIX
static const char * IPV4_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv4 addresses for reverse lookups.
Definition: d2_cfg_mgr.h:134
isc::d2::D2CfgMgr::forwardUpdatesEnabled
bool forwardUpdatesEnabled()
Returns whether or not forward updates are enabled.
Definition: d2_cfg_mgr.cc:122
isc::d2::D2CfgContext
DHCP-DDNS Configuration Context.
Definition: d2_cfg_mgr.h:33
isc::process::DCfgMgrBase::getContext
ConfigPtr & getContext()
Fetches the configuration context.
Definition: d_cfg_mgr.h:149
data.h
exceptions.h
isc::d2::D2CfgContext::clone
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition: d2_cfg_mgr.h:44
isc::d2::D2CfgMgr::reverseIpAddress
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:159
isc::d2::D2CfgMgr
DHCP-DDNS Configuration Manager.
Definition: d2_cfg_mgr.h:130
d_cfg_mgr.h
isc::d2::TSIGKeyInfoMapPtr
boost::shared_ptr< TSIGKeyInfoMap > TSIGKeyInfoMapPtr
Defines a pointer to map of TSIGkeyInfos.
Definition: d2_config.h:407
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
isc::d2::D2CfgContext::setKeys
void setKeys(const TSIGKeyInfoMapPtr &keys)
Sets the map of TSIG keys.
Definition: d2_cfg_mgr.h:89
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
isc::d2::D2CfgMgr::getConfigSummary
virtual std::string getConfigSummary(const uint32_t selection)
Returns configuration summary in the textual format.
Definition: d2_cfg_mgr.cc:242
isc::d2::D2CfgContextPtr
boost::shared_ptr< D2CfgContext > D2CfgContextPtr
Pointer to a configuration context.
Definition: d2_cfg_mgr.h:22
isc::d2::D2CfgMgr::reverseUpdatesEnabled
bool reverseUpdatesEnabled()
Returns whether or not reverse updates are enabled.
Definition: d2_cfg_mgr.cc:128
isc::d2::DdnsDomainPtr
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:586
isc::d2::D2CfgMgr::IPV6_REV_ZONE_SUFFIX
static const char * IPV6_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv6 addresses for reverse lookups.
Definition: d2_cfg_mgr.h:138
isc::d2::D2CfgContext::getKeys
TSIGKeyInfoMapPtr getKeys()
Fetches the map of TSIG keys.
Definition: d2_cfg_mgr.h:82