template<typename T>
void addArrayDataField(const T value) {
checkArrayType();
-
OptionDataType data_type = definition_.getType();
if (OptionDataTypeTraits<T>::type != data_type) {
isc_throw(isc::dhcp::InvalidDataType,
}
}
+unsigned int
+OptionDataTypeUtil::getLabelCount(const std::string& text_name) {
+ try {
+ isc::dns::Name name(text_name);
+ return (name.getLabelCount());
+ } catch (const isc::Exception& ex) {
+ isc_throw(BadDataTypeCast, ex.what());
+ }
+}
+
std::string
OptionDataTypeUtil::readString(const std::vector<uint8_t>& buf) {
std::string value;
std::vector<uint8_t>& buf,
const bool downcase = false);
+ /// @brief Return the number of labels in the Name.
+ ///
+ /// @param text_name A text representation of the name.
+ ///
+ /// @return A number of labels in the provided name.
+ /// @throw isc::BadCast if provided name is malformed.
+ static unsigned int getLabelCount(const std::string& text_name);
+
/// @brief Read string value from a buffer.
///
/// @param buf input buffer.