From: Marcin Siodelski Date: Fri, 12 Oct 2012 07:28:40 +0000 (+0200) Subject: [2304] Minor additions in comments. X-Git-Tag: trac2402_base~5^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9062cbabaeebead0b95bde1559d107fc35eeda1d;p=thirdparty%2Fkea.git [2304] Minor additions in comments. --- diff --git a/src/lib/dhcp/option6_int.h b/src/lib/dhcp/option6_int.h index f6bf1abede..cdc625ecb4 100644 --- a/src/lib/dhcp/option6_int.h +++ b/src/lib/dhcp/option6_int.h @@ -61,7 +61,7 @@ public: /// @param begin iterator to first byte of option data. /// @param end iterator to end of option data (first byte after option end). /// - /// @todo mention here what it throws. + /// @throw isc::OutOfRange if provided buffer is shorter than data size. Option6Int(uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end) : Option(Option::V6, type) { @@ -108,10 +108,14 @@ 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::OutOfRange if provided buffer is shorter than data size. virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end) { if (distance(begin, end) < sizeof(T)) { isc_throw(OutOfRange, "Option " << getType() << " truncated"); } + // @todo consider what to do if buffer is longer than data type. + // Depending on the data type length we use different utility functions // readUint16 or readUint32 which read the data laid in the network byte // order from the provided buffer. The same functions can be safely used diff --git a/src/lib/dhcp/option6_int_array.h b/src/lib/dhcp/option6_int_array.h index c9531c6581..a88e5392d1 100644 --- a/src/lib/dhcp/option6_int_array.h +++ b/src/lib/dhcp/option6_int_array.h @@ -145,6 +145,8 @@ public: if (distance(begin, end) % sizeof(T) != 0) { isc_throw(OutOfRange, "option " << getType() << " truncated"); } + // @todo consider what to do if buffer is longer than data type. + values_.clear(); while (begin != end) { // Depending on the data type length we use different utility functions