A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
packet-data-calculators.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 Drexel University
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: Joe Kopena (tjkopena@cs.drexel.edu)
19
*/
20
21
#include "ns3/log.h"
22
#include "ns3/packet.h"
23
#include "ns3/mac48-address.h"
24
25
#include "ns3/basic-data-calculators.h"
26
#include "
packet-data-calculators.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
/* static */
44
TypeId
45
PacketCounterCalculator::GetTypeId
(
void
)
46
{
47
static
TypeId
tid =
TypeId
(
"ns3::PacketCounterCalculator"
)
48
.
SetParent
<
CounterCalculator<uint32_t>
> ()
49
.SetGroupName (
"Network"
)
50
.AddConstructor<
PacketCounterCalculator
> ()
51
;
52
return
tid;
53
}
54
void
55
PacketCounterCalculator::DoDispose
(
void
)
56
{
57
NS_LOG_FUNCTION_NOARGS
();
58
59
CounterCalculator<uint32_t>::DoDispose
();
60
// PacketCounterCalculator::DoDispose
61
}
62
63
void
64
PacketCounterCalculator::PacketUpdate
(std::string path,
65
Ptr<const Packet>
packet)
66
{
67
NS_LOG_FUNCTION_NOARGS
();
68
69
CounterCalculator<uint32_t>::Update
();
70
71
// PacketCounterCalculator::Update
72
}
73
void
74
PacketCounterCalculator::FrameUpdate
(std::string path,
75
Ptr<const Packet>
packet,
76
Mac48Address
realto)
77
{
78
NS_LOG_FUNCTION_NOARGS
();
79
80
CounterCalculator<uint32_t>::Update
();
81
82
// PacketCounterCalculator::Update
83
}
84
85
86
87
88
//--------------------------------------------------------------
89
//----------------------------------------------
90
PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator
()
91
{
92
NS_LOG_FUNCTION_NOARGS
();
93
}
94
95
PacketSizeMinMaxAvgTotalCalculator::~PacketSizeMinMaxAvgTotalCalculator
()
96
{
97
NS_LOG_FUNCTION_NOARGS
();
98
}
99
/* static */
100
TypeId
101
PacketSizeMinMaxAvgTotalCalculator::GetTypeId
(
void
)
102
{
103
static
TypeId
tid =
TypeId
(
"ns3::PacketSizeMinMaxAvgTotalCalculator"
)
104
.
SetParent
<
MinMaxAvgTotalCalculator<uint32_t>
> ()
105
.SetGroupName (
"Network"
)
106
.AddConstructor<
PacketSizeMinMaxAvgTotalCalculator
> ()
107
;
108
return
tid;
109
}
110
void
111
PacketSizeMinMaxAvgTotalCalculator::DoDispose
(
void
)
112
{
113
NS_LOG_FUNCTION_NOARGS
();
114
115
MinMaxAvgTotalCalculator<uint32_t>::DoDispose
();
116
// end PacketSizeMinMaxAvgTotalCalculator::DoDispose
117
}
118
119
void
120
PacketSizeMinMaxAvgTotalCalculator::PacketUpdate
(std::string path,
121
Ptr<const Packet>
packet)
122
{
123
NS_LOG_FUNCTION_NOARGS
();
124
125
MinMaxAvgTotalCalculator<uint32_t>::Update
(packet->
GetSize
());
126
127
// end PacketSizeMinMaxAvgTotalCalculator::Update
128
}
129
void
130
PacketSizeMinMaxAvgTotalCalculator::FrameUpdate
(std::string path,
131
Ptr<const Packet>
packet,
132
Mac48Address
realto)
133
{
134
NS_LOG_FUNCTION_NOARGS
();
135
136
MinMaxAvgTotalCalculator<uint32_t>::Update
(packet->
GetSize
());
137
138
// end PacketSizeMinMaxAvgTotalCalculator::Update
139
}
ns3::CounterCalculator< uint32_t >
ns3::CounterCalculator::DoDispose
virtual void DoDispose(void)
Dispose of this Object.
Definition:
basic-data-calculators.h:344
ns3::CounterCalculator::Update
void Update()
Increments count by 1.
Definition:
basic-data-calculators.h:352
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:44
ns3::MinMaxAvgTotalCalculator< uint32_t >
ns3::MinMaxAvgTotalCalculator::DoDispose
virtual void DoDispose(void)
Dispose of this Object.
Definition:
basic-data-calculators.h:155
ns3::MinMaxAvgTotalCalculator::Update
void Update(const T i)
Updates all variables of MinMaxAvgTotalCalculator.
Definition:
basic-data-calculators.h:178
ns3::PacketCounterCalculator
A stat for counting packets.
Definition:
packet-data-calculators.h:37
ns3::PacketCounterCalculator::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition:
packet-data-calculators.cc:45
ns3::PacketCounterCalculator::~PacketCounterCalculator
virtual ~PacketCounterCalculator()
Definition:
packet-data-calculators.cc:39
ns3::PacketCounterCalculator::DoDispose
virtual void DoDispose(void)
Dispose of this Object.
Definition:
packet-data-calculators.cc:55
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:74
ns3::PacketCounterCalculator::PacketUpdate
void PacketUpdate(std::string path, Ptr< const Packet > packet)
Increments the packet counter by one.
Definition:
packet-data-calculators.cc:64
ns3::PacketCounterCalculator::PacketCounterCalculator
PacketCounterCalculator()
Definition:
packet-data-calculators.cc:34
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition:
packet.h:856
ns3::PacketSizeMinMaxAvgTotalCalculator
A stat for collecting packet size statistics: min, max and average.
Definition:
packet-data-calculators.h:82
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:130
ns3::PacketSizeMinMaxAvgTotalCalculator::~PacketSizeMinMaxAvgTotalCalculator
virtual ~PacketSizeMinMaxAvgTotalCalculator()
Definition:
packet-data-calculators.cc:95
ns3::PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator
PacketSizeMinMaxAvgTotalCalculator()
Definition:
packet-data-calculators.cc:90
ns3::PacketSizeMinMaxAvgTotalCalculator::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition:
packet-data-calculators.cc:101
ns3::PacketSizeMinMaxAvgTotalCalculator::DoDispose
virtual void DoDispose(void)
Dispose of this Object.
Definition:
packet-data-calculators.cc:111
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:120
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:922
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition:
log-macros-enabled.h:209
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 Tue Feb 6 2024 19:21:25 for ns-3 by
1.9.1