add WifiMacQueue::GetNPacketsByTidAndAddress method

This commit is contained in:
Mirko Banchi
2010-02-03 20:34:52 +01:00
parent d76ec2425c
commit b79aec57bc
2 changed files with 31 additions and 0 deletions
+24
View File
@@ -274,4 +274,28 @@ WifiMacQueue::PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr)
m_size++;
}
uint32_t
WifiMacQueue::GetNPacketsByTidAndAddress (uint8_t tid, WifiMacHeader::AddressType type,
Mac48Address addr)
{
Cleanup ();
uint32_t nPackets = 0;
if (!m_queue.empty ())
{
PacketQueueI it;
NS_ASSERT (type <= 4);
for (it = m_queue.begin (); it != m_queue.end (); it++)
{
if (GetAddressForPacket (type, it) == addr)
{
if (it->hdr.IsQosData () && it->hdr.GetQosTid () == tid)
{
nPackets++;
}
}
}
}
return nPackets;
}
} // namespace ns3
+7
View File
@@ -92,6 +92,13 @@ public:
* performed in linear time (O(n)).
*/
bool Remove (Ptr<const Packet> packet);
/**
* Returns number of QoS packets having tid equals to <i>tid</i> and address
* specified by <i>type</i> equals to <i>addr</i>.
*/
uint32_t GetNPacketsByTidAndAddress (uint8_t tid,
WifiMacHeader::AddressType type,
Mac48Address addr);
void Flush (void);