[tlv] helper methods to read/find/append TLVs with UTF8 string value (#8417)

This commit adds new methods in `Tlv` to read, find, or append simple
TLVs with a UTF8 string value. `StringTlvInfo<Type, kMaxStringLen>`
can be used to define constants and types for such TLVs. This helps
simplify implementation of many such TLVs, e.g., Vendor Name TLV,
Provisioning URL TLV, Network Name TLV, etc.
This commit is contained in:
Abtin Keshavarzian
2022-11-18 19:49:20 -08:00
committed by GitHub
parent 411a20a62b
commit faeea3d2b9
7 changed files with 192 additions and 349 deletions
+2 -5
View File
@@ -664,11 +664,8 @@ Error Manager::SendBackboneAnswer(const Ip6::Address & aDstAddr,
SuccessOrExit(error = Tlv::Append<ThreadLastTransactionTimeTlv>(*message, aTimeSinceLastTransaction));
{
const MeshCoP::NameData nameData = Get<MeshCoP::NetworkNameManager>().GetNetworkName().GetAsData();
SuccessOrExit(error = Tlv::Append<ThreadNetworkNameTlv>(*message, nameData.GetBuffer(), nameData.GetLength()));
}
SuccessOrExit(error = Tlv::Append<ThreadNetworkNameTlv>(
*message, Get<MeshCoP::NetworkNameManager>().GetNetworkName().GetAsCString()));
if (aSrcRloc16 != Mac::kShortAddrInvalid)
{
+58 -11
View File
@@ -176,6 +176,23 @@ exit:
return error;
}
Error Tlv::ReadStringTlv(const Message &aMessage, uint16_t aOffset, uint8_t aMaxStringLength, char *aValue)
{
Error error = kErrorNone;
uint16_t valueOffset;
uint16_t length;
SuccessOrExit(error = ReadTlv(aMessage, aOffset, length, valueOffset));
length = Min(length, static_cast<uint16_t>(aMaxStringLength));
aMessage.ReadBytes(valueOffset, aValue, length);
aValue[length + 1] = '\0';
exit:
return error;
}
template <typename UintType> Error Tlv::ReadUintTlv(const Message &aMessage, uint16_t aOffset, UintType &aValue)
{
Error error;
@@ -192,41 +209,64 @@ template Error Tlv::ReadUintTlv<uint8_t>(const Message &aMessage, uint16_t aOffs
template Error Tlv::ReadUintTlv<uint16_t>(const Message &aMessage, uint16_t aOffset, uint16_t &aValue);
template Error Tlv::ReadUintTlv<uint32_t>(const Message &aMessage, uint16_t aOffset, uint32_t &aValue);
Error Tlv::ReadTlvValue(const Message &aMessage, uint16_t aOffset, void *aValue, uint8_t aMinLength)
Error Tlv::ReadTlv(const Message &aMessage, uint16_t aOffset, uint16_t &aLength, uint16_t &aValueOffset)
{
Error error = kErrorNone;
Error error;
Tlv tlv;
uint16_t valueOffset;
uint16_t length;
uint32_t size;
SuccessOrExit(error = aMessage.Read(aOffset, tlv));
if (!tlv.IsExtended())
{
valueOffset = aOffset + sizeof(Tlv);
length = tlv.GetLength();
size = sizeof(Tlv) + length;
aValueOffset = aOffset + sizeof(Tlv);
aLength = tlv.GetLength();
size = sizeof(Tlv) + aLength;
}
else
{
ExtendedTlv extTlv;
SuccessOrExit(error = aMessage.Read(aOffset, extTlv));
valueOffset = aOffset + sizeof(ExtendedTlv);
length = extTlv.GetLength();
size = sizeof(ExtendedTlv) + length;
aValueOffset = aOffset + sizeof(ExtendedTlv);
aLength = extTlv.GetLength();
size = sizeof(ExtendedTlv) + aLength;
}
VerifyOrExit(length >= aMinLength, error = kErrorParse);
VerifyOrExit(aOffset + size <= aMessage.GetLength(), error = kErrorParse);
exit:
return error;
}
Error Tlv::ReadTlvValue(const Message &aMessage, uint16_t aOffset, void *aValue, uint8_t aMinLength)
{
Error error;
uint16_t valueOffset;
uint16_t length;
SuccessOrExit(error = ReadTlv(aMessage, aOffset, length, valueOffset));
VerifyOrExit(length >= aMinLength, error = kErrorParse);
aMessage.ReadBytes(valueOffset, aValue, aMinLength);
exit:
return error;
}
Error Tlv::FindStringTlv(const Message &aMessage, uint8_t aType, uint8_t aMaxStringLength, char *aValue)
{
Error error = kErrorNone;
uint16_t offset;
SuccessOrExit(error = FindTlvOffset(aMessage, aType, offset));
error = ReadStringTlv(aMessage, offset, aMaxStringLength, aValue);
exit:
return error;
}
template <typename UintType> Error Tlv::FindUintTlv(const Message &aMessage, uint8_t aType, UintType &aValue)
{
Error error = kErrorNone;
@@ -258,6 +298,13 @@ exit:
return error;
}
Error Tlv::AppendStringTlv(Message &aMessage, uint8_t aType, uint8_t aMaxStringLength, const char *aValue)
{
uint16_t length = (aValue == nullptr) ? 0 : StringLength(aValue, aMaxStringLength);
return AppendTlv(aMessage, aType, aValue, static_cast<uint8_t>(length));
}
template <typename UintType> Error Tlv::AppendUintTlv(Message &aMessage, uint8_t aType, UintType aValue)
{
UintType value = Encoding::BigEndian::HostSwap<UintType>(aValue);
+91
View File
@@ -228,6 +228,25 @@ public:
return ReadUintTlv(aMessage, aOffset, aValue);
}
/**
* This static method reads a simple TLV with a UTF-8 string value in a message at a given offset.
*
* @tparam StringTlvType The simple TLV type to read (must be a sub-class of `StringTlvInfo`).
*
* @param[in] aMessage The message to read from.
* @param[in] aOffset The offset into the message pointing to the start of the TLV.
* @param[out] aValue A reference to the string buffer to output the read value.
*
* @retval kErrorNone Successfully read the TLV and updated the @p aValue.
* @retval kErrorParse The TLV was not well-formed and could not be parsed.
*
*/
template <typename StringTlvType>
static Error Read(const Message &aMessage, uint16_t aOffset, typename StringTlvType::StringType &aValue)
{
return ReadStringTlv(aMessage, aOffset, StringTlvType::kMaxStringLength, aValue);
}
/**
* This static method searches for and reads a requested TLV out of a given message.
*
@@ -369,6 +388,32 @@ public:
return FindUintTlv(aMessage, UintTlvType::kType, aValue);
}
/**
* This static method searches for a simple TLV with a UTF-8 string value in a message, and then reads its value
* into a given string buffer.
*
* If the TLV length is longer than maximum string length specified by `StringTlvType::kMaxStringLength` then
* only up to maximum length is read and returned. In this case `kErrorNone` is returned.
*
* The returned string in @p aValue is always null terminated.`StringTlvType::StringType` MUST have at least
* `kMaxStringLength + 1` chars.
*
* @tparam StringTlvType The simple TLV type to find (must be a sub-class of `StringTlvInfo`)
*
* @param[in] aMessage A reference to the message.
* @param[out] aValue A reference to a string buffer to output the TLV's value.
*
* @retval kErrorNone The TLV was found and read successfully. @p aValue is updated.
* @retval kErrorNotFound Could not find the TLV with Type @p aType.
* @retval kErrorParse TLV was found but it was not well-formed and could not be parsed.
*
*/
template <typename StringTlvType>
static Error Find(const Message &aMessage, typename StringTlvType::StringType &aValue)
{
return FindStringTlv(aMessage, StringTlvType::kType, StringTlvType::kMaxStringLength, aValue);
}
/**
* This static method appends a TLV with a given type and value to a message.
*
@@ -428,13 +473,41 @@ public:
return AppendUintTlv(aMessage, UintTlvType::kType, aValue);
}
/**
* This static method appends a simple TLV with a single UTF-8 string value to a message.
*
* On success this method grows the message by the size of the TLV.
*
* If the passed in @p aValue string length is longer than the maximum allowed length for the TLV as specified by
* `StringTlvType::kMaxStringLength`, the first maximum length chars are appended.
*
* The @p aValue can be `nullptr` in which case it is treated as an empty string.
*
* @tparam StringTlvType The simple TLV type to append (must be a sub-class of `StringTlvInfo`)
*
* @param[in] aMessage A reference to the message to append to.
* @param[in] aValue A pointer to a C string to append as TLV's value.
*
* @retval kErrorNone Successfully appended the TLV to the message.
* @retval kErrorNoBufs Insufficient available buffers to grow the message.
*
*/
template <typename StringTlvType> static Error Append(Message &aMessage, const char *aValue)
{
return AppendStringTlv(aMessage, StringTlvType::kType, StringTlvType::kMaxStringLength, aValue);
}
protected:
static const uint8_t kExtendedLength = 255; // Extended Length value.
private:
static Error ReadTlv(const Message &aMessage, uint16_t aOffset, uint16_t &aLength, uint16_t &aValueOffset);
static Error Find(const Message &aMessage, uint8_t aType, uint16_t *aOffset, uint16_t *aSize, bool *aIsExtendedTlv);
static Error FindTlv(const Message &aMessage, uint8_t aType, void *aValue, uint8_t aLength);
static Error AppendTlv(Message &aMessage, uint8_t aType, const void *aValue, uint8_t aLength);
static Error ReadStringTlv(const Message &aMessage, uint16_t aOffset, uint8_t aMaxStringLength, char *aValue);
static Error FindStringTlv(const Message &aMessage, uint8_t aType, uint8_t aMaxStringLength, char *aValue);
static Error AppendStringTlv(Message &aMessage, uint8_t aType, uint8_t aMaxStringLength, const char *aValue);
template <typename UintType> static Error ReadUintTlv(const Message &aMessage, uint16_t aOffset, UintType &aValue);
template <typename UintType> static Error FindUintTlv(const Message &aMessage, uint8_t aType, UintType &aValue);
template <typename UintType> static Error AppendUintTlv(Message &aMessage, uint8_t aType, UintType aValue);
@@ -585,6 +658,24 @@ public:
typedef TlvValueType ValueType; ///< The TLV Value type.
};
/**
* This class defines constants and types for a simple TLV with a UTF-8 string value.
*
* This class and its sub-classes are intended to be used as the template type in `Tlv::Append<StringTlvType>()`,
* and the related `Tlv::Find<StringTlvType>()` and `Tlv::Read<StringTlvType>()`.
*
* @tparam kTlvTypeValue The TLV Type value.
* @tparam kTlvMaxValueLength The maximum allowed string length (as TLV value).
*
*/
template <uint8_t kTlvTypeValue, uint8_t kTlvMaxValueLength> class StringTlvInfo : public TlvInfo<kTlvTypeValue>
{
public:
static constexpr uint8_t kMaxStringLength = kTlvMaxValueLength; ///< Maximum string length.
typedef char StringType[kMaxStringLength + 1]; ///< String buffer for TLV value.
};
} // namespace ot
#endif // TLVS_HPP_
+12 -7
View File
@@ -1033,22 +1033,27 @@ void Commissioner::HandleTmf<kUriJoinerFinalize>(Coap::Message &aMessage, const
{
OT_UNUSED_VARIABLE(aMessageInfo);
StateTlv::State state = StateTlv::kAccept;
ProvisioningUrlTlv provisioningUrl;
StateTlv::State state = StateTlv::kAccept;
ProvisioningUrlTlv::StringType provisioningUrl;
VerifyOrExit(mState == kStateActive);
LogInfo("received joiner finalize");
if (Tlv::FindTlv(aMessage, provisioningUrl) == kErrorNone)
switch (Tlv::Find<ProvisioningUrlTlv>(aMessage, provisioningUrl))
{
uint8_t len = static_cast<uint8_t>(StringLength(mProvisioningUrl, sizeof(mProvisioningUrl)));
if ((provisioningUrl.GetProvisioningUrlLength() != len) ||
(memcmp(provisioningUrl.GetProvisioningUrl(), mProvisioningUrl, len) != 0))
case kErrorNone:
if (!StringMatch(provisioningUrl, mProvisioningUrl))
{
state = StateTlv::kReject;
}
break;
case kErrorNotFound:
break;
default:
ExitNow();
}
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
+6 -24
View File
@@ -434,11 +434,7 @@ Error Joiner::PrepareJoinerFinalizeMessage(const char *aProvisioningUrl,
const char *aVendorData)
{
Error error = kErrorNone;
VendorNameTlv vendorNameTlv;
VendorModelTlv vendorModelTlv;
VendorSwVersionTlv vendorSwVersionTlv;
VendorStackVersionTlv vendorStackVersionTlv;
ProvisioningUrlTlv provisioningUrlTlv;
mFinalizeMessage = Get<Tmf::SecureAgent>().NewPriorityConfirmablePostMessage(kUriJoinerFinalize);
VerifyOrExit(mFinalizeMessage != nullptr, error = kErrorNoBufs);
@@ -447,17 +443,9 @@ Error Joiner::PrepareJoinerFinalizeMessage(const char *aProvisioningUrl,
SuccessOrExit(error = Tlv::Append<StateTlv>(*mFinalizeMessage, StateTlv::kAccept));
vendorNameTlv.Init();
vendorNameTlv.SetVendorName(aVendorName);
SuccessOrExit(error = vendorNameTlv.AppendTo(*mFinalizeMessage));
vendorModelTlv.Init();
vendorModelTlv.SetVendorModel(aVendorModel);
SuccessOrExit(error = vendorModelTlv.AppendTo(*mFinalizeMessage));
vendorSwVersionTlv.Init();
vendorSwVersionTlv.SetVendorSwVersion(aVendorSwVersion);
SuccessOrExit(error = vendorSwVersionTlv.AppendTo(*mFinalizeMessage));
SuccessOrExit(error = Tlv::Append<VendorNameTlv>(*mFinalizeMessage, aVendorName));
SuccessOrExit(error = Tlv::Append<VendorModelTlv>(*mFinalizeMessage, aVendorModel));
SuccessOrExit(error = Tlv::Append<VendorSwVersionTlv>(*mFinalizeMessage, aVendorSwVersion));
vendorStackVersionTlv.Init();
vendorStackVersionTlv.SetOui(OPENTHREAD_CONFIG_STACK_VENDOR_OUI);
@@ -468,18 +456,12 @@ Error Joiner::PrepareJoinerFinalizeMessage(const char *aProvisioningUrl,
if (aVendorData != nullptr)
{
VendorDataTlv vendorDataTlv;
vendorDataTlv.Init();
vendorDataTlv.SetVendorData(aVendorData);
SuccessOrExit(error = vendorDataTlv.AppendTo(*mFinalizeMessage));
SuccessOrExit(error = Tlv::Append<VendorDataTlv>(*mFinalizeMessage, aVendorData));
}
provisioningUrlTlv.Init();
provisioningUrlTlv.SetProvisioningUrl(aProvisioningUrl);
if (provisioningUrlTlv.GetLength() > 0)
if (aProvisioningUrl != nullptr)
{
SuccessOrExit(error = provisioningUrlTlv.AppendTo(*mFinalizeMessage));
SuccessOrExit(error = Tlv::Append<ProvisioningUrlTlv>(*mFinalizeMessage, aProvisioningUrl));
}
exit:
+21 -301
View File
@@ -120,6 +120,17 @@ public:
kJoinerAdvertisement = OT_MESHCOP_TLV_JOINERADVERTISEMENT, ///< Joiner Advertisement TLV
};
/**
* Max length of Provisioning URL TLV.
*
*/
static constexpr uint8_t kMaxkProvisioningUrlLength = OT_PROVISIONING_URL_MAX_SIZE;
static constexpr uint8_t kMaxVendorNameLength = 32; ///< Max length of Vendor Name TLV.
static constexpr uint8_t kMaxVendorModelLength = 32; ///< Max length of Vendor Model TLV.
static constexpr uint8_t kMaxVendorSwVersionLength = 16; ///< Max length of Vendor SW Version TLV.
static constexpr uint8_t kMaxVendorDataLength = 64; ///< Max length of Vendor Data TLV.
/**
* This method returns the Type value.
*
@@ -1545,325 +1556,34 @@ private:
} OT_TOOL_PACKED_END;
/**
* This class implements Provisioning URL TLV generation and parsing.
* This class defines Provisioning TLV constants and types.
*
*/
OT_TOOL_PACKED_BEGIN
class ProvisioningUrlTlv : public Tlv, public TlvInfo<Tlv::kProvisioningUrl>
{
public:
/**
* Maximum number of chars in the Provisioning URL string.
*
*/
static constexpr uint16_t kMaxLength = OT_PROVISIONING_URL_MAX_SIZE;
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kProvisioningUrl);
SetLength(0);
}
/*
* This method returns the Provisioning URL length.
*
* @returns The Provisioning URL length.
*
*/
uint8_t GetProvisioningUrlLength(void) const
{
return GetLength() <= sizeof(mProvisioningUrl) ? GetLength() : sizeof(mProvisioningUrl);
}
/**
* This method indicates whether or not the TLV appears to be well-formed.
*
* @retval TRUE If the TLV appears to be well-formed.
* @retval FALSE If the TLV does not appear to be well-formed.
*
*/
bool IsValid(void) const
{
return GetType() == kProvisioningUrl && mProvisioningUrl[GetProvisioningUrlLength()] == '\0';
}
/**
* This method returns the Provisioning URL value.
*
* @returns The Provisioning URL value.
*
*/
const char *GetProvisioningUrl(void) const { return mProvisioningUrl; }
/**
* This method sets the Provisioning URL value.
*
* @param[in] aProvisioningUrl A pointer to the Provisioning URL value.
*
*/
void SetProvisioningUrl(const char *aProvisioningUrl)
{
uint16_t len = aProvisioningUrl ? StringLength(aProvisioningUrl, kMaxLength) : 0;
SetLength(static_cast<uint8_t>(len));
if (len > 0)
{
memcpy(mProvisioningUrl, aProvisioningUrl, len);
}
}
private:
char mProvisioningUrl[kMaxLength];
} OT_TOOL_PACKED_END;
typedef StringTlvInfo<Tlv::kProvisioningUrl, Tlv::kMaxkProvisioningUrlLength> ProvisioningUrlTlv;
/**
* This class implements Vendor Name TLV generation and parsing.
* This class defines Vendor Name TLV constants and types.
*
*/
OT_TOOL_PACKED_BEGIN
class VendorNameTlv : public Tlv, public TlvInfo<Tlv::kVendorName>
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kVendorName);
SetLength(0);
}
/**
* This method returns the Vendor Name length.
*
* @returns The Vendor Name length.
*
*/
uint8_t GetVendorNameLength(void) const
{
return GetLength() <= sizeof(mVendorName) ? GetLength() : sizeof(mVendorName);
}
/**
* This method returns the Vendor Name value.
*
* @returns The Vendor Name value.
*
*/
const char *GetVendorName(void) const { return mVendorName; }
/**
* This method sets the Vendor Name value.
*
* @param[in] aVendorName A pointer to the Vendor Name value.
*
*/
void SetVendorName(const char *aVendorName)
{
uint16_t len = (aVendorName == nullptr) ? 0 : StringLength(aVendorName, sizeof(mVendorName));
SetLength(static_cast<uint8_t>(len));
if (len > 0)
{
memcpy(mVendorName, aVendorName, len);
}
}
private:
static constexpr uint8_t kMaxLength = 32;
char mVendorName[kMaxLength];
} OT_TOOL_PACKED_END;
typedef StringTlvInfo<Tlv::kVendorName, Tlv::kMaxVendorNameLength> VendorNameTlv;
/**
* This class implements Vendor Model TLV generation and parsing.
* This class defines Vendor Model TLV constants and types.
*
*/
OT_TOOL_PACKED_BEGIN
class VendorModelTlv : public Tlv, public TlvInfo<Tlv::kVendorModel>
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kVendorModel);
SetLength(0);
}
/**
* This method returns the Vendor Model length.
*
* @returns The Vendor Model length.
*
*/
uint8_t GetVendorModelLength(void) const
{
return GetLength() <= sizeof(mVendorModel) ? GetLength() : sizeof(mVendorModel);
}
/**
* This method returns the Vendor Model value.
*
* @returns The Vendor Model value.
*
*/
const char *GetVendorModel(void) const { return mVendorModel; }
/**
* This method sets the Vendor Model value.
*
* @param[in] aVendorModel A pointer to the Vendor Model value.
*
*/
void SetVendorModel(const char *aVendorModel)
{
uint16_t len = (aVendorModel == nullptr) ? 0 : StringLength(aVendorModel, sizeof(mVendorModel));
SetLength(static_cast<uint8_t>(len));
if (len > 0)
{
memcpy(mVendorModel, aVendorModel, len);
}
}
private:
static constexpr uint8_t kMaxLength = 32;
char mVendorModel[kMaxLength];
} OT_TOOL_PACKED_END;
typedef StringTlvInfo<Tlv::kVendorModel, Tlv::kMaxVendorModelLength> VendorModelTlv;
/**
* This class implements Vendor SW Version TLV generation and parsing.
* This class defines Vendor SW Version TLV constants and types.
*
*/
OT_TOOL_PACKED_BEGIN
class VendorSwVersionTlv : public Tlv, public TlvInfo<Tlv::kVendorSwVersion>
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kVendorSwVersion);
SetLength(0);
}
/**
* This method returns the Vendor SW Version length.
*
* @returns The Vendor SW Version length.
*
*/
uint8_t GetVendorSwVersionLength(void) const
{
return GetLength() <= sizeof(mVendorSwVersion) ? GetLength() : sizeof(mVendorSwVersion);
}
/**
* This method returns the Vendor SW Version value.
*
* @returns The Vendor SW Version value.
*
*/
const char *GetVendorSwVersion(void) const { return mVendorSwVersion; }
/**
* This method sets the Vendor SW Version value.
*
* @param[in] aVendorSwVersion A pointer to the Vendor SW Version value.
*
*/
void SetVendorSwVersion(const char *aVendorSwVersion)
{
uint16_t len = (aVendorSwVersion == nullptr) ? 0 : StringLength(aVendorSwVersion, sizeof(mVendorSwVersion));
SetLength(static_cast<uint8_t>(len));
if (len > 0)
{
memcpy(mVendorSwVersion, aVendorSwVersion, len);
}
}
private:
static constexpr uint8_t kMaxLength = 16;
char mVendorSwVersion[kMaxLength];
} OT_TOOL_PACKED_END;
typedef StringTlvInfo<Tlv::kVendorSwVersion, Tlv::kMaxVendorSwVersionLength> VendorSwVersionTlv;
/**
* This class implements Vendor Data TLV generation and parsing.
* This class defines Vendor Data TLV constants and types.
*
*/
OT_TOOL_PACKED_BEGIN
class VendorDataTlv : public Tlv, public TlvInfo<Tlv::kVendorData>
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kVendorData);
SetLength(0);
}
/**
* This method returns the Vendor Data length.
*
* @returns The Vendor Data length.
*
*/
uint8_t GetVendorDataLength(void) const
{
return GetLength() <= sizeof(mVendorData) ? GetLength() : sizeof(mVendorData);
}
/**
* This method returns the Vendor Data value.
*
* @returns The Vendor Data value.
*
*/
const char *GetVendorData(void) const { return mVendorData; }
/**
* This method sets the Vendor Data value.
*
* @param[in] aVendorData A pointer to the Vendor Data value.
*
*/
void SetVendorData(const char *aVendorData)
{
uint16_t len = (aVendorData == nullptr) ? 0 : StringLength(aVendorData, sizeof(mVendorData));
SetLength(static_cast<uint8_t>(len));
if (len > 0)
{
memcpy(mVendorData, aVendorData, len);
}
}
private:
static constexpr uint8_t kMaxLength = 64;
char mVendorData[kMaxLength];
} OT_TOOL_PACKED_END;
typedef StringTlvInfo<Tlv::kVendorData, Tlv::kMaxVendorDataLength> VendorDataTlv;
/**
* This class implements Vendor Stack Version TLV generation and parsing.
+2 -1
View File
@@ -39,6 +39,7 @@
#include "common/encoding.hpp"
#include "common/message.hpp"
#include "common/tlvs.hpp"
#include "meshcop/network_name.hpp"
#include "net/ip6_address.hpp"
#include "thread/mle.hpp"
#include "thread/mle_types.hpp"
@@ -136,7 +137,7 @@ typedef UintTlvInfo<ThreadTlv::kTimeout, uint32_t> ThreadTimeoutTlv;
* This class defines Network Name TLV constants and types.
*
*/
typedef TlvInfo<ThreadTlv::kNetworkName> ThreadNetworkNameTlv;
typedef StringTlvInfo<ThreadTlv::kNetworkName, MeshCoP::NetworkName::kMaxSize> ThreadNetworkNameTlv;
/**
* This class defines Commissioner Session ID TLV constants and types.