[tlv] improve encapsulation and docs for Tlv::Info (#12301)

This change renames `Tlv::ParsedInfo` to `Tlv::Info` to make it more
concise and to better reflect its purpose as a metadata holder for a
TLV in a message.

The member variables of `Tlv::Info` are made private and public
accessor methods are introduced to interact with the object's
contenet. This helps ensure that the internal representation of the
parsed TLV information is not modified directly by external modules.
All existing caller are updated to use the new name and the public
helper getter methods.

The Doxygen comments of `Tlv::Info` are also improved for better
clarity. Unit test `test_tlv` is also updated to validate all the
new methods.
This commit is contained in:
Abtin Keshavarzian
2026-01-16 16:53:32 -08:00
committed by GitHub
parent b3d3b5c3c7
commit 5f7aa17460
7 changed files with 352 additions and 118 deletions
+3 -3
View File
@@ -2707,7 +2707,7 @@ void Mle::HandleDiscoveryRequest(RxInfo &aRxInfo)
{
Error error = kErrorNone;
bool parsedDiscoveryRequestTlv = false;
Tlv::ParsedInfo tlvInfo;
Tlv::Info tlvInfo;
MeshCoP::DiscoveryRequestTlvValue discoveryRequestTlvValue;
MeshCoP::ExtendedPanId extPanId;
OffsetRange offsetRange;
@@ -2723,12 +2723,12 @@ void Mle::HandleDiscoveryRequest(RxInfo &aRxInfo)
{
SuccessOrExit(error = tlvInfo.ParseFrom(aRxInfo.mMessage, offsetRange));
if (tlvInfo.mIsExtended)
if (tlvInfo.IsExtended())
{
continue;
}
switch (tlvInfo.mType)
switch (tlvInfo.GetType())
{
case MeshCoP::Tlv::kDiscoveryRequest:
SuccessOrExit(error = Tlv::Read<MeshCoP::DiscoveryRequestTlv>(aRxInfo.mMessage, offsetRange.GetOffset(),