summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcp/option_definition.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/dhcp/option_definition.h')
-rw-r--r--src/lib/dhcp/option_definition.h49
1 files changed, 42 insertions, 7 deletions
diff --git a/src/lib/dhcp/option_definition.h b/src/lib/dhcp/option_definition.h
index b90f5d5a79..e1e89060b2 100644
--- a/src/lib/dhcp/option_definition.h
+++ b/src/lib/dhcp/option_definition.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2017 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
@@ -85,7 +85,9 @@ class OptionIntArray;
/// value. For example, DHCPv6 option 8 comprises a two-byte option code, a
/// two-byte option length and two-byte field that carries a uint16 value
/// (RFC 3315 - http://ietf.org/rfc/rfc3315.txt). In such a case, the option
-/// type is defined as "uint16".
+/// type is defined as "uint16". Length and string tuples are a length
+/// on one (DHCPv4) or two (DHCPv6) bytes followed by a string of
+/// the given length.
///
/// When the option has a more complex structure, the option type may be
/// defined as "array", "record" or even "array of records".
@@ -102,7 +104,7 @@ class OptionIntArray;
/// option type is used. In such cases the data field types within the record
/// are specified using \ref OptionDefinition::addRecordField.
///
-/// When the OptionDefinition object has been sucessfully created, it can be
+/// When the OptionDefinition object has been successfully created, it can be
/// queried to return the appropriate option factory function for the specified
/// specified option format. There are a number of "standard" factory functions
/// that cover well known (common) formats. If the particular format does not
@@ -123,6 +125,7 @@ class OptionIntArray;
/// - "psid" (PSID length / value)
/// - "string"
/// - "fqdn" (fully qualified name)
+/// - "tuple" (length and string)
/// - "record" (set of data fields of different types)
///
/// @todo Extend the comment to describe "generic factories".
@@ -371,6 +374,9 @@ public:
/// @return true if option has the format of OpaqueDataTuples type options.
bool haveOpaqueDataTuplesFormat() const;
+ /// @brief Check if the option has format of CompressedFqdnList options.
+ bool haveCompressedFqdnListFormat() const;
+
/// @brief Option factory.
///
/// This function creates an instance of DHCP option using
@@ -518,6 +524,21 @@ public:
OptionBufferConstIter begin,
OptionBufferConstIter end);
+ /// @brief Factory to create option with tuple list.
+ ///
+ /// @param u option universe (V4 or V6).
+ /// @param type option type.
+ /// @param begin iterator pointing to the beginning of the buffer
+ /// with a list of tuples.
+ /// @param end iterator pointing to the end of the buffer with
+ /// a list of tuples.
+ ///
+ /// @return instance of the DHCP option.
+ static OptionPtr factoryOpaqueDataTuples(Option::Universe u,
+ uint16_t type,
+ OptionBufferConstIter begin,
+ OptionBufferConstIter end);
+
/// @brief Factory function to create option with integer value.
///
/// @param u universe (V4 or V6).
@@ -561,6 +582,19 @@ public:
private:
+ /// @brief Factory function to create option with a compressed FQDN list.
+ ///
+ /// @param u universe (V4 or V6).
+ /// @param type option type.
+ /// @param begin iterator pointing to the beginning of the buffer.
+ /// @param end iterator pointing to the end of the buffer.
+ ///
+ /// @return instance of the DHCP option where FQDNs are uncompressed.
+ /// @throw InvalidOptionValue if data for the option is invalid.
+ OptionPtr factoryFqdnList(Option::Universe u,
+ OptionBufferConstIter begin,
+ OptionBufferConstIter end) const;
+
/// @brief Creates an instance of an option having special format.
///
/// The option with special formats are encapsulated by the dedicated
@@ -624,7 +658,7 @@ private:
/// This function performs lexical cast of a string value to integer
/// value and checks if the resulting value is within a range of a
/// target type. The target type should be one of the supported
- /// integer types.
+ /// integer types. Hexadecimal input is supported.
///
/// @param value_str input value given as string.
/// @tparam T target integer type for lexical cast.
@@ -644,13 +678,14 @@ private:
/// if it is successful it will store the data in the buffer
/// in a binary format.
///
+ /// @param u option universe (V4 or V6).
/// @param value string representation of the value to be written.
/// @param type the actual data type to be stored.
/// @param [in, out] buf buffer where the value is to be stored.
///
/// @throw BadDataTypeCast if data write was unsuccessful.
- void writeToBuffer(const std::string& value, const OptionDataType type,
- OptionBuffer& buf) const;
+ void writeToBuffer(Option::Universe u, const std::string& value,
+ const OptionDataType type, OptionBuffer& buf) const;
/// Option name.
std::string name_;
@@ -658,7 +693,7 @@ private:
uint16_t code_;
/// Option data type.
OptionDataType type_;
- /// Indicates wheter option is a single value or array.
+ /// Indicates whether option is a single value or array.
bool array_type_;
/// Name of the space being encapsulated by this option.
std::string encapsulated_space_;