Kea  2.3.9
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. More...
 
- 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. More...
 
uint32_t getUint32 (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a value converted to uint32_t. More...
 
uint8_t getUint8 (ConstElementPtr scope, const std::string &name)
 Get an uint8_t value. More...
 
const isc::util::Triplet< uint32_t > parseIntTriplet (const data::ConstElementPtr &scope, const std::string &name)
 Parses an integer triplet. More...
 

Static Public Member Functions

static size_t setAllDefaults (data::ElementPtr global)
 Sets all defaults for D2 configuration. More...
 
static size_t setDdnsDomainDefaults (data::ElementPtr domain, const data::SimpleDefaults &domain_defaults)
 Adds default values to a DDNS Domain element. More...
 
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. More...
 
- 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. More...
 
static void checkRequired (const SimpleRequiredKeywords &required, isc::data::ConstElementPtr scope)
 Checks that all required keywords are present. More...
 
static size_t deriveParams (isc::data::ConstElementPtr parent, isc::data::ElementPtr child, const ParamsList &params)
 Derives (inherits) parameters from parent scope to a child. More...
 
static isc::asiolink::IOAddress getAddress (const ConstElementPtr &scope, const std::string &name)
 Returns a IOAddress parameter from a scope. More...
 
static bool getBoolean (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a boolean parameter from a scope. More...
 
static double getDouble (const ConstElementPtr &scope, const std::string &name)
 Returns a floating point parameter from a scope. More...
 
static int64_t getInteger (isc::data::ConstElementPtr scope, const std::string &name)
 Returns an integer parameter from a scope. More...
 
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. More...
 
static const data::Element::PositiongetPosition (const std::string &name, const data::ConstElementPtr parent)
 Utility method that returns position of an element. More...
 
static std::string getString (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a string parameter from a scope. More...
 
static size_t setDefaults (isc::data::ElementPtr scope, const SimpleDefaults &default_values)
 Sets the default values. More...
 
static size_t setListDefaults (isc::data::ConstElementPtr list, const SimpleDefaults &default_values)
 Sets the default values for all entries in a list. More...
 

Static Public Attributes

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

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. More...
 
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. More...
 

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 200 of file d2_simple_parser.cc.

References isc::dhcp_ddns::FMT_JSON, isc::hooks::HooksConfig::get(), isc::data::SimpleParser::getAddress(), isc::data::SimpleParser::getUint32(), isc_throw, isc::hooks::HooksConfig::loadLibraries(), isc::data::Element::map, isc::dhcp_ddns::NCR_UDP, isc::dhcp_ddns::ncrFormatToString(), isc::dhcp_ddns::ncrProtocolToString(), isc::d2::TSIGKeyInfoListParser::parse(), isc::d2::DdnsDomainListMgrParser::parse(), isc::hooks::HooksLibrariesParser::parse(), isc::asiolink::IOAddress::toText(), 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 123 of file d2_simple_parser.cc.

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

◆ 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 148 of file d2_simple_parser.cc.

◆ 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 165 of file d2_simple_parser.cc.

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.

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

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

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

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


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