summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcp/option_opaque_data_tuples.h
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2016-06-24 13:32:39 +0200
committerMarcin Siodelski <marcin@isc.org>2016-07-08 07:50:19 +0200
commit90615322d44e2015ff1dffa0b7c5fbc0723d7bad (patch)
tree2b4eeedbd0ee3967e9648584bee1bd478fe49552 /src/lib/dhcp/option_opaque_data_tuples.h
parent[4497] Fix constness of methods in Option classes. (diff)
downloadkea-90615322d44e2015ff1dffa0b7c5fbc0723d7bad.tar.xz
kea-90615322d44e2015ff1dffa0b7c5fbc0723d7bad.zip
[4497] Implemented deep copy of DHCP options.
Diffstat (limited to 'src/lib/dhcp/option_opaque_data_tuples.h')
-rw-r--r--src/lib/dhcp/option_opaque_data_tuples.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/dhcp/option_opaque_data_tuples.h b/src/lib/dhcp/option_opaque_data_tuples.h
index 18b977c5e5..64823ee8bf 100644
--- a/src/lib/dhcp/option_opaque_data_tuples.h
+++ b/src/lib/dhcp/option_opaque_data_tuples.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -62,6 +62,8 @@ public:
OptionBufferConstIter begin,
OptionBufferConstIter end);
+ OptionPtr clone() const;
+
/// @brief Renders option into the buffer in the wire format.
///
/// @param [out] buf Buffer to which the option is rendered.
@@ -137,12 +139,11 @@ private:
///
/// This function returns the length field type which should be used
/// for the opaque data tuples being added to this option.
- /// Currently this class is only used for a DHCPv6 option it may be expanded
- /// for DHCPv4 in the future.
///
/// @return Tuple length field type for the universe this option belongs to.
OpaqueDataTuple::LengthFieldType getLengthFieldType() const {
- return (OpaqueDataTuple::LENGTH_2_BYTES);
+ return (universe_ == Option::V6 ? OpaqueDataTuple::LENGTH_2_BYTES :
+ OpaqueDataTuple::LENGTH_1_BYTE);
}
/// @brief Returns minimal length of the option for the given universe.