BIND 10 trac2304, updated. b617d1a26e4e4fd536b37848b1dd39ff40f5213b [2304] Applied changes suggested in the second code review.

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Oct 17 20:41:59 UTC 2012


The branch, trac2304 has been updated
       via  b617d1a26e4e4fd536b37848b1dd39ff40f5213b (commit)
      from  9062cbabaeebead0b95bde1559d107fc35eeda1d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b617d1a26e4e4fd536b37848b1dd39ff40f5213b
Author: Marcin Siodelski <marcin at isc.org>
Date:   Wed Oct 17 22:41:48 2012 +0200

    [2304] Applied changes suggested in the second code review.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dhcp/option6_int.h        |   12 +++++++++++-
 src/lib/dhcp/option6_int_array.h  |   15 ++++++++++++++-
 src/lib/dhcp/option_definition.cc |   12 ++++++------
 3 files changed, 31 insertions(+), 8 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/option6_int.h b/src/lib/dhcp/option6_int.h
index cdc625e..02df9ab 100644
--- a/src/lib/dhcp/option6_int.h
+++ b/src/lib/dhcp/option6_int.h
@@ -44,6 +44,9 @@ public:
     ///
     /// @param type option type.
     /// @param value option value.
+    ///
+    /// @throw isc::dhcp::InvalidDataType if data field type provided
+    /// as template parameter is not a supported integer type.
     Option6Int(uint16_t type, T value)
         : Option(Option::V6, type), value_(value) {
         if (!OptionDataTypes<T>::valid) {
@@ -62,6 +65,8 @@ public:
     /// @param end iterator to end of option data (first byte after option end).
     ///
     /// @throw isc::OutOfRange if provided buffer is shorter than data size.
+    /// @throw isc::dhcp::InvalidDataType if data field type provided
+    /// as template parameter is not a supported integer type.
     Option6Int(uint16_t type, OptionBufferConstIter begin,
                OptionBufferConstIter end)
         : Option(Option::V6, type) {
@@ -76,7 +81,9 @@ public:
     ///
     /// @param [out] buf buffer (option will be stored here)
     ///
-    /// @throw isc::BadValue if invalid option type has been provided.
+    /// @throw isc::dhcp::InvalidDataType if size of a data field type is not
+    /// equal to 1, 2 or 4 bytes. The data type is not checked in this function
+    /// because it is checked in a constructor.
     void pack(isc::util::OutputBuffer& buf) {
         buf.writeUint16(type_);
         buf.writeUint16(len() - OPTION6_HDR_LEN);
@@ -110,6 +117,9 @@ public:
     /// @param end iterator to end of option data (first byte after option end)
     ///
     /// @throw isc::OutOfRange if provided buffer is shorter than data size.
+    /// @throw isc::dhcp::InvalidDataType if size of a data field type is not
+    /// equal to 1, 2 or 4 bytes. The data type is not checked in this function
+    /// because it is checked in a constructor.
     virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end) {
         if (distance(begin, end) < sizeof(T)) {
             isc_throw(OutOfRange, "Option " << getType() << " truncated");
diff --git a/src/lib/dhcp/option6_int_array.h b/src/lib/dhcp/option6_int_array.h
index a88e539..b6b2369 100644
--- a/src/lib/dhcp/option6_int_array.h
+++ b/src/lib/dhcp/option6_int_array.h
@@ -53,6 +53,9 @@ public:
     /// Creates option with empty values vector.
     ///
     /// @param type option type.
+    ///
+    /// @throw isc::dhcp::InvalidDataType if data field type provided
+    /// as template parameter is not a supported integer type.
     Option6IntArray(uint16_t type)
         : Option(Option::V6, type),
           values_(0) {
@@ -68,6 +71,8 @@ public:
     ///
     /// @throw isc::OutOfRange if provided buffer is empty or its length
     /// is not multiple of size of the data type in bytes.
+    /// @throw isc::dhcp::InvalidDataType if data field type provided
+    /// as template parameter is not a supported integer type.
     Option6IntArray(uint16_t type, const OptionBuffer& buf)
         : Option(Option::V6, type) {
         if (!OptionDataTypes<T>::valid) {
@@ -88,6 +93,8 @@ public:
     ///
     /// @throw isc::OutOfRange if provided buffer is empty or its length
     /// is not multiple of size of the data type in bytes.
+    /// @throw isc::dhcp::InvalidDataType if data field type provided
+    /// as template parameter is not a supported integer type.
     Option6IntArray(uint16_t type, OptionBufferConstIter begin,
                     OptionBufferConstIter end)
         : Option(Option::V6, type) {
@@ -102,7 +109,9 @@ public:
     ///
     /// @param [out] buf buffer (option will be stored here)
     ///
-    /// @throw isc::BadValue if invalid option type has been provided.
+    /// @throw isc::dhcp::InvalidDataType if size of a data fields type is not
+    /// equal to 1, 2 or 4 bytes. The data type is not checked in this function
+    /// because it is checked in a constructor.
     void pack(isc::util::OutputBuffer& buf) {
         buf.writeUint16(type_);
         buf.writeUint16(len() - OPTION6_HDR_LEN);
@@ -138,6 +147,10 @@ public:
     ///
     /// @param begin iterator to first byte of option data
     /// @param end iterator to end of option data (first byte after option end)
+    ///
+    /// @throw isc::dhcp::InvalidDataType if size of a data fields type is not
+    /// equal to 1, 2 or 4 bytes. The data type is not checked in this function
+    /// because it is checked in a constructor.
     virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end) {
         if (distance(begin, end) == 0) {
             isc_throw(OutOfRange, "option " << getType() << " empty");
diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc
index a4d3405..f562316 100644
--- a/src/lib/dhcp/option_definition.cc
+++ b/src/lib/dhcp/option_definition.cc
@@ -165,12 +165,6 @@ OptionDefinition::validate() const {
 
 bool
 OptionDefinition::haveIAx6Format(OptionDefinition::DataType first_type) const {
-    // Expect that IA_NA option format is defined as record.
-    // Although it consists of 3 elements of the same (uint32)
-    // type it can't be defined as array of uint32 elements because
-    // arrays do not impose limitations on number of elements in
-    // the array while this limitation is needed for IA_NA - need
-    // exactly 3 elements.
    return (haveType(RECORD_TYPE) &&
            record_fields_.size() == 3 &&
            record_fields_[0] == first_type &&
@@ -180,6 +174,12 @@ OptionDefinition::haveIAx6Format(OptionDefinition::DataType first_type) const {
 
 bool
 OptionDefinition::haveIA6Format() const {
+    // Expect that IA_NA option format is defined as record.
+    // Although it consists of 3 elements of the same (uint32)
+    // type it can't be defined as array of uint32 elements because
+    // arrays do not impose limitations on number of elements in
+    // the array while this limitation is needed for IA_NA - need
+    // exactly 3 elements.
     return (haveIAx6Format(UINT32_TYPE));
 }
 



More information about the bind10-changes mailing list