| Kea 3.0.2-git

isc::d2::D2CfgMgr Class Reference

DHCP-DDNS Configuration Manager. More...

`#include <d2_cfg_mgr.h>`

Inheritance diagram for isc::d2::D2CfgMgr:
[legend]

## 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.
const isc::data::ConstElementPtr | 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.

## 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 134 of file d2_cfg_mgr.cc.

References isc::process::DCfgMgrBase::DCfgMgrBase().

Here is the call graph for this function:

## ◆ ~D2CfgMgr()

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

Destructor.

Definition at line 137 of file d2_cfg_mgr.cc.

## Member Function Documentation

## ◆ createNewContext()

ConfigPtr isc::d2::D2CfgMgr::createNewContext | ( |  | ) |
| override protected virtual

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 141 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 146 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 | ) |
| override virtual

Returns configuration summary in the textual format.

Parameters

  selection | Bitfield 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 260 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 245 of file d2_cfg_mgr.cc.

References getD2CfgContext(), and getD2Params().

Referenced by getConfigSummary(), and getD2Params().

Here is the call graph for this function:

## ◆ getHttpControlSocketInfo()

const isc::data::ConstElementPtr 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 255 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 250 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
| final override virtual

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 326 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

  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.

Returns
  returns true if a match is found, false otherwise.

Exceptions

  throws | D2CfgError if given an invalid fqdn.

Definition at line 158 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_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.

Returns
  returns true if a match is found, false otherwise.

Exceptions

  throws | D2CfgError if given an invalid fqdn.

Definition at line 172 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 )
| override protected virtual

Parses configuration of the D2.

Parameters

  config | Pointer to a configuration specified for D2.
  check_only | Boolean 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 270 of file d2_cfg_mgr.cc.

References isc::config::CONTROL_RESULT_ERROR, isc::config::CONTROL_RESULT_SUCCESS, Element::create(), isc::config::createAnswer(), 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(), isc::d2::D2SimpleParser::setAllDefaults(), and isc::Exception::what().

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

  address | string containing a valid IPv4 or IPv6 address.

Returns
  a std::string containing the reverse order address.

Exceptions

  D2CfgError | if given an invalid address.

Definition at line 183 of file d2_cfg_mgr.cc.

References isc_throw, isc::asiolink::IOAddress::isV4(), 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 152 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

  ioaddr | is the IPv4 IOaddress to convert

Returns
  a std::string containing the reverse order address.

Exceptions

  D2CfgError | if not given an IPv4 address.

Definition at line 201 of file d2_cfg_mgr.cc.

References IPV4_REV_ZONE_SUFFIX, isc_throw, isc::asiolink::IOAddress::isV4(), and isc::asiolink::IOAddress::toBytes().

Referenced by reverseIpAddress().

Here is the call graph for this function:

## ◆ 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

  ioaddr | string containing a valid IPv6 address.

Returns
  a std::string containing the reverse order address.

Exceptions

  D2CfgError | if not given an IPv6 address.

Definition at line 223 of file d2_cfg_mgr.cc.

References isc::util::encode::encodeHex(), IPV6_REV_ZONE_SUFFIX, isc_throw, isc::asiolink::IOAddress::isV6(), and isc::asiolink::IOAddress::toBytes().

Referenced by reverseIpAddress().

Here is the call graph for this function:

## ◆ setCfgDefaults()

void isc::d2::D2CfgMgr::setCfgDefaults | ( | isc::data::ElementPtr | mutable_config | ) |
| override protected virtual

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 265 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:

- d2_cfg_mgr.h
- d2_cfg_mgr.cc