diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 209a5f1cc..2a87fcb98 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -1282,7 +1282,7 @@ Error Mle::SendChildUpdateResponse(const TlvList &aTlvList, break; case Tlv::kStatus: - SuccessOrExit(error = message->AppendStatusTlv(StatusTlv::kError)); + SuccessOrExit(error = message->AppendStatusTlv(kStatusError)); break; case Tlv::kAddressRegistration: @@ -2249,7 +2249,7 @@ void Mle::HandleChildUpdateRequestOnChild(RxInfo &aRxInfo) switch (Tlv::Find(aRxInfo.mMessage, status)) { case kErrorNone: - VerifyOrExit(status != StatusTlv::kError, IgnoreError(BecomeDetached())); + VerifyOrExit(status != kStatusError, IgnoreError(BecomeDetached())); break; case kErrorNotFound: break; @@ -3539,7 +3539,7 @@ Error Mle::TxMessage::AppendSourceAddressTlv(void) return Tlv::Append(*this, Get().GetRloc16()); } -Error Mle::TxMessage::AppendStatusTlv(StatusTlv::Status aStatus) { return Tlv::Append(*this, aStatus); } +Error Mle::TxMessage::AppendStatusTlv(Status aStatus) { return Tlv::Append(*this, aStatus); } Error Mle::TxMessage::AppendModeTlv(DeviceMode aMode) { return Tlv::Append(*this, aMode.Get()); } diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index 5f5f6a4e4..eba1b5b09 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -1542,7 +1542,7 @@ private: Error AppendTlvRequestTlv(const uint8_t *aTlvs, uint8_t aTlvsLength); Error AppendLeaderDataTlv(void); Error AppendScanMaskTlv(uint8_t aScanMask); - Error AppendStatusTlv(StatusTlv::Status aStatus); + Error AppendStatusTlv(Status aStatus); Error AppendLinkMarginTlv(uint8_t aLinkMargin); Error AppendVersionTlv(void); Error AppendAddressRegistrationTlv(AddressRegistrationMode aMode = kAppendAllAddresses); diff --git a/src/core/thread/mle_ftd.cpp b/src/core/thread/mle_ftd.cpp index 1772f876f..54c2743f1 100644 --- a/src/core/thread/mle_ftd.cpp +++ b/src/core/thread/mle_ftd.cpp @@ -2488,7 +2488,7 @@ void Mle::HandleChildUpdateResponseOnParent(RxInfo &aRxInfo) switch (Tlv::Find(aRxInfo.mMessage, status)) { case kErrorNone: - VerifyOrExit(status != StatusTlv::kError, RemoveNeighbor(*child)); + VerifyOrExit(status != kStatusError, RemoveNeighbor(*child)); break; case kErrorNotFound: break; @@ -3029,7 +3029,7 @@ void Mle::SendChildUpdateResponseToChild(Child *aChild, switch (tlvType) { case Tlv::kStatus: - SuccessOrExit(error = message->AppendStatusTlv(StatusTlv::kError)); + SuccessOrExit(error = message->AppendStatusTlv(kStatusError)); break; case Tlv::kLeaderData: diff --git a/src/core/thread/mle_tlvs.hpp b/src/core/thread/mle_tlvs.hpp index 0a4c844bf..74284e3bf 100644 --- a/src/core/thread/mle_tlvs.hpp +++ b/src/core/thread/mle_tlvs.hpp @@ -189,6 +189,11 @@ typedef TlvInfo TlvRequestTlv; */ typedef UintTlvInfo LinkMarginTlv; +/** + * Defines Status TLV constants and types. + */ +typedef UintTlvInfo StatusTlv; + /** * Defines Version TLV constants and types. */ @@ -881,20 +886,6 @@ private: uint8_t mSedDatagramCount; } OT_TOOL_PACKED_END; -/** - * Specifies Status TLV status values. - */ -struct StatusTlv : public UintTlvInfo -{ - /** - * Status values. - */ - enum Status : uint8_t - { - kError = 1, ///< Error. - }; -}; - /** * Provides constants and methods for generation and parsing of Address Registration TLV. */ diff --git a/src/core/thread/mle_types.hpp b/src/core/thread/mle_types.hpp index 80897cff7..4e47e5aaf 100644 --- a/src/core/thread/mle_types.hpp +++ b/src/core/thread/mle_types.hpp @@ -130,6 +130,15 @@ enum DeviceRole : uint8_t kRoleLeader = OT_DEVICE_ROLE_LEADER, ///< The Thread Leader role. }; +/** + * Represents a status value in an MLE Status TLV. + */ +enum Status : uint8_t +{ + kStatusSuccess = 0, ///< Success status. + kStatusError = 1, ///< Error status. +}; + /** * Represents MLE commands. */