Commit 21eee97b authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3409] Pass whole context to the OptionDefListParser.

parent 6db44353
...@@ -413,8 +413,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id) { ...@@ -413,8 +413,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id) {
globalContext(), globalContext(),
Dhcp4OptionDataParser::factory); Dhcp4OptionDataParser::factory);
} else if (config_id.compare("option-def") == 0) { } else if (config_id.compare("option-def") == 0) {
parser = new OptionDefListParser(config_id, parser = new OptionDefListParser(config_id, globalContext());
globalContext()->option_defs_);
} else if ((config_id.compare("version") == 0) || } else if ((config_id.compare("version") == 0) ||
(config_id.compare("next-server") == 0)) { (config_id.compare("next-server") == 0)) {
parser = new StringParser(config_id, parser = new StringParser(config_id,
......
...@@ -639,8 +639,7 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id) { ...@@ -639,8 +639,7 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id) {
globalContext(), globalContext(),
Dhcp6OptionDataParser::factory); Dhcp6OptionDataParser::factory);
} else if (config_id.compare("option-def") == 0) { } else if (config_id.compare("option-def") == 0) {
parser = new OptionDefListParser(config_id, parser = new OptionDefListParser(config_id, globalContext());
globalContext()->option_defs_);
} else if (config_id.compare("version") == 0) { } else if (config_id.compare("version") == 0) {
parser = new StringParser(config_id, parser = new StringParser(config_id,
globalContext()->string_values_); globalContext()->string_values_);
......
...@@ -817,10 +817,9 @@ OptionDefParser::createOptionDef(ConstElementPtr option_def_element) { ...@@ -817,10 +817,9 @@ OptionDefParser::createOptionDef(ConstElementPtr option_def_element) {
} }
// ******************************** OptionDefListParser ************************ // ******************************** OptionDefListParser ************************
OptionDefListParser:: OptionDefListParser::OptionDefListParser(const std::string&,
OptionDefListParser(const std::string&, OptionDefStoragePtr storage, ParserContextPtr global_context)
ParserContextPtr global_context) : storage_(global_context->option_defs_),
: storage_(storage),
global_context_(global_context) { global_context_(global_context) {
if (!storage_) { if (!storage_) {
isc_throw(isc::dhcp::DhcpConfigError, "parser logic error:" isc_throw(isc::dhcp::DhcpConfigError, "parser logic error:"
......
...@@ -752,12 +752,10 @@ public: ...@@ -752,12 +752,10 @@ public:
/// ///
/// @param dummy first argument is ignored, all Parser constructors /// @param dummy first argument is ignored, all Parser constructors
/// accept string as first argument. /// accept string as first argument.
/// @param storage is the definition storage in which to store the parsed
/// definitions in this list
/// @param global_context is a pointer to the global context which /// @param global_context is a pointer to the global context which
/// stores global scope parameters, options, option defintions. /// stores global scope parameters, options, option defintions.
/// @throw isc::dhcp::DhcpConfigError if storage is null. /// @throw isc::dhcp::DhcpConfigError if storage is null.
OptionDefListParser(const std::string& dummy, OptionDefStoragePtr storage, OptionDefListParser(const std::string& dummy,
ParserContextPtr global_context); ParserContextPtr global_context);
/// @brief Parse configuration entries. /// @brief Parse configuration entries.
......
...@@ -384,7 +384,6 @@ public: ...@@ -384,7 +384,6 @@ public:
} else if (config_id.compare("option-def") == 0) { } else if (config_id.compare("option-def") == 0) {
parser.reset(new OptionDefListParser(config_id, parser.reset(new OptionDefListParser(config_id,
parser_context_->option_defs_,
parser_context_)); parser_context_));
} else if (config_id.compare("hooks-libraries") == 0) { } else if (config_id.compare("hooks-libraries") == 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment