wifi: Add methods to WifiMacQueue to peek and dequeue by TID

This commit is contained in:
Stefano Avallone
2019-03-02 20:24:05 +01:00
parent 72739ad288
commit 94cc4b70dd
2 changed files with 59 additions and 0 deletions

View File

@@ -203,6 +203,26 @@ WifiMacQueue::DequeueByAddress (Mac48Address dest)
return 0;
}
Ptr<WifiMacQueueItem>
WifiMacQueue::DequeueByTid (uint8_t tid)
{
NS_LOG_FUNCTION (this << +tid);
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
{
if ((*it)->GetHeader ().IsQosData () && (*it)->GetHeader ().GetQosTid () == tid)
{
return DoDequeue (it);
}
it++;
}
}
NS_LOG_DEBUG ("The queue is empty");
return 0;
}
Ptr<WifiMacQueueItem>
WifiMacQueue::DequeueByTidAndAddress (uint8_t tid, Mac48Address dest)
{
@@ -262,6 +282,26 @@ WifiMacQueue::Peek (void) const
return 0;
}
Ptr<const WifiMacQueueItem>
WifiMacQueue::PeekByTid (uint8_t tid)
{
NS_LOG_FUNCTION (this << +tid);
for (auto it = Head (); it != Tail (); )
{
if (!TtlExceeded (it))
{
if ((*it)->GetHeader ().IsQosData () && (*it)->GetHeader ().GetQosTid () == tid)
{
return DoPeek (it);
}
it++;
}
}
NS_LOG_DEBUG ("The queue is empty");
return 0;
}
Ptr<const WifiMacQueueItem>
WifiMacQueue::PeekByTidAndAddress (uint8_t tid, Mac48Address dest)
{

View File

@@ -128,6 +128,16 @@ public:
* \return the packet
*/
Ptr<WifiMacQueueItem> DequeueByAddress (Mac48Address dest);
/**
* Search and return, if present in the queue, the first packet having the
* tid equal to <i>tid</i>.
* This method removes the packet from the queue.
*
* \param tid the given tid
*
* \return the packet
*/
Ptr<WifiMacQueueItem> DequeueByTid (uint8_t tid);
/**
* Search and return, if present in the queue, the first packet having the
* address indicated by <i>type</i> equal to <i>addr</i>, and tid
@@ -160,6 +170,15 @@ public:
* \return the packet
*/
Ptr<const WifiMacQueueItem> Peek (void) const;
/**
* Search and return, if present in the queue, the first packet having the
* tid equal to <i>tid</i>. This method does not remove the packet from the queue.
*
* \param tid the given TID
*
* \return packet
*/
Ptr<const WifiMacQueueItem> PeekByTid (uint8_t tid);
/**
* Search and return, if present in the queue, the first packet having the
* address indicated by <i>type</i> equal to <i>addr</i>, and tid