BIND 10 trac2317, updated. 36d56446c3758b1d8e6c005fabfe8432b9751131 [2317] Create V4 option definition in the definition parser.
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jan 9 11:14:39 UTC 2013
The branch, trac2317 has been updated
via 36d56446c3758b1d8e6c005fabfe8432b9751131 (commit)
from c4904fef78c9bae9fdff9aa9852d7b8dca3a9ba8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 36d56446c3758b1d8e6c005fabfe8432b9751131
Author: Marcin Siodelski <marcin at isc.org>
Date: Wed Jan 9 12:14:30 2013 +0100
[2317] Create V4 option definition in the definition parser.
-----------------------------------------------------------------------
Summary of changes:
src/bin/dhcp4/config_parser.cc | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/dhcp4/config_parser.cc b/src/bin/dhcp4/config_parser.cc
index 20c6f57..584552c 100644
--- a/src/bin/dhcp4/config_parser.cc
+++ b/src/bin/dhcp4/config_parser.cc
@@ -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.
More information about the bind10-changes
mailing list