mirror of
https://github.com/espressif/openthread.git
synced 2026-09-12 04:00:10 +00:00
[message] add Message::Priority enumeration type (#4977)
This commit is contained in:
committed by
Jonathan Hui
parent
6c0b9214d8
commit
17a0405c51
+25
-24
@@ -61,7 +61,7 @@ MessagePool::MessagePool(Instance &aInstance)
|
||||
#endif
|
||||
}
|
||||
|
||||
Message *MessagePool::New(Message::Type aType, uint16_t aReserveHeader, uint8_t aPriority)
|
||||
Message *MessagePool::New(Message::Type aType, uint16_t aReserveHeader, Message::Priority aPriority)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Message *message;
|
||||
@@ -89,19 +89,19 @@ exit:
|
||||
|
||||
Message *MessagePool::New(Message::Type aType, uint16_t aReserveHeader, const otMessageSettings *aSettings)
|
||||
{
|
||||
Message *message;
|
||||
bool linkSecurityEnabled;
|
||||
uint8_t priority;
|
||||
Message * message;
|
||||
bool linkSecurityEnabled;
|
||||
Message::Priority priority;
|
||||
|
||||
if (aSettings == NULL)
|
||||
{
|
||||
linkSecurityEnabled = true;
|
||||
priority = OT_MESSAGE_PRIORITY_NORMAL;
|
||||
priority = Message::kPriorityNormal;
|
||||
}
|
||||
else
|
||||
{
|
||||
linkSecurityEnabled = aSettings->mLinkSecurityEnabled;
|
||||
priority = aSettings->mPriority;
|
||||
priority = static_cast<Message::Priority>(aSettings->mPriority);
|
||||
}
|
||||
|
||||
message = New(aType, aReserveHeader, priority);
|
||||
@@ -120,7 +120,7 @@ void MessagePool::Free(Message *aMessage)
|
||||
FreeBuffers(static_cast<Buffer *>(aMessage));
|
||||
}
|
||||
|
||||
Buffer *MessagePool::NewBuffer(uint8_t aPriority)
|
||||
Buffer *MessagePool::NewBuffer(Message::Priority aPriority)
|
||||
{
|
||||
Buffer *buffer = NULL;
|
||||
|
||||
@@ -166,7 +166,7 @@ void MessagePool::FreeBuffers(Buffer *aBuffer)
|
||||
}
|
||||
}
|
||||
|
||||
otError MessagePool::ReclaimBuffers(int aNumBuffers, uint8_t aPriority)
|
||||
otError MessagePool::ReclaimBuffers(int aNumBuffers, Message::Priority aPriority)
|
||||
{
|
||||
#if OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
while (aNumBuffers > GetFreeBufferCount())
|
||||
@@ -342,15 +342,16 @@ bool Message::IsSubTypeMle(void) const
|
||||
return rval;
|
||||
}
|
||||
|
||||
otError Message::SetPriority(uint8_t aPriority)
|
||||
otError Message::SetPriority(Priority aPriority)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint8_t priority = static_cast<uint8_t>(aPriority);
|
||||
PriorityQueue *priorityQueue = NULL;
|
||||
|
||||
VerifyOrExit(aPriority < kNumPriorities, error = OT_ERROR_INVALID_ARGS);
|
||||
VerifyOrExit(priority < kNumPriorities, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
VerifyOrExit(IsInAQueue(), GetMetadata().mPriority = aPriority);
|
||||
VerifyOrExit(GetMetadata().mPriority != aPriority, OT_NOOP);
|
||||
VerifyOrExit(IsInAQueue(), GetMetadata().mPriority = priority);
|
||||
VerifyOrExit(GetMetadata().mPriority != priority, OT_NOOP);
|
||||
|
||||
if (GetMetadata().mInPriorityQ)
|
||||
{
|
||||
@@ -358,7 +359,7 @@ otError Message::SetPriority(uint8_t aPriority)
|
||||
priorityQueue->Dequeue(*this);
|
||||
}
|
||||
|
||||
GetMetadata().mPriority = aPriority;
|
||||
GetMetadata().mPriority = priority;
|
||||
|
||||
if (priorityQueue != NULL)
|
||||
{
|
||||
@@ -859,12 +860,12 @@ PriorityQueue::PriorityQueue(void)
|
||||
}
|
||||
}
|
||||
|
||||
Message *PriorityQueue::FindFirstNonNullTail(uint8_t aStartPriorityLevel) const
|
||||
Message *PriorityQueue::FindFirstNonNullTail(Message::Priority aStartPriorityLevel) const
|
||||
{
|
||||
Message *tail = NULL;
|
||||
uint8_t priority;
|
||||
|
||||
priority = aStartPriorityLevel;
|
||||
priority = static_cast<uint8_t>(aStartPriorityLevel);
|
||||
|
||||
do
|
||||
{
|
||||
@@ -884,19 +885,19 @@ Message *PriorityQueue::GetHead(void) const
|
||||
{
|
||||
Message *tail;
|
||||
|
||||
tail = FindFirstNonNullTail(0);
|
||||
tail = FindFirstNonNullTail(Message::kPriorityLow);
|
||||
|
||||
return (tail == NULL) ? NULL : tail->Next();
|
||||
}
|
||||
|
||||
Message *PriorityQueue::GetHeadForPriority(uint8_t aPriority) const
|
||||
Message *PriorityQueue::GetHeadForPriority(Message::Priority aPriority) const
|
||||
{
|
||||
Message *head;
|
||||
Message *previousTail;
|
||||
|
||||
if (mTails[aPriority] != NULL)
|
||||
{
|
||||
previousTail = FindFirstNonNullTail(PrevPriority(aPriority));
|
||||
previousTail = FindFirstNonNullTail(static_cast<Message::Priority>(PrevPriority(aPriority)));
|
||||
|
||||
OT_ASSERT(previousTail != NULL);
|
||||
|
||||
@@ -912,14 +913,14 @@ Message *PriorityQueue::GetHeadForPriority(uint8_t aPriority) const
|
||||
|
||||
Message *PriorityQueue::GetTail(void) const
|
||||
{
|
||||
return FindFirstNonNullTail(0);
|
||||
return FindFirstNonNullTail(Message::kPriorityLow);
|
||||
}
|
||||
|
||||
void PriorityQueue::Enqueue(Message &aMessage)
|
||||
{
|
||||
uint8_t priority;
|
||||
Message *tail;
|
||||
Message *next;
|
||||
Message::Priority priority;
|
||||
Message * tail;
|
||||
Message * next;
|
||||
|
||||
OT_ASSERT(!aMessage.IsInAQueue());
|
||||
|
||||
@@ -949,8 +950,8 @@ void PriorityQueue::Enqueue(Message &aMessage)
|
||||
|
||||
void PriorityQueue::Dequeue(Message &aMessage)
|
||||
{
|
||||
uint8_t priority;
|
||||
Message *tail;
|
||||
Message::Priority priority;
|
||||
Message * tail;
|
||||
|
||||
OT_ASSERT(aMessage.GetPriorityQueue() == this);
|
||||
|
||||
|
||||
+13
-16
@@ -261,13 +261,16 @@ public:
|
||||
kSubTypeMleChildIdRequest = 10, ///< MLE Child ID Request
|
||||
};
|
||||
|
||||
enum
|
||||
enum Priority
|
||||
{
|
||||
kPriorityLow = OT_MESSAGE_PRIORITY_LOW, ///< Low priority level.
|
||||
kPriorityNormal = OT_MESSAGE_PRIORITY_NORMAL, ///< Normal priority level.
|
||||
kPriorityHigh = OT_MESSAGE_PRIORITY_HIGH, ///< High priority level.
|
||||
kPriorityNet = OT_MESSAGE_PRIORITY_HIGH + 1, ///< Network Control priority level.
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kNumPriorities = 4, ///< Number of priority levels.
|
||||
};
|
||||
|
||||
@@ -380,7 +383,7 @@ public:
|
||||
* @returns The priority level associated with this message.
|
||||
*
|
||||
*/
|
||||
uint8_t GetPriority(void) const { return GetMetadata().mPriority; }
|
||||
Priority GetPriority(void) const { return static_cast<Priority>(GetMetadata().mPriority); }
|
||||
|
||||
/**
|
||||
* This method sets the messages priority.
|
||||
@@ -393,7 +396,7 @@ public:
|
||||
* @retval OT_ERROR_INVALID_ARGS Priority level is not invalid.
|
||||
*
|
||||
*/
|
||||
otError SetPriority(uint8_t aPriority);
|
||||
otError SetPriority(Priority aPriority);
|
||||
|
||||
/**
|
||||
* This method prepends bytes to the front of the message.
|
||||
@@ -1051,7 +1054,7 @@ public:
|
||||
* this priority level.
|
||||
*
|
||||
*/
|
||||
Message *GetHeadForPriority(uint8_t aPriority) const;
|
||||
Message *GetHeadForPriority(Message::Priority aPriority) const;
|
||||
|
||||
/**
|
||||
* This method adds a message to the queue.
|
||||
@@ -1109,7 +1112,7 @@ private:
|
||||
* @returns The first non-NULL tail pointer, or NULL if all the
|
||||
*
|
||||
*/
|
||||
Message *FindFirstNonNullTail(uint8_t aStartPriorityLevel) const;
|
||||
Message *FindFirstNonNullTail(Message::Priority aStartPriorityLevel) const;
|
||||
|
||||
private:
|
||||
Message *mTails[Message::kNumPriorities]; ///< Tail pointers associated with different priority levels.
|
||||
@@ -1133,17 +1136,16 @@ public:
|
||||
explicit MessagePool(Instance &aInstance);
|
||||
|
||||
/**
|
||||
* This method is used to obtain a new message. The default priority `kDefaultMessagePriority`
|
||||
* is assigned to the message.
|
||||
* This method is used to obtain a new message.
|
||||
*
|
||||
* @param[in] aType The message type.
|
||||
* @param[in] aReserveHeader The number of header bytes to reserve.
|
||||
* @param[in] aPriority The priority level of the message.
|
||||
* @param[in] aPriority The priority level of the message (default value is `Message::kPriorityNormal`).
|
||||
*
|
||||
* @returns A pointer to the message or NULL if no message buffers are available.
|
||||
*
|
||||
*/
|
||||
Message *New(Message::Type aType, uint16_t aReserveHeader, uint8_t aPriority = kDefaultMessagePriority);
|
||||
Message *New(Message::Type aType, uint16_t aReserveHeader, Message::Priority aPriority = Message::kPriorityNormal);
|
||||
|
||||
/**
|
||||
* This method is used to obtain a new message with specified settings.
|
||||
@@ -1177,14 +1179,9 @@ public:
|
||||
uint16_t GetFreeBufferCount(void) const;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
kDefaultMessagePriority = Message::kPriorityNormal,
|
||||
};
|
||||
|
||||
Buffer *NewBuffer(uint8_t aPriority);
|
||||
Buffer *NewBuffer(Message::Priority aPriority);
|
||||
void FreeBuffers(Buffer *aBuffer);
|
||||
otError ReclaimBuffers(int aNumBuffers, uint8_t aPriority);
|
||||
otError ReclaimBuffers(int aNumBuffers, Message::Priority aPriority);
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT == 0
|
||||
uint16_t mNumFreeBuffers;
|
||||
|
||||
@@ -77,7 +77,7 @@ Message *Ip6::NewMessage(const uint8_t *aData, uint16_t aDataLength, const otMes
|
||||
{
|
||||
otMessageSettings settings = {true, OT_MESSAGE_PRIORITY_NORMAL};
|
||||
Message * message = NULL;
|
||||
uint8_t priority;
|
||||
Message::Priority priority;
|
||||
|
||||
if (aSettings != NULL)
|
||||
{
|
||||
@@ -98,10 +98,10 @@ exit:
|
||||
return message;
|
||||
}
|
||||
|
||||
uint8_t Ip6::DscpToPriority(uint8_t aDscp)
|
||||
Message::Priority Ip6::DscpToPriority(uint8_t aDscp)
|
||||
{
|
||||
uint8_t priority;
|
||||
uint8_t cs = aDscp & kDscpCsMask;
|
||||
Message::Priority priority;
|
||||
uint8_t cs = aDscp & kDscpCsMask;
|
||||
|
||||
switch (cs)
|
||||
{
|
||||
@@ -130,7 +130,7 @@ uint8_t Ip6::DscpToPriority(uint8_t aDscp)
|
||||
return priority;
|
||||
}
|
||||
|
||||
uint8_t Ip6::PriorityToDscp(uint8_t aPriority)
|
||||
uint8_t Ip6::PriorityToDscp(Message::Priority aPriority)
|
||||
{
|
||||
uint8_t dscp = kDscpCs0;
|
||||
|
||||
@@ -141,6 +141,7 @@ uint8_t Ip6::PriorityToDscp(uint8_t aPriority)
|
||||
break;
|
||||
|
||||
case Message::kPriorityNormal:
|
||||
case Message::kPriorityNet:
|
||||
dscp = kDscpCs0;
|
||||
break;
|
||||
|
||||
@@ -152,7 +153,7 @@ uint8_t Ip6::PriorityToDscp(uint8_t aPriority)
|
||||
return dscp;
|
||||
}
|
||||
|
||||
otError Ip6::GetDatagramPriority(const uint8_t *aData, uint16_t aDataLen, uint8_t &aPriority)
|
||||
otError Ip6::GetDatagramPriority(const uint8_t *aData, uint16_t aDataLen, Message::Priority &aPriority)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
const Header *header;
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
* @returns The IPv6 DSCP value.
|
||||
*
|
||||
*/
|
||||
static uint8_t PriorityToDscp(uint8_t aPriority);
|
||||
static uint8_t PriorityToDscp(Message::Priority aPriority);
|
||||
|
||||
/**
|
||||
* This method converts the IPv6 DSCP value to message priority level.
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
* @returns The message priority level.
|
||||
*
|
||||
*/
|
||||
static uint8_t DscpToPriority(uint8_t aDscp);
|
||||
static Message::Priority DscpToPriority(uint8_t aDscp);
|
||||
|
||||
/**
|
||||
* This constructor initializes the object.
|
||||
@@ -344,7 +344,7 @@ private:
|
||||
static void HandleSendQueue(Tasklet &aTasklet);
|
||||
void HandleSendQueue(void);
|
||||
|
||||
static otError GetDatagramPriority(const uint8_t *aData, uint16_t aDataLen, uint8_t &aPriority);
|
||||
static otError GetDatagramPriority(const uint8_t *aData, uint16_t aDataLen, Message::Priority &aPriority);
|
||||
|
||||
otError ProcessReceiveCallback(const Message & aMessage,
|
||||
const MessageInfo &aMessageInfo,
|
||||
|
||||
@@ -1258,9 +1258,9 @@ otError MeshForwarder::FrameToMessage(const uint8_t * aFrame,
|
||||
const Mac::Address &aMacDest,
|
||||
Message *& aMessage)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
int headerLength;
|
||||
uint8_t priority;
|
||||
otError error = OT_ERROR_NONE;
|
||||
int headerLength;
|
||||
Message::Priority priority;
|
||||
|
||||
error = GetFramePriority(aFrame, aFrameLength, aMacSource, aMacDest, priority);
|
||||
SuccessOrExit(error);
|
||||
@@ -1350,7 +1350,7 @@ otError MeshForwarder::GetFramePriority(const uint8_t * aFrame,
|
||||
uint16_t aFrameLength,
|
||||
const Mac::Address &aMacSource,
|
||||
const Mac::Address &aMacDest,
|
||||
uint8_t & aPriority)
|
||||
Message::Priority & aPriority)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Ip6::Header ip6Header;
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
* @returns The fragment priority value.
|
||||
*
|
||||
*/
|
||||
uint8_t GetPriority(void) const { return mPriority; }
|
||||
Message::Priority GetPriority(void) const { return static_cast<Message::Priority>(mPriority); }
|
||||
|
||||
/**
|
||||
* This method sets the fragment priority value.
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
* @param[in] aPriority The fragment priority value.
|
||||
*
|
||||
*/
|
||||
void SetPriority(uint8_t aPriority) { mPriority = aPriority; }
|
||||
void SetPriority(Message::Priority aPriority) { mPriority = aPriority; }
|
||||
|
||||
/**
|
||||
* This method returns the fragment priority entry's remaining lifetime.
|
||||
@@ -271,7 +271,7 @@ public:
|
||||
* @retval OT_ERROR_NOT_FOUND No low priority messages available to evict.
|
||||
*
|
||||
*/
|
||||
otError EvictMessage(uint8_t aPriority);
|
||||
otError EvictMessage(Message::Priority aPriority);
|
||||
|
||||
/**
|
||||
* This method returns a reference to the send queue.
|
||||
@@ -316,8 +316,7 @@ public:
|
||||
private:
|
||||
enum
|
||||
{
|
||||
kStateUpdatePeriod = 1000, ///< State update period in milliseconds.
|
||||
kDefaultMsgPriority = Message::kPriorityNormal, ///< Default message priority.
|
||||
kStateUpdatePeriod = 1000, ///< State update period in milliseconds.
|
||||
|
||||
/**
|
||||
* The number of fragment priority entries.
|
||||
@@ -402,7 +401,7 @@ private:
|
||||
void UpdateFragmentPriority(Lowpan::FragmentHeader &aFragmentHeader,
|
||||
uint16_t aFragmentLength,
|
||||
uint16_t aSrcRloc16,
|
||||
uint8_t aPriority);
|
||||
Message::Priority aPriority);
|
||||
otError HandleDatagram(Message &aMessage, const otThreadLinkInfo &aLinkInfo, const Mac::Address &aMacSource);
|
||||
void ClearReassemblyList(void);
|
||||
void RemoveMessage(Message &aMessage);
|
||||
@@ -424,13 +423,15 @@ private:
|
||||
uint16_t aFrameLength,
|
||||
const Mac::Address &aMacSource,
|
||||
const Mac::Address &aMacDest,
|
||||
uint8_t & aPriority);
|
||||
otError GetFragmentPriority(Lowpan::FragmentHeader &aFragmentHeader, uint16_t aSrcRloc16, uint8_t &aPriority);
|
||||
Message::Priority & aPriority);
|
||||
otError GetFragmentPriority(Lowpan::FragmentHeader &aFragmentHeader,
|
||||
uint16_t aSrcRloc16,
|
||||
Message::Priority & aPriority);
|
||||
void GetForwardFramePriority(const uint8_t * aFrame,
|
||||
uint16_t aFrameLength,
|
||||
const Mac::Address &aMeshSource,
|
||||
const Mac::Address &aMeshDest,
|
||||
uint8_t & aPriority);
|
||||
Message::Priority & aPriority);
|
||||
|
||||
FragmentPriorityEntry *FindFragmentPriorityEntry(uint16_t aTag, uint16_t aSrcRloc16);
|
||||
FragmentPriorityEntry *GetUnusedFragmentPriorityEntry(void);
|
||||
|
||||
@@ -181,7 +181,7 @@ void MeshForwarder::HandleResolved(const Ip6::Address &aEid, otError aError)
|
||||
}
|
||||
}
|
||||
|
||||
otError MeshForwarder::EvictMessage(uint8_t aPriority)
|
||||
otError MeshForwarder::EvictMessage(Message::Priority aPriority)
|
||||
{
|
||||
otError error = OT_ERROR_NOT_FOUND;
|
||||
PriorityQueue *queues[] = {&mResolvingQueue, &mSendQueue};
|
||||
@@ -192,7 +192,8 @@ otError MeshForwarder::EvictMessage(uint8_t aPriority)
|
||||
{
|
||||
for (uint8_t priority = 0; priority < aPriority; priority++)
|
||||
{
|
||||
for (Message *message = queues[index]->GetHeadForPriority(priority); message; message = message->GetNext())
|
||||
for (Message *message = queues[index]->GetHeadForPriority(static_cast<Message::Priority>(priority));
|
||||
message; message = message->GetNext())
|
||||
{
|
||||
if (message->GetPriority() != priority)
|
||||
{
|
||||
@@ -205,7 +206,7 @@ otError MeshForwarder::EvictMessage(uint8_t aPriority)
|
||||
}
|
||||
|
||||
evict = message;
|
||||
aPriority = priority;
|
||||
aPriority = static_cast<Message::Priority>(priority);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -648,8 +649,8 @@ void MeshForwarder::HandleMesh(uint8_t * aFrame,
|
||||
}
|
||||
else if (meshHeader.GetHopsLeft() > 0)
|
||||
{
|
||||
uint8_t priority = kDefaultMsgPriority;
|
||||
uint16_t offset = 0;
|
||||
Message::Priority priority = Message::kPriorityNormal;
|
||||
uint16_t offset = 0;
|
||||
|
||||
Get<Mle::MleRouter>().ResolveRoutingLoops(aMacSource.GetShort(), meshDest.GetShort());
|
||||
|
||||
@@ -755,7 +756,7 @@ bool MeshForwarder::UpdateFragmentLifetime(void)
|
||||
void MeshForwarder::UpdateFragmentPriority(Lowpan::FragmentHeader &aFragmentHeader,
|
||||
uint16_t aFragmentLength,
|
||||
uint16_t aSrcRloc16,
|
||||
uint8_t aPriority)
|
||||
Message::Priority aPriority)
|
||||
{
|
||||
FragmentPriorityEntry *entry;
|
||||
|
||||
@@ -828,7 +829,7 @@ exit:
|
||||
|
||||
otError MeshForwarder::GetFragmentPriority(Lowpan::FragmentHeader &aFragmentHeader,
|
||||
uint16_t aSrcRloc16,
|
||||
uint8_t & aPriority)
|
||||
Message::Priority & aPriority)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
FragmentPriorityEntry *entry;
|
||||
@@ -845,7 +846,7 @@ void MeshForwarder::GetForwardFramePriority(const uint8_t * aFrame,
|
||||
uint16_t aFrameLength,
|
||||
const Mac::Address &aMeshSource,
|
||||
const Mac::Address &aMeshDest,
|
||||
uint8_t & aPriority)
|
||||
Message::Priority & aPriority)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
bool isFragment = false;
|
||||
|
||||
@@ -49,14 +49,14 @@ otError MeshForwarder::SendMessage(Message &aMessage)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError MeshForwarder::EvictMessage(uint8_t aPriority)
|
||||
otError MeshForwarder::EvictMessage(Message::Priority aPriority)
|
||||
{
|
||||
otError error = OT_ERROR_NOT_FOUND;
|
||||
Message *message;
|
||||
|
||||
VerifyOrExit((message = mSendQueue.GetTail()) != NULL, OT_NOOP);
|
||||
|
||||
if (message->GetPriority() < aPriority)
|
||||
if (message->GetPriority() < static_cast<uint8_t>(aPriority))
|
||||
{
|
||||
RemoveMessage(*message);
|
||||
ExitNow(error = OT_ERROR_NONE);
|
||||
|
||||
@@ -83,12 +83,13 @@ void VerifyPriorityQueueContent(ot::PriorityQueue &aPriorityQueue, int aExpected
|
||||
{
|
||||
// Check the `GetHeadForPriority` is NULL if there are no expected message for this priority level.
|
||||
VerifyOrQuit(
|
||||
aPriorityQueue.GetHeadForPriority(static_cast<uint8_t>(curPriority)) == NULL,
|
||||
aPriorityQueue.GetHeadForPriority(static_cast<ot::Message::Priority>(curPriority)) == NULL,
|
||||
"PriorityQueue::GetHeadForPriority is non-NULL when no expected msg for this priority.");
|
||||
}
|
||||
|
||||
// Check the `GetHeadForPriority`.
|
||||
VerifyOrQuit(aPriorityQueue.GetHeadForPriority(static_cast<uint8_t>(curPriority)) == msgArg,
|
||||
VerifyOrQuit(aPriorityQueue.GetHeadForPriority(static_cast<ot::Message::Priority>(curPriority)) ==
|
||||
msgArg,
|
||||
"PriorityQueue::GetHeadForPriority failed.");
|
||||
}
|
||||
|
||||
@@ -103,7 +104,7 @@ void VerifyPriorityQueueContent(ot::PriorityQueue &aPriorityQueue, int aExpected
|
||||
// Check the `GetHeadForPriority` is NULL if there are no expected message for any remaining priority level.
|
||||
for (curPriority--; curPriority >= 0; curPriority--)
|
||||
{
|
||||
VerifyOrQuit(aPriorityQueue.GetHeadForPriority(static_cast<uint8_t>(curPriority)) == NULL,
|
||||
VerifyOrQuit(aPriorityQueue.GetHeadForPriority(static_cast<ot::Message::Priority>(curPriority)) == NULL,
|
||||
"PriorityQueue::GetHeadForPriority is non-NULL when no expected msg for this priority.");
|
||||
}
|
||||
}
|
||||
@@ -172,10 +173,6 @@ void TestPriorityQueue(void)
|
||||
VerifyOrQuit(msgLow[i] != NULL, "Message::New failed");
|
||||
}
|
||||
|
||||
// Check the failure case for `New()` for invalid argument.
|
||||
VerifyOrQuit(messagePool->New(ot::Message::kTypeIp6, 0, ot::Message::kNumPriorities) == NULL,
|
||||
"Message::New() with out of range value did not fail as expected.");
|
||||
|
||||
// Use the function "SetPriority()" to allocate messages with different priorities
|
||||
for (int i = kNumNewPriorityTestMessages; i < kNumTestMessages; i++)
|
||||
{
|
||||
@@ -193,10 +190,6 @@ void TestPriorityQueue(void)
|
||||
SuccessOrQuit(msgLow[i]->SetPriority(ot::Message::kPriorityLow), "Message:SetPriority failed");
|
||||
}
|
||||
|
||||
// Check the failure case for `SetPriority()` for invalid argument.
|
||||
VerifyOrQuit(msgNet[2]->SetPriority(ot::Message::kNumPriorities) == OT_ERROR_INVALID_ARGS,
|
||||
"Message::SetPriority() with out of range value did not fail as expected.");
|
||||
|
||||
// Check the `GetPriority()`
|
||||
for (int i = 0; i < kNumTestMessages; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user