A class to count the number of lost packets. More...
#include "packet-loss-counter.h"
Public Member Functions | |
PacketLossCounter (uint8_t bitmapSize) | |
Constructor. | |
~PacketLossCounter () | |
uint16_t | GetBitMapSize () const |
Return the size of the window used to compute the packet loss. | |
uint32_t | GetLost () const |
Get the number of lost packets. | |
void | NotifyReceived (uint32_t seq) |
Record a successfully received packet. | |
void | SetBitMapSize (uint16_t size) |
Set the size of the window used to compute the packet loss. | |
Private Member Functions | |
bool | GetBit (uint32_t seqNum) |
Check if a sequence number in the window has been received. | |
void | SetBit (uint32_t seqNum, bool val) |
Set a sequence number to a given state. | |
Private Attributes | |
uint16_t | m_bitMapSize |
Window size. | |
uint32_t | m_lastMaxSeqNum |
Last sequence number seen. | |
uint32_t | m_lost |
Lost packets counter. | |
uint8_t * | m_receiveBitMap |
Received packets in the window size. | |
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 34 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 21 of file packet-loss-counter.cc.
References NS_LOG_FUNCTION, and SetBitMapSize().
ns3::PacketLossCounter::~PacketLossCounter | ( | ) |
Definition at line 31 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 67 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 38 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 60 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 100 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 74 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 45 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 80 of file packet-loss-counter.h.
Referenced by GetBit(), GetBitMapSize(), NotifyReceived(), SetBit(), and SetBitMapSize().
|
private |
Last sequence number seen.
Definition at line 81 of file packet-loss-counter.h.
Referenced by NotifyReceived().
|
private |
Lost packets counter.
Definition at line 79 of file packet-loss-counter.h.
Referenced by GetLost(), and NotifyReceived().
|
private |
Received packets in the window size.
Definition at line 82 of file packet-loss-counter.h.
Referenced by ~PacketLossCounter(), GetBit(), SetBit(), and SetBitMapSize().