A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
packet-data-calculators.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 Drexel University
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Joe Kopena (tjkopena@cs.drexel.edu)
18
*/
19
20
#include "
packet-data-calculators.h
"
21
22
#include "
mac48-address.h
"
23
24
#include "ns3/basic-data-calculators.h"
25
#include "ns3/log.h"
26
#include "ns3/packet.h"
27
28
using namespace
ns3
;
29
30
NS_LOG_COMPONENT_DEFINE
(
"PacketDataCalculators"
);
31
32
//--------------------------------------------------------------
33
//----------------------------------------------
34
PacketCounterCalculator::PacketCounterCalculator
()
35
{
36
NS_LOG_FUNCTION_NOARGS
();
37
}
38
39
PacketCounterCalculator::~PacketCounterCalculator
()
40
{
41
NS_LOG_FUNCTION_NOARGS
();
42
}
43
44
/* static */
45
TypeId
46
PacketCounterCalculator::GetTypeId
()
47
{
48
static
TypeId
tid =
TypeId
(
"ns3::PacketCounterCalculator"
)
49
.
SetParent
<
CounterCalculator<uint32_t>
>()
50
.SetGroupName(
"Network"
)
51
.AddConstructor<
PacketCounterCalculator
>();
52
return
tid;
53
}
54
55
void
56
PacketCounterCalculator::DoDispose
()
57
{
58
NS_LOG_FUNCTION_NOARGS
();
59
60
CounterCalculator<uint32_t>::DoDispose
();
61
// PacketCounterCalculator::DoDispose
62
}
63
64
void
65
PacketCounterCalculator::PacketUpdate
(std::string path,
Ptr<const Packet>
packet)
66
{
67
NS_LOG_FUNCTION_NOARGS
();
68
69
CounterCalculator<uint32_t>::Update
();
70
71
// PacketCounterCalculator::Update
72
}
73
74
void
75
PacketCounterCalculator::FrameUpdate
(std::string path,
76
Ptr<const Packet>
packet,
77
Mac48Address
realto)
78
{
79
NS_LOG_FUNCTION_NOARGS
();
80
81
CounterCalculator<uint32_t>::Update
();
82
83
// PacketCounterCalculator::Update
84
}
85
86
//--------------------------------------------------------------
87
//----------------------------------------------
88
PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator
()
89
{
90
NS_LOG_FUNCTION_NOARGS
();
91
}
92
93
PacketSizeMinMaxAvgTotalCalculator::~PacketSizeMinMaxAvgTotalCalculator
()
94
{
95
NS_LOG_FUNCTION_NOARGS
();
96
}
97
98
/* static */
99
TypeId
100
PacketSizeMinMaxAvgTotalCalculator::GetTypeId
()
101
{
102
static
TypeId
tid =
TypeId
(
"ns3::PacketSizeMinMaxAvgTotalCalculator"
)
103
.
SetParent
<
MinMaxAvgTotalCalculator<uint32_t>
>()
104
.SetGroupName(
"Network"
)
105
.AddConstructor<
PacketSizeMinMaxAvgTotalCalculator
>();
106
return
tid;
107
}
108
109
void
110
PacketSizeMinMaxAvgTotalCalculator::DoDispose
()
111
{
112
NS_LOG_FUNCTION_NOARGS
();
113
114
MinMaxAvgTotalCalculator<uint32_t>::DoDispose
();
115
// end PacketSizeMinMaxAvgTotalCalculator::DoDispose
116
}
117
118
void
119
PacketSizeMinMaxAvgTotalCalculator::PacketUpdate
(std::string path,
Ptr<const Packet>
packet)
120
{
121
NS_LOG_FUNCTION_NOARGS
();
122
123
MinMaxAvgTotalCalculator<uint32_t>::Update
(packet->
GetSize
());
124
125
// end PacketSizeMinMaxAvgTotalCalculator::Update
126
}
127
128
void
129
PacketSizeMinMaxAvgTotalCalculator::FrameUpdate
(std::string path,
130
Ptr<const Packet>
packet,
131
Mac48Address
realto)
132
{
133
NS_LOG_FUNCTION_NOARGS
();
134
135
MinMaxAvgTotalCalculator<uint32_t>::Update
(packet->
GetSize
());
136
137
// end PacketSizeMinMaxAvgTotalCalculator::Update
138
}
ns3::CounterCalculator< uint32_t >
ns3::CounterCalculator::DoDispose
void DoDispose() override
Dispose of this Object.
Definition:
basic-data-calculators.h:371
ns3::CounterCalculator::Update
void Update()
Increments count by 1.
Definition:
basic-data-calculators.h:379
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:46
ns3::MinMaxAvgTotalCalculator< uint32_t >
ns3::MinMaxAvgTotalCalculator::Update
void Update(const T i)
Updates all variables of MinMaxAvgTotalCalculator.
Definition:
basic-data-calculators.h:207
ns3::MinMaxAvgTotalCalculator::DoDispose
void DoDispose() override
Dispose of this Object.
Definition:
basic-data-calculators.h:187
ns3::PacketCounterCalculator
A stat for counting packets.
Definition:
packet-data-calculators.h:39
ns3::PacketCounterCalculator::~PacketCounterCalculator
~PacketCounterCalculator() override
Definition:
packet-data-calculators.cc:39
ns3::PacketCounterCalculator::FrameUpdate
void FrameUpdate(std::string path, Ptr< const Packet > packet, Mac48Address realto)
Increments the packet counter by one.
Definition:
packet-data-calculators.cc:75
ns3::PacketCounterCalculator::PacketUpdate
void PacketUpdate(std::string path, Ptr< const Packet > packet)
Increments the packet counter by one.
Definition:
packet-data-calculators.cc:65
ns3::PacketCounterCalculator::PacketCounterCalculator
PacketCounterCalculator()
Definition:
packet-data-calculators.cc:34
ns3::PacketCounterCalculator::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition:
packet-data-calculators.cc:46
ns3::PacketCounterCalculator::DoDispose
void DoDispose() override
Dispose of this Object.
Definition:
packet-data-calculators.cc:56
ns3::Packet::GetSize
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition:
packet.h:861
ns3::PacketSizeMinMaxAvgTotalCalculator
A stat for collecting packet size statistics: min, max and average.
Definition:
packet-data-calculators.h:84
ns3::PacketSizeMinMaxAvgTotalCalculator::DoDispose
void DoDispose() override
Destructor implementation.
Definition:
packet-data-calculators.cc:110
ns3::PacketSizeMinMaxAvgTotalCalculator::FrameUpdate
void FrameUpdate(std::string path, Ptr< const Packet > packet, Mac48Address realto)
Increments the packet stats by the size of the packet.
Definition:
packet-data-calculators.cc:129
ns3::PacketSizeMinMaxAvgTotalCalculator::~PacketSizeMinMaxAvgTotalCalculator
~PacketSizeMinMaxAvgTotalCalculator() override
Definition:
packet-data-calculators.cc:93
ns3::PacketSizeMinMaxAvgTotalCalculator::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition:
packet-data-calculators.cc:100
ns3::PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator
PacketSizeMinMaxAvgTotalCalculator()
Definition:
packet-data-calculators.cc:88
ns3::PacketSizeMinMaxAvgTotalCalculator::PacketUpdate
void PacketUpdate(std::string path, Ptr< const Packet > packet)
Increments the packet stats by the size of the packet.
Definition:
packet-data-calculators.cc:119
ns3::Ptr< const Packet >
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:931
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition:
log-macros-enabled.h:206
mac48-address.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
packet-data-calculators.h
src
network
utils
packet-data-calculators.cc
Generated on Sun Mar 3 2024 17:11:06 for ns-3 by
1.9.1