// Depending on the data type length we use different utility functions
// writeUint16 or writeUint32 which write the data in the network byte
// order to the provided buffer. The same functions can be safely used
- // for either unsiged or signed integers so there is not need to create
+ // for either unsigned or signed integers so there is not need to create
// special cases for intX_t types.
switch (OptionDataTypeTraits<T>::len) {
case 1:
// 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
- // for either unsiged or signed integers so there is not need to create
+ // for either unsigned or signed integers so there is not need to create
// special cases for intX_t types.
int data_size_len = OptionDataTypeTraits<T>::len;
switch (data_size_len) {
// Depending on the data type length we use different utility functions
// writeUint16 or writeUint32 which write the data in the network byte
// order to the provided buffer. The same functions can be safely used
- // for either unsiged or signed integers so there is not need to create
+ // for either unsigned or signed integers so there is not need to create
// special cases for intX_t types.
switch (OptionDataTypeTraits<T>::len) {
case 1:
// 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
- // for either unsiged or signed integers so there is not need to create
+ // for either unsigned or signed integers so there is not need to create
// special cases for intX_t types.
int data_size_len = OptionDataTypeTraits<T>::len;
switch (data_size_len) {
///
/// @param def option definition.
/// @param u specifies universe (V4 or V6).
- /// @param def option definition.
/// @param data content of the option.
///
/// @throw OutOfRange if option buffer is truncated.
// Get the option definition type.
OptionDataType data_type = definition_.getType();
- //
if (data_type == OPT_RECORD_TYPE) {
const OptionDefinition::RecordFieldsCollection& record_fields =
definition_.getRecordFields();
virtual void unpack(OptionBufferConstIter begin,
OptionBufferConstIter end);
- /// Returns string representation of the option.
+ /// @brief Returns string representation of the option.
///
/// @param indent number of spaces before printed text.
///
/// @return string with text representation.
virtual std::string toText(int indent = 0);
- /// Returns length of the complete option (data length + DHCPv4/DHCPv6
- /// option header)
+ /// @brief Returns length of the complete option (data length +
+ /// DHCPv4/DHCPv6 option header)
///
/// @return length of the option
virtual uint16_t len();
/// @brief Check if data field index is valid.
///
+ /// @param index Data field index to check.
+ ///
/// @throw isc::OutOfRange if index is out of range.
void checkIndex(const uint32_t index) const;
OptionDataTypeUtil::writeBinary(const std::string& hex_str,
std::vector<uint8_t>& buf) {
// Binary value means that the value is encoded as a string
- // of hexadecimal deigits. We need to decode this string
+ // of hexadecimal digits. We need to decode this string
// to the binary format here.
OptionBuffer binary;
try {
return (false);
}
isc_throw(BadDataTypeCast, "unable to read the buffer as boolean"
- << " value. Inavlid value " << static_cast<int>(buf[0]));
+ << " value. Invalid value " << static_cast<int>(buf[0]));
}
void
/// @brief Get data type buffer length.
///
- /// This functionm returs the size of a particular data type.
+ /// This function returns the size of a particular data type.
/// Values retured by this function correspond to the data type
/// sizes defined in OptionDataTypeTraits (IPV4_ADDRESS_TYPE and
/// IPV6_ADDRESS_TYPE are exceptions here) so they rather indicate
/// the fixed length of the data being written into the buffer,
- /// not the sizeof the particular data type. Thus for data types
+ /// not the size of the particular data type. Thus for data types
/// such as string, binary etc. for which the buffer length can't
/// be determined this function returns 0.
/// In addition, this function returns the data sizes for
return (value);
}
- /// @brief Write integer or unsiged integer value into a buffer.
+ /// @brief Write integer or unsigned integer value into a buffer.
///
/// @param value an integer value to be written into a buffer.
/// @param [out] buf output buffer.
static void readString(const std::vector<uint8_t>& buf,
std::string& value);
- /// @brief Write utf8-encoded string into a buffer.
+ /// @brief Write UTF8-encoded string into a buffer.
///
/// @param value string value to be written into a buffer.
/// @param [out] buf output buffer.
err_str << "binary data field can't be laid before data fields"
<< " of other types.";
}
- /// Empty typy is not allowed within a record.
+ /// Empty type is not allowed within a record.
if (*it == OPT_EMPTY_TYPE) {
err_str << "empty data type can't be stored as a field in an"
<< " option record.";
}
}
- /// @brief Write integer (signed or unsiged) into a buffer.
+ /// @brief Write integer (signed or unsigned) into a buffer.
///
/// @param value integer value.
/// @param [out] buf output buffer.
EXPECT_TRUE(std::equal(buf_in.begin(), buf_in.end(), buf_out.begin()));
}
-// The purpose of this test is to verify that the option definition comprising
-// single boolean value can be used to create an instance of custom option.
+// The purpose of this test is to verify that an option definition comprising
+// a single boolean value can be used to create an instance of custom option.
TEST_F(OptionCustomTest, booleanData) {
OptionDefinition opt_def("OPTION_FOO", 1000, "boolean");