A class to count the number of lost packets. More...
#include "packet-loss-counter.h"
Public Member Functions | |
PacketLossCounter (uint8_t bitmapSize) | |
Constructor. More... | |
~PacketLossCounter () | |
uint16_t | GetBitMapSize () const |
Return the size of the window used to compute the packet loss. More... | |
uint32_t | GetLost () const |
Get the number of lost packets. More... | |
void | NotifyReceived (uint32_t seq) |
Record a successfully received packet. More... | |
void | SetBitMapSize (uint16_t size) |
Set the size of the window used to compute the packet loss. More... | |
Private Member Functions | |
bool | GetBit (uint32_t seqNum) |
Check if a sequence number in the window has been received. More... | |
void | SetBit (uint32_t seqNum, bool val) |
Set a sequence number to a given state. More... | |
Private Attributes | |
uint16_t | m_bitMapSize |
Window size. More... | |
uint32_t | m_lastMaxSeqNum |
Last sequence number seen. More... | |
uint32_t | m_lost |
Lost packets counter. More... | |
uint8_t * | m_receiveBitMap |
Received packets in the window size. More... | |
A class to count the number of lost packets.
This class records the packet lost in a client/server transmission leveraging a sequence number. All the packets outside a given window (i.e., too old with respect to the last sequence number seen) are considered lost,
Definition at line 45 of file packet-loss-counter.h.
ns3::PacketLossCounter::PacketLossCounter | ( | uint8_t | bitmapSize | ) |
Constructor.
bitmapSize | The window size. Must be a multiple of 8. |
Definition at line 32 of file packet-loss-counter.cc.
References NS_LOG_FUNCTION, and SetBitMapSize().
ns3::PacketLossCounter::~PacketLossCounter | ( | ) |
Definition at line 42 of file packet-loss-counter.cc.
References m_receiveBitMap, and NS_LOG_FUNCTION.
|
private |
Check if a sequence number in the window has been received.
seqNum | the sequence number. |
Definition at line 78 of file packet-loss-counter.cc.
References m_bitMapSize, m_receiveBitMap, and NS_LOG_FUNCTION.
Referenced by NotifyReceived().
uint16_t ns3::PacketLossCounter::GetBitMapSize | ( | ) | const |
Return the size of the window used to compute the packet loss.
Definition at line 49 of file packet-loss-counter.cc.
References m_bitMapSize, and NS_LOG_FUNCTION.
Referenced by ns3::UdpServer::GetPacketWindowSize().
uint32_t ns3::PacketLossCounter::GetLost | ( | ) | const |
Get the number of lost packets.
Definition at line 71 of file packet-loss-counter.cc.
References m_lost, and NS_LOG_FUNCTION.
Referenced by PacketLossCounterTestCase::DoRun(), and ns3::UdpServer::GetLost().
void ns3::PacketLossCounter::NotifyReceived | ( | uint32_t | seq | ) |
Record a successfully received packet.
seq | the packet sequence number |
Definition at line 111 of file packet-loss-counter.cc.
References GetBit(), m_bitMapSize, m_lastMaxSeqNum, m_lost, NS_LOG_FUNCTION, NS_LOG_INFO, and SetBit().
Referenced by PacketLossCounterTestCase::DoRun(), and ns3::UdpServer::HandleRead().
|
private |
Set a sequence number to a given state.
seqNum | the sequence number. |
val | false if the packet has not been received. |
Definition at line 85 of file packet-loss-counter.cc.
References m_bitMapSize, m_receiveBitMap, and NS_LOG_FUNCTION.
Referenced by NotifyReceived().
void ns3::PacketLossCounter::SetBitMapSize | ( | uint16_t | size | ) |
Set the size of the window used to compute the packet loss.
size | The window size. Must be a multiple of 8. |
Definition at line 56 of file packet-loss-counter.cc.
References m_bitMapSize, m_receiveBitMap, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
Referenced by PacketLossCounter(), and ns3::UdpServer::SetPacketWindowSize().
|
private |
Window size.
Definition at line 91 of file packet-loss-counter.h.
Referenced by GetBit(), GetBitMapSize(), NotifyReceived(), SetBit(), and SetBitMapSize().
|
private |
Last sequence number seen.
Definition at line 92 of file packet-loss-counter.h.
Referenced by NotifyReceived().
|
private |
Lost packets counter.
Definition at line 90 of file packet-loss-counter.h.
Referenced by GetLost(), and NotifyReceived().
|
private |
Received packets in the window size.
Definition at line 93 of file packet-loss-counter.h.
Referenced by ~PacketLossCounter(), GetBit(), SetBit(), and SetBitMapSize().