Commit 36d56446 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[2317] Create V4 option definition in the definition parser.

parent c4904fef
......@@ -991,7 +991,6 @@ public:
/// @brief Stores the parsed option definition in a storage.
void commit() {
}
/// @brief Sets a pointer to a storage.
......@@ -1007,12 +1006,34 @@ public:
private:
/// @brief Create option definition from the parsed parameters.
void createOptionDef() {
// Get the option space name and validate it.
std::string space = getParam<std::string>("space", string_values_);
// @todo uncomment the code below when the #2313 is merged.
/* if (!OptionSpace::validateName()) {
isc_throw(DhcpConfigError, "invalid option space name '"
<< space << "'");
} */
// Get other parameters that are needed to create the
// option definition.
std::string name = getParam<std::string>("name", string_values_);
uint32_t code = getParam<uint32_t>("code", uint32_values_);
std::string type = getParam<std::string>("type", string_values_);
bool array_type = getParam<bool>("array", boolean_values_);
std::string space = getParam<std::string>("space", string_values_);
OptionDefinitionPtr def(new OptionDefinition(name, code,
type, array_type));
// Check the option definition parameters are valid.
try {
def->validate();
} catch (const isc::Exception ex) {
isc_throw(DhcpConfigError, "invalid option definition"
<< " parameters" << ex.what());
}
// Option definition has been created successfully.
option_definition_ = def;
}
/// Instance of option definition being created by this parser.
......
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