From 3a1f56f53a5d2b3b4d2458deb5af31a0edc713c6 Mon Sep 17 00:00:00 2001 From: Piotrek Zadroga Date: Thu, 9 Mar 2023 11:31:46 +0100 Subject: [PATCH] [#939] Updating comments and documentation --- src/lib/dhcp/option_definition.cc | 3 +-- src/lib/dhcp/option_definition.h | 3 ++- src/lib/dhcp/option_opaque_data_tuples.cc | 2 +- src/lib/dhcp/option_opaque_data_tuples.h | 16 +++++++++------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc index 8868e062b5..a9a6929eab 100644 --- a/src/lib/dhcp/option_definition.cc +++ b/src/lib/dhcp/option_definition.cc @@ -776,8 +776,7 @@ OptionDefinition::factoryOpaqueDataTuples(Option::Universe u, uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end, - OpaqueDataTuple::LengthFieldType lenFieldType - ) { + OpaqueDataTuple::LengthFieldType lenFieldType) { boost::shared_ptr option(new OptionOpaqueDataTuples(u, type, begin, end, lenFieldType)); diff --git a/src/lib/dhcp/option_definition.h b/src/lib/dhcp/option_definition.h index 678e18bb31..5d07396476 100644 --- a/src/lib/dhcp/option_definition.h +++ b/src/lib/dhcp/option_definition.h @@ -581,7 +581,8 @@ public: OptionBufferConstIter begin, OptionBufferConstIter end); - /// @brief Factory to create option with tuple list with explict tuple's length field type. + /// @brief Factory to create option with tuple list with explict + /// tuple's length field type. /// /// @param u option universe (V4 or V6). /// @param type option type. diff --git a/src/lib/dhcp/option_opaque_data_tuples.cc b/src/lib/dhcp/option_opaque_data_tuples.cc index 655027b2e2..967b9d31b3 100644 --- a/src/lib/dhcp/option_opaque_data_tuples.cc +++ b/src/lib/dhcp/option_opaque_data_tuples.cc @@ -33,7 +33,7 @@ OptionOpaqueDataTuples::OptionOpaqueDataTuples(Option::Universe u, OptionBufferConstIter end, OpaqueDataTuple::LengthFieldType lenFieldType) : Option(u, type) { - prefLenFieldType = lenFieldType; + prefLenFieldType_ = lenFieldType; unpack(begin, end); } diff --git a/src/lib/dhcp/option_opaque_data_tuples.h b/src/lib/dhcp/option_opaque_data_tuples.h index f1248f59d9..4f74b5d441 100644 --- a/src/lib/dhcp/option_opaque_data_tuples.h +++ b/src/lib/dhcp/option_opaque_data_tuples.h @@ -64,8 +64,10 @@ public: /// @brief Constructor. /// - /// This constructor creates an instance of the option using a buffer with - /// on-wire data. It may throw an exception if the @c unpack method throws. + /// This constructor creates an instance of an OpaqueDataTuple option using + /// a buffer with on-wire data. This constructor allows to explicitly set + /// tuple's length field type. + /// It may throw an exception if the @c unpack method throws. /// /// @param u universe (v4 or v6) /// @param type option type @@ -154,9 +156,9 @@ public: private: /// @brief holds information of explicitly assigned tuple length field. /// Normally tuple length is evaluated basing on Option's universe. - /// But there may be cases when e.g. for v4 universe tuple length field is 2 bytes long - /// (e.g. DHCPv4 SZTP Redirect Option #143 bootstrap-server-list). - OpaqueDataTuple::LengthFieldType prefLenFieldType = OpaqueDataTuple::LENGTH_EMPTY; + /// But there may be cases when e.g. for v4 universe tuple length field + /// is 2 bytes long (e.g. DHCPv4 SZTP Redirect Option #143 bootstrap-server-list). + OpaqueDataTuple::LengthFieldType prefLenFieldType_ = OpaqueDataTuple::LENGTH_EMPTY; /// @brief Returns the tuple length field type for the given universe. /// @@ -165,8 +167,8 @@ private: /// /// @return Tuple length field type for the universe this option belongs to. OpaqueDataTuple::LengthFieldType getLengthFieldType() const { - if (prefLenFieldType != OpaqueDataTuple::LENGTH_EMPTY) { - return (prefLenFieldType); + if (prefLenFieldType_ != OpaqueDataTuple::LENGTH_EMPTY) { + return (prefLenFieldType_); } return (universe_ == Option::V6 ? OpaqueDataTuple::LENGTH_2_BYTES : OpaqueDataTuple::LENGTH_1_BYTE); -- 2.47.2