Kea 2.7.6
isc::d2::D2SimpleParser Class Reference

#include <d2_simple_parser.h>

+ Inheritance diagram for isc::d2::D2SimpleParser:

Public Member Functions

void parse (const D2CfgContextPtr &ctx, const isc::data::ConstElementPtr &config, bool check_only)
 Parses the whole D2 configuration.
 
- Public Member Functions inherited from isc::data::SimpleParser
uint16_t getUint16 (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a value converted to uint16_t.
 
uint32_t getUint32 (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a value converted to uint32_t.
 
uint8_t getUint8 (ConstElementPtr scope, const std::string &name)
 Get an uint8_t value.
 
const isc::util::Triplet< uint32_t > parseIntTriplet (const data::ConstElementPtr &scope, const std::string &name)
 Parses an integer triplet.
 

Static Public Member Functions

static size_t setAllDefaults (data::ElementPtr global)
 Sets all defaults for D2 configuration.
 
static size_t setDdnsDomainDefaults (data::ElementPtr domain, const data::SimpleDefaults &domain_defaults)
 Adds default values to a DDNS Domain element.
 
static size_t setManagerDefaults (data::ElementPtr global, const std::string &mgr_name, const data::SimpleDefaults &mgr_defaults)
 Adds default values to a DDNS Domain List Manager.
 
- Static Public Member Functions inherited from isc::data::SimpleParser
static void checkKeywords (const SimpleKeywords &keywords, isc::data::ConstElementPtr scope)
 Checks acceptable keywords with their expected type.
 
static void checkRequired (const SimpleRequiredKeywords &required, isc::data::ConstElementPtr scope)
 Checks that all required keywords are present.
 
static size_t deriveParams (isc::data::ConstElementPtr parent, isc::data::ElementPtr child, const ParamsList &params)
 Derives (inherits) parameters from parent scope to a child.
 
static isc::asiolink::IOAddress getAddress (const ConstElementPtr &scope, const std::string &name)
 Returns a IOAddress parameter from a scope.
 
static bool getBoolean (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a boolean parameter from a scope.
 
static double getDouble (const ConstElementPtr &scope, const std::string &name)
 Returns a floating point parameter from a scope.
 
static int64_t getInteger (isc::data::ConstElementPtr scope, const std::string &name)
 Returns an integer parameter from a scope.
 
static int64_t getInteger (isc::data::ConstElementPtr scope, const std::string &name, int64_t min, int64_t max)
 Returns an integer parameter from a scope and checks its range.
 
static const data::Element::PositiongetPosition (const std::string &name, const data::ConstElementPtr parent)
 Utility method that returns position of an element.
 
static std::string getString (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a string parameter from a scope.
 
static size_t setDefaults (isc::data::ElementPtr scope, const SimpleDefaults &default_values)
 Sets the default values.
 
static size_t setListDefaults (isc::data::ConstElementPtr list, const SimpleDefaults &default_values)
 Sets the default values for all entries in a list.
 

Static Public Attributes

static const data::SimpleDefaults D2_GLOBAL_DEFAULTS
 This table defines default global values for D2.
 
static const data::SimpleDefaults TSIG_KEY_DEFAULTS
 Supplies defaults for ddns-domains list elements (i.e. DdnsDomains)
 
static const data::SimpleDefaults DDNS_DOMAIN_MGR_DEFAULTS
 Supplies defaults for optional values in DDNS domain managers (e.g.
 
static const data::SimpleDefaults DDNS_DOMAIN_DEFAULTS
 Supplies defaults for ddns-domains list elements (i.e. DdnsDomains)
 
static const data::SimpleDefaults DNS_SERVER_DEFAULTS
 Supplies defaults for optional values DdnsDomain entries.
 

Additional Inherited Members

- Protected Member Functions inherited from isc::data::SimpleParser
template<typename target_type , target_type convert>
target_type getAndConvert (isc::data::ConstElementPtr scope, const std::string &name, const std::string &type_name)
 Returns a converted value from a scope.
 
template<typename int_type >
int_type getIntType (isc::data::ConstElementPtr scope, const std::string &name)
 Returns an integer value with range checking from a scope.
 

Detailed Description

Definition at line 22 of file d2_simple_parser.h.

Member Function Documentation

◆ parse()

void isc::d2::D2SimpleParser::parse ( const D2CfgContextPtr & ctx,
const isc::data::ConstElementPtr & config,
bool check_only )

Parses the whole D2 configuration.

Parameters
ctx- parsed information will be stored here
config- Element tree structure that holds configuration
check_only- if true the configuration is verified only, not applied
Exceptions
ConfigErrorif any issues are encountered.

Definition at line 201 of file d2_simple_parser.cc.

References isc::asiolink::IOServiceMgr::clearIOServices(), isc::data::Element::createList(), isc::dhcp_ddns::FMT_JSON, isc::hooks::HooksConfig::get(), isc::data::SimpleParser::getAddress(), isc::data::SimpleParser::getUint32(), isc::asiolink::IOServiceMgr::instance(), isc_throw, isc::data::Element::list, isc::hooks::HooksConfig::loadLibraries(), isc::data::Element::map, isc::dhcp_ddns::NCR_UDP, isc::dhcp_ddns::ncrFormatToString(), isc::dhcp_ddns::ncrProtocolToString(), isc::d2::DdnsDomainListMgrParser::parse(), isc::d2::TSIGKeyInfoListParser::parse(), isc::hooks::HooksLibrariesParser::parse(), isc::data::Element::string, isc::data::UserContext::toElement(), and isc::hooks::HooksConfig::verifyLibraries().

Referenced by isc::d2::D2CfgMgr::parse().

+ Here is the call graph for this function:

◆ setAllDefaults()

size_t isc::d2::D2SimpleParser::setAllDefaults ( data::ElementPtr global)
static

Sets all defaults for D2 configuration.

This method sets global and element defaults.

Parameters
globalscope to be filled in with defaults.
Returns
number of default values added

— end of default values ----------------------------------------------—

Definition at line 124 of file d2_simple_parser.cc.

References D2_GLOBAL_DEFAULTS, DDNS_DOMAIN_MGR_DEFAULTS, isc::data::SimpleParser::setDefaults(), isc::data::SimpleParser::setListDefaults(), setManagerDefaults(), and TSIG_KEY_DEFAULTS.

Referenced by isc::d2::D2CfgMgr::parse(), and isc::d2::D2CfgMgr::setCfgDefaults().

+ Here is the call graph for this function:

◆ setDdnsDomainDefaults()

size_t isc::d2::D2SimpleParser::setDdnsDomainDefaults ( data::ElementPtr domain,
const data::SimpleDefaults & domain_defaults )
static

Adds default values to a DDNS Domain element.

Adds the scalar default values to the given DDNS domain element, and then adds the DNS Server defaults to the domain's server list, "dns-servers".

Parameters
domainDDNS domain element to which defaults should be added
domain_defaultslist of default values from which to add
Returns
returns the number of default values added

Definition at line 149 of file d2_simple_parser.cc.

References DNS_SERVER_DEFAULTS, isc::data::SimpleParser::setDefaults(), and isc::data::SimpleParser::setListDefaults().

Referenced by setManagerDefaults().

+ Here is the call graph for this function:

◆ setManagerDefaults()

size_t isc::d2::D2SimpleParser::setManagerDefaults ( data::ElementPtr global,
const std::string & mgr_name,
const data::SimpleDefaults & mgr_defaults )
static

Adds default values to a DDNS Domain List Manager.

This function looks for the named DDNS domain manager element within the given element tree. If it is found, it adds the scalar default values to the manager element and then adds the DDNS Domain defaults to its domain list, "ddns-domains". If the manager element is not found, then an empty map entry is added for it, thus defaulting the manager to "disabled".

Parameters
globalelement tree containing the DDNS domain manager element to which defaults should be added
mgr_namename of the manager element within the element tree (e.g. "forward-ddns", "reverse-ddns")
mgr_defaultslist of default values from which to add
Returns
returns the number of default values added

Definition at line 166 of file d2_simple_parser.cc.

References DDNS_DOMAIN_DEFAULTS, setDdnsDomainDefaults(), and isc::data::SimpleParser::setDefaults().

Referenced by setAllDefaults().

+ Here is the call graph for this function:

Member Data Documentation

◆ D2_GLOBAL_DEFAULTS

const SimpleDefaults isc::d2::D2SimpleParser::D2_GLOBAL_DEFAULTS
static
Initial value:
= {
{ "ip-address", Element::string, "127.0.0.1" },
{ "port", Element::integer, "53001" },
{ "dns-server-timeout", Element::integer, "500" },
{ "ncr-protocol", Element::string, "UDP" },
{ "ncr-format", Element::string, "JSON" }
}

This table defines default global values for D2.

Some of the global parameters defined in the global scope (i.e. directly in DhcpDdns) are optional. If not defined, the following values will be used.

Definition at line 34 of file d2_simple_parser.h.

Referenced by setAllDefaults().

◆ DDNS_DOMAIN_DEFAULTS

const SimpleDefaults isc::d2::D2SimpleParser::DDNS_DOMAIN_DEFAULTS
static
Initial value:
= {
{ "key-name", Element::string, "" }
}

Supplies defaults for ddns-domains list elements (i.e. DdnsDomains)

Definition at line 43 of file d2_simple_parser.h.

Referenced by setManagerDefaults().

◆ DDNS_DOMAIN_MGR_DEFAULTS

const SimpleDefaults isc::d2::D2SimpleParser::DDNS_DOMAIN_MGR_DEFAULTS
static
Initial value:
= {
}

Supplies defaults for optional values in DDNS domain managers (e.g.

"forward-ddns" and "reverse-ddns").

Note
While there are none yet defined, it is highly likely there will be domain manager defaults added in the future. This code to set defaults already uses this list, so supporting values will simply require adding them to this list.

Definition at line 40 of file d2_simple_parser.h.

Referenced by setAllDefaults().

◆ DNS_SERVER_DEFAULTS

const SimpleDefaults isc::d2::D2SimpleParser::DNS_SERVER_DEFAULTS
static
Initial value:
= {
{ "hostname", Element::string, "" },
{ "port", Element::integer, "53" },
{ "key-name", Element::string, "" }
}

Supplies defaults for optional values DdnsDomain entries.

Definition at line 46 of file d2_simple_parser.h.

Referenced by setDdnsDomainDefaults().

◆ TSIG_KEY_DEFAULTS

const SimpleDefaults isc::d2::D2SimpleParser::TSIG_KEY_DEFAULTS
static
Initial value:
= {
{ "digest-bits", Element::integer, "0" }
}

Supplies defaults for ddns-domains list elements (i.e. DdnsDomains)

Definition at line 37 of file d2_simple_parser.h.

Referenced by setAllDefaults().


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