A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::PacketLossCounter Class Reference

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 (void) const
 Return the size of the window used to compute the packet loss. More...
 
uint32_t GetLost (void) 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...
 

Detailed Description

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 wit respect to the last sequence number seen) are considered lost,

Definition at line 45 of file packet-loss-counter.h.

Constructor & Destructor Documentation

ns3::PacketLossCounter::PacketLossCounter ( uint8_t  bitmapSize)

Constructor.

Parameters
bitmapSizeThe window size. Must be a multiple of 8.

Definition at line 33 of file packet-loss-counter.cc.

References NS_LOG_FUNCTION, and SetBitMapSize().

+ Here is the call graph for this function:

ns3::PacketLossCounter::~PacketLossCounter ( )

Definition at line 43 of file packet-loss-counter.cc.

References m_receiveBitMap, and NS_LOG_FUNCTION.

Member Function Documentation

bool ns3::PacketLossCounter::GetBit ( uint32_t  seqNum)
private

Check if a sequence number in the window has been received.

Parameters
seqNumthe sequence number.
Returns
false if the packet has not been received.

Definition at line 79 of file packet-loss-counter.cc.

References m_bitMapSize, m_receiveBitMap, and NS_LOG_FUNCTION.

Referenced by NotifyReceived().

+ Here is the caller graph for this function:

uint16_t ns3::PacketLossCounter::GetBitMapSize ( void  ) const

Return the size of the window used to compute the packet loss.

Returns
the window size.

Definition at line 50 of file packet-loss-counter.cc.

References m_bitMapSize, and NS_LOG_FUNCTION.

Referenced by ns3::UdpServer::GetPacketWindowSize().

+ Here is the caller graph for this function:

uint32_t ns3::PacketLossCounter::GetLost ( void  ) const

Get the number of lost packets.

Returns
the number of lost packets.

Definition at line 72 of file packet-loss-counter.cc.

References m_lost, and NS_LOG_FUNCTION.

Referenced by PacketLossCounterTestCase::DoRun(), and ns3::UdpServer::GetLost().

+ Here is the caller graph for this function:

void ns3::PacketLossCounter::NotifyReceived ( uint32_t  seq)

Record a successfully received packet.

Parameters
seqthe packet sequence number

Definition at line 112 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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PacketLossCounter::SetBit ( uint32_t  seqNum,
bool  val 
)
private

Set a sequence number to a given state.

Parameters
seqNumthe sequence number.
valfalse if the packet has not been received.

Definition at line 86 of file packet-loss-counter.cc.

References m_bitMapSize, m_receiveBitMap, and NS_LOG_FUNCTION.

Referenced by NotifyReceived().

+ Here is the caller graph for this function:

void ns3::PacketLossCounter::SetBitMapSize ( uint16_t  size)

Set the size of the window used to compute the packet loss.

Parameters
sizeThe window size. Must be a multiple of 8.

Definition at line 57 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().

+ Here is the caller graph for this function:

Member Data Documentation

uint16_t ns3::PacketLossCounter::m_bitMapSize
private

Window size.

Definition at line 90 of file packet-loss-counter.h.

Referenced by GetBit(), GetBitMapSize(), NotifyReceived(), SetBit(), and SetBitMapSize().

uint32_t ns3::PacketLossCounter::m_lastMaxSeqNum
private

Last sequence number seen.

Definition at line 91 of file packet-loss-counter.h.

Referenced by NotifyReceived().

uint32_t ns3::PacketLossCounter::m_lost
private

Lost packets counter.

Definition at line 89 of file packet-loss-counter.h.

Referenced by GetLost(), and NotifyReceived().

uint8_t* ns3::PacketLossCounter::m_receiveBitMap
private

Received packets in the window size.

Definition at line 92 of file packet-loss-counter.h.

Referenced by GetBit(), SetBit(), SetBitMapSize(), and ~PacketLossCounter().


The documentation for this class was generated from the following files: