Kea 2.5.8
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>
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;
25typedef boost::shared_ptr<D2CfgContext> D2CfgContextPtr;
26
35public:
38
40 virtual ~D2CfgContext();
41
46 return (process::ConfigPtr(new D2CfgContext(*this)));
47 }
48
51 return (d2_params_);
52 }
53
58 return (forward_mgr_);
59 }
60
64 forward_mgr_ = forward_mgr;
65 }
66
71 return (reverse_mgr_);
72 }
73
77 reverse_mgr_ = reverse_mgr;
78 }
79
84 return (keys_);
85 }
86
90 void setKeys(const TSIGKeyInfoMapPtr& keys) {
91 keys_ = keys;
92 }
93
97 return (control_socket_);
98 }
99
103 control_socket_ = control_socket;
104 }
105
110 return (hooks_config_);
111 }
112
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
153typedef boost::shared_ptr<DdnsDomainListMgr> DdnsDomainListMgrPtr;
154
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
181 return (boost::dynamic_pointer_cast<D2CfgContext>(getContext()));
182 }
183
193
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
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
DHCP-DDNS Configuration Context.
Definition: d2_cfg_mgr.h:34
void setControlSocketInfo(const isc::data::ConstElementPtr &control_socket)
Sets information about the control socket.
Definition: d2_cfg_mgr.h:102
void setForwardMgr(DdnsDomainListMgrPtr forward_mgr)
Sets the forward domain list manager.
Definition: d2_cfg_mgr.h:63
virtual ~D2CfgContext()
Destructor.
Definition: d2_cfg_mgr.cc:60
D2ParamsPtr & getD2Params()
Fetches a reference to the D2Params.
Definition: d2_cfg_mgr.h:50
void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr)
Sets the reverse domain list manager.
Definition: d2_cfg_mgr.h:76
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_cfg_mgr.cc:64
DdnsDomainListMgrPtr getReverseMgr()
Fetches the reverse DNS domain list manager.
Definition: d2_cfg_mgr.h:70
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition: d2_cfg_mgr.h:109
DdnsDomainListMgrPtr getForwardMgr()
Fetches the forward DNS domain list manager.
Definition: d2_cfg_mgr.h:57
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition: d2_cfg_mgr.h:45
const isc::data::ConstElementPtr getControlSocketInfo() const
Returns information about control socket.
Definition: d2_cfg_mgr.h:96
TSIGKeyInfoMapPtr getKeys()
Fetches the map of TSIG keys.
Definition: d2_cfg_mgr.h:83
D2CfgContext()
Constructor.
Definition: d2_cfg_mgr.cc:33
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
Definition: d2_cfg_mgr.h:116
void setKeys(const TSIGKeyInfoMapPtr &keys)
Sets the map of TSIG keys.
Definition: d2_cfg_mgr.h:90
DHCP-DDNS Configuration Manager.
Definition: d2_cfg_mgr.h:161
virtual ~D2CfgMgr()
Destructor.
Definition: d2_cfg_mgr.cc:123
bool matchForward(const std::string &fqdn, DdnsDomainPtr &domain)
Matches a given FQDN to a forward domain.
Definition: d2_cfg_mgr.cc:144
virtual process::ConfigPtr createNewContext() override
Creates an new, blank D2CfgContext context.
Definition: d2_cfg_mgr.cc:127
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:169
D2CfgContextPtr getD2CfgContext()
Convenience method that returns the D2 configuration context.
Definition: d2_cfg_mgr.h:180
bool reverseUpdatesEnabled()
Returns whether or not reverse updates are enabled.
Definition: d2_cfg_mgr.cc:138
virtual void setCfgDefaults(isc::data::ElementPtr mutable_config) override
Adds default values to the given config.
Definition: d2_cfg_mgr.cc:246
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:307
D2CfgMgr()
Constructor.
Definition: d2_cfg_mgr.cc:120
static const char * IPV6_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv6 addresses for reverse lookups.
Definition: d2_cfg_mgr.h:169
static std::string reverseV4Address(const isc::asiolink::IOAddress &ioaddr)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:187
bool forwardUpdatesEnabled()
Returns whether or not forward updates are enabled.
Definition: d2_cfg_mgr.cc:132
bool matchReverse(const std::string &ip_address, DdnsDomainPtr &domain)
Matches a given IP address to a reverse domain.
Definition: d2_cfg_mgr.cc:158
virtual std::string getConfigSummary(const uint32_t selection) override
Returns configuration summary in the textual format.
Definition: d2_cfg_mgr.cc:241
static std::string reverseV6Address(const isc::asiolink::IOAddress &ioaddr)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:209
const D2ParamsPtr & getD2Params()
Convenience method fetches the D2Params from context.
Definition: d2_cfg_mgr.cc:231
const isc::data::ConstElementPtr getControlSocketInfo()
Convenience method fetches information about control socket from context.
Definition: d2_cfg_mgr.cc:236
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only) override
Parses configuration of the D2.
Definition: d2_cfg_mgr.cc:251
static const char * IPV4_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv4 addresses for reverse lookups.
Definition: d2_cfg_mgr.h:165
Wrapper class that holds hooks libraries configuration.
Definition: hooks_config.h:36
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< DdnsDomainListMgr > DdnsDomainListMgrPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_cfg_mgr.h:153
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:622
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:334
boost::shared_ptr< D2CfgContext > D2CfgContextPtr
Pointer to a configuration context.
Definition: d2_cfg_mgr.h:25
boost::shared_ptr< D2Params > D2ParamsPtr
Defines a pointer for D2Params instances.
Definition: d2_config.h:255
boost::shared_ptr< TSIGKeyInfoMap > TSIGKeyInfoMapPtr
Defines a pointer to map of TSIGkeyInfos.
Definition: d2_config.h:423
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.
Definition: config_base.h:176
Defines the logger used by the top-level component of kea-lfc.