summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcp/option_definition.cc
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2014-02-13 14:17:03 +0100
committerMarcin Siodelski <marcin@isc.org>2014-02-13 14:17:03 +0100
commit20784067f58bff3e1019d842ee8fb7f9d9119842 (patch)
treeb1d4ad91e7efa0336662e134a9f3a9bc89d31da0 /src/lib/dhcp/option_definition.cc
parent[3316] Implemented a class which encapsulates Vendor Class option. (diff)
downloadkea-20784067f58bff3e1019d842ee8fb7f9d9119842.tar.xz
kea-20784067f58bff3e1019d842ee8fb7f9d9119842.zip
[3316] Use OptionVendorClass to encapsulate DHCPv6 option 16.
Diffstat (limited to 'src/lib/dhcp/option_definition.cc')
-rw-r--r--src/lib/dhcp/option_definition.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc
index 98765e6313..c8c836fdcb 100644
--- a/src/lib/dhcp/option_definition.cc
+++ b/src/lib/dhcp/option_definition.cc
@@ -28,6 +28,7 @@
#include <dhcp/option_space.h>
#include <dhcp/option_string.h>
#include <dhcp/option_vendor.h>
+#include <dhcp/option_vendor_class.h>
#include <util/encode/hex.h>
#include <util/strutil.h>
#include <boost/algorithm/string/classification.hpp>
@@ -400,6 +401,14 @@ OptionDefinition::haveVendor6Format() const {
}
bool
+OptionDefinition::haveVendorClass6Format() const {
+ return (haveType(OPT_RECORD_TYPE) &&
+ (record_fields_.size() == 2) &&
+ (record_fields_[0] == OPT_UINT32_TYPE) &&
+ (record_fields_[1] == OPT_BINARY_TYPE));
+}
+
+bool
OptionDefinition::convertToBool(const std::string& value_str) const {
// Case insensitve check that the input is one of: "true" or "false".
if (boost::iequals(value_str, "true")) {
@@ -653,6 +662,9 @@ OptionDefinition::factorySpecialFormatOption(Option::Universe u,
} else if (getCode() == D6O_VENDOR_OPTS && haveVendor6Format()) {
// Vendor-Specific Information.
return (OptionPtr(new OptionVendor(Option::V6, begin, end)));
+ } else if (getCode() == D6O_VENDOR_CLASS && haveVendorClass6Format()) {
+ // Vendor Class.
+ return (OptionPtr(new OptionVendorClass(Option::V6, begin, end)));
}
} else {
if ((getCode() == DHO_FQDN) && haveFqdn4Format()) {