A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
applications
model
packet-loss-counter.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007,2008,2009 INRIA, UDCAST
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Amine Ismail <amine.ismail@sophia.inria.fr>
19
* <amine.ismail@udcast.com>
20
*
21
*/
22
23
#ifndef PACKET_LOSS_COUNTER_H
24
#define PACKET_LOSS_COUNTER_H
25
26
#include "ns3/application.h"
27
#include "ns3/event-id.h"
28
#include "ns3/ptr.h"
29
#include "ns3/address.h"
30
31
namespace
ns3
{
32
33
class
Socket;
34
class
Packet;
35
45
class
PacketLossCounter
46
{
47
public
:
52
PacketLossCounter
(uint8_t bitmapSize);
53
~PacketLossCounter
();
58
void
NotifyReceived
(uint32_t seq);
63
uint32_t
GetLost
(
void
)
const
;
68
uint16_t
GetBitMapSize
(
void
)
const
;
74
void
SetBitMapSize
(uint16_t size);
75
private
:
81
bool
GetBit
(uint32_t seqNum);
87
void
SetBit
(uint32_t seqNum,
bool
val);
88
89
uint32_t
m_lost
;
90
uint16_t
m_bitMapSize
;
91
uint32_t
m_lastMaxSeqNum
;
92
uint8_t *
m_receiveBitMap
;
93
};
94
}
95
96
#endif
/* PACKET_LOSS_COUNTER_H */
ns3::PacketLossCounter::NotifyReceived
void NotifyReceived(uint32_t seq)
Record a successfully received packet.
Definition:
packet-loss-counter.cc:110
ns3::PacketLossCounter::m_lastMaxSeqNum
uint32_t m_lastMaxSeqNum
Last sequence number seen.
Definition:
packet-loss-counter.h:91
ns3::PacketLossCounter::GetBit
bool GetBit(uint32_t seqNum)
Check if a sequence number in the window has been received.
Definition:
packet-loss-counter.cc:77
ns3::PacketLossCounter::GetBitMapSize
uint16_t GetBitMapSize(void) const
Return the size of the window used to compute the packet loss.
Definition:
packet-loss-counter.cc:48
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:55
ns3::PacketLossCounter::m_lost
uint32_t m_lost
Lost packets counter.
Definition:
packet-loss-counter.h:89
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::PacketLossCounter::SetBit
void SetBit(uint32_t seqNum, bool val)
Set a sequence number to a given state.
Definition:
packet-loss-counter.cc:84
ns3::PacketLossCounter::GetLost
uint32_t GetLost(void) const
Get the number of lost packets.
Definition:
packet-loss-counter.cc:70
ns3::PacketLossCounter
A class to count the number of lost packets.
Definition:
packet-loss-counter.h:45
ns3::PacketLossCounter::m_receiveBitMap
uint8_t * m_receiveBitMap
Received packets in the window size.
Definition:
packet-loss-counter.h:92
ns3::PacketLossCounter::m_bitMapSize
uint16_t m_bitMapSize
Window size.
Definition:
packet-loss-counter.h:90
ns3::PacketLossCounter::PacketLossCounter
PacketLossCounter(uint8_t bitmapSize)
Constructor.
Definition:
packet-loss-counter.cc:31
ns3::PacketLossCounter::~PacketLossCounter
~PacketLossCounter()
Definition:
packet-loss-counter.cc:41
Generated on Wed Nov 7 2018 10:01:47 for ns-3 by
1.8.14