From: Marcin Siodelski Date: Fri, 25 Apr 2014 12:16:43 +0000 (+0200) Subject: [3409] Pass whole context to the OptionDefListParser. X-Git-Tag: trac3434_base~43^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=21eee97b5883cc63de87cc053f2a1e6dafee2f0d;p=thirdparty%2Fkea.git [3409] Pass whole context to the OptionDefListParser. --- diff --git a/src/bin/dhcp4/config_parser.cc b/src/bin/dhcp4/config_parser.cc index 126e56b0af..91780e9dd7 100644 --- a/src/bin/dhcp4/config_parser.cc +++ b/src/bin/dhcp4/config_parser.cc @@ -413,8 +413,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id) { globalContext(), Dhcp4OptionDataParser::factory); } else if (config_id.compare("option-def") == 0) { - parser = new OptionDefListParser(config_id, - globalContext()->option_defs_); + parser = new OptionDefListParser(config_id, globalContext()); } else if ((config_id.compare("version") == 0) || (config_id.compare("next-server") == 0)) { parser = new StringParser(config_id, diff --git a/src/bin/dhcp6/config_parser.cc b/src/bin/dhcp6/config_parser.cc index 8762fe6fa8..f47e1ed814 100644 --- a/src/bin/dhcp6/config_parser.cc +++ b/src/bin/dhcp6/config_parser.cc @@ -639,8 +639,7 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id) { globalContext(), Dhcp6OptionDataParser::factory); } else if (config_id.compare("option-def") == 0) { - parser = new OptionDefListParser(config_id, - globalContext()->option_defs_); + parser = new OptionDefListParser(config_id, globalContext()); } else if (config_id.compare("version") == 0) { parser = new StringParser(config_id, globalContext()->string_values_); diff --git a/src/lib/dhcpsrv/dhcp_parsers.cc b/src/lib/dhcpsrv/dhcp_parsers.cc index 3c8173b4fd..601d73b512 100644 --- a/src/lib/dhcpsrv/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/dhcp_parsers.cc @@ -817,10 +817,9 @@ OptionDefParser::createOptionDef(ConstElementPtr option_def_element) { } // ******************************** OptionDefListParser ************************ -OptionDefListParser:: -OptionDefListParser(const std::string&, OptionDefStoragePtr storage, - ParserContextPtr global_context) - : storage_(storage), +OptionDefListParser::OptionDefListParser(const std::string&, + ParserContextPtr global_context) + : storage_(global_context->option_defs_), global_context_(global_context) { if (!storage_) { isc_throw(isc::dhcp::DhcpConfigError, "parser logic error:" diff --git a/src/lib/dhcpsrv/dhcp_parsers.h b/src/lib/dhcpsrv/dhcp_parsers.h index c976f2799f..28d3d81727 100644 --- a/src/lib/dhcpsrv/dhcp_parsers.h +++ b/src/lib/dhcpsrv/dhcp_parsers.h @@ -752,12 +752,10 @@ public: /// /// @param dummy first argument is ignored, all Parser constructors /// 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 /// stores global scope parameters, options, option defintions. /// @throw isc::dhcp::DhcpConfigError if storage is null. - OptionDefListParser(const std::string& dummy, OptionDefStoragePtr storage, + OptionDefListParser(const std::string& dummy, ParserContextPtr global_context); /// @brief Parse configuration entries. diff --git a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc index e1671f737a..eb234142a2 100644 --- a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc +++ b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc @@ -384,7 +384,6 @@ public: } else if (config_id.compare("option-def") == 0) { parser.reset(new OptionDefListParser(config_id, - parser_context_->option_defs_, parser_context_)); } else if (config_id.compare("hooks-libraries") == 0) {