mirror of
https://github.com/espressif/openthread.git
synced 2026-08-06 18:57:47 +00:00
[style] return void where code always returns OT_ERROR_NONE (#3543)
This commit is contained in:
@@ -76,7 +76,7 @@ void otCryptoAesCcm(const uint8_t *aKey,
|
||||
|
||||
assert((aKey != NULL) && (aNonce != NULL) && (aPlainText != NULL) && (aCipherText != NULL) && (aTag != NULL));
|
||||
|
||||
SuccessOrExit(aesCcm.SetKey(aKey, aKeyLength));
|
||||
aesCcm.SetKey(aKey, aKeyLength);
|
||||
SuccessOrExit(aesCcm.Init(aHeaderLength, aLength, aTagLength, aNonce, aNonceLength));
|
||||
|
||||
if (aHeaderLength != 0)
|
||||
|
||||
@@ -45,7 +45,9 @@ otError otJamDetectionSetRssiThreshold(otInstance *aInstance, int8_t aRssiThresh
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.GetThreadNetif().GetJamDetector().SetRssiThreshold(aRssiThreshold);
|
||||
instance.GetThreadNetif().GetJamDetector().SetRssiThreshold(aRssiThreshold);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
int8_t otJamDetectionGetRssiThreshold(otInstance *aInstance)
|
||||
|
||||
@@ -72,14 +72,16 @@ otError otJoinerStart(otInstance * aInstance,
|
||||
|
||||
otError otJoinerStop(otInstance *aInstance)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
otError error;
|
||||
|
||||
#if OPENTHREAD_ENABLE_JOINER
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.GetThreadNetif().GetJoiner().Stop();
|
||||
instance.GetThreadNetif().GetJoiner().Stop();
|
||||
error = OT_ERROR_NONE;
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
error = OT_ERROR_DISABLED_FEATURE;
|
||||
#endif
|
||||
|
||||
return error;
|
||||
|
||||
@@ -104,7 +104,7 @@ otError otLinkSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExt
|
||||
|
||||
instance.GetThreadNetif().GetMac().SetExtAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
|
||||
SuccessOrExit(error = instance.GetThreadNetif().GetMle().UpdateLinkLocalAddress());
|
||||
instance.GetThreadNetif().GetMle().UpdateLinkLocalAddress();
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -130,7 +130,7 @@ otError otLinkSetPanId(otInstance *aInstance, otPanId aPanId)
|
||||
VerifyOrExit(instance.GetThreadNetif().GetMle().GetRole() == OT_DEVICE_ROLE_DISABLED,
|
||||
error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
error = instance.GetThreadNetif().GetMac().SetPanId(aPanId);
|
||||
instance.GetThreadNetif().GetMac().SetPanId(aPanId);
|
||||
instance.GetThreadNetif().GetActiveDataset().Clear();
|
||||
instance.GetThreadNetif().GetPendingDataset().Clear();
|
||||
|
||||
@@ -318,7 +318,7 @@ otError otLinkSetEnabled(otInstance *aInstance, bool aEnable)
|
||||
// cannot disable the link layer if the Thread interface is enabled
|
||||
VerifyOrExit(instance.GetThreadNetif().IsUp() == false, error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
error = instance.GetThreadNetif().GetMac().SetEnabled(aEnable);
|
||||
instance.GetThreadNetif().GetMac().SetEnabled(aEnable);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
|
||||
@@ -451,7 +451,7 @@ otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
|
||||
}
|
||||
else
|
||||
{
|
||||
error = instance.GetThreadNetif().GetMle().Stop(true);
|
||||
instance.GetThreadNetif().GetMle().Stop(true);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
@@ -119,7 +119,9 @@ otError otThreadSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoinerUdpPort)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.GetThreadNetif().GetJoinerRouter().SetJoinerUdpPort(aJoinerUdpPort);
|
||||
instance.GetThreadNetif().GetJoinerRouter().SetJoinerUdpPort(aJoinerUdpPort);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
uint32_t otThreadGetContextIdReuseDelay(otInstance *aInstance)
|
||||
|
||||
@@ -151,7 +151,8 @@ otError CoapSecure::Disconnect(void)
|
||||
Ip6::SockAddr sockAddr;
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
SuccessOrExit(error = GetNetif().GetDtls().Stop());
|
||||
GetNetif().GetDtls().Stop();
|
||||
|
||||
// Disconnect from previous peer by connecting to any address
|
||||
SuccessOrExit(error = mSocket.Connect(sockAddr));
|
||||
|
||||
|
||||
@@ -493,7 +493,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Message::RemoveHeader(uint16_t aLength)
|
||||
void Message::RemoveHeader(uint16_t aLength)
|
||||
{
|
||||
assert(aLength <= mBuffer.mHead.mInfo.mLength);
|
||||
|
||||
@@ -508,8 +508,6 @@ otError Message::RemoveHeader(uint16_t aLength)
|
||||
{
|
||||
mBuffer.mHead.mInfo.mOffset = 0;
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
uint16_t Message::Read(uint16_t aOffset, uint16_t aLength, void *aBuf) const
|
||||
|
||||
@@ -387,10 +387,8 @@ public:
|
||||
*
|
||||
* @param[in] aLength Number of header bytes to remove.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully removed header bytes from the message.
|
||||
*
|
||||
*/
|
||||
otError RemoveHeader(uint16_t aLength);
|
||||
void RemoveHeader(uint16_t aLength);
|
||||
|
||||
/**
|
||||
* This method appends bytes to the end of the message.
|
||||
|
||||
@@ -39,10 +39,9 @@
|
||||
namespace ot {
|
||||
namespace Crypto {
|
||||
|
||||
otError AesCcm::SetKey(const uint8_t *aKey, uint16_t aKeyLength)
|
||||
void AesCcm::SetKey(const uint8_t *aKey, uint16_t aKeyLength)
|
||||
{
|
||||
mEcb.SetKey(aKey, 8 * aKeyLength);
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError AesCcm::Init(uint32_t aHeaderLength,
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
* @param[in] aKeyLength Length of the key in bytes.
|
||||
*
|
||||
*/
|
||||
otError SetKey(const uint8_t *aKey, uint16_t aKeyLength);
|
||||
void SetKey(const uint8_t *aKey, uint16_t aKeyLength);
|
||||
|
||||
/**
|
||||
* This method initializes the AES CCM computation.
|
||||
|
||||
@@ -349,10 +349,9 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError Mac::SetShortAddress(ShortAddress aShortAddress)
|
||||
void Mac::SetShortAddress(ShortAddress aShortAddress)
|
||||
{
|
||||
mSubMac.SetShortAddress(aShortAddress);
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Mac::SetPanChannel(uint8_t aChannel)
|
||||
@@ -461,7 +460,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Mac::SetPanId(PanId aPanId)
|
||||
void Mac::SetPanId(PanId aPanId)
|
||||
{
|
||||
VerifyOrExit(mPanId != aPanId, GetNotifier().SignalIfFirst(OT_CHANGED_THREAD_PANID));
|
||||
mPanId = aPanId;
|
||||
@@ -469,10 +468,10 @@ otError Mac::SetPanId(PanId aPanId)
|
||||
GetNotifier().Signal(OT_CHANGED_THREAD_PANID);
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
otError Mac::SetExtendedPanId(const otExtendedPanId &aExtendedPanId)
|
||||
void Mac::SetExtendedPanId(const otExtendedPanId &aExtendedPanId)
|
||||
{
|
||||
VerifyOrExit(memcmp(mExtendedPanId.m8, aExtendedPanId.m8, sizeof(mExtendedPanId)) != 0,
|
||||
GetNotifier().SignalIfFirst(OT_CHANGED_THREAD_EXT_PANID));
|
||||
@@ -481,7 +480,7 @@ otError Mac::SetExtendedPanId(const otExtendedPanId &aExtendedPanId)
|
||||
GetNotifier().Signal(OT_CHANGED_THREAD_EXT_PANID);
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
otError Mac::SendFrameRequest(void)
|
||||
@@ -1756,11 +1755,9 @@ void Mac::SetPromiscuous(bool aPromiscuous)
|
||||
UpdateIdleMode();
|
||||
}
|
||||
|
||||
otError Mac::SetEnabled(bool aEnable)
|
||||
void Mac::SetEnabled(bool aEnable)
|
||||
{
|
||||
mEnabled = aEnable;
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void Mac::ResetCounters(void)
|
||||
|
||||
+4
-12
@@ -269,10 +269,8 @@ public:
|
||||
*
|
||||
* @param[in] aShortAddress The IEEE 802.15.4 Short Address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the IEEE 802.15.4 Short Address.
|
||||
*
|
||||
*/
|
||||
otError SetShortAddress(ShortAddress aShortAddress);
|
||||
void SetShortAddress(ShortAddress aShortAddress);
|
||||
|
||||
/**
|
||||
* This method returns the IEEE 802.15.4 PAN Channel.
|
||||
@@ -395,10 +393,8 @@ public:
|
||||
*
|
||||
* @param[in] aPanId The IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
*/
|
||||
otError SetPanId(PanId aPanId);
|
||||
void SetPanId(PanId aPanId);
|
||||
|
||||
/**
|
||||
* This method returns the IEEE 802.15.4 Extended PAN ID.
|
||||
@@ -413,10 +409,8 @@ public:
|
||||
*
|
||||
* @param[in] aExtendedPanId The IEEE 802.15.4 Extended PAN ID.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the IEEE 802.15.4 Extended PAN ID.
|
||||
*
|
||||
*/
|
||||
otError SetExtendedPanId(const otExtendedPanId &aExtendedPanId);
|
||||
void SetExtendedPanId(const otExtendedPanId &aExtendedPanId);
|
||||
|
||||
#if OPENTHREAD_ENABLE_MAC_FILTER
|
||||
/**
|
||||
@@ -572,10 +566,8 @@ public:
|
||||
*
|
||||
* @param[in] aEnable The requested State for the MAC layer. true - Start, false - Stop.
|
||||
*
|
||||
* @retval OT_ERROR_NONE The operation succeeded or the new State equals the current State.
|
||||
*
|
||||
*/
|
||||
otError SetEnabled(bool aEnable);
|
||||
void SetEnabled(bool aEnable);
|
||||
|
||||
/**
|
||||
* This method indicates whether or not the link layer is enabled.
|
||||
|
||||
+15
-40
@@ -89,7 +89,7 @@ Address::InfoString Address::ToString(void) const
|
||||
: (mType == kTypeNone ? InfoString("None") : InfoString("0x%04x", GetShort()));
|
||||
}
|
||||
|
||||
otError Frame::InitMacHeader(uint16_t aFcf, uint8_t aSecurityControl)
|
||||
void Frame::InitMacHeader(uint16_t aFcf, uint8_t aSecurityControl)
|
||||
{
|
||||
uint8_t *bytes = GetPsdu();
|
||||
uint8_t length = 0;
|
||||
@@ -180,8 +180,6 @@ otError Frame::InitMacHeader(uint16_t aFcf, uint8_t aSecurityControl)
|
||||
}
|
||||
|
||||
SetPsduLength(length + GetFooterLength());
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
uint16_t Frame::GetFrameControlField(void) const
|
||||
@@ -250,14 +248,12 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Frame::SetDstPanId(PanId aPanId)
|
||||
void Frame::SetDstPanId(PanId aPanId)
|
||||
{
|
||||
uint8_t index = FindDstPanIdIndex();
|
||||
|
||||
assert(index != kInvalidIndex);
|
||||
Encoding::LittleEndian::WriteUint16(aPanId, GetPsdu() + index);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
uint8_t Frame::FindDstAddrIndex(void) const
|
||||
@@ -291,15 +287,13 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Frame::SetDstAddr(ShortAddress aShortAddress)
|
||||
void Frame::SetDstAddr(ShortAddress aShortAddress)
|
||||
{
|
||||
assert((GetFrameControlField() & kFcfDstAddrMask) == kFcfDstAddrShort);
|
||||
Encoding::LittleEndian::WriteUint16(aShortAddress, GetPsdu() + FindDstAddrIndex());
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Frame::SetDstAddr(const ExtAddress &aExtAddress)
|
||||
void Frame::SetDstAddr(const ExtAddress &aExtAddress)
|
||||
{
|
||||
uint8_t index = FindDstAddrIndex();
|
||||
uint8_t *buf = GetPsdu() + index;
|
||||
@@ -311,30 +305,24 @@ otError Frame::SetDstAddr(const ExtAddress &aExtAddress)
|
||||
{
|
||||
buf[i] = aExtAddress.m8[sizeof(ExtAddress) - 1 - i];
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Frame::SetDstAddr(const Address &aAddress)
|
||||
void Frame::SetDstAddr(const Address &aAddress)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
switch (aAddress.GetType())
|
||||
{
|
||||
case Address::kTypeShort:
|
||||
error = SetDstAddr(aAddress.GetShort());
|
||||
SetDstAddr(aAddress.GetShort());
|
||||
break;
|
||||
|
||||
case Address::kTypeExtended:
|
||||
error = SetDstAddr(aAddress.GetExtended());
|
||||
SetDstAddr(aAddress.GetExtended());
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
uint8_t Frame::FindSrcPanIdIndex(void) const
|
||||
@@ -471,7 +459,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Frame::SetSrcAddr(ShortAddress aShortAddress)
|
||||
void Frame::SetSrcAddr(ShortAddress aShortAddress)
|
||||
{
|
||||
uint8_t index = FindSrcAddrIndex();
|
||||
|
||||
@@ -479,11 +467,9 @@ otError Frame::SetSrcAddr(ShortAddress aShortAddress)
|
||||
assert(index != kInvalidIndex);
|
||||
|
||||
Encoding::LittleEndian::WriteUint16(aShortAddress, GetPsdu() + index);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Frame::SetSrcAddr(const ExtAddress &aExtAddress)
|
||||
void Frame::SetSrcAddr(const ExtAddress &aExtAddress)
|
||||
{
|
||||
uint8_t index = FindSrcAddrIndex();
|
||||
uint8_t *buf = GetPsdu() + index;
|
||||
@@ -495,30 +481,24 @@ otError Frame::SetSrcAddr(const ExtAddress &aExtAddress)
|
||||
{
|
||||
buf[i] = aExtAddress.m8[sizeof(aExtAddress) - 1 - i];
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Frame::SetSrcAddr(const Address &aAddress)
|
||||
void Frame::SetSrcAddr(const Address &aAddress)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
switch (aAddress.GetType())
|
||||
{
|
||||
case Address::kTypeShort:
|
||||
error = SetSrcAddr(aAddress.GetShort());
|
||||
SetSrcAddr(aAddress.GetShort());
|
||||
break;
|
||||
|
||||
case Address::kTypeExtended:
|
||||
error = SetSrcAddr(aAddress.GetExtended());
|
||||
SetSrcAddr(aAddress.GetExtended());
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
uint8_t Frame::FindSecurityHeaderIndex(void) const
|
||||
@@ -607,7 +587,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Frame::SetFrameCounter(uint32_t aFrameCounter)
|
||||
void Frame::SetFrameCounter(uint32_t aFrameCounter)
|
||||
{
|
||||
uint8_t index = FindSecurityHeaderIndex();
|
||||
|
||||
@@ -617,8 +597,6 @@ otError Frame::SetFrameCounter(uint32_t aFrameCounter)
|
||||
index += kSecurityControlSize;
|
||||
|
||||
Encoding::LittleEndian::WriteUint32(aFrameCounter, GetPsdu() + index);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
const uint8_t *Frame::GetKeySource(void) const
|
||||
@@ -694,7 +672,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Frame::SetKeyId(uint8_t aKeyId)
|
||||
void Frame::SetKeyId(uint8_t aKeyId)
|
||||
{
|
||||
uint8_t keySourceLength;
|
||||
uint8_t index = FindSecurityHeaderIndex();
|
||||
@@ -707,8 +685,6 @@ otError Frame::SetKeyId(uint8_t aKeyId)
|
||||
buf += kSecurityControlSize + kFrameCounterSize + keySourceLength;
|
||||
|
||||
buf[0] = aKeyId;
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Frame::GetCommandId(uint8_t &aCommandId) const
|
||||
@@ -802,10 +778,9 @@ uint8_t Frame::GetPayloadLength(void) const
|
||||
return GetPsduLength() - (GetHeaderLength() + GetFooterLength());
|
||||
}
|
||||
|
||||
otError Frame::SetPayloadLength(uint8_t aLength)
|
||||
void Frame::SetPayloadLength(uint8_t aLength)
|
||||
{
|
||||
SetPsduLength(GetHeaderLength() + GetFooterLength() + aLength);
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
uint8_t Frame::SkipSecurityHeaderIndex(void) const
|
||||
|
||||
+12
-42
@@ -552,11 +552,8 @@ public:
|
||||
* @param[in] aFcf The Frame Control field.
|
||||
* @param[in] aSecCtl The Security Control field.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully initialized the MAC header.
|
||||
* @retval OT_ERROR_INVALID_ARGS Invalid values for @p aFcf and/or @p aSecCtl.
|
||||
*
|
||||
*/
|
||||
otError InitMacHeader(uint16_t aFcf, uint8_t aSecCtl);
|
||||
void InitMacHeader(uint16_t aFcf, uint8_t aSecCtl);
|
||||
|
||||
/**
|
||||
* This method validates the frame.
|
||||
@@ -666,10 +663,8 @@ public:
|
||||
*
|
||||
* @param[in] aPanId The Destination PAN Identifier.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Destination PAN Identifier.
|
||||
*
|
||||
*/
|
||||
otError SetDstPanId(PanId aPanId);
|
||||
void SetDstPanId(PanId aPanId);
|
||||
|
||||
/**
|
||||
* This method gets the Destination Address.
|
||||
@@ -686,30 +681,24 @@ public:
|
||||
*
|
||||
* @param[in] aShortAddress The Destination Address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Destination Address.
|
||||
*
|
||||
*/
|
||||
otError SetDstAddr(ShortAddress aShortAddress);
|
||||
void SetDstAddr(ShortAddress aShortAddress);
|
||||
|
||||
/**
|
||||
* This method sets the Destination Address.
|
||||
*
|
||||
* @param[in] aExtAddress The Destination Address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Destination Address.
|
||||
*
|
||||
*/
|
||||
otError SetDstAddr(const ExtAddress &aExtAddress);
|
||||
void SetDstAddr(const ExtAddress &aExtAddress);
|
||||
|
||||
/**
|
||||
* This method sets the Destination Address.
|
||||
*
|
||||
* @param[in] aAddress The Destination Address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Destination Address.
|
||||
*
|
||||
*/
|
||||
otError SetDstAddr(const Address &aAddress);
|
||||
void SetDstAddr(const Address &aAddress);
|
||||
|
||||
/**
|
||||
* This method indicates whether or not the Src PanId is present.
|
||||
@@ -754,30 +743,24 @@ public:
|
||||
*
|
||||
* @param[in] aShortAddress The Source Address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Source Address.
|
||||
*
|
||||
*/
|
||||
otError SetSrcAddr(ShortAddress aShortAddress);
|
||||
void SetSrcAddr(ShortAddress aShortAddress);
|
||||
|
||||
/**
|
||||
* This method sets the Source Address.
|
||||
*
|
||||
* @param[in] aExtAddress The Source Address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Source Address.
|
||||
*
|
||||
*/
|
||||
otError SetSrcAddr(const ExtAddress &aExtAddress);
|
||||
void SetSrcAddr(const ExtAddress &aExtAddress);
|
||||
|
||||
/**
|
||||
* This method sets the Source Address.
|
||||
*
|
||||
* @param[in] aAddress The Source Address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Source Address.
|
||||
*
|
||||
*/
|
||||
otError SetSrcAddr(const Address &aAddress);
|
||||
void SetSrcAddr(const Address &aAddress);
|
||||
|
||||
/**
|
||||
* This method gets the Security Level Identifier.
|
||||
@@ -814,10 +797,8 @@ public:
|
||||
*
|
||||
* @param[in] aFrameCounter The Frame Counter.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Frame Counter.
|
||||
*
|
||||
*/
|
||||
otError SetFrameCounter(uint32_t aFrameCounter);
|
||||
void SetFrameCounter(uint32_t aFrameCounter);
|
||||
|
||||
/**
|
||||
* This method returns a pointer to the Key Source.
|
||||
@@ -850,10 +831,8 @@ public:
|
||||
*
|
||||
* @param[in] aKeyId The Key Identifier.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Key Identifier.
|
||||
*
|
||||
*/
|
||||
otError SetKeyId(uint8_t aKeyId);
|
||||
void SetKeyId(uint8_t aKeyId);
|
||||
|
||||
/**
|
||||
* This method gets the Command ID.
|
||||
@@ -896,14 +875,8 @@ public:
|
||||
*
|
||||
* @param[in] aLength The MAC Frame Length.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the MAC Frame Length.
|
||||
*
|
||||
*/
|
||||
otError SetLength(uint8_t aLength)
|
||||
{
|
||||
SetPsduLength(aLength);
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
void SetLength(uint8_t aLength) { SetPsduLength(aLength); }
|
||||
|
||||
/**
|
||||
* This method returns the MAC header size.
|
||||
@@ -940,11 +913,8 @@ public:
|
||||
/**
|
||||
* This method sets the MAC Payload length.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the MAC Payload length.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aLength value was invalid.
|
||||
*
|
||||
*/
|
||||
otError SetPayloadLength(uint8_t aLength);
|
||||
void SetPayloadLength(uint8_t aLength);
|
||||
|
||||
/**
|
||||
* This method returns the IEEE 802.15.4 channel used for transmission or reception.
|
||||
|
||||
@@ -240,7 +240,7 @@ void Dataset::Get(otOperationalDataset &aDataset) const
|
||||
}
|
||||
}
|
||||
|
||||
otError Dataset::Set(const Dataset &aDataset)
|
||||
void Dataset::Set(const Dataset &aDataset)
|
||||
{
|
||||
memcpy(mTlvs, aDataset.mTlvs, aDataset.mLength);
|
||||
mLength = aDataset.mLength;
|
||||
@@ -252,8 +252,6 @@ otError Dataset::Set(const Dataset &aDataset)
|
||||
}
|
||||
|
||||
mUpdateTime = aDataset.GetUpdateTime();
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
@@ -620,12 +618,11 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Dataset::ConvertToActive(void)
|
||||
void Dataset::ConvertToActive(void)
|
||||
{
|
||||
Remove(Tlv::kPendingTimestamp);
|
||||
Remove(Tlv::kDelayTimer);
|
||||
mType = Tlv::kActiveTimestamp;
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
} // namespace MeshCoP
|
||||
|
||||
@@ -187,17 +187,16 @@ public:
|
||||
*
|
||||
* @param[in] aDataset The input Dataset.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Dataset.
|
||||
*
|
||||
*/
|
||||
otError Set(const Dataset &aDataset);
|
||||
void Set(const Dataset &aDataset);
|
||||
|
||||
/**
|
||||
* This method sets the Dataset.
|
||||
*
|
||||
* @param[in] aDataset The input Dataset.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Dataset.
|
||||
* @retval OT_ERROR_NONE Successfully set the Dataset.
|
||||
* @retval OT_ERROR_INVALID_ARGS Dataset is missing Active and/or Pending Timestamp.
|
||||
*
|
||||
*/
|
||||
otError Set(const otOperationalDataset &aDataset);
|
||||
@@ -236,10 +235,8 @@ public:
|
||||
*
|
||||
* This method removes the Delay Timer and Pending Timestamp TLVs
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully converted to Active Dataset.
|
||||
*
|
||||
*/
|
||||
otError ConvertToActive(void);
|
||||
void ConvertToActive(void);
|
||||
|
||||
private:
|
||||
void Remove(uint8_t *aStart, uint8_t aLength);
|
||||
|
||||
@@ -330,7 +330,7 @@ void Dtls::SetSslAuthMode(bool aVerifyPeerCertificate)
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE
|
||||
|
||||
otError Dtls::Stop(void)
|
||||
void Dtls::Stop(void)
|
||||
{
|
||||
VerifyOrExit((mState == kStateConnecting) || (mState == kStateConnected));
|
||||
|
||||
@@ -338,7 +338,7 @@ otError Dtls::Stop(void)
|
||||
Close();
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
void Dtls::Close(void)
|
||||
@@ -489,15 +489,13 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Dtls::Receive(Message &aMessage, uint16_t aOffset, uint16_t aLength)
|
||||
void Dtls::Receive(Message &aMessage, uint16_t aOffset, uint16_t aLength)
|
||||
{
|
||||
mReceiveMessage = &aMessage;
|
||||
mReceiveOffset = aOffset;
|
||||
mReceiveLength = aLength;
|
||||
|
||||
Process();
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
int Dtls::HandleMbedtlsTransmit(void *aContext, const unsigned char *aBuf, size_t aLength)
|
||||
|
||||
@@ -150,10 +150,8 @@ public:
|
||||
/**
|
||||
* This method stops the DTLS service.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully stopped the DTLS service.
|
||||
*
|
||||
*/
|
||||
otError Stop(void);
|
||||
void Stop(void);
|
||||
|
||||
/**
|
||||
* This method returns the DTLS connection state.
|
||||
@@ -297,10 +295,8 @@ public:
|
||||
* @param[in] aOffset The offset within @p aMessage where the DTLS message starts.
|
||||
* @param[in] aLength The size of the DTLS message (bytes).
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully processed the received DTLS message.
|
||||
*
|
||||
*/
|
||||
otError Receive(Message &aMessage, uint16_t aOffset, uint16_t aLength);
|
||||
void Receive(Message &aMessage, uint16_t aOffset, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* This method sets the default message sub-type that will be used for all messages without defined
|
||||
|
||||
@@ -142,11 +142,9 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Joiner::Stop(void)
|
||||
void Joiner::Stop(void)
|
||||
{
|
||||
Close();
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otJoinerState Joiner::GetState(void) const
|
||||
|
||||
@@ -90,10 +90,8 @@ public:
|
||||
/**
|
||||
* This method stops the Joiner service.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully stopped the Joiner service.
|
||||
*
|
||||
*/
|
||||
otError Stop(void);
|
||||
void Stop(void);
|
||||
|
||||
/**
|
||||
* This function returns the Joiner State.
|
||||
|
||||
@@ -121,13 +121,11 @@ exit:
|
||||
return rval;
|
||||
}
|
||||
|
||||
otError JoinerRouter::SetJoinerUdpPort(uint16_t aJoinerUdpPort)
|
||||
void JoinerRouter::SetJoinerUdpPort(uint16_t aJoinerUdpPort)
|
||||
{
|
||||
mJoinerUdpPort = aJoinerUdpPort;
|
||||
mIsJoinerPortConfigured = true;
|
||||
HandleStateChanged(OT_CHANGED_THREAD_NETDATA);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void JoinerRouter::HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
||||
|
||||
@@ -75,10 +75,8 @@ public:
|
||||
*
|
||||
* @param[in] The Joiner UDP Port number.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Joiner UDP Port.
|
||||
*
|
||||
*/
|
||||
otError SetJoinerUdpPort(uint16_t aJoinerUdpPort);
|
||||
void SetJoinerUdpPort(uint16_t aJoinerUdpPort);
|
||||
|
||||
private:
|
||||
enum
|
||||
|
||||
@@ -170,7 +170,7 @@ void Dhcp6Client::UpdateAddresses(void)
|
||||
}
|
||||
}
|
||||
|
||||
otError Dhcp6Client::Start(void)
|
||||
void Dhcp6Client::Start(void)
|
||||
{
|
||||
Ip6::SockAddr sockaddr;
|
||||
|
||||
@@ -179,14 +179,11 @@ otError Dhcp6Client::Start(void)
|
||||
mSocket.Bind(sockaddr);
|
||||
|
||||
ProcessNextIdentityAssociation();
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Dhcp6Client::Stop(void)
|
||||
void Dhcp6Client::Stop(void)
|
||||
{
|
||||
mSocket.Close();
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
bool Dhcp6Client::ProcessNextIdentityAssociation()
|
||||
|
||||
@@ -117,8 +117,8 @@ public:
|
||||
void UpdateAddresses(void);
|
||||
|
||||
private:
|
||||
otError Start(void);
|
||||
otError Stop(void);
|
||||
void Start(void);
|
||||
void Stop(void);
|
||||
|
||||
static bool MatchNetifAddressWithPrefix(const otNetifAddress &aNetifAddress, const otIp6Prefix &aIp6Prefix);
|
||||
|
||||
|
||||
@@ -188,20 +188,18 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Dhcp6Server::Start(void)
|
||||
void Dhcp6Server::Start(void)
|
||||
{
|
||||
Ip6::SockAddr sockaddr;
|
||||
|
||||
sockaddr.mPort = kDhcpServerPort;
|
||||
mSocket.Open(&Dhcp6Server::HandleUdpReceive, this);
|
||||
mSocket.Bind(sockaddr);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Dhcp6Server::Stop(void)
|
||||
void Dhcp6Server::Stop(void)
|
||||
{
|
||||
mSocket.Close();
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Dhcp6Server::AddPrefixAgent(otIp6Prefix &aIp6Prefix)
|
||||
|
||||
@@ -113,8 +113,8 @@ public:
|
||||
otError UpdateService();
|
||||
|
||||
private:
|
||||
otError Start(void);
|
||||
otError Stop(void);
|
||||
void Start(void);
|
||||
void Stop(void);
|
||||
|
||||
otError AddPrefixAgent(otIp6Prefix &aIp6Prefix);
|
||||
otError RemovePrefixAgent(const uint8_t *aIp6Address);
|
||||
|
||||
@@ -250,7 +250,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Icmp::UpdateChecksum(Message &aMessage, uint16_t aChecksum)
|
||||
void Icmp::UpdateChecksum(Message &aMessage, uint16_t aChecksum)
|
||||
{
|
||||
aChecksum = aMessage.UpdateChecksum(aChecksum, aMessage.GetOffset(), aMessage.GetLength() - aMessage.GetOffset());
|
||||
|
||||
@@ -261,7 +261,6 @@ otError Icmp::UpdateChecksum(Message &aMessage, uint16_t aChecksum)
|
||||
|
||||
aChecksum = HostSwap16(aChecksum);
|
||||
aMessage.Write(aMessage.GetOffset() + IcmpHeader::GetChecksumOffset(), sizeof(aChecksum), &aChecksum);
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
} // namespace Ip6
|
||||
|
||||
@@ -312,11 +312,8 @@ public:
|
||||
* @param[in] aMessage A reference to the ICMPv6 message.
|
||||
* @param[in] aPseudoHeaderChecksum The pseudo-header checksum value.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully updated the ICMPv6 checksum.
|
||||
* @retval OT_ERROR_INVALID_ARGS The message was invalid.
|
||||
*
|
||||
*/
|
||||
otError UpdateChecksum(Message &aMessage, uint16_t aPseudoHeaderChecksum);
|
||||
void UpdateChecksum(Message &aMessage, uint16_t aPseudoHeaderChecksum);
|
||||
|
||||
/**
|
||||
* This method indicates whether or not ICMPv6 Echo processing is enabled.
|
||||
|
||||
@@ -487,11 +487,11 @@ otError Ip6::SendDatagram(Message &aMessage, MessageInfo &aMessageInfo, IpProto
|
||||
switch (aIpProto)
|
||||
{
|
||||
case kProtoUdp:
|
||||
SuccessOrExit(error = mUdp.UpdateChecksum(aMessage, checksum));
|
||||
mUdp.UpdateChecksum(aMessage, checksum);
|
||||
break;
|
||||
|
||||
case kProtoIcmp6:
|
||||
SuccessOrExit(error = mIcmp.UpdateChecksum(aMessage, checksum));
|
||||
mIcmp.UpdateChecksum(aMessage, checksum);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -64,7 +64,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Routes::Remove(Route &aRoute)
|
||||
void Routes::Remove(Route &aRoute)
|
||||
{
|
||||
if (&aRoute == mRoutes)
|
||||
{
|
||||
@@ -83,8 +83,6 @@ otError Routes::Remove(Route &aRoute)
|
||||
}
|
||||
|
||||
aRoute.mNext = NULL;
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
int8_t Routes::Lookup(const Address &aSource, const Address &aDestination)
|
||||
|
||||
@@ -96,11 +96,8 @@ public:
|
||||
*
|
||||
* @param[in] aRoute A reference to the IPv6 route.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully removed the route.
|
||||
* @retval OT_ERROR_NOT_FOUND The route was not added.
|
||||
*
|
||||
*/
|
||||
otError Remove(Route &aRoute);
|
||||
void Remove(Route &aRoute);
|
||||
|
||||
/**
|
||||
* This method performs source-destination route lookup.
|
||||
|
||||
+13
-10
@@ -76,7 +76,7 @@ Message *UdpSocket::NewMessage(uint16_t aReserved, const otMessageSettings *aSet
|
||||
|
||||
otError UdpSocket::Open(otUdpReceive aHandler, void *aContext)
|
||||
{
|
||||
otError error;
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
memset(&mSockName, 0, sizeof(mSockName));
|
||||
memset(&mPeerName, 0, sizeof(mPeerName));
|
||||
@@ -86,9 +86,12 @@ otError UdpSocket::Open(otUdpReceive aHandler, void *aContext)
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
SuccessOrExit(error = otPlatUdpSocket(this));
|
||||
#endif
|
||||
SuccessOrExit(error = GetUdp().AddSocket(*this));
|
||||
|
||||
GetUdp().AddSocket(*this);
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
exit:
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -140,11 +143,14 @@ otError UdpSocket::Close(void)
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
SuccessOrExit(error = otPlatUdpClose(this));
|
||||
#endif
|
||||
SuccessOrExit(error = GetUdp().RemoveSocket(*this));
|
||||
|
||||
GetUdp().RemoveSocket(*this);
|
||||
memset(&mSockName, 0, sizeof(mSockName));
|
||||
memset(&mPeerName, 0, sizeof(mPeerName));
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
exit:
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -253,7 +259,7 @@ otError Udp::RemoveReceiver(UdpReceiver &aReceiver)
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Udp::AddSocket(UdpSocket &aSocket)
|
||||
void Udp::AddSocket(UdpSocket &aSocket)
|
||||
{
|
||||
for (UdpSocket *cur = mSockets; cur; cur = cur->GetNext())
|
||||
{
|
||||
@@ -267,10 +273,10 @@ otError Udp::AddSocket(UdpSocket &aSocket)
|
||||
mSockets = &aSocket;
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
otError Udp::RemoveSocket(UdpSocket &aSocket)
|
||||
void Udp::RemoveSocket(UdpSocket &aSocket)
|
||||
{
|
||||
if (mSockets == &aSocket)
|
||||
{
|
||||
@@ -289,8 +295,6 @@ otError Udp::RemoveSocket(UdpSocket &aSocket)
|
||||
}
|
||||
|
||||
aSocket.SetNext(NULL);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
uint16_t Udp::GetEphemeralPort(void)
|
||||
@@ -431,7 +435,7 @@ void Udp::HandlePayload(Message &aMessage, MessageInfo &aMessageInfo)
|
||||
}
|
||||
}
|
||||
|
||||
otError Udp::UpdateChecksum(Message &aMessage, uint16_t aChecksum)
|
||||
void Udp::UpdateChecksum(Message &aMessage, uint16_t aChecksum)
|
||||
{
|
||||
aChecksum = aMessage.UpdateChecksum(aChecksum, aMessage.GetOffset(), aMessage.GetLength() - aMessage.GetOffset());
|
||||
|
||||
@@ -442,7 +446,6 @@ otError Udp::UpdateChecksum(Message &aMessage, uint16_t aChecksum)
|
||||
|
||||
aChecksum = HostSwap16(aChecksum);
|
||||
aMessage.Write(aMessage.GetOffset() + UdpHeader::GetChecksumOffset(), sizeof(aChecksum), &aChecksum);
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
} // namespace Ip6
|
||||
|
||||
+3
-10
@@ -248,20 +248,16 @@ public:
|
||||
*
|
||||
* @param[in] aSocket A reference to the UDP socket.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully added the UDP socket.
|
||||
*
|
||||
*/
|
||||
otError AddSocket(UdpSocket &aSocket);
|
||||
void AddSocket(UdpSocket &aSocket);
|
||||
|
||||
/**
|
||||
* This method removes a UDP socket.
|
||||
*
|
||||
* @param[in] aSocket A reference to the UDP socket.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully removed the UDP socket.
|
||||
*
|
||||
*/
|
||||
otError RemoveSocket(UdpSocket &aSocket);
|
||||
void RemoveSocket(UdpSocket &aSocket);
|
||||
|
||||
/**
|
||||
* This method returns a new ephemeral port.
|
||||
@@ -322,11 +318,8 @@ public:
|
||||
* @param[in] aMessage A reference to the UDP message.
|
||||
* @param[in] aPseudoHeaderChecksum The pseudo-header checksum value.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully updated the UDP checksum.
|
||||
* @retval OT_ERROR_INVALID_ARGS The message was invalid.
|
||||
*
|
||||
*/
|
||||
otError UpdateChecksum(Message &aMessage, uint16_t aPseudoHeaderChecksum);
|
||||
void UpdateChecksum(Message &aMessage, uint16_t aPseudoHeaderChecksum);
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
otUdpSocket *GetUdpSockets(void) { return mSockets; }
|
||||
|
||||
@@ -159,7 +159,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError KeyManager::ComputeKey(uint32_t aKeySequence, uint8_t *aKey)
|
||||
void KeyManager::ComputeKey(uint32_t aKeySequence, uint8_t *aKey)
|
||||
{
|
||||
Crypto::HmacSha256 hmac;
|
||||
uint8_t keySequenceBytes[4];
|
||||
@@ -174,8 +174,6 @@ otError KeyManager::ComputeKey(uint32_t aKeySequence, uint8_t *aKey)
|
||||
hmac.Update(kThreadString, sizeof(kThreadString));
|
||||
|
||||
hmac.Finish(aKey);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void KeyManager::SetCurrentKeySequence(uint32_t aKeySequence)
|
||||
|
||||
@@ -335,7 +335,7 @@ private:
|
||||
kOneHourIntervalInMsec = 3600u * 1000u,
|
||||
};
|
||||
|
||||
otError ComputeKey(uint32_t aKeySequence, uint8_t *aKey);
|
||||
void ComputeKey(uint32_t aKeySequence, uint8_t *aKey);
|
||||
|
||||
void StartKeyRotationTimer(void);
|
||||
static void HandleKeyRotationTimer(Timer &aTimer);
|
||||
|
||||
@@ -53,7 +53,7 @@ Lowpan::Lowpan(Instance &aInstance)
|
||||
{
|
||||
}
|
||||
|
||||
otError Lowpan::CopyContext(const Context &aContext, Ip6::Address &aAddress)
|
||||
void Lowpan::CopyContext(const Context &aContext, Ip6::Address &aAddress)
|
||||
{
|
||||
memcpy(&aAddress, aContext.mPrefix, aContext.mPrefixLength / CHAR_BIT);
|
||||
|
||||
@@ -62,8 +62,6 @@ otError Lowpan::CopyContext(const Context &aContext, Ip6::Address &aAddress)
|
||||
aAddress.mFields.m8[i / CHAR_BIT] &= ~(0x80 >> (i % CHAR_BIT));
|
||||
aAddress.mFields.m8[i / CHAR_BIT] |= aContext.mPrefix[i / CHAR_BIT] & (0x80 >> (i % CHAR_BIT));
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Lowpan::ComputeIid(const Mac::Address &aMacAddr, const Context &aContext, Ip6::Address &aIpAddress)
|
||||
|
||||
@@ -234,7 +234,7 @@ private:
|
||||
int DecompressUdpHeader(Message &aMessage, const uint8_t *aBuf, uint16_t aBufLength, uint16_t aDatagramLength);
|
||||
otError DispatchToNextHeader(uint8_t aDispatch, Ip6::IpProto &aNextHeader);
|
||||
|
||||
static otError CopyContext(const Context &aContext, Ip6::Address &aAddress);
|
||||
static void CopyContext(const Context &aContext, Ip6::Address &aAddress);
|
||||
static otError ComputeIid(const Mac::Address &aMacAddr, const Context &aContext, Ip6::Address &aIpAddress);
|
||||
};
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ void MeshForwarder::SetRxOnWhenIdle(bool aRxOnWhenIdle)
|
||||
}
|
||||
}
|
||||
|
||||
otError MeshForwarder::GetMacSourceAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr)
|
||||
void MeshForwarder::GetMacSourceAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
|
||||
@@ -421,11 +421,9 @@ otError MeshForwarder::GetMacSourceAddress(const Ip6::Address &aIp6Addr, Mac::Ad
|
||||
{
|
||||
aMacAddr.SetShort(netif.GetMac().GetShortAddress());
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError MeshForwarder::GetMacDestinationAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr)
|
||||
void MeshForwarder::GetMacDestinationAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr)
|
||||
{
|
||||
if (aIp6Addr.IsMulticast())
|
||||
{
|
||||
@@ -446,8 +444,6 @@ otError MeshForwarder::GetMacDestinationAddress(const Ip6::Address &aIp6Addr, Ma
|
||||
{
|
||||
aIp6Addr.ToExtAddress(aMacAddr);
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError MeshForwarder::GetMeshHeader(const uint8_t *&aFrame, uint8_t &aFrameLength, Lowpan::MeshHeader &aMeshHeader)
|
||||
@@ -586,17 +582,17 @@ otError MeshForwarder::HandleFrameRequest(Mac::Frame &aFrame)
|
||||
break;
|
||||
|
||||
case Message::kTypeMacDataPoll:
|
||||
error = SendPoll(*mSendMessage, aFrame);
|
||||
SendPoll(*mSendMessage, aFrame);
|
||||
break;
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
case Message::kType6lowpan:
|
||||
error = SendMesh(*mSendMessage, aFrame);
|
||||
SendMesh(*mSendMessage, aFrame);
|
||||
break;
|
||||
|
||||
case Message::kTypeSupervision:
|
||||
error = SendEmptyFrame(aFrame, kSupervisionMsgAckRequest);
|
||||
SendEmptyFrame(aFrame, kSupervisionMsgAckRequest);
|
||||
mMessageNextOffset = mSendMessage->GetLength();
|
||||
break;
|
||||
|
||||
@@ -651,7 +647,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError MeshForwarder::SendPoll(Message &aMessage, Mac::Frame &aFrame)
|
||||
void MeshForwarder::SendPoll(Message &aMessage, Mac::Frame &aFrame)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
uint16_t fcf;
|
||||
@@ -677,8 +673,6 @@ otError MeshForwarder::SendPoll(Message &aMessage, Mac::Frame &aFrame)
|
||||
aFrame.SetCommandId(Mac::Frame::kMacCmdDataRequest);
|
||||
|
||||
mMessageNextOffset = aMessage.GetLength();
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError MeshForwarder::SendFragment(Message &aMessage, Mac::Frame &aFrame)
|
||||
@@ -968,7 +962,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError MeshForwarder::SendEmptyFrame(Mac::Frame &aFrame, bool aAckRequest)
|
||||
void MeshForwarder::SendEmptyFrame(Mac::Frame &aFrame, bool aAckRequest)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
uint16_t fcf;
|
||||
@@ -1005,8 +999,6 @@ otError MeshForwarder::SendEmptyFrame(Mac::Frame &aFrame, bool aAckRequest)
|
||||
aFrame.SetSrcAddr(macSource);
|
||||
aFrame.SetPayloadLength(0);
|
||||
aFrame.SetFramePending(false);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void MeshForwarder::HandleSentFrame(Mac::Frame &aFrame, otError aError)
|
||||
|
||||
@@ -391,8 +391,8 @@ private:
|
||||
const Mac::Address &aMacSource,
|
||||
const Mac::Address &aMacDest,
|
||||
Ip6::Header & aIp6Header);
|
||||
otError GetMacDestinationAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr);
|
||||
otError GetMacSourceAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr);
|
||||
void GetMacDestinationAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr);
|
||||
void GetMacSourceAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr);
|
||||
Message *GetDirectTransmission(void);
|
||||
otError GetIndirectTransmission(void);
|
||||
Message *GetIndirectTransmission(Child &aChild);
|
||||
@@ -419,10 +419,10 @@ private:
|
||||
uint8_t aFrameLength,
|
||||
Lowpan::FragmentHeader &aFragmentHeader);
|
||||
|
||||
otError SendPoll(Message &aMessage, Mac::Frame &aFrame);
|
||||
otError SendMesh(Message &aMessage, Mac::Frame &aFrame);
|
||||
void SendPoll(Message &aMessage, Mac::Frame &aFrame);
|
||||
void SendMesh(Message &aMessage, Mac::Frame &aFrame);
|
||||
otError SendFragment(Message &aMessage, Mac::Frame &aFrame);
|
||||
otError SendEmptyFrame(Mac::Frame &aFrame, bool aAckRequest);
|
||||
void SendEmptyFrame(Mac::Frame &aFrame, bool aAckRequest);
|
||||
otError UpdateIp6Route(Message &aMessage);
|
||||
otError UpdateIp6RouteFtd(Ip6::Header &ip6Header);
|
||||
otError UpdateMeshRoute(Message &aMessage);
|
||||
|
||||
@@ -529,7 +529,7 @@ void MeshForwarder::PrepareIndirectTransmission(Message &aMessage, const Child &
|
||||
}
|
||||
}
|
||||
|
||||
otError MeshForwarder::SendMesh(Message &aMessage, Mac::Frame &aFrame)
|
||||
void MeshForwarder::SendMesh(Message &aMessage, Mac::Frame &aFrame)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
uint16_t fcf;
|
||||
@@ -550,8 +550,6 @@ otError MeshForwarder::SendMesh(Message &aMessage, Mac::Frame &aFrame)
|
||||
aFrame.SetPayloadLength(static_cast<uint8_t>(aMessage.GetLength()));
|
||||
|
||||
mMessageNextOffset = aMessage.GetLength();
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void MeshForwarder::HandleDataRequest(const Mac::Address &aMacSource, const otThreadLinkInfo &aLinkInfo)
|
||||
|
||||
+7
-11
@@ -228,7 +228,7 @@ otError Mle::Disable(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
SuccessOrExit(error = Stop(false));
|
||||
Stop(false);
|
||||
SuccessOrExit(error = mSocket.Close());
|
||||
SuccessOrExit(error = GetNetif().RemoveUnicastAddress(mLinkLocal64));
|
||||
|
||||
@@ -280,7 +280,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Mle::Stop(bool aClearNetworkDatasets)
|
||||
void Mle::Stop(bool aClearNetworkDatasets)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
|
||||
@@ -302,7 +302,7 @@ otError Mle::Stop(bool aClearNetworkDatasets)
|
||||
SetRole(OT_DEVICE_ROLE_DISABLED);
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
void Mle::SetRole(otDeviceRole aRole)
|
||||
@@ -784,7 +784,7 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError Mle::SetTimeout(uint32_t aTimeout)
|
||||
void Mle::SetTimeout(uint32_t aTimeout)
|
||||
{
|
||||
VerifyOrExit(mTimeout != aTimeout);
|
||||
|
||||
@@ -803,7 +803,7 @@ otError Mle::SetTimeout(uint32_t aTimeout)
|
||||
}
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
otError Mle::SetDeviceMode(uint8_t aDeviceMode)
|
||||
@@ -853,7 +853,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Mle::UpdateLinkLocalAddress(void)
|
||||
void Mle::UpdateLinkLocalAddress(void)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
|
||||
@@ -862,8 +862,6 @@ otError Mle::UpdateLinkLocalAddress(void)
|
||||
netif.AddUnicastAddress(mLinkLocal64);
|
||||
|
||||
GetNotifier().Signal(OT_CHANGED_THREAD_LL_ADDR);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void Mle::SetMeshLocalPrefix(const otMeshLocalPrefix &aMeshLocalPrefix)
|
||||
@@ -951,7 +949,7 @@ uint16_t Mle::GetRloc16(void) const
|
||||
return GetNetif().GetMac().GetShortAddress();
|
||||
}
|
||||
|
||||
otError Mle::SetRloc16(uint16_t aRloc16)
|
||||
void Mle::SetRloc16(uint16_t aRloc16)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
|
||||
@@ -966,8 +964,6 @@ otError Mle::SetRloc16(uint16_t aRloc16)
|
||||
|
||||
netif.GetMac().SetShortAddress(aRloc16);
|
||||
netif.GetIp6().GetMpl().SetSeedId(aRloc16);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void Mle::SetLeaderData(uint32_t aPartitionId, uint8_t aWeighting, uint8_t aLeaderRouterId)
|
||||
|
||||
+4
-10
@@ -509,10 +509,8 @@ public:
|
||||
*
|
||||
* @param[in] aClearNetworkDatasets True to clear network datasets, False not.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully stopped the protocol operation.
|
||||
*
|
||||
*/
|
||||
otError Stop(bool aClearNetworkDatasets);
|
||||
void Stop(bool aClearNetworkDatasets);
|
||||
|
||||
/**
|
||||
* This method restores network information from non-volatile memory.
|
||||
@@ -730,10 +728,8 @@ public:
|
||||
*
|
||||
* Call this method when the IEEE 802.15.4 Extended Address has changed.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully updated the link local address.
|
||||
*
|
||||
*/
|
||||
otError UpdateLinkLocalAddress(void);
|
||||
void UpdateLinkLocalAddress(void);
|
||||
|
||||
/**
|
||||
* This method returns a reference to the link-local all Thread nodes multicast address.
|
||||
@@ -814,7 +810,7 @@ public:
|
||||
* @param[in] aTimeout The Timeout value in seconds.
|
||||
*
|
||||
*/
|
||||
otError SetTimeout(uint32_t aTimeout);
|
||||
void SetTimeout(uint32_t aTimeout);
|
||||
|
||||
/**
|
||||
* This method returns the RLOC16 assigned to the Thread interface.
|
||||
@@ -1512,10 +1508,8 @@ protected:
|
||||
*
|
||||
* @param[in] aRloc16 The RLOC16 to set.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the RLOC16.
|
||||
*
|
||||
*/
|
||||
otError SetRloc16(uint16_t aRloc16);
|
||||
void SetRloc16(uint16_t aRloc16);
|
||||
|
||||
/**
|
||||
* This method sets the Device State to Detached.
|
||||
|
||||
@@ -194,7 +194,7 @@ otError MleRouter::BecomeLeader(void)
|
||||
netif.GetNetworkDataLeader().Reset();
|
||||
netif.GetLeader().SetEmptyCommissionerData();
|
||||
|
||||
SuccessOrExit(error = SetStateLeader(GetRloc16(leaderId)));
|
||||
SetStateLeader(GetRloc16(leaderId));
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -213,13 +213,11 @@ void MleRouter::StopLeader(void)
|
||||
netif.UnsubscribeAllRoutersMulticast();
|
||||
}
|
||||
|
||||
otError MleRouter::HandleDetachStart(void)
|
||||
void MleRouter::HandleDetachStart(void)
|
||||
{
|
||||
mRouterTable.ClearNeighbors();
|
||||
StopLeader();
|
||||
mStateUpdateTimer.Stop();
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError MleRouter::HandleChildStart(AttachMode aMode)
|
||||
@@ -301,7 +299,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError MleRouter::SetStateRouter(uint16_t aRloc16)
|
||||
void MleRouter::SetStateRouter(uint16_t aRloc16)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
|
||||
@@ -330,11 +328,9 @@ otError MleRouter::SetStateRouter(uint16_t aRloc16)
|
||||
RemoveNeighbor(*iter.GetChild());
|
||||
}
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError MleRouter::SetStateLeader(uint16_t aRloc16)
|
||||
void MleRouter::SetStateLeader(uint16_t aRloc16)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
|
||||
@@ -373,8 +369,6 @@ otError MleRouter::SetStateLeader(uint16_t aRloc16)
|
||||
}
|
||||
|
||||
otLogNoteMle("Leader partition id 0x%x", mLeaderData.GetPartitionId());
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
bool MleRouter::HandleAdvertiseTimer(TrickleTimer &aTimer)
|
||||
@@ -1675,7 +1669,7 @@ otError MleRouter::HandleParentRequest(const Message &aMessage, const Ip6::Messa
|
||||
child->SetTimeout(TimerMilli::MsecToSec(kMaxChildIdRequestTimeout));
|
||||
}
|
||||
|
||||
SuccessOrExit(error = SendParentResponse(child, challenge, !scanMask.IsEndDeviceFlagSet()));
|
||||
SendParentResponse(child, challenge, !scanMask.IsEndDeviceFlagSet());
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -1897,7 +1891,7 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError MleRouter::SendParentResponse(Child *aChild, const ChallengeTlv &aChallenge, bool aRoutersOnlyRequest)
|
||||
void MleRouter::SendParentResponse(Child *aChild, const ChallengeTlv &aChallenge, bool aRoutersOnlyRequest)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Ip6::Address destination;
|
||||
@@ -1952,8 +1946,6 @@ exit:
|
||||
{
|
||||
message->Free();
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError MleRouter::UpdateChildAddresses(const Message &aMessage, uint16_t aOffset, Child &aChild)
|
||||
@@ -2540,7 +2532,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError MleRouter::HandleNetworkDataUpdateRouter(void)
|
||||
void MleRouter::HandleNetworkDataUpdateRouter(void)
|
||||
{
|
||||
static const uint8_t tlvs[] = {Tlv::kNetworkData};
|
||||
Ip6::Address destination;
|
||||
@@ -2558,7 +2550,7 @@ otError MleRouter::HandleNetworkDataUpdateRouter(void)
|
||||
SynchronizeChildNetworkData();
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
void MleRouter::SynchronizeChildNetworkData(void)
|
||||
@@ -2979,11 +2971,11 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError MleRouter::SendChildUpdateResponse(Child * aChild,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
const uint8_t * aTlvs,
|
||||
uint8_t aTlvslength,
|
||||
const ChallengeTlv * aChallenge)
|
||||
void MleRouter::SendChildUpdateResponse(Child * aChild,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
const uint8_t * aTlvs,
|
||||
uint8_t aTlvslength,
|
||||
const ChallengeTlv * aChallenge)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Message *message;
|
||||
@@ -3056,8 +3048,6 @@ exit:
|
||||
{
|
||||
message->Free();
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError MleRouter::SendDataResponse(const Ip6::Address &aDestination,
|
||||
@@ -3154,13 +3144,13 @@ otError MleRouter::RemoveNeighbor(const Mac::Address &aAddress)
|
||||
Neighbor *neighbor;
|
||||
|
||||
VerifyOrExit((neighbor = GetNeighbor(aAddress)) != NULL, error = OT_ERROR_NOT_FOUND);
|
||||
SuccessOrExit(error = RemoveNeighbor(*neighbor));
|
||||
RemoveNeighbor(*neighbor);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError MleRouter::RemoveNeighbor(Neighbor &aNeighbor)
|
||||
void MleRouter::RemoveNeighbor(Neighbor &aNeighbor)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
|
||||
@@ -3210,8 +3200,6 @@ otError MleRouter::RemoveNeighbor(Neighbor &aNeighbor)
|
||||
|
||||
aNeighbor.GetLinkInfo().Clear();
|
||||
aNeighbor.SetState(Neighbor::kStateInvalid);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
Neighbor *MleRouter::GetNeighbor(uint16_t aAddress)
|
||||
@@ -3980,7 +3968,7 @@ void MleRouter::HandleAddressSolicitResponse(Coap::Message * aMessage,
|
||||
// assign short address
|
||||
SetRouterId(routerId);
|
||||
|
||||
SuccessOrExit(SetStateRouter(GetRloc16(mRouterId)));
|
||||
SetStateRouter(GetRloc16(mRouterId));
|
||||
mRouterTable.Clear();
|
||||
mRouterTable.ProcessTlv(routerMaskTlv);
|
||||
|
||||
@@ -4706,13 +4694,11 @@ bool MleRouter::IsSleepyChildSubscribed(const Ip6::Address &aAddress, Child &aCh
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
otError MleRouter::HandleTimeSync(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
|
||||
void MleRouter::HandleTimeSync(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
|
||||
{
|
||||
LogMleMessage("Receive Time Sync", aMessageInfo.GetPeerAddr());
|
||||
|
||||
GetNetif().GetTimeSync().HandleTimeSyncMessage(aMessage);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError MleRouter::SendTimeSync(void)
|
||||
|
||||
@@ -331,10 +331,8 @@ public:
|
||||
*
|
||||
* @param[in] aNeighbor A reference to the neighbor object.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully removed the neighbor.
|
||||
*
|
||||
*/
|
||||
otError RemoveNeighbor(Neighbor &aNeighbor);
|
||||
void RemoveNeighbor(Neighbor &aNeighbor);
|
||||
|
||||
/**
|
||||
* This method gets the `ChildTable` object.
|
||||
@@ -695,7 +693,7 @@ private:
|
||||
otError AppendPendingDataset(Message &aMessage);
|
||||
otError GetChildInfo(Child &aChild, otChildInfo &aChildInfo);
|
||||
otError RefreshStoredChildren(void);
|
||||
otError HandleDetachStart(void);
|
||||
void HandleDetachStart(void);
|
||||
otError HandleChildStart(AttachMode aMode);
|
||||
otError HandleLinkRequest(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
otError HandleLinkAccept(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo, uint32_t aKeySequence);
|
||||
@@ -716,10 +714,10 @@ private:
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
uint32_t aKeySequence);
|
||||
otError HandleDataRequest(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
otError HandleNetworkDataUpdateRouter(void);
|
||||
void HandleNetworkDataUpdateRouter(void);
|
||||
otError HandleDiscoveryRequest(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
otError HandleTimeSync(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
void HandleTimeSync(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
#endif
|
||||
|
||||
otError ProcessRouteTlv(const RouteTlv &aRoute);
|
||||
@@ -734,10 +732,10 @@ private:
|
||||
Neighbor * aNeighbor,
|
||||
const TlvRequestTlv & aTlvRequest,
|
||||
const ChallengeTlv & aChallenge);
|
||||
otError SendParentResponse(Child *aChild, const ChallengeTlv &aChallenge, bool aRoutersOnlyRequest);
|
||||
void SendParentResponse(Child *aChild, const ChallengeTlv &aChallenge, bool aRoutersOnlyRequest);
|
||||
otError SendChildIdResponse(Child &aChild);
|
||||
otError SendChildUpdateRequest(Child &aChild);
|
||||
otError SendChildUpdateResponse(Child * aChild,
|
||||
void SendChildUpdateResponse(Child * aChild,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
const uint8_t * aTlvs,
|
||||
uint8_t aTlvsLength,
|
||||
@@ -748,8 +746,8 @@ private:
|
||||
uint16_t aDelay);
|
||||
otError SendDiscoveryResponse(const Ip6::Address &aDestination, uint16_t aPanId);
|
||||
|
||||
otError SetStateRouter(uint16_t aRloc16);
|
||||
otError SetStateLeader(uint16_t aRloc16);
|
||||
void SetStateRouter(uint16_t aRloc16);
|
||||
void SetStateLeader(uint16_t aRloc16);
|
||||
void StopLeader(void);
|
||||
void SynchronizeChildNetworkData(void);
|
||||
otError UpdateChildAddresses(const Message &aMessage, uint16_t aOffset, Child &aChild);
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
bool IsSleepyChildSubscribed(const Ip6::Address &, Child &) { return false; }
|
||||
|
||||
private:
|
||||
otError HandleDetachStart(void) { return OT_ERROR_NONE; }
|
||||
void HandleDetachStart(void) {}
|
||||
otError HandleChildStart(AttachMode) { return OT_ERROR_NONE; }
|
||||
otError HandleLinkRequest(const Message &, const Ip6::MessageInfo &) { return OT_ERROR_DROP; }
|
||||
otError HandleLinkAccept(const Message &, const Ip6::MessageInfo &, uint32_t) { return OT_ERROR_DROP; }
|
||||
@@ -142,7 +142,7 @@ private:
|
||||
otError HandleChildUpdateRequest(const Message &, const Ip6::MessageInfo &, uint32_t) { return OT_ERROR_DROP; }
|
||||
otError HandleChildUpdateResponse(const Message &, const Ip6::MessageInfo &, uint32_t) { return OT_ERROR_DROP; }
|
||||
otError HandleDataRequest(const Message &, const Ip6::MessageInfo &) { return OT_ERROR_DROP; }
|
||||
otError HandleNetworkDataUpdateRouter(void) { return OT_ERROR_NONE; }
|
||||
void HandleNetworkDataUpdateRouter(void) {}
|
||||
otError HandleDiscoveryRequest(const Message &, const Ip6::MessageInfo &) { return OT_ERROR_DROP; }
|
||||
void HandlePartitionChange(void) {}
|
||||
void StopAdvertiseTimer(void) {}
|
||||
|
||||
@@ -979,20 +979,18 @@ exit:
|
||||
}
|
||||
#endif
|
||||
|
||||
otError NetworkData::Insert(uint8_t *aStart, uint8_t aLength)
|
||||
void NetworkData::Insert(uint8_t *aStart, uint8_t aLength)
|
||||
{
|
||||
assert(aLength + mLength <= sizeof(mTlvs) && mTlvs <= aStart && aStart <= mTlvs + mLength);
|
||||
memmove(aStart + aLength, aStart, mLength - static_cast<size_t>(aStart - mTlvs));
|
||||
mLength += aLength;
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError NetworkData::Remove(uint8_t *aStart, uint8_t aLength)
|
||||
void NetworkData::Remove(uint8_t *aStart, uint8_t aLength)
|
||||
{
|
||||
assert(aLength <= mLength && mTlvs <= aStart && (aStart - mTlvs) + aLength <= mLength);
|
||||
memmove(aStart, aStart + aLength, mLength - (static_cast<size_t>(aStart - mTlvs) + aLength));
|
||||
mLength -= aLength;
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError NetworkData::SendServerDataNotification(uint16_t aRloc16)
|
||||
|
||||
@@ -399,11 +399,8 @@ protected:
|
||||
* @param[in] aStart A pointer to the beginning of the insertion.
|
||||
* @param[in] aLength The number of bytes to insert.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully inserted bytes.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer space to insert bytes.
|
||||
*
|
||||
*/
|
||||
otError Insert(uint8_t *aStart, uint8_t aLength);
|
||||
void Insert(uint8_t *aStart, uint8_t aLength);
|
||||
|
||||
/**
|
||||
* This method removes bytes from the Network Data.
|
||||
@@ -411,10 +408,8 @@ protected:
|
||||
* @param[in] aStart A pointer to the beginning of the removal.
|
||||
* @param[in] aLength The number of bytes to remove.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully removed bytes.
|
||||
*
|
||||
*/
|
||||
otError Remove(uint8_t *aStart, uint8_t aLength);
|
||||
void Remove(uint8_t *aStart, uint8_t aLength);
|
||||
|
||||
/**
|
||||
* This method strips non-stable data from the Thread Network Data.
|
||||
|
||||
@@ -120,10 +120,9 @@ uint32_t Leader::GetContextIdReuseDelay(void) const
|
||||
return mContextIdReuseDelay;
|
||||
}
|
||||
|
||||
otError Leader::SetContextIdReuseDelay(uint32_t aDelay)
|
||||
void Leader::SetContextIdReuseDelay(uint32_t aDelay)
|
||||
{
|
||||
mContextIdReuseDelay = aDelay;
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void Leader::RemoveBorderRouter(uint16_t aRloc16, MatchMode aMatchMode)
|
||||
@@ -772,7 +771,7 @@ otError Leader::RegisterNetworkData(uint16_t aRloc16, uint8_t *aTlvs, uint8_t aT
|
||||
// Store old Service IDs for given rloc16, so updates to server will reuse the same Service ID
|
||||
SuccessOrExit(error = GetNetworkData(false, oldTlvs, oldTlvsLength));
|
||||
|
||||
SuccessOrExit(error = RemoveRloc(aRloc16, kMatchModeRloc16));
|
||||
RemoveRloc(aRloc16, kMatchModeRloc16);
|
||||
SuccessOrExit(error = AddNetworkData(aTlvs, aTlvsLength, oldTlvs, oldTlvsLength));
|
||||
|
||||
mVersion++;
|
||||
@@ -1197,7 +1196,7 @@ exit:
|
||||
return rval;
|
||||
}
|
||||
|
||||
otError Leader::FreeContext(uint8_t aContextId)
|
||||
void Leader::FreeContext(uint8_t aContextId)
|
||||
{
|
||||
otLogInfoNetData("Free Context Id = %d", aContextId);
|
||||
RemoveContext(aContextId);
|
||||
@@ -1205,7 +1204,6 @@ otError Leader::FreeContext(uint8_t aContextId)
|
||||
mVersion++;
|
||||
mStableVersion++;
|
||||
GetNotifier().Signal(OT_CHANGED_THREAD_NETDATA);
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void Leader::StartContextReuseTimer(uint8_t aContextId)
|
||||
@@ -1241,7 +1239,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode)
|
||||
void Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode)
|
||||
{
|
||||
NetworkDataTlv *cur = reinterpret_cast<NetworkDataTlv *>(mTlvs);
|
||||
NetworkDataTlv *end;
|
||||
@@ -1304,11 +1302,9 @@ otError Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode)
|
||||
}
|
||||
|
||||
otDumpDebgNetData("remove done", mTlvs, mLength);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Leader::RemoveRloc(PrefixTlv &prefix, uint16_t aRloc16, MatchMode aMatchMode)
|
||||
void Leader::RemoveRloc(PrefixTlv &prefix, uint16_t aRloc16, MatchMode aMatchMode)
|
||||
{
|
||||
NetworkDataTlv *cur = prefix.GetSubTlvs();
|
||||
NetworkDataTlv *end;
|
||||
@@ -1371,12 +1367,10 @@ otError Leader::RemoveRloc(PrefixTlv &prefix, uint16_t aRloc16, MatchMode aMatch
|
||||
StopContextReuseTimer(context->GetContextId());
|
||||
}
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_SERVICE
|
||||
otError Leader::RemoveRloc(ServiceTlv &service, uint16_t aRloc16, MatchMode aMatchMode)
|
||||
void Leader::RemoveRloc(ServiceTlv &service, uint16_t aRloc16, MatchMode aMatchMode)
|
||||
{
|
||||
NetworkDataTlv *cur = service.GetSubTlvs();
|
||||
NetworkDataTlv *end;
|
||||
@@ -1413,12 +1407,10 @@ otError Leader::RemoveRloc(ServiceTlv &service, uint16_t aRloc16, MatchMode aMat
|
||||
|
||||
cur = cur->GetNext();
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
otError Leader::RemoveRloc(PrefixTlv &aPrefix, HasRouteTlv &aHasRoute, uint16_t aRloc16, MatchMode aMatchMode)
|
||||
void Leader::RemoveRloc(PrefixTlv &aPrefix, HasRouteTlv &aHasRoute, uint16_t aRloc16, MatchMode aMatchMode)
|
||||
{
|
||||
HasRouteEntry *entry = aHasRoute.GetFirstEntry();
|
||||
|
||||
@@ -1434,11 +1426,9 @@ otError Leader::RemoveRloc(PrefixTlv &aPrefix, HasRouteTlv &aHasRoute, uint16_t
|
||||
|
||||
entry = entry->GetNext();
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Leader::RemoveRloc(PrefixTlv &aPrefix, BorderRouterTlv &aBorderRouter, uint16_t aRloc16, MatchMode aMatchMode)
|
||||
void Leader::RemoveRloc(PrefixTlv &aPrefix, BorderRouterTlv &aBorderRouter, uint16_t aRloc16, MatchMode aMatchMode)
|
||||
{
|
||||
BorderRouterEntry *entry = aBorderRouter.GetFirstEntry();
|
||||
|
||||
@@ -1454,11 +1444,9 @@ otError Leader::RemoveRloc(PrefixTlv &aPrefix, BorderRouterTlv &aBorderRouter, u
|
||||
|
||||
entry = entry->GetNext();
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Leader::RemoveContext(uint8_t aContextId)
|
||||
void Leader::RemoveContext(uint8_t aContextId)
|
||||
{
|
||||
NetworkDataTlv *cur = reinterpret_cast<NetworkDataTlv *>(mTlvs);
|
||||
NetworkDataTlv *end;
|
||||
@@ -1498,11 +1486,9 @@ otError Leader::RemoveContext(uint8_t aContextId)
|
||||
}
|
||||
|
||||
otDumpDebgNetData("remove done", mTlvs, mLength);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Leader::RemoveContext(PrefixTlv &aPrefix, uint8_t aContextId)
|
||||
void Leader::RemoveContext(PrefixTlv &aPrefix, uint8_t aContextId)
|
||||
{
|
||||
NetworkDataTlv *cur = aPrefix.GetSubTlvs();
|
||||
NetworkDataTlv *end;
|
||||
@@ -1542,8 +1528,6 @@ otError Leader::RemoveContext(PrefixTlv &aPrefix, uint8_t aContextId)
|
||||
|
||||
cur = cur->GetNext();
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void Leader::UpdateContextsAfterReset(void)
|
||||
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
* @param[in] aDelay The CONTEXT_ID_REUSE_DELAY value.
|
||||
*
|
||||
*/
|
||||
otError SetContextIdReuseDelay(uint32_t aDelay);
|
||||
void SetContextIdReuseDelay(uint32_t aDelay);
|
||||
|
||||
/**
|
||||
* This method removes Network Data entries matching with a given RLOC16.
|
||||
@@ -188,23 +188,23 @@ private:
|
||||
otError AddService(ServiceTlv &aTlv, uint8_t *aOldTlvs, uint8_t aOldTlvsLength);
|
||||
#endif
|
||||
|
||||
int AllocateContext(void);
|
||||
otError FreeContext(uint8_t aContextId);
|
||||
void StartContextReuseTimer(uint8_t aContextId);
|
||||
void StopContextReuseTimer(uint8_t aContextId);
|
||||
int AllocateContext(void);
|
||||
void FreeContext(uint8_t aContextId);
|
||||
void StartContextReuseTimer(uint8_t aContextId);
|
||||
void StopContextReuseTimer(uint8_t aContextId);
|
||||
|
||||
otError RemoveContext(uint8_t aContextId);
|
||||
otError RemoveContext(PrefixTlv &aPrefix, uint8_t aContextId);
|
||||
void RemoveContext(uint8_t aContextId);
|
||||
void RemoveContext(PrefixTlv &aPrefix, uint8_t aContextId);
|
||||
|
||||
otError RemoveCommissioningData(void);
|
||||
void RemoveCommissioningData(void);
|
||||
|
||||
otError RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode);
|
||||
otError RemoveRloc(PrefixTlv &aPrefix, uint16_t aRloc16, MatchMode aMatchMode);
|
||||
void RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode);
|
||||
void RemoveRloc(PrefixTlv &aPrefix, uint16_t aRloc16, MatchMode aMatchMode);
|
||||
#if OPENTHREAD_ENABLE_SERVICE
|
||||
otError RemoveRloc(ServiceTlv &service, uint16_t aRloc16, MatchMode aMatchMode);
|
||||
void RemoveRloc(ServiceTlv &service, uint16_t aRloc16, MatchMode aMatchMode);
|
||||
#endif
|
||||
otError RemoveRloc(PrefixTlv &aPrefix, HasRouteTlv &aHasRoute, uint16_t aRloc16, MatchMode aMatchMode);
|
||||
otError RemoveRloc(PrefixTlv &aPrefix, BorderRouterTlv &aBorderRouter, uint16_t aRloc16, MatchMode aMatchMode);
|
||||
void RemoveRloc(PrefixTlv &aPrefix, HasRouteTlv &aHasRoute, uint16_t aRloc16, MatchMode aMatchMode);
|
||||
void RemoveRloc(PrefixTlv &aPrefix, BorderRouterTlv &aBorderRouter, uint16_t aRloc16, MatchMode aMatchMode);
|
||||
|
||||
static bool RlocMatch(uint16_t aFirstRloc16, uint16_t aSecondRloc16, MatchMode aMatchMode);
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ exit:
|
||||
}
|
||||
#endif
|
||||
|
||||
otError Local::UpdateRloc(void)
|
||||
void Local::UpdateRloc(void)
|
||||
{
|
||||
for (NetworkDataTlv *cur = reinterpret_cast<NetworkDataTlv *>(mTlvs);
|
||||
cur < reinterpret_cast<NetworkDataTlv *>(mTlvs + mLength); cur = cur->GetNext())
|
||||
@@ -266,11 +266,9 @@ otError Local::UpdateRloc(void)
|
||||
}
|
||||
|
||||
ClearResubmitDelayTimer();
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Local::UpdateRloc(PrefixTlv &aPrefix)
|
||||
void Local::UpdateRloc(PrefixTlv &aPrefix)
|
||||
{
|
||||
for (NetworkDataTlv *cur = aPrefix.GetSubTlvs(); cur < aPrefix.GetNext(); cur = cur->GetNext())
|
||||
{
|
||||
@@ -289,26 +287,22 @@ otError Local::UpdateRloc(PrefixTlv &aPrefix)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Local::UpdateRloc(HasRouteTlv &aHasRoute)
|
||||
void Local::UpdateRloc(HasRouteTlv &aHasRoute)
|
||||
{
|
||||
HasRouteEntry *entry = aHasRoute.GetEntry(0);
|
||||
entry->SetRloc(GetNetif().GetMle().GetRloc16());
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Local::UpdateRloc(BorderRouterTlv &aBorderRouter)
|
||||
void Local::UpdateRloc(BorderRouterTlv &aBorderRouter)
|
||||
{
|
||||
BorderRouterEntry *entry = aBorderRouter.GetEntry(0);
|
||||
entry->SetRloc(GetNetif().GetMle().GetRloc16());
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_SERVICE
|
||||
otError Local::UpdateRloc(ServiceTlv &aService)
|
||||
void Local::UpdateRloc(ServiceTlv &aService)
|
||||
{
|
||||
for (NetworkDataTlv *cur = aService.GetSubTlvs(); cur < aService.GetNext(); cur = cur->GetNext())
|
||||
{
|
||||
@@ -323,14 +317,11 @@ otError Local::UpdateRloc(ServiceTlv &aService)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Local::UpdateRloc(ServerTlv &aServer)
|
||||
void Local::UpdateRloc(ServerTlv &aServer)
|
||||
{
|
||||
aServer.SetServer16(GetNetif().GetMle().GetRloc16());
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -166,13 +166,13 @@ public:
|
||||
otError SendServerDataNotification(void);
|
||||
|
||||
private:
|
||||
otError UpdateRloc(void);
|
||||
otError UpdateRloc(PrefixTlv &aPrefix);
|
||||
otError UpdateRloc(HasRouteTlv &aHasRoute);
|
||||
otError UpdateRloc(BorderRouterTlv &aBorderRouter);
|
||||
void UpdateRloc(void);
|
||||
void UpdateRloc(PrefixTlv &aPrefix);
|
||||
void UpdateRloc(HasRouteTlv &aHasRoute);
|
||||
void UpdateRloc(BorderRouterTlv &aBorderRouter);
|
||||
#if OPENTHREAD_ENABLE_SERVICE
|
||||
otError UpdateRloc(ServiceTlv &aService);
|
||||
otError UpdateRloc(ServerTlv &aService);
|
||||
void UpdateRloc(ServiceTlv &aService);
|
||||
void UpdateRloc(ServerTlv &aService);
|
||||
#endif
|
||||
|
||||
bool IsOnMeshPrefixConsistent(void);
|
||||
|
||||
@@ -127,12 +127,10 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError JamDetector::SetRssiThreshold(int8_t aThreshold)
|
||||
void JamDetector::SetRssiThreshold(int8_t aThreshold)
|
||||
{
|
||||
mRssiThreshold = aThreshold;
|
||||
otLogInfoUtil("JamDetector - RSSI threshold set to %d", mRssiThreshold);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError JamDetector::SetWindow(uint8_t aWindow)
|
||||
|
||||
@@ -107,10 +107,8 @@ public:
|
||||
*
|
||||
* @param[in] aRssiThreshold The RSSI threshold.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the threshold.
|
||||
*
|
||||
*/
|
||||
otError SetRssiThreshold(int8_t aThreshold);
|
||||
void SetRssiThreshold(int8_t aThreshold);
|
||||
|
||||
/**
|
||||
* Get the Jam Detection RSSI Threshold (in dBm).
|
||||
|
||||
@@ -327,7 +327,7 @@ bool NcpFrameBuffer::InFrameIsWriting(Priority aPriority) const
|
||||
return (mWriteDirection == static_cast<Direction>(aPriority));
|
||||
}
|
||||
|
||||
otError NcpFrameBuffer::InFrameBegin(Priority aPriority)
|
||||
void NcpFrameBuffer::InFrameBegin(Priority aPriority)
|
||||
{
|
||||
// Discard any previous unfinished frame.
|
||||
InFrameDiscard();
|
||||
@@ -345,8 +345,6 @@ otError NcpFrameBuffer::InFrameBegin(Priority aPriority)
|
||||
|
||||
// Set up the segment head and tail
|
||||
mWriteSegmentHead = mWriteSegmentTail = mWriteFrameStart[mWriteDirection];
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError NcpFrameBuffer::InFrameFeedByte(uint8_t aByte)
|
||||
|
||||
@@ -161,11 +161,8 @@ public:
|
||||
*
|
||||
* @param[in] aPriority Priority level of the new input frame.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully started a new frame.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer space available to start a new frame.
|
||||
*
|
||||
*/
|
||||
otError InFrameBegin(Priority aPriority);
|
||||
void InFrameBegin(Priority aPriority);
|
||||
|
||||
/**
|
||||
* This method adds a single byte to current input frame.
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace Ncp {
|
||||
otError SpinelEncoder::BeginFrame(NcpFrameBuffer::Priority aPriority)
|
||||
{
|
||||
mNumOpenStructs = 0;
|
||||
return mNcpBuffer.InFrameBegin(aPriority);
|
||||
mNcpBuffer.InFrameBegin(aPriority);
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError SpinelEncoder::BeginFrame(uint8_t aHeader, unsigned int aCommand)
|
||||
|
||||
@@ -222,7 +222,7 @@ void WriteTestFrame1(NcpFrameBuffer &aNcpBuffer, NcpFrameBuffer::Priority aPrior
|
||||
message->Write(0, sizeof(sMottoText), sMottoText);
|
||||
|
||||
oldContext = sContext;
|
||||
SuccessOrQuit(aNcpBuffer.InFrameBegin(aPriority), "InFrameBegin() failed.");
|
||||
aNcpBuffer.InFrameBegin(aPriority);
|
||||
SuccessOrQuit(aNcpBuffer.InFrameFeedData(sMottoText, sizeof(sMottoText)), "InFrameFeedData() failed.");
|
||||
SuccessOrQuit(aNcpBuffer.InFrameFeedData(sMysteryText, sizeof(sMysteryText)), "InFrameFeedData() failed.");
|
||||
SuccessOrQuit(aNcpBuffer.InFrameFeedMessage(message), "InFrameFeedMessage() failed.");
|
||||
@@ -270,7 +270,7 @@ void WriteTestFrame2(NcpFrameBuffer &aNcpBuffer, NcpFrameBuffer::Priority aPrior
|
||||
SuccessOrQuit(message2->SetLength(sizeof(sHelloText)), "Could not set the length of message.");
|
||||
message2->Write(0, sizeof(sHelloText), sHelloText);
|
||||
|
||||
SuccessOrQuit(aNcpBuffer.InFrameBegin(aPriority), "InFrameFeedBegin() failed.");
|
||||
aNcpBuffer.InFrameBegin(aPriority);
|
||||
SuccessOrQuit(aNcpBuffer.InFrameFeedMessage(message1), "InFrameFeedMessage() failed.");
|
||||
SuccessOrQuit(aNcpBuffer.InFrameFeedData(sOpenThreadText, sizeof(sOpenThreadText)), "InFrameFeedData() failed.");
|
||||
SuccessOrQuit(aNcpBuffer.InFrameFeedMessage(message2), "InFrameFeedMessage() failed.");
|
||||
@@ -311,7 +311,7 @@ void WriteTestFrame3(NcpFrameBuffer &aNcpBuffer, NcpFrameBuffer::Priority aPrior
|
||||
// An empty message with no content.
|
||||
SuccessOrQuit(message1->SetLength(0), "Could not set the length of message.");
|
||||
|
||||
SuccessOrQuit(aNcpBuffer.InFrameBegin(aPriority), "InFrameFeedBegin() failed.");
|
||||
aNcpBuffer.InFrameBegin(aPriority);
|
||||
SuccessOrQuit(aNcpBuffer.InFrameFeedMessage(message1), "InFrameFeedMessage() failed.");
|
||||
SuccessOrQuit(aNcpBuffer.InFrameFeedData(sMysteryText, sizeof(sMysteryText)), "InFrameFeedData() failed.");
|
||||
SuccessOrQuit(aNcpBuffer.InFrameEnd(), "InFrameEnd() failed.");
|
||||
@@ -342,7 +342,7 @@ void WriteTestFrame4(NcpFrameBuffer &aNcpBuffer, NcpFrameBuffer::Priority aPrior
|
||||
{
|
||||
CallbackContext oldContext = sContext;
|
||||
|
||||
SuccessOrQuit(aNcpBuffer.InFrameBegin(aPriority), "InFrameFeedBegin() failed.");
|
||||
aNcpBuffer.InFrameBegin(aPriority);
|
||||
SuccessOrQuit(aNcpBuffer.InFrameFeedData(sOpenThreadText, sizeof(sOpenThreadText)), "InFrameFeedData() failed.");
|
||||
SuccessOrQuit(aNcpBuffer.InFrameEnd(), "InFrameEnd() failed.");
|
||||
|
||||
@@ -732,7 +732,7 @@ void TestNcpFrameBuffer(void)
|
||||
printf("\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
|
||||
printf("\n Test 11: Read and remove in middle of an active input frame write");
|
||||
WriteTestFrame1(ncpBuffer, NcpFrameBuffer::kPriorityLow);
|
||||
SuccessOrQuit(ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityHigh), "InFrameFeedBegin() failed.");
|
||||
ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityHigh);
|
||||
SuccessOrQuit(ncpBuffer.InFrameFeedData(sOpenThreadText, sizeof(sOpenThreadText)), "InFrameFeedData() failed.");
|
||||
VerifyAndRemoveFrame1(ncpBuffer);
|
||||
VerifyOrQuit(ncpBuffer.IsEmpty() == true, "IsEmpty() failed.");
|
||||
@@ -740,7 +740,7 @@ void TestNcpFrameBuffer(void)
|
||||
VerifyAndRemoveFrame4(ncpBuffer);
|
||||
// Repeat the test reversing priorities
|
||||
WriteTestFrame1(ncpBuffer, NcpFrameBuffer::kPriorityHigh);
|
||||
SuccessOrQuit(ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityLow), "InFrameFeedBegin() failed.");
|
||||
ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityLow);
|
||||
SuccessOrQuit(ncpBuffer.InFrameFeedData(sOpenThreadText, sizeof(sOpenThreadText)), "InFrameFeedData() failed.");
|
||||
VerifyAndRemoveFrame1(ncpBuffer);
|
||||
VerifyOrQuit(ncpBuffer.IsEmpty() == true, "IsEmpty() failed.");
|
||||
@@ -748,7 +748,7 @@ void TestNcpFrameBuffer(void)
|
||||
VerifyAndRemoveFrame4(ncpBuffer);
|
||||
// Repeat the test with same priorities
|
||||
WriteTestFrame1(ncpBuffer, NcpFrameBuffer::kPriorityHigh);
|
||||
SuccessOrQuit(ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityHigh), "InFrameFeedBegin() failed.");
|
||||
ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityHigh);
|
||||
SuccessOrQuit(ncpBuffer.InFrameFeedData(sOpenThreadText, sizeof(sOpenThreadText)), "InFrameFeedData() failed.");
|
||||
VerifyAndRemoveFrame1(ncpBuffer);
|
||||
VerifyOrQuit(ncpBuffer.IsEmpty() == true, "IsEmpty() failed.");
|
||||
@@ -759,7 +759,7 @@ void TestNcpFrameBuffer(void)
|
||||
printf("\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
|
||||
printf("\n Test 12: Check returned error status");
|
||||
WriteTestFrame1(ncpBuffer, NcpFrameBuffer::kPriorityLow);
|
||||
SuccessOrQuit(ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityHigh), "InFrameFeedBegin() failed.");
|
||||
ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityHigh);
|
||||
VerifyOrQuit(ncpBuffer.InFrameFeedData(buffer, sizeof(buffer)) == OT_ERROR_NO_BUFS, "Incorrect error status");
|
||||
VerifyAndRemoveFrame1(ncpBuffer);
|
||||
VerifyOrQuit(ncpBuffer.IsEmpty() == true, "IsEmpty() failed.");
|
||||
@@ -791,7 +791,7 @@ void TestNcpFrameBuffer(void)
|
||||
printf("\n Test 13: Ensure we can utilize the full buffer size when frames removed during write");
|
||||
WriteTestFrame1(ncpBuffer, NcpFrameBuffer::kPriorityHigh);
|
||||
WriteTestFrame2(ncpBuffer, NcpFrameBuffer::kPriorityLow);
|
||||
SuccessOrQuit(ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityHigh), "InFrameBegin() failed.");
|
||||
ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityHigh);
|
||||
VerifyAndRemoveFrame1(ncpBuffer);
|
||||
VerifyAndRemoveFrame2(ncpBuffer);
|
||||
SuccessOrQuit(ncpBuffer.InFrameFeedData(buffer, sizeof(buffer) - 4), "InFrameFeedData() failed.");
|
||||
@@ -800,7 +800,7 @@ void TestNcpFrameBuffer(void)
|
||||
// Repeat the test with a low priority buffer write
|
||||
WriteTestFrame1(ncpBuffer, NcpFrameBuffer::kPriorityHigh);
|
||||
WriteTestFrame2(ncpBuffer, NcpFrameBuffer::kPriorityLow);
|
||||
SuccessOrQuit(ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityLow), "InFrameBegin() failed.");
|
||||
ncpBuffer.InFrameBegin(NcpFrameBuffer::kPriorityLow);
|
||||
VerifyAndRemoveFrame1(ncpBuffer);
|
||||
VerifyAndRemoveFrame2(ncpBuffer);
|
||||
SuccessOrQuit(ncpBuffer.InFrameFeedData(buffer, sizeof(buffer) - 4), "InFrameFeedData() failed.");
|
||||
@@ -821,7 +821,7 @@ void TestNcpFrameBuffer(void)
|
||||
printf("*");
|
||||
priority = ((j % 3) == 0) ? NcpFrameBuffer::kPriorityHigh : NcpFrameBuffer::kPriorityLow;
|
||||
index = static_cast<uint16_t>(j % sizeof(sHexText));
|
||||
SuccessOrQuit(ncpBuffer.InFrameBegin(priority), "InFrameBegin() failed");
|
||||
ncpBuffer.InFrameBegin(priority);
|
||||
SuccessOrQuit(ncpBuffer.InFrameFeedData(sHexText, index), "InFrameFeedData() failed.");
|
||||
SuccessOrQuit(ncpBuffer.InFrameGetPosition(pos1), "InFrameGetPosition() failed");
|
||||
SuccessOrQuit(ncpBuffer.InFrameFeedData(sMysteryText, sizeof(sHexText) - index), "InFrameFeedData() failed.");
|
||||
@@ -867,7 +867,7 @@ void TestNcpFrameBuffer(void)
|
||||
printf("*");
|
||||
priority = ((j % 3) == 0) ? NcpFrameBuffer::kPriorityHigh : NcpFrameBuffer::kPriorityLow;
|
||||
index = static_cast<uint16_t>(j % sizeof(sHexText));
|
||||
SuccessOrQuit(ncpBuffer.InFrameBegin(priority), "InFrameBegin() failed");
|
||||
ncpBuffer.InFrameBegin(priority);
|
||||
SuccessOrQuit(ncpBuffer.InFrameFeedData(sHexText, index), "InFrameFeedData() failed.");
|
||||
SuccessOrQuit(ncpBuffer.InFrameGetPosition(pos1), "InFrameGetPosition() failed");
|
||||
SuccessOrQuit(ncpBuffer.InFrameFeedData(sMysteryText, sizeof(sHexText) - index), "InFrameFeedData() failed.");
|
||||
@@ -951,7 +951,7 @@ otError WriteRandomFrame(uint32_t aLength, NcpFrameBuffer &aNcpBuffer, NcpFrameB
|
||||
CallbackContext oldContext = sContext;
|
||||
uint32_t tail = sFrameBufferTailIndex[priority];
|
||||
|
||||
SuccessOrExit(error = aNcpBuffer.InFrameBegin(aPriority));
|
||||
aNcpBuffer.InFrameBegin(aPriority);
|
||||
|
||||
while (aLength--)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user