Kea: d2_cfg_mgr.h Source File

| Kea 3.2.0-git

d2_cfg_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2014-2025 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 <config/http_command_config.h>
13#include <exceptions/exceptions.h>
14#include <d2srv/d2_config.h>
15#include <hooks/hooks_config.h>
16#include <process/d_cfg_mgr.h>
17
18#include <stdint.h>
19#include <string>
20
21namespace isc {
22namespace d2 {
23
24class D2CfgContext;
26 typedef boost::shared_ptr<D2CfgContext> D2CfgContextPtr;
27
35 class D2CfgContext : public process::ConfigBase {
36public:
38 D2CfgContext();
39
41 virtual ~D2CfgContext();
42
46 virtual process::ConfigPtr clone() {
47 return (process::ConfigPtr(new D2CfgContext(*this)));
48 }
49
51 D2ParamsPtr& getD2Params() {
52 return (d2_params_);
53 }
54
58 DdnsDomainListMgrPtr getForwardMgr() {
59 return (forward_mgr_);
60 }
61
65 void setForwardMgr(DdnsDomainListMgrPtr forward_mgr) {
66 forward_mgr_ = forward_mgr;
67 }
68
72 DdnsDomainListMgrPtr getReverseMgr() {
73 return (reverse_mgr_);
74 }
75
79 void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr) {
80 reverse_mgr_ = reverse_mgr;
81 }
82
86 TSIGKeyInfoMapPtr getKeys() {
87 return (keys_);
88 }
89
93 void setKeys(const TSIGKeyInfoMapPtr& keys) {
94 keys_ = keys;
95 }
96
100 const isc::data::ConstElementPtr getUnixControlSocketInfo() const {
101 return (unix_control_socket_);
102 }
103
107 void setUnixControlSocketInfo(const isc::data::ConstElementPtr& control_socket) {
108 unix_control_socket_ = control_socket;
109 }
110
114 const isc::data::ConstElementPtr getHttpControlSocketInfo() const {
115 return (http_control_socket_);
116 }
117
121 void setHttpControlSocketInfo(const isc::data::ConstElementPtr& control_socket) {
122 http_control_socket_ = control_socket;
123 }
124
128 isc::hooks::HooksConfig& getHooksConfig() {
129 return (hooks_config_);
130 }
131
135 const isc::hooks::HooksConfig& getHooksConfig() const {
136 return (hooks_config_);
137 }
138
142 virtual isc::data::ElementPtr toElement() const;
143
144protected:
146 D2CfgContext(const D2CfgContext& rhs);
147
148private:
150 D2CfgContext& operator=(const D2CfgContext& rhs);
151
153 D2ParamsPtr d2_params_;
154
156 DdnsDomainListMgrPtr forward_mgr_;
157
159 DdnsDomainListMgrPtr reverse_mgr_;
160
162 TSIGKeyInfoMapPtr keys_;
163
165 isc::data::ConstElementPtr unix_control_socket_;
166
168 isc::data::ConstElementPtr http_control_socket_;
169
171 isc::hooks::HooksConfig hooks_config_;
172};
173
175 typedef boost::shared_ptr<DdnsDomainListMgr> DdnsDomainListMgrPtr;
176
183 class D2CfgMgr : public process::DCfgMgrBase {
184public:
188 static const char* IPV4_REV_ZONE_SUFFIX;
189
193 static const char* IPV6_REV_ZONE_SUFFIX;
194
196 D2CfgMgr();
197
199 virtual ~D2CfgMgr();
200
204 D2CfgContextPtr getD2CfgContext() {
205 return (boost::dynamic_pointer_cast<D2CfgContext>(getContext()));
206 }
207
216 bool forwardUpdatesEnabled();
217
226 bool reverseUpdatesEnabled();
227
239 bool matchForward(const std::string& fqdn, DdnsDomainPtr& domain);
240
252 bool matchReverse(const std::string& ip_address, DdnsDomainPtr& domain);
253
267 static std::string reverseIpAddress(const std::string& address);
268
286 static std::string reverseV4Address(const isc::asiolink::IOAddress& ioaddr);
287
306 static std::string reverseV6Address(const isc::asiolink::IOAddress& ioaddr);
307
311 const D2ParamsPtr& getD2Params();
312
317 const isc::data::ConstElementPtr getUnixControlSocketInfo();
318
323 const isc::data::ConstElementPtr getHttpControlSocketInfo();
324
331 virtual std::string getConfigSummary(const uint32_t selection) override;
332
333 std::list<std::list<std::string>> jsonPathsToRedact() const final override;
334
335protected:
343 virtual isc::data::ConstElementPtr
344 parse(isc::data::ConstElementPtr config, bool check_only) override;
345
352 virtual void setCfgDefaults(isc::data::ElementPtr mutable_config) override;
353
363 virtual process::ConfigPtr createNewContext() override;
364};
365
367typedef boost::shared_ptr<D2CfgMgr> D2CfgMgrPtr;
368
369} // end of isc::d2 namespace
370} // end of isc namespace
371
372#endif // D2_CFG_MGR_H
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic).
Definition io_address.h:53
isc::d2::D2CfgContext
DHCP-DDNS Configuration Context.
Definition d2_cfg_mgr.h:35
isc::d2::D2CfgContext::setForwardMgr
void setForwardMgr(DdnsDomainListMgrPtr forward_mgr)
Sets the forward domain list manager.
Definition d2_cfg_mgr.h:65
isc::d2::D2CfgContext::~D2CfgContext
virtual ~D2CfgContext()
Destructor.
Definition d2_cfg_mgr.cc:63
isc::d2::D2CfgContext::getD2Params
D2ParamsPtr & getD2Params()
Fetches a reference to the D2Params.
Definition d2_cfg_mgr.h:51
isc::d2::D2CfgContext::setUnixControlSocketInfo
void setUnixControlSocketInfo(const isc::data::ConstElementPtr &control_socket)
Sets information about the UNIX control socket.
Definition d2_cfg_mgr.h:107
isc::d2::D2CfgContext::setReverseMgr
void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr)
Sets the reverse domain list manager.
Definition d2_cfg_mgr.h:79
isc::d2::D2CfgContext::getHttpControlSocketInfo
const isc::data::ConstElementPtr getHttpControlSocketInfo() const
Returns information about HTTP/HTTPS control socket.
Definition d2_cfg_mgr.h:114
isc::d2::D2CfgContext::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition d2_cfg_mgr.cc:67
isc::d2::D2CfgContext::getReverseMgr
DdnsDomainListMgrPtr getReverseMgr()
Fetches the reverse DNS domain list manager.
Definition d2_cfg_mgr.h:72
isc::d2::D2CfgContext::getHooksConfig
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition d2_cfg_mgr.h:128
isc::d2::D2CfgContext::getForwardMgr
DdnsDomainListMgrPtr getForwardMgr()
Fetches the forward DNS domain list manager.
Definition d2_cfg_mgr.h:58
isc::d2::D2CfgContext::clone
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition d2_cfg_mgr.h:46
isc::d2::D2CfgContext::getKeys
TSIGKeyInfoMapPtr getKeys()
Fetches the map of TSIG keys.
Definition d2_cfg_mgr.h:86
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:135
isc::d2::D2CfgContext::setHttpControlSocketInfo
void setHttpControlSocketInfo(const isc::data::ConstElementPtr &control_socket)
Sets information about the HTTP/HTTPS control socket.
Definition d2_cfg_mgr.h:121
isc::d2::D2CfgContext::getUnixControlSocketInfo
const isc::data::ConstElementPtr getUnixControlSocketInfo() const
Returns information about UNIX control socket.
Definition d2_cfg_mgr.h:100
isc::d2::D2CfgContext::setKeys
void setKeys(const TSIGKeyInfoMapPtr &keys)
Sets the map of TSIG keys.
Definition d2_cfg_mgr.h:93
isc::d2::D2CfgMgr
DHCP-DDNS Configuration Manager.
Definition d2_cfg_mgr.h:183
isc::d2::D2CfgMgr::~D2CfgMgr
virtual ~D2CfgMgr()
Destructor.
Definition d2_cfg_mgr.cc:137
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:158
isc::d2::D2CfgMgr::getHttpControlSocketInfo
const isc::data::ConstElementPtr getHttpControlSocketInfo()
Convenience method fetches information about HTTP/HTTPS control socket from context.
Definition d2_cfg_mgr.cc:255
isc::d2::D2CfgMgr::createNewContext
virtual process::ConfigPtr createNewContext() override
Creates an new, blank D2CfgContext context.
Definition d2_cfg_mgr.cc:141
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:183
isc::d2::D2CfgMgr::getUnixControlSocketInfo
const isc::data::ConstElementPtr getUnixControlSocketInfo()
Convenience method fetches information about UNIX control socket from context.
Definition d2_cfg_mgr.cc:250
isc::d2::D2CfgMgr::getD2CfgContext
D2CfgContextPtr getD2CfgContext()
Convenience method that returns the D2 configuration context.
Definition d2_cfg_mgr.h:204
isc::d2::D2CfgMgr::reverseUpdatesEnabled
bool reverseUpdatesEnabled()
Returns whether or not reverse updates are enabled.
Definition d2_cfg_mgr.cc:152
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:265
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:326
isc::d2::D2CfgMgr::D2CfgMgr
D2CfgMgr()
Constructor.
Definition d2_cfg_mgr.cc:134
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:193
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:201
isc::d2::D2CfgMgr::forwardUpdatesEnabled
bool forwardUpdatesEnabled()
Returns whether or not forward updates are enabled.
Definition d2_cfg_mgr.cc:146
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:172
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:260
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:223
isc::d2::D2CfgMgr::getD2Params
const D2ParamsPtr & getD2Params()
Convenience method fetches the D2Params from context.
Definition d2_cfg_mgr.cc:245
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:270
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:188
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:105
isc::process::DCfgMgrBase::getContext
ConfigPtr & getContext()
Fetches the configuration context.
Definition d_cfg_mgr.h:148
ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
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
http_command_config.h
io_service.h
isc::config
Definition command_interpreter.cc:23
isc::d2
Definition check_exists_add.cc:19
isc::d2::DdnsDomainListMgrPtr
boost::shared_ptr< DdnsDomainListMgr > DdnsDomainListMgrPtr
Defines a pointer for DdnsDomain instances.
Definition d2_cfg_mgr.h:175
isc::d2::DdnsDomainPtr
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition d2_config.h:624
isc::d2::D2CfgMgrPtr
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition d2_cfg_mgr.h:367
isc::d2::D2CfgContextPtr
boost::shared_ptr< D2CfgContext > D2CfgContextPtr
Pointer to a configuration context.
Definition d2_cfg_mgr.h:26
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:425
isc::data
Definition base_stamped_element.cc:12
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
isc::process
Definition cb_ctl_base.h:22
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 check_exists_add.cc:18