Kea 1.5.0
d2_cfg_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2014-2018 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 <d2/d2_config.h>
14#include <process/d_cfg_mgr.h>
15
16#include <stdint.h>
17#include <string>
18
19namespace isc {
20namespace d2 {
21
22class D2CfgContext;
24typedef boost::shared_ptr<D2CfgContext> D2CfgContextPtr;
25
34public:
37
39 virtual ~D2CfgContext();
40
45 return (process::ConfigPtr(new D2CfgContext(*this)));
46 }
47
50 return (d2_params_);
51 }
52
57 return (forward_mgr_);
58 }
59
63 forward_mgr_ = forward_mgr;
64 }
65
70 return (reverse_mgr_);
71 }
72
76 reverse_mgr_ = reverse_mgr;
77 }
78
83 return (keys_);
84 }
85
89 void setKeys(const TSIGKeyInfoMapPtr& keys) {
90 keys_ = keys;
91 }
92
96 virtual isc::data::ElementPtr toElement() const;
97
98protected:
100 D2CfgContext(const D2CfgContext& rhs);
101
102private:
104 D2CfgContext& operator=(const D2CfgContext& rhs);
105
107 D2ParamsPtr d2_params_;
108
110 DdnsDomainListMgrPtr forward_mgr_;
111
113 DdnsDomainListMgrPtr reverse_mgr_;
114
116 TSIGKeyInfoMapPtr keys_;
117};
118
120typedef boost::shared_ptr<DdnsDomainListMgr> DdnsDomainListMgrPtr;
121
122
123
131public:
134 static const char* IPV4_REV_ZONE_SUFFIX;
135
138 static const char* IPV6_REV_ZONE_SUFFIX;
139
141 D2CfgMgr();
142
144 virtual ~D2CfgMgr();
145
150 return (boost::dynamic_pointer_cast<D2CfgContext>(getContext()));
151 }
152
162
172
184 bool matchForward(const std::string& fqdn, DdnsDomainPtr& domain);
185
197 bool matchReverse(const std::string& ip_address, DdnsDomainPtr& domain);
198
212 static std::string reverseIpAddress(const std::string& address);
213
231 static std::string reverseV4Address(const isc::asiolink::IOAddress& ioaddr);
232
251 static std::string reverseV6Address(const isc::asiolink::IOAddress& ioaddr);
252
255 const D2ParamsPtr& getD2Params();
256
263 virtual std::string getConfigSummary(const uint32_t selection);
264
265protected:
266
274 parse(isc::data::ConstElementPtr config, bool check_only);
275
282 virtual void setCfgDefaults(isc::data::ElementPtr mutable_config);
283
294};
295
297typedef boost::shared_ptr<D2CfgMgr> D2CfgMgrPtr;
298
299
300}; // end of isc::d2 namespace
301}; // end of isc namespace
302
303#endif // D2_CFG_MGR_H
DHCP-DDNS Configuration Context.
Definition: d2_cfg_mgr.h:33
void setForwardMgr(DdnsDomainListMgrPtr forward_mgr)
Sets the forward domain list manager.
Definition: d2_cfg_mgr.h:62
virtual ~D2CfgContext()
Destructor.
Definition: d2_cfg_mgr.cc:55
D2ParamsPtr & getD2Params()
Fetches a reference to the D2Params.
Definition: d2_cfg_mgr.h:49
void setReverseMgr(DdnsDomainListMgrPtr reverse_mgr)
Sets the reverse domain list manager.
Definition: d2_cfg_mgr.h:75
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_cfg_mgr.cc:59
DdnsDomainListMgrPtr getReverseMgr()
Fetches the reverse DNS domain list manager.
Definition: d2_cfg_mgr.h:69
DdnsDomainListMgrPtr getForwardMgr()
Fetches the forward DNS domain list manager.
Definition: d2_cfg_mgr.h:56
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition: d2_cfg_mgr.h:44
TSIGKeyInfoMapPtr getKeys()
Fetches the map of TSIG keys.
Definition: d2_cfg_mgr.h:82
D2CfgContext()
Constructor.
Definition: d2_cfg_mgr.cc:33
void setKeys(const TSIGKeyInfoMapPtr &keys)
Sets the map of TSIG keys.
Definition: d2_cfg_mgr.h:89
DHCP-DDNS Configuration Manager.
Definition: d2_cfg_mgr.h:130
virtual ~D2CfgMgr()
Destructor.
Definition: d2_cfg_mgr.cc:113
virtual void setCfgDefaults(isc::data::ElementPtr mutable_config)
Adds default values to the given config.
Definition: d2_cfg_mgr.cc:247
bool matchForward(const std::string &fqdn, DdnsDomainPtr &domain)
Matches a given FQDN to a forward domain.
Definition: d2_cfg_mgr.cc:134
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:159
D2CfgContextPtr getD2CfgContext()
Convenience method that returns the D2 configuration context.
Definition: d2_cfg_mgr.h:149
bool reverseUpdatesEnabled()
Returns whether or not reverse updates are enabled.
Definition: d2_cfg_mgr.cc:128
virtual process::ConfigPtr createNewContext()
Creates an new, blank D2CfgContext context.
Definition: d2_cfg_mgr.cc:117
D2CfgMgr()
Constructor.
Definition: d2_cfg_mgr.cc:110
static const char * IPV6_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv6 addresses for reverse lookups.
Definition: d2_cfg_mgr.h:138
virtual std::string getConfigSummary(const uint32_t selection)
Returns configuration summary in the textual format.
Definition: d2_cfg_mgr.cc:242
static std::string reverseV4Address(const isc::asiolink::IOAddress &ioaddr)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:177
bool forwardUpdatesEnabled()
Returns whether or not forward updates are enabled.
Definition: d2_cfg_mgr.cc:122
bool matchReverse(const std::string &ip_address, DdnsDomainPtr &domain)
Matches a given IP address to a reverse domain.
Definition: d2_cfg_mgr.cc:148
static std::string reverseV6Address(const isc::asiolink::IOAddress &ioaddr)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:207
const D2ParamsPtr & getD2Params()
Convenience method fetches the D2Params from context.
Definition: d2_cfg_mgr.cc:237
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only)
Parses configuration of the D2.
Definition: d2_cfg_mgr.cc:252
static const char * IPV4_REV_ZONE_SUFFIX
Reverse zone suffix added to IPv4 addresses for reverse lookups.
Definition: d2_cfg_mgr.h:134
Base class for all configurations.
Definition: config_base.h:31
Configuration Manager.
Definition: d_cfg_mgr.h:106
ConfigPtr & getContext()
Fetches the configuration context.
Definition: d_cfg_mgr.h:149
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:120
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:586
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:297
boost::shared_ptr< D2CfgContext > D2CfgContextPtr
Pointer to a configuration context.
Definition: d2_cfg_mgr.h:24
boost::shared_ptr< D2Params > D2ParamsPtr
Defines a pointer for D2Params instances.
Definition: d2_config.h:251
boost::shared_ptr< TSIGKeyInfoMap > TSIGKeyInfoMapPtr
Defines a pointer to map of TSIGkeyInfos.
Definition: d2_config.h:407
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
boost::shared_ptr< Element > ElementPtr
Definition: data.h:22
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the SrvConfig.
Definition: config_base.h:119
Defines the logger used by the top-level component of kea-dhcp-ddns.