diff --git a/src/core/mac/mac_frame.cpp b/src/core/mac/mac_frame.cpp index ddfd84ebe17..d32af7b19cd 100644 --- a/src/core/mac/mac_frame.cpp +++ b/src/core/mac/mac_frame.cpp @@ -450,14 +450,6 @@ Error Frame::GetDstPanId(PanId &aPanId) const return error; } -void Frame::SetDstPanId(PanId aPanId) -{ - uint8_t index = FindDstPanIdIndex(); - - OT_ASSERT(index != kInvalidIndex); - LittleEndian::WriteUint16(aPanId, &mPsdu[index]); -} - uint8_t Frame::GetSequence(void) const { OT_ASSERT(IsSequencePresent()); @@ -500,40 +492,6 @@ Error Frame::GetDstAddr(Address &aAddress) const return error; } -void Frame::SetDstAddr(ShortAddress aShortAddress) -{ - OT_ASSERT(GetFcfDstAddr(GetFrameControlField()) == kFcfAddrShort); - LittleEndian::WriteUint16(aShortAddress, &mPsdu[FindDstAddrIndex()]); -} - -void Frame::SetDstAddr(const ExtAddress &aExtAddress) -{ - uint8_t index = FindDstAddrIndex(); - - OT_ASSERT(GetFcfDstAddr(GetFrameControlField()) == kFcfAddrExt); - OT_ASSERT(index != kInvalidIndex); - - aExtAddress.CopyTo(&mPsdu[index], ExtAddress::kReverseByteOrder); -} - -void Frame::SetDstAddr(const Address &aAddress) -{ - switch (aAddress.GetType()) - { - case Address::kTypeShort: - SetDstAddr(aAddress.GetShort()); - break; - - case Address::kTypeExtended: - SetDstAddr(aAddress.GetExtended()); - break; - - default: - OT_ASSERT(false); - OT_UNREACHABLE_CODE(break); - } -} - uint8_t Frame::FindSrcPanIdIndex(void) const { uint16_t fcf = GetFrameControlField(); @@ -627,18 +585,6 @@ Error Frame::GetSrcPanId(PanId &aPanId) const return error; } -Error Frame::SetSrcPanId(PanId aPanId) -{ - Error error = kErrorNone; - uint8_t index = FindSrcPanIdIndex(); - - VerifyOrExit(index != kInvalidIndex, error = kErrorParse); - LittleEndian::WriteUint16(aPanId, &mPsdu[index]); - -exit: - return error; -} - uint8_t Frame::FindSrcAddrIndex(void) const { uint16_t fcf = GetFrameControlField(); @@ -700,43 +646,6 @@ Error Frame::GetSrcAddr(Address &aAddress) const return error; } -void Frame::SetSrcAddr(ShortAddress aShortAddress) -{ - uint8_t index = FindSrcAddrIndex(); - - OT_ASSERT(GetFcfSrcAddr(GetFrameControlField()) == kFcfAddrShort); - OT_ASSERT(index != kInvalidIndex); - - LittleEndian::WriteUint16(aShortAddress, &mPsdu[index]); -} - -void Frame::SetSrcAddr(const ExtAddress &aExtAddress) -{ - uint8_t index = FindSrcAddrIndex(); - - OT_ASSERT(GetFcfSrcAddr(GetFrameControlField()) == kFcfAddrExt); - OT_ASSERT(index != kInvalidIndex); - - aExtAddress.CopyTo(&mPsdu[index], ExtAddress::kReverseByteOrder); -} - -void Frame::SetSrcAddr(const Address &aAddress) -{ - switch (aAddress.GetType()) - { - case Address::kTypeShort: - SetSrcAddr(aAddress.GetShort()); - break; - - case Address::kTypeExtended: - SetSrcAddr(aAddress.GetExtended()); - break; - - default: - OT_ASSERT(false); - } -} - Error Frame::GetSecurityControlField(uint8_t &aSecurityControlField) const { Error error = kErrorNone; @@ -750,15 +659,6 @@ Error Frame::GetSecurityControlField(uint8_t &aSecurityControlField) const return error; } -void Frame::SetSecurityControlField(uint8_t aSecurityControlField) -{ - uint8_t index = FindSecurityHeaderIndex(); - - OT_ASSERT(index != kInvalidIndex); - - mPsdu[index] = aSecurityControlField; -} - uint8_t Frame::FindSecurityHeaderIndex(void) const { uint8_t index; diff --git a/src/core/mac/mac_frame.hpp b/src/core/mac/mac_frame.hpp index 588363b235c..272eb50dbfa 100644 --- a/src/core/mac/mac_frame.hpp +++ b/src/core/mac/mac_frame.hpp @@ -347,13 +347,6 @@ class Frame : public otRadioFrame */ Error GetDstPanId(PanId &aPanId) const; - /** - * Sets the Destination PAN Identifier. - * - * @param[in] aPanId The Destination PAN Identifier. - */ - void SetDstPanId(PanId aPanId); - /** * Indicates whether or not the Destination Address is present for this object. * @@ -371,27 +364,6 @@ class Frame : public otRadioFrame */ Error GetDstAddr(Address &aAddress) const; - /** - * Sets the Destination Address. - * - * @param[in] aShortAddress The Destination Address. - */ - void SetDstAddr(ShortAddress aShortAddress); - - /** - * Sets the Destination Address. - * - * @param[in] aExtAddress The Destination Address. - */ - void SetDstAddr(const ExtAddress &aExtAddress); - - /** - * Sets the Destination Address. - * - * @param[in] aAddress The Destination Address. - */ - void SetDstAddr(const Address &aAddress); - /** * Indicates whether or not the Source Address is present for this object. * @@ -409,15 +381,6 @@ class Frame : public otRadioFrame */ Error GetSrcPanId(PanId &aPanId) const; - /** - * Sets the Source PAN Identifier. - * - * @param[in] aPanId The Source PAN Identifier. - * - * @retval kErrorNone Successfully set the Source PAN Identifier. - */ - Error SetSrcPanId(PanId aPanId); - /** * Indicates whether or not the Source Address is present for this object. * @@ -435,27 +398,6 @@ class Frame : public otRadioFrame */ Error GetSrcAddr(Address &aAddress) const; - /** - * Sets the Source Address. - * - * @param[in] aShortAddress The Source Address. - */ - void SetSrcAddr(ShortAddress aShortAddress); - - /** - * Sets the Source Address. - * - * @param[in] aExtAddress The Source Address. - */ - void SetSrcAddr(const ExtAddress &aExtAddress); - - /** - * Sets the Source Address. - * - * @param[in] aAddress The Source Address. - */ - void SetSrcAddr(const Address &aAddress); - /** * Gets the Security Control Field. * @@ -466,13 +408,6 @@ class Frame : public otRadioFrame */ Error GetSecurityControlField(uint8_t &aSecurityControlField) const; - /** - * Sets the Security Control Field. - * - * @param[in] aSecurityControlField The Security Control Field. - */ - void SetSecurityControlField(uint8_t aSecurityControlField); - /** * Gets the Security Level Identifier. * diff --git a/tests/unit/test_mac_frame.cpp b/tests/unit/test_mac_frame.cpp index babd1601987..9085ba4cbc4 100644 --- a/tests/unit/test_mac_frame.cpp +++ b/tests/unit/test_mac_frame.cpp @@ -626,9 +626,6 @@ void TestMacFrameApi(void) VerifyOrQuit(frame.IsSrcAddrPresent()); SuccessOrQuit(frame.GetSecurityControlField(scf)); VerifyOrQuit(scf == 0x0d); - frame.SetSecurityControlField(0xff); - SuccessOrQuit(frame.GetSecurityControlField(scf)); - VerifyOrQuit(scf == 0xff); #endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2 // IEEE 802.15.4-2006 Mac Command