Commit f9abab4b authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[5014_phase2] SimpleParser implemented, 4 parsers converted

 - SimpleParser concept implemented
 - Converted 4 parsers (option data, option data list, option defintion,
   option definition list)
 - updated unit-tests
 - converted other parsers (HostReservationParser{4,6}, ClientClassDefParser)
   to use those new parsers
 - converted kea-dhcp{4,6} to use those new parsers

Conflicts:
	src/bin/dhcp6/json_config_parser.cc
	src/lib/dhcpsrv/parsers/dhcp_parsers.cc
parent 04fa0d3f
......@@ -20,6 +20,7 @@
#include <dhcpsrv/parsers/host_reservation_parser.h>
#include <dhcpsrv/parsers/host_reservations_list_parser.h>
#include <dhcpsrv/parsers/ifaces_config_parser.h>
#include <dhcpsrv/parsers/simple_parser.h>
#include <dhcpsrv/timer_mgr.h>
#include <config/command_mgr.h>
#include <util/encode/hex.h>
......@@ -190,8 +191,7 @@ protected:
parser = new Pools4ListParser(config_id, pools_);
} else if (config_id.compare("relay") == 0) {
parser = new RelayInfoParser(config_id, relay_info_, Option::V4);
} else if (config_id.compare("option-data") == 0) {
parser = new OptionDataListParser(config_id, options_, AF_INET);
// option-data has been converted to SimpleParser already.
} else if (config_id.compare("match-client-id") == 0) {
parser = new BooleanParser(config_id, boolean_values_);
} else if (config_id.compare("4o6-subnet") == 0) {
......@@ -424,10 +424,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
parser = new IfacesConfigParser4();
} else if (config_id.compare("subnet4") == 0) {
parser = new Subnets4ListConfigParser(config_id);
} else if (config_id.compare("option-data") == 0) {
parser = new OptionDataListParser(config_id, CfgOptionPtr(), AF_INET);
} else if (config_id.compare("option-def") == 0) {
parser = new OptionDefListParser(config_id, globalContext());
// option-data and option-def have been converted to SimpleParser already.
} else if ((config_id.compare("version") == 0) ||
(config_id.compare("next-server") == 0)) {
parser = new StringParser(config_id,
......@@ -538,7 +535,6 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
// Please do not change this order!
ParserCollection independent_parsers;
ParserPtr subnet_parser;
ParserPtr option_parser;
ParserPtr iface_parser;
ParserPtr leases_parser;
ParserPtr client_classes_parser;
......@@ -567,10 +563,43 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
// the name of the failing parser can be retrieved in the "catch" clause.
ConfigPair config_pair;
try {
// This is a way to convert ConstElementPtr to ElementPtr.
// We need a config that can be edited, because we will insert
// default values and will insert derived values as well.
std::map<std::string, ConstElementPtr> values;
config_set->getValue(values);
ElementPtr mutable_cfg(new MapElement());
mutable_cfg->setValue(values);
// Set all default values if not specified by the user.
SimpleParser::setAllDefaults(mutable_cfg, false);
// We need definitions first
ConstElementPtr option_defs = mutable_cfg->get("option-def");
if (option_defs) {
OptionDefListParser parser(AF_INET);
CfgOptionDefPtr cfg_option_def = CfgMgr::instance().getStagingCfg()->getCfgOptionDef();
parser.parse(cfg_option_def, option_defs);
}
// Make parsers grouping.
const std::map<std::string, ConstElementPtr>& values_map =
config_set->mapValue();
mutable_cfg->mapValue();
BOOST_FOREACH(config_pair, values_map) {
if (config_pair.first == "option-def") {
// This is converted to SimpleParser and is handled already above.
continue;
}
if (config_pair.first == "option-data") {
OptionDataListParser parser(AF_INET);
CfgOptionPtr cfg_option = CfgMgr::instance().getStagingCfg()->getCfgOption();
parser.parse(cfg_option, config_pair.second);
continue;
}
ParserPtr parser(createGlobalDhcp4ConfigParser(config_pair.first,
config_pair.second));
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_PARSER_CREATED)
......@@ -579,8 +608,6 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
subnet_parser = parser;
} else if (config_pair.first == "lease-database") {
leases_parser = parser;
} else if (config_pair.first == "option-data") {
option_parser = parser;
} else if (config_pair.first == "interfaces-config") {
// The interface parser is independent from any other
// parser and can be run here before any other parsers.
......@@ -606,15 +633,6 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
}
}
// The option values parser is the next one to be run.
std::map<std::string, ConstElementPtr>::const_iterator option_config =
values_map.find("option-data");
if (option_config != values_map.end()) {
config_pair.first = "option-data";
option_parser->build(option_config->second);
option_parser->commit();
}
// The class definitions parser is the next one to be run.
std::map<std::string, ConstElementPtr>::const_iterator cc_config =
values_map.find("client-classes");
......
......@@ -203,7 +203,7 @@ const char* HOST_CONFIGS[] = {
"\"valid-lifetime\": 600,"
"\"option-data\": [ {"
" \"name\": \"vivso-suboptions\","
" \"data\": 4491"
" \"data\": \"4491\""
"},"
"{"
" \"name\": \"tftp-servers\","
......@@ -221,7 +221,7 @@ const char* HOST_CONFIGS[] = {
" \"ip-address\": \"10.0.0.7\","
" \"option-data\": [ {"
" \"name\": \"vivso-suboptions\","
" \"data\": 4491"
" \"data\": \"4491\""
" },"
" {"
" \"name\": \"tftp-servers\","
......
......@@ -29,6 +29,7 @@
#include <dhcpsrv/parsers/host_reservation_parser.h>
#include <dhcpsrv/parsers/host_reservations_list_parser.h>
#include <dhcpsrv/parsers/ifaces_config_parser.h>
#include <dhcpsrv/parsers/simple_parser.h>
#include <log/logger_support.h>
#include <util/encode/hex.h>
#include <util/strutil.h>
......@@ -184,10 +185,12 @@ public:
uint32_values_));
parser = code_parser;
} else if (entry == "option-data") {
OptionDataListParserPtr option_parser(new OptionDataListParser(entry,
options_,
AF_INET6));
parser = option_parser;
OptionDataListParser opts_parser(AF_INET6);
opts_parser.parse(options_, param.second);
// OptionDataListParser is converted to SimpleParser already,
// no need to go through build/commit phases.
continue;
} else if (entry == "user-context") {
user_context_ = param.second;
continue; // no parser to remember, simply store the value
......@@ -425,8 +428,7 @@ protected:
parser = new RelayInfoParser(config_id, relay_info_, Option::V6);
} else if (config_id.compare("pd-pools") == 0) {
parser = new PdPoolListParser(config_id, pools_);
} else if (config_id.compare("option-data") == 0) {
parser = new OptionDataListParser(config_id, options_, AF_INET6);
// option-data was here, but it is now converted to SimpleParser
} else if (config_id.compare("rapid-commit") == 0) {
parser = new BooleanParser(config_id, boolean_values_);
} else {
......@@ -703,11 +705,9 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id,
parser = new IfacesConfigParser6();
} else if (config_id.compare("subnet6") == 0) {
parser = new Subnets6ListConfigParser(config_id);
} else if (config_id.compare("option-data") == 0) {
parser = new OptionDataListParser(config_id, CfgOptionPtr(), AF_INET6);
} else if (config_id.compare("option-def") == 0) {
parser = new OptionDefListParser(config_id, globalContext());
} else if (config_id.compare("version") == 0) {
// option-data and option-def are no longer needed here. They're now
// converted to SimpleParser and are handled in configureDhcp6Server
} else if (config_id.compare("version") == 0) {
parser = new StringParser(config_id,
globalContext()->string_values_);
} else if (config_id.compare("lease-database") == 0) {
......@@ -808,7 +808,6 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
// Please do not change this order!
ParserCollection independent_parsers;
ParserPtr subnet_parser;
ParserPtr option_parser;
ParserPtr iface_parser;
ParserPtr leases_parser;
ParserPtr client_classes_parser;
......@@ -838,10 +837,42 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
ConfigPair config_pair;
try {
// This is a way to convert ConstElementPtr to ElementPtr.
// We need a config that can be edited, because we will insert
// default values and will insert derived values as well.
std::map<std::string, ConstElementPtr> values;
config_set->getValue(values);
ElementPtr mutable_cfg(new MapElement());
mutable_cfg->setValue(values);
SimpleParser::setAllDefaults(mutable_cfg, true);
// Make parsers grouping.
const std::map<std::string, ConstElementPtr>& values_map =
config_set->mapValue();
mutable_cfg->mapValue();
// We need definitions first
ConstElementPtr option_defs = mutable_cfg->get("option-def");
if (option_defs) {
OptionDefListParser parser(AF_INET6);
CfgOptionDefPtr cfg_option_def = CfgMgr::instance().getStagingCfg()->getCfgOptionDef();
parser.parse(cfg_option_def, option_defs);
}
BOOST_FOREACH(config_pair, values_map) {
if (config_pair.first == "option-def") {
// This is converted to SimpleParser and is handled already above.
continue;
}
if (config_pair.first == "option-data") {
OptionDataListParser parser(AF_INET6);
CfgOptionPtr cfg_option = CfgMgr::instance().getStagingCfg()->getCfgOption();
parser.parse(cfg_option, config_pair.second);
continue;
}
ParserPtr parser(createGlobal6DhcpConfigParser(config_pair.first,
config_pair.second));
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL, DHCP6_PARSER_CREATED)
......@@ -850,9 +881,9 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
subnet_parser = parser;
} else if (config_pair.first == "lease-database") {
leases_parser = parser;
} else if (config_pair.first == "option-data") {
} /* else if (config_pair.first == "option-data") {
option_parser = parser;
} else if (config_pair.first == "hooks-libraries") {
} */ else if (config_pair.first == "hooks-libraries") {
// Executing the commit will alter currently loaded hooks
// libraries. Check if the supplied libraries are valid,
// but defer the commit until after everything else has
......@@ -878,15 +909,6 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
}
}
// The option values parser is the next one to be run.
std::map<std::string, ConstElementPtr>::const_iterator option_config =
values_map.find("option-data");
if (option_config != values_map.end()) {
config_pair.first = "option-data";
option_parser->build(option_config->second);
option_parser->commit();
}
// The class definitions parser is the next one to be run.
std::map<std::string, ConstElementPtr>::const_iterator cc_config =
values_map.find("client-classes");
......
......@@ -2024,10 +2024,12 @@ TEST_F(Dhcpv6SrvTest, rsooOverride) {
" \"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 120,"
" \"csv-format\": false,"
" \"type\": \"binary\""
" } ],"
" \"option-data\": [ {"
" \"code\": 120,"
" \"csv-format\": false,"
" \"data\": \"05\""
" } ],"
" \"preferred-lifetime\": 3000,"
......
......@@ -229,7 +229,7 @@ const char* CONFIGS[] = {
"\"renew-timer\": 1000, "
"\"option-data\": [ {"
" \"name\": \"vendor-opts\","
" \"data\": 4491"
" \"data\": \"4491\""
"},"
"{"
" \"name\": \"tftp-servers\","
......@@ -247,7 +247,7 @@ const char* CONFIGS[] = {
" \"ip-addresses\": [ \"2001:db8:1::2\" ],"
" \"option-data\": [ {"
" \"name\": \"vendor-opts\","
" \"data\": 4491"
" \"data\": \"4491\""
" },"
" {"
" \"name\": \"tftp-servers\","
......
......@@ -32,6 +32,8 @@ EXTRA_DIST =
EXTRA_DIST += parsers/client_class_def_parser.cc
EXTRA_DIST += parsers/client_class_def_parser.h
EXTRA_DIST += parsers/dhcp_config_parser.h
EXTRA_DIST += parsers/simple_parser.cc
EXTRA_DIST += parsers/simple_parser.h
EXTRA_DIST += parsers/dbaccess_parser.cc
EXTRA_DIST += parsers/dbaccess_parser.h
EXTRA_DIST += parsers/dhcp_parsers.cc
......@@ -161,6 +163,8 @@ libkea_dhcpsrv_la_SOURCES += parsers/dbaccess_parser.cc
libkea_dhcpsrv_la_SOURCES += parsers/dbaccess_parser.h
libkea_dhcpsrv_la_SOURCES += parsers/dhcp_parsers.cc
libkea_dhcpsrv_la_SOURCES += parsers/dhcp_parsers.h
libkea_dhcpsrv_la_SOURCES += parsers/simple_parser.cc
libkea_dhcpsrv_la_SOURCES += parsers/simple_parser.h
libkea_dhcpsrv_la_SOURCES += parsers/duid_config_parser.cc
libkea_dhcpsrv_la_SOURCES += parsers/duid_config_parser.h
libkea_dhcpsrv_la_SOURCES += parsers/expiration_config_parser.cc
......
......@@ -91,12 +91,16 @@ ClientClassDefParser::build(ConstElementPtr class_def_cfg) {
global_context_));
parser = exp_parser;
} else if (entry == "option-data") {
OptionDataListParserPtr opts_parser;
uint16_t family = (global_context_->universe_ == Option::V4 ?
AF_INET : AF_INET6);
opts_parser.reset(new OptionDataListParser(entry, options_, family));
parser = opts_parser;
OptionDataListParser opts_parser(family);
opts_parser.parse(options_, param.second);
// OptionDataListParser is converted to SimpleParser already,
// no need to go through build/commit phases.
continue;
} else if (entry == "next-server") {
StringParserPtr str_parser(new StringParser(entry, string_values_));
parser = str_parser;
......
This diff is collapsed.
......@@ -15,7 +15,9 @@
#include <dhcpsrv/cfg_iface.h>
#include <dhcpsrv/cfg_option.h>
#include <dhcpsrv/subnet.h>
#include <dhcpsrv/cfg_option_def.h>
#include <dhcpsrv/parsers/dhcp_config_parser.h>
#include <dhcpsrv/parsers/simple_parser.h>
#include <hooks/libinfo.h>
#include <exceptions/exceptions.h>
#include <util/optional_value.h>
......@@ -534,39 +536,30 @@ private:
/// an option the configuration will not be accepted. If parsing
/// is successful then an instance of an option is created and
/// added to the storage provided by the calling class.
class OptionDataParser : public DhcpConfigParser {
class OptionDataParser : public SimpleParser {
public:
/// @brief Constructor.
///
/// @param dummy first argument is ignored, all Parser constructors
/// accept string as first argument.
/// @param [out] cfg Pointer to the configuration object where parsed option
/// should be stored or NULL if this is a global option.
/// @param address_family Address family: @c AF_INET or @c AF_INET6.
/// @throw isc::dhcp::DhcpConfigError if options or global_context are null.
OptionDataParser(const std::string& dummy, const CfgOptionPtr& cfg,
const uint16_t address_family);
OptionDataParser(const uint16_t address_family);
/// @brief Parses the single option data.
/// @brief Parses ElementPtr containing option definition
///
/// This method parses the data of a single option from the configuration.
/// The option data includes option name, option code and data being
/// carried by this option. Eventually it creates the instance of the
/// option and adds it to the Configuration Manager.
/// This method parses ElementPtr containing the option defintion,
/// instantiates the option for it and then returns a pair
/// of option descritor (that holds that new option) and
/// a string that specifies the option space.
///
/// @param option_data_entries collection of entries that define value
/// for a particular option.
/// @throw DhcpConfigError if invalid parameter specified in
/// the configuration.
/// @throw isc::InvalidOperation if failed to set storage prior to
/// calling build.
virtual void build(isc::data::ConstElementPtr option_data_entries);
/// @brief Does nothing.
virtual void commit();
/// @brief virtual destructor to ensure orderly destruction of derivations.
virtual ~OptionDataParser(){};
/// Note: ElementPtr is expected to contain all fields. If your
/// ElementPtr does not have them, please use
/// @ref SimpleParser::setOptionDefaults to fill the missing fields
/// with default values.
///
/// @param single_option ElementPtr containing option defintion
/// @return Option object wrapped in option description and an option
/// space
std::pair<OptionDescriptor, std::string>
parse(isc::data::ConstElementPtr single_option);
private:
/// @brief Finds an option definition within an option space
......@@ -594,22 +587,19 @@ private:
/// options storage. If the option data parsed by \ref build function
/// are invalid or insufficient this function emits an exception.
///
/// @warning this function does not check if options_ storage pointer
/// is intitialized but this check is not needed here because it is done
/// in the \ref build function.
///
/// @param option_data An element holding data for a single option being
/// created.
///
/// @return created option descriptor
///
/// @throw DhcpConfigError if parameters provided in the configuration
/// are invalid.
void createOption(isc::data::ConstElementPtr option_data);
std::pair<OptionDescriptor, std::string>
createOption(isc::data::ConstElementPtr option_data);
/// @brief Retrieves parsed option code as an optional value.
///
/// @param parent A data element holding full option data configuration.
/// It is used here to log a position if the element holding a code
/// is not specified and its position is therefore unavailable.
///
/// @return Option code, possibly unspecified.
/// @throw DhcpConfigError if option code is invalid.
......@@ -619,8 +609,6 @@ private:
/// @brief Retrieves parsed option name as an optional value.
///
/// @param parent A data element holding full option data configuration.
/// It is used here to log a position if the element holding a name
/// is not specified and its position is therefore unavailable.
///
/// @return Option name, possibly unspecified.
/// @throw DhcpConfigError if option name is invalid.
......@@ -630,13 +618,14 @@ private:
/// @brief Retrieves csv-format parameter as an optional value.
///
/// @return Value of the csv-format parameter, possibly unspecified.
util::OptionalValue<bool> extractCSVFormat() const;
util::OptionalValue<bool> extractCSVFormat(data::ConstElementPtr parent) const;
/// @brief Retrieves option data as a string.
///
/// @param parent A data element holding full option data configuration.
/// @return Option data as a string. It will return empty string if
/// option data is unspecified.
std::string extractData() const;
std::string extractData(data::ConstElementPtr parent) const;
/// @brief Retrieves option space name.
///
......@@ -644,27 +633,10 @@ private:
/// 'dhcp4' or 'dhcp6' option space name is returned, depending on
/// the universe specified in the parser context.
///
/// @param parent A data element holding full option data configuration.
///
/// @return Option space name.
std::string extractSpace() const;
/// Storage for boolean values.
BooleanStoragePtr boolean_values_;
/// Storage for string values (e.g. option name or data).
StringStoragePtr string_values_;
/// Storage for uint32 values (e.g. option code).
Uint32StoragePtr uint32_values_;
/// Option descriptor holds newly configured option.
OptionDescriptor option_descriptor_;
/// Option space name where the option belongs to.
std::string option_space_;
/// @brief Configuration holding option being parsed or NULL if the option
/// is global.
CfgOptionPtr cfg_;
std::string extractSpace(data::ConstElementPtr parent) const;
/// @brief Address family: @c AF_INET or @c AF_INET6.
uint16_t address_family_;
......@@ -680,97 +652,52 @@ typedef OptionDataParser *OptionDataParserFactory(const std::string&,
/// data for a particular subnet and creates a collection of options.
/// If parsing is successful, all these options are added to the Subnet
/// object.
class OptionDataListParser : public DhcpConfigParser {
class OptionDataListParser : public SimpleParser {
public:
/// @brief Constructor.
///
/// @param dummy nominally would be param name, this is always ignored.
/// @param [out] cfg Pointer to the configuration object where options
/// should be stored or NULL if this is global option scope.
/// @param address_family Address family: @c AF_INET or AF_INET6
OptionDataListParser(const std::string& dummy, const CfgOptionPtr& cfg,
const uint16_t address_family);
OptionDataListParser(const uint16_t address_family);
/// @brief Parses entries that define options' data for a subnet.
/// @brief Parses a list of options, instantiates them and stores in cfg
///
/// This method iterates over all entries that define option data
/// for options within a single subnet and creates options' instances.
///
/// @param option_data_list pointer to a list of options' data sets.
/// @throw DhcpConfigError if option parsing failed.
void build(isc::data::ConstElementPtr option_data_list);
/// @brief Commit all option values.
/// This method expects to get a list of options in option_data_list,
/// iterates over them, creates option objects, wraps them with
/// option descriptor and stores in specified cfg.
///
/// This function invokes commit for all option values
/// and append suboptions to the top-level options.
void commit();
/// @param cfg created options will be stored here
/// @param option_data_list configuration that describes the options
void parse(const CfgOptionPtr& cfg,
isc::data::ConstElementPtr option_data_list);
private:
/// Collection of parsers;
ParserCollection parsers_;
/// @brief Pointer to a configuration where options are stored.
CfgOptionPtr cfg_;
/// @brief Address family: @c AF_INET or @c AF_INET6
uint16_t address_family_;
};
typedef boost::shared_ptr<OptionDataListParser> OptionDataListParserPtr;
typedef std::pair<isc::dhcp::OptionDefinitionPtr, std::string> OptionDefinitionTuple;
/// @brief Parser for a single option definition.
///
/// This parser creates an instance of a single option definition.
class OptionDefParser : public DhcpConfigParser {
class OptionDefParser : public SimpleParser {
public:
/// @brief Constructor.
///
/// @param dummy first argument is ignored, all Parser constructors
/// accept string as first argument.
/// @param global_context is a pointer to the global context which
/// stores global scope parameters, options, option defintions.
OptionDefParser(const std::string& dummy, ParserContextPtr global_context);
/// @param address_family Address family: @c AF_INET or AF_INET6
OptionDefParser(const uint16_t address_family);
/// @brief Parses an entry that describes single option definition.
///
/// @param option_def a configuration entry to be parsed.
/// @return tuple (option definition, option space) of the parsed structure
///
/// @throw DhcpConfigError if parsing was unsuccessful.
void build(isc::data::ConstElementPtr option_def);
/// @brief Stores the parsed option definition in a storage.
void commit();
OptionDefinitionTuple
parse(isc::data::ConstElementPtr option_def);
private:
/// @brief Create option definition from the parsed parameters.
///
/// @param option_def_element A data element holding the configuration
/// for an option definition.
void createOptionDef(isc::data::ConstElementPtr option_def_element);
/// Instance of option definition being created by this parser.
OptionDefinitionPtr option_definition_;
/// Name of the space the option definition belongs to.
std::string option_space_name_;
/// Storage for boolean values.
BooleanStoragePtr boolean_values_;
/// Storage for string values.
StringStoragePtr string_values_;
/// Storage for uint32 values.
Uint32StoragePtr uint32_values_;
/// Parsing context which contains global values, options and option
/// definitions.
ParserContextPtr global_context_;
/// @brief Address family: @c AF_INET or @c AF_INET6
uint16_t address_family_;
};
/// @brief Parser for a list of option definitions.
......@@ -779,7 +706,7 @@ private:
/// option definitions and creates instances of these definitions.
/// If the parsing is successful, the collection of created definitions
/// is put into the provided storage.
class OptionDefListParser : public DhcpConfigParser {
class OptionDefListParser : public SimpleParser {
public:
/// @brief Constructor.
///
......@@ -787,29 +714,24 @@ public:
/// accept string as first argument.
/// @param global_context is a pointer to the global context which
/// stores global scope parameters, options, option defintions.
OptionDefListParser(const std::string& dummy,
ParserContextPtr global_context);
OptionDefListParser(const uint16_t address_family);
//const std::string& dummy,
//ParserContextPtr global_context);
/// @brief Parse configuration entries.
/// @brief Parses a list of option defintions, create them and store in cfg
///
/// This function parses configuration entries, creates instances
/// of option definitions and tries to add them to the Configuration
/// Manager.
/// This method iterates over def_list, which is a JSON list of option defintions,
/// then creates corresponding option defintions and store them in the
/// configuration structure.
///
/// @param option_def_list pointer to an element that holds entries
/// that define option definitions.
/// @throw DhcpConfigError if configuration parsing fails.
void build(isc::data::ConstElementPtr option_def_list);
/// @param def_list JSON list describing option definitions
/// @param cfg parsed option definitions will be stored here
void parse(CfgOptionDefPtr cfg, isc::data::ConstElementPtr def_list);
/// @brief Commits option definitions.
///
/// Currently this function is no-op, because option definitions are
/// added to the Configuration Manager in the @c build method.
void commit();
protected:
/// Parsing context which contains global values, options and option
/// definitions.
ParserContextPtr global_context_;
/// @brief Address family: @c AF_INET or @c AF_INET6
uint16_t address_family_;
};
/// @brief a collection of pools
......