A Discrete-Event Network Simulator
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
16namespace ns3
17{
18
20 : ApplicationHelper("ns3::V4TraceRoute")
21{
22 m_factory.Set("Remote", Ipv4AddressValue(remote));
23}
24
25void
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
A helper to make it easier to instantiate an application on a set of nodes.
ObjectFactory m_factory
Object factory.
Ipv4 addresses are stored in host order in this class.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Smart pointer class similar to boost::intrusive_ptr.
static void PrintTraceRouteAt(Ptr< Node > node, Ptr< OutputStreamWrapper > stream)
Print the resulting trace routes from given node.
V4TraceRouteHelper(const Ipv4Address &remote)
Create a V4TraceRouteHelper which is used to make life easier for people wanting to use TraceRoute.
Traceroute application sends one ICMP ECHO request with TTL=1, and after receiving an ICMP TIME EXCEE...
#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
Every class exported by the ns3 library is enclosed in the ns3 namespace.