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
ipv4-packet-probe.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Bucknell University
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: L. Felipe Perrone (perrone@bucknell.edu)
7
* Tiago G. Rodrigues (tgr002@bucknell.edu)
8
*
9
* Modified by: Mitch Watrous (watrous@u.washington.edu)
10
*/
11
12
#ifndef IPV4_PACKET_PROBE_H
13
#define IPV4_PACKET_PROBE_H
14
15
#include "
ipv4.h
"
16
17
#include "ns3/boolean.h"
18
#include "ns3/callback.h"
19
#include "ns3/nstime.h"
20
#include "ns3/object.h"
21
#include "ns3/packet.h"
22
#include "ns3/probe.h"
23
#include "ns3/simulator.h"
24
#include "ns3/traced-value.h"
25
26
namespace
ns3
27
{
28
29
/**
30
* \ingroup ipv4
31
*
32
* This class is designed to probe an underlying ns3 TraceSource
33
* exporting a packet, an IPv4 object, and an interface. This probe
34
* exports a trace source "Output" with arguments of type Ptr<const Packet>,
35
* Ptr<Ipv4>, and uint32_t. The Output trace source emits a value
36
* when either the trace source emits a new value, or when SetValue ()
37
* is called.
38
*/
39
class
Ipv4PacketProbe
:
public
Probe
40
{
41
public
:
42
/**
43
* \brief Get the type ID.
44
* \return the object TypeId
45
*/
46
static
TypeId
GetTypeId
();
47
Ipv4PacketProbe
();
48
~Ipv4PacketProbe
()
override
;
49
50
/**
51
* \brief Set a probe value
52
*
53
* \param packet set the traced packet equal to this
54
* \param ipv4 set the IPv4 object for the traced packet equal to this
55
* \param interface set the IPv4 interface for the traced packet equal to this
56
*/
57
void
SetValue
(
Ptr<const Packet>
packet,
Ptr<Ipv4>
ipv4,
uint32_t
interface);
58
59
/**
60
* \brief Set a probe value by its name in the Config system
61
*
62
* \param path config path to access the probe
63
* \param packet set the traced packet equal to this
64
* \param ipv4 set the IPv4 object for the traced packet equal to this
65
* \param interface set the IPv4 interface for the traced packet equal to this
66
*/
67
static
void
SetValueByPath
(std::string path,
68
Ptr<const Packet>
packet,
69
Ptr<Ipv4>
ipv4,
70
uint32_t
interface);
71
72
/**
73
* \brief connect to a trace source attribute provided by a given object
74
*
75
* \param traceSource the name of the attribute TraceSource to connect to
76
* \param obj ns3::Object to connect to
77
* \return true if the trace source was successfully connected
78
*/
79
bool
ConnectByObject
(std::string traceSource,
Ptr<Object>
obj)
override
;
80
81
/**
82
* \brief connect to a trace source provided by a config path
83
*
84
* \param path Config path to bind to
85
*
86
* Note, if an invalid path is provided, the probe will not be connected
87
* to anything.
88
*/
89
void
ConnectByPath
(std::string path)
override
;
90
91
private
:
92
/**
93
* \brief Method to connect to an underlying ns3::TraceSource with
94
* arguments of type Ptr<const Packet>, Ptr<Ipv4>, and uint32_t
95
*
96
* \param packet the traced packet
97
* \param ipv4 the IPv4 object for the traced packet
98
* \param interface the IPv4 interface for the traced packet
99
*/
100
void
TraceSink
(
Ptr<const Packet>
packet,
Ptr<Ipv4>
ipv4,
uint32_t
interface);
101
102
/// Traced Callback: the packet, the Ipv4 object and the interface.
103
ns3::TracedCallback<Ptr<const Packet>
,
Ptr<Ipv4>
,
uint32_t
>
m_output
;
104
/// Traced Callback: the previous packet's size and the actual packet's size.
105
ns3::TracedCallback<uint32_t, uint32_t>
m_outputBytes
;
106
107
/// The traced packet.
108
Ptr<const Packet>
m_packet
;
109
110
/// The IPv4 object for the traced packet.
111
Ptr<Ipv4>
m_ipv4
;
112
113
/// The IPv4 interface for the traced packet.
114
uint32_t
m_interface
;
115
116
/// The size of the traced packet.
117
uint32_t
m_packetSizeOld
;
118
};
119
120
}
// namespace ns3
121
122
#endif
// IPV4_PACKET_PROBE_H
ns3::Ipv4PacketProbe
This class is designed to probe an underlying ns3 TraceSource exporting a packet, an IPv4 object,...
Definition
ipv4-packet-probe.h:40
ns3::Ipv4PacketProbe::ConnectByPath
void ConnectByPath(std::string path) override
connect to a trace source provided by a config path
Definition
ipv4-packet-probe.cc:99
ns3::Ipv4PacketProbe::SetValueByPath
static void SetValueByPath(std::string path, Ptr< const Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
Set a probe value by its name in the Config system.
Definition
ipv4-packet-probe.cc:76
ns3::Ipv4PacketProbe::m_packetSizeOld
uint32_t m_packetSizeOld
The size of the traced packet.
Definition
ipv4-packet-probe.h:117
ns3::Ipv4PacketProbe::m_outputBytes
ns3::TracedCallback< uint32_t, uint32_t > m_outputBytes
Traced Callback: the previous packet's size and the actual packet's size.
Definition
ipv4-packet-probe.h:105
ns3::Ipv4PacketProbe::Ipv4PacketProbe
Ipv4PacketProbe()
Definition
ipv4-packet-probe.cc:47
ns3::Ipv4PacketProbe::ConnectByObject
bool ConnectByObject(std::string traceSource, Ptr< Object > obj) override
connect to a trace source attribute provided by a given object
Definition
ipv4-packet-probe.cc:88
ns3::Ipv4PacketProbe::~Ipv4PacketProbe
~Ipv4PacketProbe() override
Definition
ipv4-packet-probe.cc:56
ns3::Ipv4PacketProbe::m_output
ns3::TracedCallback< Ptr< const Packet >, Ptr< Ipv4 >, uint32_t > m_output
Traced Callback: the packet, the Ipv4 object and the interface.
Definition
ipv4-packet-probe.h:103
ns3::Ipv4PacketProbe::TraceSink
void TraceSink(Ptr< const Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
Method to connect to an underlying ns3::TraceSource with arguments of type Ptr<const Packet>,...
Definition
ipv4-packet-probe.cc:107
ns3::Ipv4PacketProbe::m_interface
uint32_t m_interface
The IPv4 interface for the traced packet.
Definition
ipv4-packet-probe.h:114
ns3::Ipv4PacketProbe::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
ipv4-packet-probe.cc:28
ns3::Ipv4PacketProbe::SetValue
void SetValue(Ptr< const Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
Set a probe value.
Definition
ipv4-packet-probe.cc:62
ns3::Ipv4PacketProbe::m_ipv4
Ptr< Ipv4 > m_ipv4
The IPv4 object for the traced packet.
Definition
ipv4-packet-probe.h:111
ns3::Ipv4PacketProbe::m_packet
Ptr< const Packet > m_packet
The traced packet.
Definition
ipv4-packet-probe.h:108
ns3::Probe
Base class for probes.
Definition
probe.h:30
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition
traced-callback.h:43
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ipv4.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet
model
ipv4-packet-probe.h
Generated on Fri Nov 8 2024 13:59:01 for ns-3 by
1.11.0