A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
packet-loss-counter.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007,2008,2009 INRIA, UDCAST
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Amine Ismail <amine.ismail@sophia.inria.fr>
7
* <amine.ismail@udcast.com>
8
*
9
*/
10
11
#ifndef PACKET_LOSS_COUNTER_H
12
#define PACKET_LOSS_COUNTER_H
13
14
#include "ns3/address.h"
15
#include "ns3/application.h"
16
#include "ns3/event-id.h"
17
#include "ns3/ptr.h"
18
19
namespace
ns3
20
{
21
22
class
Socket;
23
class
Packet;
24
25
/**
26
* @ingroup udpclientserver
27
*
28
* @brief A class to count the number of lost packets.
29
*
30
* This class records the packet lost in a client/server transmission
31
* leveraging a sequence number. All the packets outside a given window
32
* (i.e., too old with respect to the last sequence number seen) are considered lost,
33
*/
34
class
PacketLossCounter
35
{
36
public
:
37
/**
38
* @brief Constructor
39
* @param bitmapSize The window size. Must be a multiple of 8.
40
*/
41
PacketLossCounter
(uint8_t bitmapSize);
42
~PacketLossCounter
();
43
/**
44
* @brief Record a successfully received packet
45
* @param seq the packet sequence number
46
*/
47
void
NotifyReceived
(
uint32_t
seq);
48
/**
49
* @brief Get the number of lost packets.
50
* @returns the number of lost packets.
51
*/
52
uint32_t
GetLost
()
const
;
53
/**
54
* @brief Return the size of the window used to compute the packet loss.
55
* @return the window size.
56
*/
57
uint16_t
GetBitMapSize
()
const
;
58
/**
59
* @brief Set the size of the window used to compute the packet loss.
60
*
61
* @param size The window size. Must be a multiple of 8.
62
*/
63
void
SetBitMapSize
(uint16_t size);
64
65
private
:
66
/**
67
* @brief Check if a sequence number in the window has been received.
68
* @param seqNum the sequence number.
69
* @returns false if the packet has not been received.
70
*/
71
bool
GetBit
(
uint32_t
seqNum);
72
/**
73
* @brief Set a sequence number to a given state.
74
* @param seqNum the sequence number.
75
* @param val false if the packet has not been received.
76
*/
77
void
SetBit
(
uint32_t
seqNum,
bool
val);
78
79
uint32_t
m_lost
;
//!< Lost packets counter.
80
uint16_t
m_bitMapSize
;
//!< Window size.
81
uint32_t
m_lastMaxSeqNum
;
//!< Last sequence number seen.
82
uint8_t*
m_receiveBitMap
;
//!< Received packets in the window size.
83
};
84
}
// namespace ns3
85
86
#endif
/* PACKET_LOSS_COUNTER_H */
ns3::PacketLossCounter
A class to count the number of lost packets.
Definition
packet-loss-counter.h:35
ns3::PacketLossCounter::SetBit
void SetBit(uint32_t seqNum, bool val)
Set a sequence number to a given state.
Definition
packet-loss-counter.cc:74
ns3::PacketLossCounter::NotifyReceived
void NotifyReceived(uint32_t seq)
Record a successfully received packet.
Definition
packet-loss-counter.cc:100
ns3::PacketLossCounter::m_lastMaxSeqNum
uint32_t m_lastMaxSeqNum
Last sequence number seen.
Definition
packet-loss-counter.h:81
ns3::PacketLossCounter::GetBit
bool GetBit(uint32_t seqNum)
Check if a sequence number in the window has been received.
Definition
packet-loss-counter.cc:67
ns3::PacketLossCounter::PacketLossCounter
PacketLossCounter(uint8_t bitmapSize)
Constructor.
Definition
packet-loss-counter.cc:21
ns3::PacketLossCounter::m_lost
uint32_t m_lost
Lost packets counter.
Definition
packet-loss-counter.h:79
ns3::PacketLossCounter::SetBitMapSize
void SetBitMapSize(uint16_t size)
Set the size of the window used to compute the packet loss.
Definition
packet-loss-counter.cc:45
ns3::PacketLossCounter::m_receiveBitMap
uint8_t * m_receiveBitMap
Received packets in the window size.
Definition
packet-loss-counter.h:82
ns3::PacketLossCounter::GetBitMapSize
uint16_t GetBitMapSize() const
Return the size of the window used to compute the packet loss.
Definition
packet-loss-counter.cc:38
ns3::PacketLossCounter::GetLost
uint32_t GetLost() const
Get the number of lost packets.
Definition
packet-loss-counter.cc:60
ns3::PacketLossCounter::~PacketLossCounter
~PacketLossCounter()
Definition
packet-loss-counter.cc:31
ns3::PacketLossCounter::m_bitMapSize
uint16_t m_bitMapSize
Window size.
Definition
packet-loss-counter.h:80
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
applications
model
packet-loss-counter.h
Generated on Thu Dec 12 2024 18:40:35 for ns-3 by
1.11.0