Kea 3.3.3
d2_cfg_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2014-2026 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>
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
25extern const std::string DDNS_REV_ZONE_DEFAULT4;
26
28extern const std::string DDNS_REV_ZONE_DEFAULT6;
29
30class D2CfgContext;
32typedef boost::shared_ptr<D2CfgContext> D2CfgContextPtr;
33
42public:
45
47 virtual ~D2CfgContext();
48
53 return (process::ConfigPtr(new D2CfgContext(*this)));
54 }
55
58 return (d2_params_);
59 }
60
65 return (forward_mgr_);
66 }
67
72 forward_mgr_ = forward_mgr;
73 }
74
79 return (reverse_mgr_);
80 }
81
86 reverse_mgr_ = reverse_mgr;
87 }
88
93 return (keys_);
94 }
95
99 void setKeys(const TSIGKeyInfoMapPtr& keys) {
100 keys_ = keys;
101 }
102
107 return (unix_control_socket_);
108 }
109
114 unix_control_socket_ = control_socket;
115 }
116
121 return (http_control_socket_);
122 }
123
128 http_control_socket_ = control_socket;
129 }
130
135 return (hooks_config_);
136 }
137
142 return (hooks_config_);
143 }
144
148 virtual isc::data::ElementPtr toElement() const;
149
150protected:
152 D2CfgContext(const D2CfgContext& rhs);
153
154private:
156 D2CfgContext& operator=(const D2CfgContext& rhs);
157
159 D2ParamsPtr d2_params_;
160
162 DdnsDomainListMgrPtr forward_mgr_;
163
165 DdnsDomainListMgrPtr reverse_mgr_;
166
168 TSIGKeyInfoMapPtr keys_;
169
171 isc::data::ConstElementPtr unix_control_socket_;
172
174 isc::data::ConstElementPtr http_control_socket_;
175
177 isc::hooks::HooksConfig hooks_config_;
178};
179
181typedef boost::shared_ptr<DdnsDomainListMgr> DdnsDomainListMgrPtr;
182
190public:
194 static const char* IPV4_REV_ZONE_SUFFIX;
195
199 static const char* IPV6_REV_ZONE_SUFFIX;
200
202 D2CfgMgr();
203
205 virtual ~D2CfgMgr();
206
211 return (boost::dynamic_pointer_cast<D2CfgContext>(getContext()));
212 }
213
223
233
245 bool matchForward(const std::string& fqdn, DdnsDomainPtr& domain);
246
261 bool matchReverse(const std::string& ip_address,
262 DdnsDomainPtr& domain,
263 const std::string& reverse_zone = "");
264
282 static std::string reverseIpAddress(const std::string& address,
283 const std::string& reverse_zone = "");
284
305 static std::string reverseV4Address(const isc::asiolink::IOAddress& ioaddr, const std::string& reverse_zone);
306
328 static std::string reverseV6Address(const isc::asiolink::IOAddress& ioaddr, const std::string& reverse_zone);
329
333 const D2ParamsPtr& getD2Params();
334
340
346
353 virtual std::string getConfigSummary(const uint32_t selection) override;
354
355 std::list<std::list<std::string>> jsonPathsToRedact() const final override;
356
357protected:
365 virtual isc::data::ConstElementPtr
366 parse(isc::data::ConstElementPtr config, bool check_only) override;
367
374 virtual void setCfgDefaults(isc::data::ElementPtr mutable_config) override;
375
385 virtual process::ConfigPtr createNewContext() override;
386};
387
389typedef boost::shared_ptr<D2CfgMgr> D2CfgMgrPtr;
390
391} // end of isc::d2 namespace
392} // end of isc namespace
393
394#endif // D2_CFG_MGR_H
DHCP-DDNS Configuration Context.
Definition d2_cfg_mgr.h:41
void setForwardMgr(DdnsDomainListMgrPtr forward_mgr)
Sets the forward domain list manager.
Definition d2_cfg_mgr.h:71
virtual ~D2CfgContext()
Destructor.
Definition d2_cfg_mgr.cc:66
D2ParamsPtr & getD2Params()
Fetches a reference to the D2Params.
Definition d2_cfg_mgr.h:57
void setUnixControlSocketInfo(const isc::data::ConstElementPtr &control_socket)
Sets information about the UNIX control socket.
Definition d2_cfg_mgr.h:113
void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr)
Sets the reverse domain list manager.
Definition d2_cfg_mgr.h:85
const isc::data::ConstElementPtr getHttpControlSocketInfo() const
Returns information about HTTP/HTTPS control socket.
Definition d2_cfg_mgr.h:120
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition d2_cfg_mgr.cc:70
DdnsDomainListMgrPtr getReverseMgr()
Fetches the reverse DNS domain list manager.
Definition d2_cfg_mgr.h:78
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition d2_cfg_mgr.h:134
DdnsDomainListMgrPtr getForwardMgr()
Fetches the forward DNS domain list manager.
Definition d2_cfg_mgr.h:64
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition d2_cfg_mgr.h:52
TSIGKeyInfoMapPtr getKeys()
Fetches the map of TSIG keys.
Definition d2_cfg_mgr.h:92
D2CfgContext()
Constructor.
Definition d2_cfg_mgr.cc:36
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
Definition d2_cfg_mgr.h:141
void setHttpControlSocketInfo(const isc::data::ConstElementPtr &control_socket)
Sets information about the HTTP/HTTPS control socket.
Definition d2_cfg_mgr.h:127
const isc::data::ConstElementPtr getUnixControlSocketInfo() const
Returns information about UNIX control socket.
Definition d2_cfg_mgr.h:106
void setKeys(const TSIGKeyInfoMapPtr &keys)
Sets the map of TSIG keys.
Definition d2_cfg_mgr.h:99
DHCP-DDNS Configuration Manager.
Definition d2_cfg_mgr.h:189
static std::string reverseV4Address(const isc::asiolink::IOAddress &ioaddr, const std::string &reverse_zone)
Generate a reverse order string for the given IP address.
static const char * IPV6_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv6 addresses for reverse lookups.
Definition d2_cfg_mgr.h:199
virtual ~D2CfgMgr()
Destructor.
static std::string reverseV6Address(const isc::asiolink::IOAddress &ioaddr, const std::string &reverse_zone)
Generate a reverse order string for the given IP address.
bool matchForward(const std::string &fqdn, DdnsDomainPtr &domain)
Matches a given FQDN to a forward domain.
const isc::data::ConstElementPtr getHttpControlSocketInfo()
Convenience method fetches information about HTTP/HTTPS control socket from context.
virtual process::ConfigPtr createNewContext() override
Creates an new, blank D2CfgContext context.
static const char * IPV4_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv4 addresses for reverse lookups.
Definition d2_cfg_mgr.h:194
const isc::data::ConstElementPtr getUnixControlSocketInfo()
Convenience method fetches information about UNIX control socket from context.
D2CfgContextPtr getD2CfgContext()
Convenience method that returns the D2 configuration context.
Definition d2_cfg_mgr.h:210
bool reverseUpdatesEnabled()
Returns whether or not reverse updates are enabled.
bool matchReverse(const std::string &ip_address, DdnsDomainPtr &domain, const std::string &reverse_zone="")
Matches a given IP address to a reverse domain.
virtual void setCfgDefaults(isc::data::ElementPtr mutable_config) override
Adds default values to the given config.
std::list< std::list< std::string > > jsonPathsToRedact() const final override
Return a list of all paths that contain passwords or secrets.
D2CfgMgr()
Constructor.
bool forwardUpdatesEnabled()
Returns whether or not forward updates are enabled.
virtual std::string getConfigSummary(const uint32_t selection) override
Returns configuration summary in the textual format.
static std::string reverseIpAddress(const std::string &address, const std::string &reverse_zone="")
Generate a reverse order string for the given IP address.
const D2ParamsPtr & getD2Params()
Convenience method fetches the D2Params from context.
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only) override
Parses configuration of the D2.
Wrapper class that holds hooks libraries configuration.
Base class for all configurations.
Definition config_base.h:33
Configuration Manager.
Definition d_cfg_mgr.h:105
ConfigPtr & getContext()
Fetches the configuration context.
Definition d_cfg_mgr.h:148
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
A collection of classes for housing and parsing the application configuration necessary for the DHCP-...
boost::shared_ptr< DdnsDomainListMgr > DdnsDomainListMgrPtr
Defines a pointer for DdnsDomain instances.
Definition d2_cfg_mgr.h:181
const std::string DDNS_REV_ZONE_DEFAULT6
Default reverse DNS domain for V6.
Definition d2_cfg_mgr.cc:26
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition d2_config.h:624
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition d2_cfg_mgr.h:389
const std::string DDNS_REV_ZONE_DEFAULT4
Default reverse DNS domain for V4.
Definition d2_cfg_mgr.cc:25
boost::shared_ptr< D2CfgContext > D2CfgContextPtr
Pointer to a configuration context.
Definition d2_cfg_mgr.h:32
boost::shared_ptr< D2Params > D2ParamsPtr
Defines a pointer for D2Params instances.
Definition d2_config.h:257
boost::shared_ptr< TSIGKeyInfoMap > TSIGKeyInfoMapPtr
Defines a pointer to map of TSIGkeyInfos.
Definition d2_config.h:425
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Defines the logger used by the top-level component of kea-lfc.