Kea: d2_cfg_mgr.h Source File

| Kea 2.2.0

d2_cfg_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2014-2021 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 <d2srv/d2_config.h>
14#include <hooks/hooks_config.h>
15#include <process/d_cfg_mgr.h>
16
17#include <stdint.h>
18#include <string>
19
20namespace isc {
21namespace d2 {
22
23class D2CfgContext;
25 typedef boost::shared_ptr<D2CfgContext> D2CfgContextPtr;
26
34 class D2CfgContext : public process::ConfigBase {
35public:
37 D2CfgContext();
38
40 virtual ~D2CfgContext();
41
45 virtual process::ConfigPtr clone() {
46 return (process::ConfigPtr(new D2CfgContext(*this)));
47 }
48
50 D2ParamsPtr& getD2Params() {
51 return (d2_params_);
52 }
53
57 DdnsDomainListMgrPtr getForwardMgr() {
58 return (forward_mgr_);
59 }
60
63 void setForwardMgr(DdnsDomainListMgrPtr forward_mgr) {
64 forward_mgr_ = forward_mgr;
65 }
66
70 DdnsDomainListMgrPtr getReverseMgr() {
71 return (reverse_mgr_);
72 }
73
76 void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr) {
77 reverse_mgr_ = reverse_mgr;
78 }
79
83 TSIGKeyInfoMapPtr getKeys() {
84 return (keys_);
85 }
86
90 void setKeys(const TSIGKeyInfoMapPtr& keys) {
91 keys_ = keys;
92 }
93
96 const isc::data::ConstElementPtr getControlSocketInfo() const {
97 return (control_socket_);
98 }
99
102 void setControlSocketInfo(const isc::data::ConstElementPtr& control_socket) {
103 control_socket_ = control_socket;
104 }
105
109 isc::hooks::HooksConfig& getHooksConfig() {
110 return (hooks_config_);
111 }
112
116 const isc::hooks::HooksConfig& getHooksConfig() const {
117 return (hooks_config_);
118 }
119
123 virtual isc::data::ElementPtr toElement() const;
124
125protected:
127 D2CfgContext(const D2CfgContext& rhs);
128
129private:
131 D2CfgContext& operator=(const D2CfgContext& rhs);
132
134 D2ParamsPtr d2_params_;
135
137 DdnsDomainListMgrPtr forward_mgr_;
138
140 DdnsDomainListMgrPtr reverse_mgr_;
141
143 TSIGKeyInfoMapPtr keys_;
144
146 isc::data::ConstElementPtr control_socket_;
147
149 isc::hooks::HooksConfig hooks_config_;
150};
151
153 typedef boost::shared_ptr<DdnsDomainListMgr> DdnsDomainListMgrPtr;
154
161 class D2CfgMgr : public process::DCfgMgrBase {
162public:
165 static const char* IPV4_REV_ZONE_SUFFIX;
166
169 static const char* IPV6_REV_ZONE_SUFFIX;
170
172 D2CfgMgr();
173
175 virtual ~D2CfgMgr();
176
180 D2CfgContextPtr getD2CfgContext() {
181 return (boost::dynamic_pointer_cast<D2CfgContext>(getContext()));
182 }
183
192 bool forwardUpdatesEnabled();
193
202 bool reverseUpdatesEnabled();
203
215 bool matchForward(const std::string& fqdn, DdnsDomainPtr& domain);
216
228 bool matchReverse(const std::string& ip_address, DdnsDomainPtr& domain);
229
243 static std::string reverseIpAddress(const std::string& address);
244
262 static std::string reverseV4Address(const isc::asiolink::IOAddress& ioaddr);
263
282 static std::string reverseV6Address(const isc::asiolink::IOAddress& ioaddr);
283
286 const D2ParamsPtr& getD2Params();
287
291 const isc::data::ConstElementPtr getControlSocketInfo();
292
299 virtual std::string getConfigSummary(const uint32_t selection) override;
300
301 std::list<std::list<std::string>> jsonPathsToRedact() const final override;
302
303protected:
310 virtual isc::data::ConstElementPtr
311 parse(isc::data::ConstElementPtr config, bool check_only) override;
312
319 virtual void setCfgDefaults(isc::data::ElementPtr mutable_config) override;
320
330 virtual process::ConfigPtr createNewContext() override;
331};
332
334typedef boost::shared_ptr<D2CfgMgr> D2CfgMgrPtr;
335
336} // end of isc::d2 namespace
337} // end of isc namespace
338
339#endif // D2_CFG_MGR_H
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic)
Definition: io_address.h:45
isc::d2::D2CfgContext
DHCP-DDNS Configuration Context.
Definition: d2_cfg_mgr.h:34
isc::d2::D2CfgContext::setControlSocketInfo
void setControlSocketInfo(const isc::data::ConstElementPtr &control_socket)
Sets information about the control socket.
Definition: d2_cfg_mgr.h:102
isc::d2::D2CfgContext::setForwardMgr
void setForwardMgr(DdnsDomainListMgrPtr forward_mgr)
Sets the forward domain list manager.
Definition: d2_cfg_mgr.h:63
isc::d2::D2CfgContext::~D2CfgContext
virtual ~D2CfgContext()
Destructor.
Definition: d2_cfg_mgr.cc:60
isc::d2::D2CfgContext::getD2Params
D2ParamsPtr & getD2Params()
Fetches a reference to the D2Params.
Definition: d2_cfg_mgr.h:50
isc::d2::D2CfgContext::setReverseMgr
void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr)
Sets the reverse domain list manager.
Definition: d2_cfg_mgr.h:76
isc::d2::D2CfgContext::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_cfg_mgr.cc:64
isc::d2::D2CfgContext::getReverseMgr
DdnsDomainListMgrPtr getReverseMgr()
Fetches the reverse DNS domain list manager.
Definition: d2_cfg_mgr.h:70
isc::d2::D2CfgContext::getHooksConfig
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition: d2_cfg_mgr.h:109
isc::d2::D2CfgContext::getForwardMgr
DdnsDomainListMgrPtr getForwardMgr()
Fetches the forward DNS domain list manager.
Definition: d2_cfg_mgr.h:57
isc::d2::D2CfgContext::clone
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition: d2_cfg_mgr.h:45
isc::d2::D2CfgContext::getControlSocketInfo
const isc::data::ConstElementPtr getControlSocketInfo() const
Returns information about control socket.
Definition: d2_cfg_mgr.h:96
isc::d2::D2CfgContext::getKeys
TSIGKeyInfoMapPtr getKeys()
Fetches the map of TSIG keys.
Definition: d2_cfg_mgr.h:83
isc::d2::D2CfgContext::D2CfgContext
D2CfgContext()
Constructor.
Definition: d2_cfg_mgr.cc:33
isc::d2::D2CfgContext::getHooksConfig
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
Definition: d2_cfg_mgr.h:116
isc::d2::D2CfgContext::setKeys
void setKeys(const TSIGKeyInfoMapPtr &keys)
Sets the map of TSIG keys.
Definition: d2_cfg_mgr.h:90
isc::d2::D2CfgMgr
DHCP-DDNS Configuration Manager.
Definition: d2_cfg_mgr.h:161
isc::d2::D2CfgMgr::~D2CfgMgr
virtual ~D2CfgMgr()
Destructor.
Definition: d2_cfg_mgr.cc:124
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:145
isc::d2::D2CfgMgr::createNewContext
virtual process::ConfigPtr createNewContext() override
Creates an new, blank D2CfgContext context.
Definition: d2_cfg_mgr.cc:128
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:170
isc::d2::D2CfgMgr::getD2CfgContext
D2CfgContextPtr getD2CfgContext()
Convenience method that returns the D2 configuration context.
Definition: d2_cfg_mgr.h:180
isc::d2::D2CfgMgr::reverseUpdatesEnabled
bool reverseUpdatesEnabled()
Returns whether or not reverse updates are enabled.
Definition: d2_cfg_mgr.cc:139
isc::d2::D2CfgMgr::setCfgDefaults
virtual void setCfgDefaults(isc::data::ElementPtr mutable_config) override
Adds default values to the given config.
Definition: d2_cfg_mgr.cc:263
isc::d2::D2CfgMgr::jsonPathsToRedact
std::list< std::list< std::string > > jsonPathsToRedact() const final override
Return a list of all paths that contain passwords or secrets.
Definition: d2_cfg_mgr.cc:317
isc::d2::D2CfgMgr::D2CfgMgr
D2CfgMgr()
Constructor.
Definition: d2_cfg_mgr.cc:121
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:169
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:188
isc::d2::D2CfgMgr::forwardUpdatesEnabled
bool forwardUpdatesEnabled()
Returns whether or not forward updates are enabled.
Definition: d2_cfg_mgr.cc:133
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:159
isc::d2::D2CfgMgr::getConfigSummary
virtual std::string getConfigSummary(const uint32_t selection) override
Returns configuration summary in the textual format.
Definition: d2_cfg_mgr.cc:258
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:218
isc::d2::D2CfgMgr::getD2Params
const D2ParamsPtr & getD2Params()
Convenience method fetches the D2Params from context.
Definition: d2_cfg_mgr.cc:248
isc::d2::D2CfgMgr::getControlSocketInfo
const isc::data::ConstElementPtr getControlSocketInfo()
Convenience method fetches information about control socket from context.
Definition: d2_cfg_mgr.cc:253
isc::d2::D2CfgMgr::parse
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only) override
Parses configuration of the D2.
Definition: d2_cfg_mgr.cc:268
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:165
isc::hooks::HooksConfig
Wrapper class that holds hooks libraries configuration.
Definition: hooks_config.h:36
isc::process::ConfigBase
Base class for all configurations.
Definition: config_base.h:33
isc::process::DCfgMgrBase
Configuration Manager.
Definition: d_cfg_mgr.h:108
isc::process::DCfgMgrBase::getContext
ConfigPtr & getContext()
Fetches the configuration context.
Definition: d_cfg_mgr.h:151
d2_config.h
A collection of classes for housing and parsing the application configuration necessary for the DHCP-...
d_cfg_mgr.h
data.h
exceptions.h
hooks_config.h
io_service.h
boost
Definition: io_service.h:14
isc::d2::DdnsDomainListMgrPtr
boost::shared_ptr< DdnsDomainListMgr > DdnsDomainListMgrPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_cfg_mgr.h:153
isc::d2::DdnsDomainPtr
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:612
isc::d2::D2CfgMgrPtr
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:334
isc::d2::D2CfgContextPtr
boost::shared_ptr< D2CfgContext > D2CfgContextPtr
Pointer to a configuration context.
Definition: d2_cfg_mgr.h:23
isc::d2::D2ParamsPtr
boost::shared_ptr< D2Params > D2ParamsPtr
Defines a pointer for D2Params instances.
Definition: d2_config.h:257
isc::d2::TSIGKeyInfoMapPtr
boost::shared_ptr< TSIGKeyInfoMap > TSIGKeyInfoMapPtr
Defines a pointer to map of TSIGkeyInfos.
Definition: d2_config.h:413
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
isc::process::ConfigPtr
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Definition: config_base.h:176
isc
Defines the logger used by the top-level component of kea-lfc.
Definition: agent_parser.cc:143