if (opt_type == D6O_VENDOR_OPTS) {
if (offset + 4 > length) {
- // Truncated vendor-option. There is expected at least
- // 4 bytes long enterprise-id field. Let's roll back
+ // Truncated vendor-option. We expect at least
+ // 4 bytes for the enterprise-id field. Let's roll back
// option code + option length (4 bytes) and return.
return (offset - 4);
}
continue;
}
-
// Get all definitions with the particular option code. Note
// that option code is non-unique within this container
// however at this point we expect to get one option
while (offset + 1 <= buf.size()) {
// Note that Vendor-Specific info option (RFC3925) has a
// different option format than Vendor-Spec info for
- // DHCPv6. (there's additional layer of data-length
+ // DHCPv6. (there's additional layer of data-length)
uint8_t data_len = buf[offset++];
if (offset + data_len > buf.size()) {
-// Copyright (C) 2011-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
///
/// @param buf Buffer to be parsed.
/// @param option_space A name of the option space which holds definitions
- /// of to be used to parse options in the packets.
+ /// to be used to parse options in the packets.
/// @param options Reference to option container. Options will be
/// put here.
/// @return offset to the first byte after the last successfully parsed option
/// container. The last two parameters are optional and are used in
/// relay parsing. If they are specified, relay-msg option is not created,
/// but rather those two parameters are specified to point out where
- /// the relay-msg option resides and what is its length. This is perfromance
+ /// the relay-msg option resides and what is its length. This is a performance
/// optimization that avoids unnecessary copying of potentially large
/// relay-msg option. It is not used for anything, except in the next
/// iteration its content will be treated as buffer to be parsed.
///
/// @param buf Buffer to be parsed.
/// @param option_space A name of the option space which holds definitions
- /// of to be used to parse options in the packets.
+ /// to be used to parse options in the packets.
/// @param options Reference to option container. Options will be
/// put here.
/// @param relay_msg_offset reference to a size_t structure. If specified,
-// Copyright (C) 2011-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
Pkt4Ptr success(new Pkt4(&orig[0], orig.size()));
EXPECT_NO_THROW(success->unpack());
- // At the exception of END and PAD an option must have a length byte
+ // With the exception of END and PAD an option must have a length byte
vector<uint8_t> nolength = orig;
nolength.resize(orig.size() - 4);
Pkt4Ptr no_length_pkt(new Pkt4(&nolength[0], nolength.size()));
Pkt4Ptr bad_data_len_pkt(new Pkt4(&baddatalen[0], baddatalen.size()));
EXPECT_THROW(bad_data_len_pkt->unpack(), InvalidOptionValue);
- // At the exception of END and PAD, a suboption must have a length byte
+ // A suboption must have a length byte
vector<uint8_t> nolength = orig;
nolength.resize(orig.size() - 4);
nolength[full_len_index] = 11;
Pkt4Ptr no_length_pkt(new Pkt4(&nolength[0], nolength.size()));
EXPECT_THROW(no_length_pkt->unpack(), InvalidOptionValue);
- // Truncated data is not accepted too
+ // Truncated data is not accepted either
vector<uint8_t> shorty = orig;
shorty.resize(orig.size() - 1);
shorty[full_len_index] = 14;
// Let's check a truncated packet. Moderately sane DHCPv6 packet should at
// least have four bytes header. Zero bytes is definitely not a valid one.
OptionBuffer empty(1); // Let's allocate one byte, so we won't be
- // dereferencing and empty buffer.
+ // dereferencing an empty buffer.
Pkt6Ptr empty_pkt(new Pkt6(&empty[0], 0));
EXPECT_THROW(empty_pkt->unpack(), isc::BadValue);