Kea 2.7.5
|
DHCP-DDNS Configuration Manager. More...
#include <d2_cfg_mgr.h>
Public Member Functions | |
D2CfgMgr () | |
Constructor. | |
virtual | ~D2CfgMgr () |
Destructor. | |
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. | |
D2CfgContextPtr | getD2CfgContext () |
Convenience method that returns the D2 configuration context. | |
const D2ParamsPtr & | getD2Params () |
Convenience method fetches the D2Params from context. | |
isc::config::HttpCommandConfigPtr | getHttpControlSocketInfo () |
Convenience method fetches information about HTTP/HTTPS control socket from context. | |
const isc::data::ConstElementPtr | getUnixControlSocketInfo () |
Convenience method fetches information about UNIX control socket from context. | |
std::list< std::list< std::string > > | jsonPathsToRedact () const final override |
Return a list of all paths that contain passwords or secrets. | |
bool | matchForward (const std::string &fqdn, DdnsDomainPtr &domain) |
Matches a given FQDN to a forward domain. | |
bool | matchReverse (const std::string &ip_address, DdnsDomainPtr &domain) |
Matches a given IP address to a reverse domain. | |
bool | reverseUpdatesEnabled () |
Returns whether or not reverse updates are enabled. | |
Public Member Functions inherited from isc::process::DCfgMgrBase | |
DCfgMgrBase (ConfigPtr context) | |
Constructor. | |
virtual | ~DCfgMgrBase () |
Destructor. | |
ConfigPtr & | getContext () |
Fetches the configuration context. | |
isc::data::ConstElementPtr | redactConfig (isc::data::ConstElementPtr const &config) const |
Redact the configuration. | |
isc::data::ConstElementPtr | simpleParseConfig (isc::data::ConstElementPtr config, bool check_only=false, const std::function< void()> &post_config_cb=nullptr) |
Acts as the receiver of new configurations. | |
Static Public Member Functions | |
static std::string | reverseIpAddress (const std::string &address) |
Generate a reverse order string for the given IP address. | |
static std::string | reverseV4Address (const isc::asiolink::IOAddress &ioaddr) |
Generate a reverse order string for the given IP address. | |
static std::string | reverseV6Address (const isc::asiolink::IOAddress &ioaddr) |
Generate a reverse order string for the given IP address. | |
Static Public Attributes | |
static const char * | IPV4_REV_ZONE_SUFFIX = "in-addr.arpa." |
Reverse zone suffix added to IPv4 addresses for reverse lookups. | |
static const char * | IPV6_REV_ZONE_SUFFIX = "ip6.arpa." |
Reverse zone suffix added to IPv6 addresses for reverse lookups. | |
Protected Member Functions | |
virtual process::ConfigPtr | createNewContext () override |
Creates an new, blank D2CfgContext context. | |
virtual isc::data::ConstElementPtr | parse (isc::data::ConstElementPtr config, bool check_only) override |
Parses configuration of the D2. | |
virtual void | setCfgDefaults (isc::data::ElementPtr mutable_config) override |
Adds default values to the given config. | |
Protected Member Functions inherited from isc::process::DCfgMgrBase | |
void | resetContext () |
Replaces existing context with a new, empty context. | |
void | setContext (ConfigPtr &context) |
Update the current context. | |
DHCP-DDNS Configuration Manager.
Provides the mechanisms for managing the DHCP-DDNS application's configuration. This includes services for parsing sets of configuration values, storing the parsed information in its converted form, and retrieving the information on demand.
Definition at line 183 of file d2_cfg_mgr.h.
isc::d2::D2CfgMgr::D2CfgMgr | ( | ) |
Constructor.
Definition at line 130 of file d2_cfg_mgr.cc.
|
virtual |
Destructor.
Definition at line 133 of file d2_cfg_mgr.cc.
|
overrideprotectedvirtual |
Creates an new, blank D2CfgContext context.
This method is used at the beginning of configuration process to create a fresh, empty copy of a D2CfgContext. This new context will be populated during the configuration process and will replace the existing context provided the configuration process completes without error.
Implements isc::process::DCfgMgrBase.
Definition at line 137 of file d2_cfg_mgr.cc.
bool isc::d2::D2CfgMgr::forwardUpdatesEnabled | ( | ) |
Returns whether or not forward updates are enabled.
This method currently uses the presence or absence of Forward DDNS Domains to determine if forward updates are enabled or disabled.
Definition at line 142 of file d2_cfg_mgr.cc.
References getD2CfgContext().
|
overridevirtual |
Returns configuration summary in the textual format.
selection | Bitfield which describes the parts of the configuration to be returned. This parameter is ignored for the D2. |
Implements isc::process::DCfgMgrBase.
Definition at line 256 of file d2_cfg_mgr.cc.
References getConfigSummary(), and getD2Params().
Referenced by getConfigSummary().
|
inline |
Convenience method that returns the D2 configuration context.
Definition at line 204 of file d2_cfg_mgr.h.
References isc::process::DCfgMgrBase::getContext().
Referenced by forwardUpdatesEnabled(), getD2Params(), getHttpControlSocketInfo(), getUnixControlSocketInfo(), matchForward(), matchReverse(), parse(), and reverseUpdatesEnabled().
const D2ParamsPtr & isc::d2::D2CfgMgr::getD2Params | ( | ) |
Convenience method fetches the D2Params from context.
Definition at line 241 of file d2_cfg_mgr.cc.
References getD2CfgContext(), and getD2Params().
Referenced by getConfigSummary(), and getD2Params().
isc::config::HttpCommandConfigPtr isc::d2::D2CfgMgr::getHttpControlSocketInfo | ( | ) |
Convenience method fetches information about HTTP/HTTPS control socket from context.
Definition at line 251 of file d2_cfg_mgr.cc.
References getD2CfgContext(), and getHttpControlSocketInfo().
Referenced by getHttpControlSocketInfo().
const isc::data::ConstElementPtr isc::d2::D2CfgMgr::getUnixControlSocketInfo | ( | ) |
Convenience method fetches information about UNIX control socket from context.
Definition at line 246 of file d2_cfg_mgr.cc.
References getD2CfgContext(), and getUnixControlSocketInfo().
Referenced by getUnixControlSocketInfo().
|
finaloverridevirtual |
Return a list of all paths that contain passwords or secrets.
Used in isc::process::Daemon::redactConfig to only make copies and only redact configuration subtrees that contain passwords or secrets.
This method needs to be overridden in each process that has a distinct configuration structure.
Reimplemented from isc::process::DCfgMgrBase.
Definition at line 322 of file d2_cfg_mgr.cc.
bool isc::d2::D2CfgMgr::matchForward | ( | const std::string & | fqdn, |
DdnsDomainPtr & | domain ) |
Matches a given FQDN to a forward domain.
This calls the matchDomain method of the forward domain manager to match the given FQDN to a forward domain.
fqdn | is the name for which to look. |
domain | receives the matching domain. Note that it will be reset upon entry and only set if a match is subsequently found. |
throws | D2CfgError if given an invalid fqdn. |
Definition at line 154 of file d2_cfg_mgr.cc.
References getD2CfgContext(), and isc_throw.
bool isc::d2::D2CfgMgr::matchReverse | ( | const std::string & | ip_address, |
DdnsDomainPtr & | domain ) |
Matches a given IP address to a reverse domain.
This calls the matchDomain method of the reverse domain manager to match the given IPv4 or IPv6 address to a reverse domain.
ip_address | is the name for which to look. |
domain | receives the matching domain. Note that it will be reset upon entry and only set if a match is subsequently found. |
throws | D2CfgError if given an invalid fqdn. |
Definition at line 168 of file d2_cfg_mgr.cc.
References getD2CfgContext(), and reverseIpAddress().
|
overrideprotectedvirtual |
Parses configuration of the D2.
config | Pointer to a configuration specified for D2. |
check_only | Boolean flag indicating if this method should only verify correctness of the provided configuration. |
Reimplemented from isc::process::DCfgMgrBase.
Definition at line 266 of file d2_cfg_mgr.cc.
References isc::config::CONTROL_RESULT_ERROR, isc::config::CONTROL_RESULT_SUCCESS, isc::data::Element::create(), isc::config::createAnswer(), isc::data::Element::createMap(), isc::d2::d2_logger, isc::d2::DHCP_DDNS_CONFIG_CHECK_FAIL, isc::d2::DHCP_DDNS_CONFIG_FAIL, isc::process::DCfgMgrBase::getContext(), getD2CfgContext(), isc::config::BaseCommandMgr::getHash(), isc_throw, LOG_ERROR, isc::d2::D2SimpleParser::parse(), and isc::d2::D2SimpleParser::setAllDefaults().
|
static |
Generate a reverse order string for the given IP address.
This method creates a string containing the given IP address contents in reverse order. This format is used for matching against reverse DDNS domains in DHCP_DDNS configuration. After reversing the syllables of the address, it appends the appropriate suffix.
address | string containing a valid IPv4 or IPv6 address. |
D2CfgError | if given an invalid address. |
Definition at line 179 of file d2_cfg_mgr.cc.
References isc_throw, reverseV4Address(), reverseV6Address(), and isc::Exception::what().
Referenced by isc::d2::CheckExistsRemoveTransaction::buildRemoveRevPtrsRequest(), isc::d2::NameRemoveTransaction::buildRemoveRevPtrsRequest(), isc::d2::SimpleRemoveTransaction::buildRemoveRevPtrsRequest(), isc::d2::SimpleRemoveWithoutDHCIDTransaction::buildRemoveRevPtrsRequest(), isc::d2::CheckExistsAddTransaction::buildReplaceRevPtrsRequest(), isc::d2::NameAddTransaction::buildReplaceRevPtrsRequest(), isc::d2::SimpleAddTransaction::buildReplaceRevPtrsRequest(), isc::d2::SimpleAddWithoutDHCIDTransaction::buildReplaceRevPtrsRequest(), and matchReverse().
bool isc::d2::D2CfgMgr::reverseUpdatesEnabled | ( | ) |
Returns whether or not reverse updates are enabled.
This method currently uses the presence or absence of Reverse DDNS Domains to determine if reverse updates are enabled or disabled.
Definition at line 148 of file d2_cfg_mgr.cc.
References getD2CfgContext().
|
static |
Generate a reverse order string for the given IP address.
This method creates a string containing the given IP address contents in reverse order. This format is used for matching against reverse DDNS domains in DHCP_DDNS configuration. After reversing the syllables of the address, it appends the appropriate suffix.
Example: input: 192.168.1.15 output: 15.1.168.192.in-addr.arpa.
ioaddr | is the IPv4 IOaddress to convert |
D2CfgError | if not given an IPv4 address. |
Definition at line 197 of file d2_cfg_mgr.cc.
References IPV4_REV_ZONE_SUFFIX, and isc_throw.
Referenced by reverseIpAddress().
|
static |
Generate a reverse order string for the given IP address.
This method creates a string containing the given IPv6 address contents in reverse order. This format is used for matching against reverse DDNS domains in DHCP_DDNS configuration. After reversing the syllables of the address, it appends the appropriate suffix.
IPv6 example: input: 2001:db8:302:99:: output: 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.9.0.0.2.0.3.0.8.B.D.0.1.0.0.2.ip6.arpa.
ioaddr | string containing a valid IPv6 address. |
D2CfgError | if not given an IPv6 address. |
Definition at line 219 of file d2_cfg_mgr.cc.
References isc::util::encode::encodeHex(), IPV6_REV_ZONE_SUFFIX, and isc_throw.
Referenced by reverseIpAddress().
|
overrideprotectedvirtual |
Adds default values to the given config.
Adds the D2 default values to the configuration Element map. This method is invoked by DCfgMgrBase::parseConfig()
.
mutable_config | - configuration to which defaults should be added |
Reimplemented from isc::process::DCfgMgrBase.
Definition at line 261 of file d2_cfg_mgr.cc.
References isc::d2::D2SimpleParser::setAllDefaults().
|
static |
Reverse zone suffix added to IPv4 addresses for reverse lookups.
Definition at line 188 of file d2_cfg_mgr.h.
Referenced by reverseV4Address().
|
static |
Reverse zone suffix added to IPv6 addresses for reverse lookups.
Definition at line 193 of file d2_cfg_mgr.h.
Referenced by reverseV6Address().