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
ipv6-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
* Adapted to Ipv6 by: Tommaso Pecorella (tommaso.pecorella@unifi.it)
11
*/
12
13
#ifndef IPV6_PACKET_PROBE_H
14
#define IPV6_PACKET_PROBE_H
15
16
#include "
ipv6.h
"
17
18
#include "ns3/boolean.h"
19
#include "ns3/callback.h"
20
#include "ns3/nstime.h"
21
#include "ns3/object.h"
22
#include "ns3/packet.h"
23
#include "ns3/probe.h"
24
#include "ns3/simulator.h"
25
#include "ns3/traced-value.h"
26
27
namespace
ns3
28
{
29
30
/**
31
* \ingroup ipv6
32
*
33
* This class is designed to probe an underlying ns3 TraceSource
34
* exporting a packet, an IPv6 object, and an interface. This probe
35
* exports a trace source "Output" with arguments of type Ptr<const Packet>,
36
* Ptr<Ipv6>, and uint32_t. The Output trace source emits a value
37
* when either the trace source emits a new value, or when SetValue ()
38
* is called.
39
*/
40
class
Ipv6PacketProbe
:
public
Probe
41
{
42
public
:
43
/**
44
* \brief Get the type ID.
45
* \return the object TypeId
46
*/
47
static
TypeId
GetTypeId
();
48
49
Ipv6PacketProbe
();
50
~Ipv6PacketProbe
()
override
;
51
52
/**
53
* \brief Set a probe value
54
*
55
* \param packet set the traced packet equal to this
56
* \param ipv6 set the IPv6 object for the traced packet equal to this
57
* \param interface set the IPv6 interface for the traced packet equal to this
58
*/
59
void
SetValue
(
Ptr<const Packet>
packet,
Ptr<Ipv6>
ipv6,
uint32_t
interface);
60
61
/**
62
* \brief Set a probe value by its name in the Config system
63
*
64
* \param path config path to access the probe
65
* \param packet set the traced packet equal to this
66
* \param ipv6 set the IPv6 object for the traced packet equal to this
67
* \param interface set the IPv6 interface for the traced packet equal to this
68
*/
69
static
void
SetValueByPath
(std::string path,
70
Ptr<const Packet>
packet,
71
Ptr<Ipv6>
ipv6,
72
uint32_t
interface);
73
74
/**
75
* \brief connect to a trace source attribute provided by a given object
76
*
77
* \param traceSource the name of the attribute TraceSource to connect to
78
* \param obj ns3::Object to connect to
79
* \return true if the trace source was successfully connected
80
*/
81
bool
ConnectByObject
(std::string traceSource,
Ptr<Object>
obj)
override
;
82
83
/**
84
* \brief connect to a trace source provided by a config path
85
*
86
* \param path Config path to bind to
87
*
88
* Note, if an invalid path is provided, the probe will not be connected
89
* to anything.
90
*/
91
void
ConnectByPath
(std::string path)
override
;
92
93
private
:
94
/**
95
* \brief Method to connect to an underlying ns3::TraceSource with
96
* arguments of type Ptr<const Packet>, Ptr<Ipv6>, and uint32_t
97
*
98
* \param packet the traced packet
99
* \param ipv6 the IPv6 object for the traced packet
100
* \param interface the IPv6 interface for the traced packet
101
*/
102
void
TraceSink
(
Ptr<const Packet>
packet,
Ptr<Ipv6>
ipv6,
uint32_t
interface);
103
104
/// Traced Callback: the packet, the Ipv6 object and the interface.
105
ns3::TracedCallback<Ptr<const Packet>
,
Ptr<Ipv6>
,
uint32_t
>
m_output
;
106
/// Traced Callback: the previous packet's size and the actual packet's size.
107
ns3::TracedCallback<uint32_t, uint32_t>
m_outputBytes
;
108
109
/// The traced packet.
110
Ptr<const Packet>
m_packet
;
111
112
/// The IPv6 object for the traced packet.
113
Ptr<Ipv6>
m_ipv6
;
114
115
/// The IPv6 interface for the traced packet.
116
uint32_t
m_interface
;
117
118
/// The size of the traced packet.
119
uint32_t
m_packetSizeOld
;
120
};
121
122
}
// namespace ns3
123
124
#endif
// IPV6_PACKET_PROBE_H
ns3::Ipv6PacketProbe
This class is designed to probe an underlying ns3 TraceSource exporting a packet, an IPv6 object,...
Definition
ipv6-packet-probe.h:41
ns3::Ipv6PacketProbe::ConnectByObject
bool ConnectByObject(std::string traceSource, Ptr< Object > obj) override
connect to a trace source attribute provided by a given object
Definition
ipv6-packet-probe.cc:89
ns3::Ipv6PacketProbe::ConnectByPath
void ConnectByPath(std::string path) override
connect to a trace source provided by a config path
Definition
ipv6-packet-probe.cc:100
ns3::Ipv6PacketProbe::Ipv6PacketProbe
Ipv6PacketProbe()
Definition
ipv6-packet-probe.cc:48
ns3::Ipv6PacketProbe::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
ipv6-packet-probe.cc:29
ns3::Ipv6PacketProbe::TraceSink
void TraceSink(Ptr< const Packet > packet, Ptr< Ipv6 > ipv6, uint32_t interface)
Method to connect to an underlying ns3::TraceSource with arguments of type Ptr<const Packet>,...
Definition
ipv6-packet-probe.cc:108
ns3::Ipv6PacketProbe::m_ipv6
Ptr< Ipv6 > m_ipv6
The IPv6 object for the traced packet.
Definition
ipv6-packet-probe.h:113
ns3::Ipv6PacketProbe::~Ipv6PacketProbe
~Ipv6PacketProbe() override
Definition
ipv6-packet-probe.cc:57
ns3::Ipv6PacketProbe::m_packet
Ptr< const Packet > m_packet
The traced packet.
Definition
ipv6-packet-probe.h:110
ns3::Ipv6PacketProbe::m_interface
uint32_t m_interface
The IPv6 interface for the traced packet.
Definition
ipv6-packet-probe.h:116
ns3::Ipv6PacketProbe::m_output
ns3::TracedCallback< Ptr< const Packet >, Ptr< Ipv6 >, uint32_t > m_output
Traced Callback: the packet, the Ipv6 object and the interface.
Definition
ipv6-packet-probe.h:105
ns3::Ipv6PacketProbe::m_packetSizeOld
uint32_t m_packetSizeOld
The size of the traced packet.
Definition
ipv6-packet-probe.h:119
ns3::Ipv6PacketProbe::m_outputBytes
ns3::TracedCallback< uint32_t, uint32_t > m_outputBytes
Traced Callback: the previous packet's size and the actual packet's size.
Definition
ipv6-packet-probe.h:107
ns3::Ipv6PacketProbe::SetValue
void SetValue(Ptr< const Packet > packet, Ptr< Ipv6 > ipv6, uint32_t interface)
Set a probe value.
Definition
ipv6-packet-probe.cc:63
ns3::Ipv6PacketProbe::SetValueByPath
static void SetValueByPath(std::string path, Ptr< const Packet > packet, Ptr< Ipv6 > ipv6, uint32_t interface)
Set a probe value by its name in the Config system.
Definition
ipv6-packet-probe.cc:77
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
ipv6.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet
model
ipv6-packet-probe.h
Generated on Fri Nov 8 2024 13:59:01 for ns-3 by
1.11.0