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
v4traceroute-helper.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019 Ritsumeikan University, Shiga, Japan
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
*
7
* Author: Alberto Gallegos Ramonet <ramonet@fc.ritsumei.ac.jp>
8
*
9
*/
10
11
#include "
v4traceroute-helper.h
"
12
13
#include "ns3/output-stream-wrapper.h"
14
#include "ns3/v4traceroute.h"
15
16
namespace
ns3
17
{
18
19
V4TraceRouteHelper::V4TraceRouteHelper
(
const
Ipv4Address
& remote)
20
:
ApplicationHelper
(
"ns3::V4TraceRoute"
)
21
{
22
m_factory
.
Set
(
"Remote"
,
Ipv4AddressValue
(remote));
23
}
24
25
void
26
V4TraceRouteHelper::PrintTraceRouteAt
(
Ptr<Node>
node,
Ptr<OutputStreamWrapper>
stream)
27
{
28
for
(
uint32_t
i = 0; i < node->GetNApplications(); ++i)
29
{
30
if
(
auto
trace = node->GetApplication(i)->GetObject<
V4TraceRoute
>())
31
{
32
*stream->GetStream() <<
"Tracing Route from Node "
<< node->GetId() <<
"\n"
;
33
trace->Print(stream);
34
return
;
35
}
36
}
37
NS_ASSERT_MSG
(
false
,
"No V4TraceRoute application found in node "
<< node->GetId());
38
}
39
40
}
// namespace ns3
ns3::ApplicationHelper
A helper to make it easier to instantiate an application on a set of nodes.
Definition
application-helper.h:28
ns3::ApplicationHelper::m_factory
ObjectFactory m_factory
Object factory.
Definition
application-helper.h:129
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::Ipv4AddressValue
Definition
ipv4-address.h:330
ns3::ObjectFactory::Set
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Definition
object-factory.h:213
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::V4TraceRouteHelper::PrintTraceRouteAt
static void PrintTraceRouteAt(Ptr< Node > node, Ptr< OutputStreamWrapper > stream)
Print the resulting trace routes from given node.
Definition
v4traceroute-helper.cc:26
ns3::V4TraceRouteHelper::V4TraceRouteHelper
V4TraceRouteHelper(const Ipv4Address &remote)
Create a V4TraceRouteHelper which is used to make life easier for people wanting to use TraceRoute.
Definition
v4traceroute-helper.cc:19
ns3::V4TraceRoute
Traceroute application sends one ICMP ECHO request with TTL=1, and after receiving an ICMP TIME EXCEE...
Definition
v4traceroute.h:40
uint32_t
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition
assert.h:75
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
v4traceroute-helper.h
src
internet-apps
helper
v4traceroute-helper.cc
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0