///
/// @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) {
/// @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) {
///
/// @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);
/// @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");
/// 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) {
///
/// @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) {
///
/// @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) {
///
/// @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);
///
/// @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");
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 &&
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));
}