Kea 2.7.5
isc::d2::D2CfgMgr Class Reference

DHCP-DDNS Configuration Manager. More...

#include <d2_cfg_mgr.h>

+ Inheritance diagram for isc::d2::D2CfgMgr:

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 D2ParamsPtrgetD2Params ()
 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.
 
ConfigPtrgetContext ()
 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ D2CfgMgr()

isc::d2::D2CfgMgr::D2CfgMgr ( )

Constructor.

Definition at line 130 of file d2_cfg_mgr.cc.

◆ ~D2CfgMgr()

isc::d2::D2CfgMgr::~D2CfgMgr ( )
virtual

Destructor.

Definition at line 133 of file d2_cfg_mgr.cc.

Member Function Documentation

◆ createNewContext()

ConfigPtr isc::d2::D2CfgMgr::createNewContext ( )
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.

Returns
Returns a ConfigPtr to the new context instance.

Implements isc::process::DCfgMgrBase.

Definition at line 137 of file d2_cfg_mgr.cc.

◆ forwardUpdatesEnabled()

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.

Todo
This could be expanded to include the check of a configurable boolean value.
Returns
true if forward updates are enabled, false otherwise.

Definition at line 142 of file d2_cfg_mgr.cc.

References getD2CfgContext().

+ Here is the call graph for this function:

◆ getConfigSummary()

std::string isc::d2::D2CfgMgr::getConfigSummary ( const uint32_t selection)
overridevirtual

Returns configuration summary in the textual format.

Parameters
selectionBitfield which describes the parts of the configuration to be returned. This parameter is ignored for the D2.
Returns
Summary of the configuration in the textual format.

Implements isc::process::DCfgMgrBase.

Definition at line 256 of file d2_cfg_mgr.cc.

References getConfigSummary(), and getD2Params().

Referenced by getConfigSummary().

+ Here is the call graph for this function:

◆ getD2CfgContext()

D2CfgContextPtr isc::d2::D2CfgMgr::getD2CfgContext ( )
inline

Convenience method that returns the D2 configuration context.

Returns
returns a pointer to the 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().

+ Here is the call graph for this function:

◆ getD2Params()

const D2ParamsPtr & isc::d2::D2CfgMgr::getD2Params ( )

Convenience method fetches the D2Params from context.

Returns
reference to const D2ParamsPtr

Definition at line 241 of file d2_cfg_mgr.cc.

References getD2CfgContext(), and getD2Params().

Referenced by getConfigSummary(), and getD2Params().

+ Here is the call graph for this function:

◆ getHttpControlSocketInfo()

isc::config::HttpCommandConfigPtr isc::d2::D2CfgMgr::getHttpControlSocketInfo ( )

Convenience method fetches information about HTTP/HTTPS control socket from context.

Returns
pointer to the HTTP/HTTPS control socket config

Definition at line 251 of file d2_cfg_mgr.cc.

References getD2CfgContext(), and getHttpControlSocketInfo().

Referenced by getHttpControlSocketInfo().

+ Here is the call graph for this function:

◆ getUnixControlSocketInfo()

const isc::data::ConstElementPtr isc::d2::D2CfgMgr::getUnixControlSocketInfo ( )

Convenience method fetches information about UNIX control socket from context.

Returns
pointer to the Element that holds control-socket map

Definition at line 246 of file d2_cfg_mgr.cc.

References getD2CfgContext(), and getUnixControlSocketInfo().

Referenced by getUnixControlSocketInfo().

+ Here is the call graph for this function:

◆ jsonPathsToRedact()

std::list< std::list< std::string > > isc::d2::D2CfgMgr::jsonPathsToRedact ( ) const
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.

Returns
the list of lists of sequential JSON map keys needed to reach the passwords and secrets.

Reimplemented from isc::process::DCfgMgrBase.

Definition at line 322 of file d2_cfg_mgr.cc.

◆ matchForward()

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.

Parameters
fqdnis the name for which to look.
domainreceives the matching domain. Note that it will be reset upon entry and only set if a match is subsequently found.
Returns
returns true if a match is found, false otherwise.
Exceptions
throwsD2CfgError if given an invalid fqdn.

Definition at line 154 of file d2_cfg_mgr.cc.

References getD2CfgContext(), and isc_throw.

+ Here is the call graph for this function:

◆ matchReverse()

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.

Parameters
ip_addressis the name for which to look.
domainreceives the matching domain. Note that it will be reset upon entry and only set if a match is subsequently found.
Returns
returns true if a match is found, false otherwise.
Exceptions
throwsD2CfgError if given an invalid fqdn.

Definition at line 168 of file d2_cfg_mgr.cc.

References getD2CfgContext(), and reverseIpAddress().

+ Here is the call graph for this function:

◆ parse()

isc::data::ConstElementPtr isc::d2::D2CfgMgr::parse ( isc::data::ConstElementPtr config,
bool check_only )
overrideprotectedvirtual

Parses configuration of the D2.

Parameters
configPointer to a configuration specified for D2.
check_onlyBoolean flag indicating if this method should only verify correctness of the provided configuration.
Returns
Pointer to a result of configuration parsing.

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().

+ Here is the call graph for this function:

◆ reverseIpAddress()

std::string isc::d2::D2CfgMgr::reverseIpAddress ( const std::string & address)
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.

Parameters
addressstring containing a valid IPv4 or IPv6 address.
Returns
a std::string containing the reverse order address.
Exceptions
D2CfgErrorif 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().

+ Here is the call graph for this function:

◆ reverseUpdatesEnabled()

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.

Todo
This could be expanded to include the check of a configurable boolean value.
Returns
true if reverse updates are enabled, false otherwise.

Definition at line 148 of file d2_cfg_mgr.cc.

References getD2CfgContext().

+ Here is the call graph for this function:

◆ reverseV4Address()

std::string isc::d2::D2CfgMgr::reverseV4Address ( const isc::asiolink::IOAddress & ioaddr)
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.

Parameters
ioaddris the IPv4 IOaddress to convert
Returns
a std::string containing the reverse order address.
Exceptions
D2CfgErrorif 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().

◆ reverseV6Address()

std::string isc::d2::D2CfgMgr::reverseV6Address ( const isc::asiolink::IOAddress & ioaddr)
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.

Parameters
ioaddrstring containing a valid IPv6 address.
Returns
a std::string containing the reverse order address.
Exceptions
D2CfgErrorif 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().

+ Here is the call graph for this function:

◆ setCfgDefaults()

void isc::d2::D2CfgMgr::setCfgDefaults ( isc::data::ElementPtr mutable_config)
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().

Parameters
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().

+ Here is the call graph for this function:

Member Data Documentation

◆ IPV4_REV_ZONE_SUFFIX

const char * isc::d2::D2CfgMgr::IPV4_REV_ZONE_SUFFIX = "in-addr.arpa."
static

Reverse zone suffix added to IPv4 addresses for reverse lookups.

Todo
This should be configurable.

Definition at line 188 of file d2_cfg_mgr.h.

Referenced by reverseV4Address().

◆ IPV6_REV_ZONE_SUFFIX

const char * isc::d2::D2CfgMgr::IPV6_REV_ZONE_SUFFIX = "ip6.arpa."
static

Reverse zone suffix added to IPv6 addresses for reverse lookups.

Todo
This should be configurable.

Definition at line 193 of file d2_cfg_mgr.h.

Referenced by reverseV6Address().


The documentation for this class was generated from the following files: