summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/dhcp/option4_dnr.cc6
-rw-r--r--src/lib/dhcp/option4_dnr.h12
-rw-r--r--src/lib/dhcp/option6_dnr.cc6
-rw-r--r--src/lib/dhcp/option6_dnr.h12
-rw-r--r--src/lib/dhcp/option_definition.cc4
-rw-r--r--src/lib/dhcp/std_option_defs.h25
6 files changed, 36 insertions, 29 deletions
diff --git a/src/lib/dhcp/option4_dnr.cc b/src/lib/dhcp/option4_dnr.cc
index 794572f873..a848d92d92 100644
--- a/src/lib/dhcp/option4_dnr.cc
+++ b/src/lib/dhcp/option4_dnr.cc
@@ -16,8 +16,10 @@ using namespace isc::util;
namespace isc {
namespace dhcp {
-Option4Dnr::Option4Dnr(OptionBufferConstIter begin, OptionBufferConstIter end)
- : Option(V4, DHO_V4_DNR) {
+Option4Dnr::Option4Dnr(OptionBufferConstIter begin,
+ OptionBufferConstIter end,
+ bool convenient_notation)
+ : Option(V4, DHO_V4_DNR), convenient_notation_(convenient_notation) {
unpack(begin, end);
}
diff --git a/src/lib/dhcp/option4_dnr.h b/src/lib/dhcp/option4_dnr.h
index f8434cec17..221a5ee8cc 100644
--- a/src/lib/dhcp/option4_dnr.h
+++ b/src/lib/dhcp/option4_dnr.h
@@ -464,12 +464,17 @@ public:
/// @param begin Iterator pointing to the beginning of the buffer holding an
/// option.
/// @param end Iterator pointing to the end of the buffer holding an option.
+ /// @param convenient_notation Flag stating whether data in buffer is a convenient
+ /// notation string that needs custom parsing or binary
+ /// data. Defaults to @c false.
///
/// @throw OutOfRange Thrown in case of truncated data. May be also thrown when
/// @c DnrInstance::unpackDnrInstanceDataLength(begin,end) throws.
/// @throw BadValue Thrown when @c DnrInstance::unpackAdn(begin,end) throws.
/// @throw InvalidOptionDnrDomainName Thrown when @c DnrInstance::unpackAdn(begin,end) throws.
- Option4Dnr(OptionBufferConstIter begin, OptionBufferConstIter end);
+ Option4Dnr(OptionBufferConstIter begin,
+ OptionBufferConstIter end,
+ bool convenient_notation = false);
/// @brief Constructor of the empty %Option.
///
@@ -536,6 +541,11 @@ public:
protected:
/// @brief Container holding DNR Instances.
DnrInstanceContainer dnr_instances_;
+
+private:
+ /// @brief Flag stating whether the %Option was constructed with a convenient notation string,
+ /// that needs custom parsing, or binary data.
+ bool convenient_notation_;
};
/// A pointer to the @c OptionDnr4 object.
diff --git a/src/lib/dhcp/option6_dnr.cc b/src/lib/dhcp/option6_dnr.cc
index 1358ee5afb..389c3adeb2 100644
--- a/src/lib/dhcp/option6_dnr.cc
+++ b/src/lib/dhcp/option6_dnr.cc
@@ -13,8 +13,10 @@ using namespace isc::asiolink;
namespace isc {
namespace dhcp {
-Option6Dnr::Option6Dnr(OptionBufferConstIter begin, OptionBufferConstIter end)
- : Option(V6, D6O_V6_DNR), DnrInstance(V6) {
+Option6Dnr::Option6Dnr(OptionBufferConstIter begin,
+ OptionBufferConstIter end,
+ bool convenient_notation)
+ : Option(V6, D6O_V6_DNR), DnrInstance(V6), convenient_notation_(convenient_notation) {
unpack(begin, end);
}
diff --git a/src/lib/dhcp/option6_dnr.h b/src/lib/dhcp/option6_dnr.h
index 6cf38e579a..f7fbeaa4d4 100644
--- a/src/lib/dhcp/option6_dnr.h
+++ b/src/lib/dhcp/option6_dnr.h
@@ -34,11 +34,16 @@ public:
/// @param begin Iterator pointing to the beginning of the buffer holding an
/// option.
/// @param end Iterator pointing to the end of the buffer holding an option.
+ /// @param convenient_notation Flag stating whether data in buffer is a convenient
+ /// notation string that needs custom parsing or binary
+ /// data. Defaults to @c false.
///
/// @throw OutOfRange Thrown in case of truncated data.
/// @throw BadValue Thrown when @c DnrInstance::unpackAdn(begin,end) throws.
/// @throw InvalidOptionDnrDomainName Thrown when @c DnrInstance::unpackAdn(begin,end) throws.
- Option6Dnr(OptionBufferConstIter begin, OptionBufferConstIter end);
+ Option6Dnr(OptionBufferConstIter begin,
+ OptionBufferConstIter end,
+ bool convenient_notation = false);
/// @brief Constructor of the %Option with all fields from params.
///
@@ -136,6 +141,11 @@ public:
/// @throw OutOfRange Thrown in case of malformed data detected during parsing e.g.
/// Addr Len not divisible by 16, Addr Len is 0, addresses data truncated etc.
void unpackAddresses(OptionBufferConstIter& begin, OptionBufferConstIter end) override;
+
+private:
+ /// @brief Flag stating whether the %Option was constructed with a convenient notation string,
+ /// that needs custom parsing, or binary data.
+ bool convenient_notation_;
};
/// A pointer to the @c Option6Dnr object.
diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc
index d07d61da71..1a0f0d7da4 100644
--- a/src/lib/dhcp/option_definition.cc
+++ b/src/lib/dhcp/option_definition.cc
@@ -893,7 +893,7 @@ OptionDefinition::factorySpecialFormatOption(Option::Universe u,
return (OptionPtr(new Option6PDExclude(begin, end)));
case D6O_V6_DNR:
- return (OptionPtr(new Option6Dnr(begin, end)));
+ return (OptionPtr(new Option6Dnr(begin, end, convenient_notation)));
default:
break;
@@ -927,7 +927,7 @@ OptionDefinition::factorySpecialFormatOption(Option::Universe u,
return (factoryOpaqueDataTuples(Option::V4, getCode(), begin, end, OpaqueDataTuple::LENGTH_2_BYTES));
case DHO_V4_DNR:
- return (OptionPtr(new Option4Dnr(begin, end)));
+ return (OptionPtr(new Option4Dnr(begin, end, convenient_notation)));
default:
break;
diff --git a/src/lib/dhcp/std_option_defs.h b/src/lib/dhcp/std_option_defs.h
index c2c5de9148..1457845499 100644
--- a/src/lib/dhcp/std_option_defs.h
+++ b/src/lib/dhcp/std_option_defs.h
@@ -107,16 +107,6 @@ RECORD_DECL(V4_PORTPARAMS_RECORDS, OPT_UINT8_TYPE, OPT_PSID_TYPE);
RECORD_DECL(OPT_6RD_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE,
OPT_IPV6_ADDRESS_TYPE, OPT_IPV4_ADDRESS_TYPE);
-// RFC-draft-ietf-add-dnr DHCPv4 DNR option.
-//
-// DNR Instance Data Length (2 octets), Service Priority (2 octets),
-// ADN Length (1 octet), ADN FQDN.
-// Opaque data is represented here by the binary data field.
-// It may contain Addr Length (1 octet), IPv4 address(es), SvcParams,
-// and next DNR instances as binary data.
-RECORD_DECL(V4_DNR_RECORDS, OPT_UINT16_TYPE, OPT_UINT16_TYPE, OPT_UINT8_TYPE,
- OPT_FQDN_TYPE, OPT_BINARY_TYPE);
-
/// @brief Definitions of standard DHCPv4 options.
const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
{ "subnet-mask", DHO_SUBNET_MASK, DHCP4_OPTION_SPACE,
@@ -378,8 +368,8 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
OPT_UINT8_TYPE, false, NO_RECORD_DEF, "" },
{ "v4-portparams", DHO_V4_PORTPARAMS, DHCP4_OPTION_SPACE, OPT_RECORD_TYPE,
false, RECORD_DEF(V4_PORTPARAMS_RECORDS), "" },
- { "v4-dnr", DHO_V4_DNR, DHCP4_OPTION_SPACE, OPT_RECORD_TYPE,
- false, RECORD_DEF(V4_DNR_RECORDS), "" },
+ { "v4-dnr", DHO_V4_DNR, DHCP4_OPTION_SPACE, OPT_INTERNAL_TYPE,
+ false, NO_RECORD_DEF, "" },
{ "option-6rd", DHO_6RD, DHCP4_OPTION_SPACE, OPT_RECORD_TYPE, true,
RECORD_DEF(OPT_6RD_RECORDS), "" },
{ "v4-access-domain", DHO_V4_ACCESS_DOMAIN, DHCP4_OPTION_SPACE,
@@ -501,13 +491,6 @@ RECORD_DECL(SIGNATURE_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE,
// Three 1 byte fileds to describe a network interface: type, major and minor
RECORD_DECL(CLIENT_NII_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE, OPT_UINT8_TYPE);
-// RFC-draft-ietf-add-dnr DHCPv6 DNR option.
-//
-// Service Priority (2 octets), ADN Length (2 octets), ADN FQDN.
-// Opaque data is represented here by the binary data field.
-// It may contain Addr Length (2 octets), IPv6 address(es), SvcParams.
-RECORD_DECL(V6_DNR_RECORDS, OPT_UINT16_TYPE, OPT_UINT16_TYPE, OPT_FQDN_TYPE, OPT_BINARY_TYPE);
-
/// Standard DHCPv6 option definitions.
///
/// @warning in this array, the initializers are provided for all
@@ -671,8 +654,8 @@ const OptionDefParams STANDARD_V6_OPTION_DEFINITIONS[] = {
false, NO_RECORD_DEF, MAPT_V6_OPTION_SPACE },
{ "s46-cont-lw", D6O_S46_CONT_LW, DHCP6_OPTION_SPACE, OPT_EMPTY_TYPE,
false, NO_RECORD_DEF, LW_V6_OPTION_SPACE },
- { "v6-dnr", D6O_V6_DNR, DHCP6_OPTION_SPACE, OPT_RECORD_TYPE,
- false, RECORD_DEF(V6_DNR_RECORDS), "" }
+ { "v6-dnr", D6O_V6_DNR, DHCP6_OPTION_SPACE, OPT_INTERNAL_TYPE,
+ false, NO_RECORD_DEF, "" }
// @todo There is still a bunch of options for which we have to provide
// definitions but we don't do it because they are not really