it != tuples_.end(); ++it) {
it->pack(buf);
}
-
}
void
if (tuple.getLengthFieldType() != getLengthFieldType()) {
isc_throw(isc::BadValue, "attempted to add opaque data tuple having"
" invalid size of the length field "
- << tuple.getDataFieldSize() << " to Vendor Class option");
+ << tuple.getDataFieldSize() << " to opaque data tuple option");
}
tuples_.push_back(tuple);
OptionOpaqueDataTuples::setTuple(const size_t at, const OpaqueDataTuple& tuple) {
if (at >= getTuplesNum()) {
isc_throw(isc::OutOfRange, "attempted to set an opaque data for the"
- " vendor option at position " << at << " which is out of"
- " range");
+ " opaque data tuple option at position " << at << " which"
+ " is out of range");
} else if (tuple.getLengthFieldType() != getLengthFieldType()) {
isc_throw(isc::BadValue, "attempted to set opaque data tuple having"
" invalid size of the length field "
- << tuple.getDataFieldSize() << " to Vendor Class option");
+ << tuple.getDataFieldSize() << " to opaque data tuple option");
}
tuples_[at] = tuple;
OptionOpaqueDataTuples::getTuple(const size_t at) const {
if (at >= getTuplesNum()) {
isc_throw(isc::OutOfRange, "attempted to get an opaque data for the"
- " vendor option at position " << at << " which is out of"
- " range. There are only " << getTuplesNum() << " tuples");
+ " opaque data tuple option at position " << at << " which is"
+ " out of range. There are only " << getTuplesNum() << " tuples");
}
return (tuples_[at]);
}
return (false);
}
-
uint16_t
OptionOpaqueDataTuples::len() {
// The option starts with the header.
// Apply indentation
s << std::string(indent, ' ');
-
-
// Print type and length
s << "type=" << getType() << ", len=" << len() - getHeaderLen() << std::dec;
// Iterate over all tuples and print their size and contents.
/// be used for an option such as DHCPv6 Bootfile Parameters (60).
///
/// @param u universe (v4 or v6).
- /// @param type option type
+ /// @param type option type
OptionOpaqueDataTuples(Option::Universe u, const uint16_t type);
/// @brief Constructor.
/// on-wire data. It may throw an exception if the @c unpack method throws.
///
/// @param u universe (v4 or v6)
- /// @param type option type
+ /// @param type option type
/// @param begin Iterator pointing to the beginning of the buffer holding an
/// option.
/// @param end Iterator pointing to the end of the buffer holding an option.
/// This function returns the length field type which should be used
/// for the opaque data tuples being added to this option.
/// Currently this class is only used for a DHCPv6 option it may be expanded
- /// for DHCPv4 in the future
+ /// for DHCPv4 in the future.
///
/// @return Tuple length field type for the universe this option belongs to.
OpaqueDataTuple::LengthFieldType getLengthFieldType() const {
/// @brief Returns minimal length of the option for the given universe.
/// Currently this class is only used for a DHCPv6 option it may be expanded
- /// for DHCPv4 in the future
+ /// for DHCPv4 in the future.
uint16_t getMinimalLength() const {
return (4);
}
// is correctly parsed.
TEST(OptionOpaqueDataTuples, unpack6EmptyTuple) {
// Prepare data to decode.
- const uint8_t buf_data[] = {
- 0x00, 0x00 // tuple length is 0
- };
+ const uint8_t buf_data[] = {0x00, 0x00}; // tuple length is 0
OptionBuffer buf(buf_data, buf_data + sizeof(buf_data));
OptionOpaqueDataTuplesPtr data_tuple;
}
} // end of anonymous namespace
-