Kea 2.7.5
d2_cfg_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2014-2024 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
24class D2CfgContext;
26typedef boost::shared_ptr<D2CfgContext> D2CfgContextPtr;
27
36public:
39
41 virtual ~D2CfgContext();
42
47 return (process::ConfigPtr(new D2CfgContext(*this)));
48 }
49
52 return (d2_params_);
53 }
54
59 return (forward_mgr_);
60 }
61
66 forward_mgr_ = forward_mgr;
67 }
68
73 return (reverse_mgr_);
74 }
75
80 reverse_mgr_ = reverse_mgr;
81 }
82
87 return (keys_);
88 }
89
93 void setKeys(const TSIGKeyInfoMapPtr& keys) {
94 keys_ = keys;
95 }
96
101 return (unix_control_socket_);
102 }
103
108 unix_control_socket_ = control_socket;
109 }
110
115 return (http_control_socket_);
116 }
117
122 http_control_socket_ = control_socket;
123 }
124
129 return (hooks_config_);
130 }
131
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::config::HttpCommandConfigPtr http_control_socket_;
169
171 isc::hooks::HooksConfig hooks_config_;
172};
173
175typedef boost::shared_ptr<DdnsDomainListMgr> DdnsDomainListMgrPtr;
176
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
205 return (boost::dynamic_pointer_cast<D2CfgContext>(getContext()));
206 }
207
217
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
318
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
DHCP-DDNS Configuration Context.
Definition d2_cfg_mgr.h:35
void setForwardMgr(DdnsDomainListMgrPtr forward_mgr)
Sets the forward domain list manager.
Definition d2_cfg_mgr.h:65
virtual ~D2CfgContext()
Destructor.
Definition d2_cfg_mgr.cc:63
D2ParamsPtr & getD2Params()
Fetches a reference to the D2Params.
Definition d2_cfg_mgr.h:51
void setUnixControlSocketInfo(const isc::data::ConstElementPtr &control_socket)
Sets information about the UNIX control socket.
Definition d2_cfg_mgr.h:107
void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr)
Sets the reverse domain list manager.
Definition d2_cfg_mgr.h:79
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition d2_cfg_mgr.cc:67
DdnsDomainListMgrPtr getReverseMgr()
Fetches the reverse DNS domain list manager.
Definition d2_cfg_mgr.h:72
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition d2_cfg_mgr.h:128
DdnsDomainListMgrPtr getForwardMgr()
Fetches the forward DNS domain list manager.
Definition d2_cfg_mgr.h:58
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition d2_cfg_mgr.h:46
TSIGKeyInfoMapPtr getKeys()
Fetches the map of TSIG keys.
Definition d2_cfg_mgr.h:86
isc::config::HttpCommandConfigPtr getHttpControlSocketInfo() const
Returns information about HTTP/HTTPS control socket.
Definition d2_cfg_mgr.h:114
D2CfgContext()
Constructor.
Definition d2_cfg_mgr.cc:33
void setHttpControlSocketInfo(const isc::config::HttpCommandConfigPtr &control_socket)
Sets information about the HTTP/HTTPS control socket.
Definition d2_cfg_mgr.h:121
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
Definition d2_cfg_mgr.h:135
const isc::data::ConstElementPtr getUnixControlSocketInfo() const
Returns information about UNIX control socket.
Definition d2_cfg_mgr.h:100
void setKeys(const TSIGKeyInfoMapPtr &keys)
Sets the map of TSIG keys.
Definition d2_cfg_mgr.h:93
DHCP-DDNS Configuration Manager.
Definition d2_cfg_mgr.h:183
virtual ~D2CfgMgr()
Destructor.
bool matchForward(const std::string &fqdn, DdnsDomainPtr &domain)
Matches a given FQDN to a forward domain.
virtual process::ConfigPtr createNewContext() override
Creates an new, blank D2CfgContext context.
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
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:204
bool reverseUpdatesEnabled()
Returns whether or not reverse updates are enabled.
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.
static const char * IPV6_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv6 addresses for reverse lookups.
Definition d2_cfg_mgr.h:193
static std::string reverseV4Address(const isc::asiolink::IOAddress &ioaddr)
Generate a reverse order string for the given IP address.
bool forwardUpdatesEnabled()
Returns whether or not forward updates are enabled.
bool matchReverse(const std::string &ip_address, DdnsDomainPtr &domain)
Matches a given IP address to a reverse domain.
virtual std::string getConfigSummary(const uint32_t selection) override
Returns configuration summary in the textual format.
static std::string reverseV6Address(const isc::asiolink::IOAddress &ioaddr)
Generate a reverse order string for the given IP address.
isc::config::HttpCommandConfigPtr getHttpControlSocketInfo()
Convenience method fetches information about HTTP/HTTPS control socket from context.
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.
static const char * IPV4_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv4 addresses for reverse lookups.
Definition d2_cfg_mgr.h:188
Wrapper class that holds hooks libraries configuration.
Base class for all configurations.
Definition config_base.h:33
Configuration Manager.
Definition d_cfg_mgr.h:108
ConfigPtr & getContext()
Fetches the configuration context.
Definition d_cfg_mgr.h:151
A collection of classes for housing and parsing the application configuration necessary for the DHCP-...
boost::shared_ptr< HttpCommandConfig > HttpCommandConfigPtr
Pointer to a HttpCommandConfig object.
boost::shared_ptr< DdnsDomainListMgr > DdnsDomainListMgrPtr
Defines a pointer for DdnsDomain instances.
Definition d2_cfg_mgr.h:175
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:367
boost::shared_ptr< D2CfgContext > D2CfgContextPtr
Pointer to a configuration context.
Definition d2_cfg_mgr.h:26
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:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Defines the logger used by the top-level component of kea-lfc.