A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv4-global-routing-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
9
10#include "ns3/global-route-manager.h"
11#include "ns3/global-router-interface.h"
12#include "ns3/global-routing.h"
13#include "ns3/ipv4-list-routing.h"
14#include "ns3/log.h"
15
16namespace ns3
17{
18
19NS_LOG_COMPONENT_DEFINE("Ipv4GlobalRoutingHelper");
20
24
28
31{
32 return new Ipv4GlobalRoutingHelper(*this);
33}
34
37{
38 NS_LOG_LOGIC("Adding GlobalRouter interface to node " << node->GetId());
39
41 node->AggregateObject(globalRouter);
42
43 NS_LOG_LOGIC("Adding GlobalRouting Protocol to node " << node->GetId());
46 globalRouter->SetRoutingProtocol(globalRouting);
47
48 return globalRouting;
49}
50
51void
57
58void
60 Ipv4Address dest,
62 bool nodeIdLookup,
63 Time::Unit unit)
64{
65 GlobalRouteManager<Ipv4Manager>::PrintRoute(sourceNode, dest, stream, nodeIdLookup, unit);
66}
67
68void
70 Ipv4Address dest,
71 bool nodeIdLookup,
72 Time::Unit unit)
73{
74 GlobalRouteManager<Ipv4Manager>::PrintRoute(sourceNode, dest, nodeIdLookup, unit);
75}
76
77void
79 Ptr<Node> dest,
81 bool nodeIdLookup,
82 Time::Unit unit)
83{
84 GlobalRouteManager<Ipv4Manager>::PrintRoute(sourceNode, dest, stream, nodeIdLookup, unit);
85}
86
87void
89 Ptr<Node> dest,
90 bool nodeIdLookup,
91 Time::Unit unit)
92{
93 GlobalRouteManager<Ipv4Manager>::PrintRoute(sourceNode, dest, nodeIdLookup, unit);
94}
95
96void
98 Ipv4Address dest,
99 Time printTime,
101 bool nodeIdLookup,
102 Time::Unit unit)
103{
105 printTime,
106 static_cast<void (*)(Ptr<Node>, Ipv4Address, Ptr<OutputStreamWrapper>, bool, Time::Unit)>(
108 sourceNode,
109 dest,
110 stream,
111 nodeIdLookup,
112 unit);
113}
114
115void
117 Ipv4Address dest,
118 Time printTime,
119 bool nodeIdLookup,
120 Time::Unit unit)
121{
122 Simulator::Schedule(printTime,
123 static_cast<void (*)(Ptr<Node>, Ipv4Address, bool, Time::Unit)>(
125 sourceNode,
126 dest,
127 nodeIdLookup,
128 unit);
129}
130
131void
133 Ptr<Node> dest,
134 Time printTime,
136 bool nodeIdLookup,
137 Time::Unit unit)
138{
140 printTime,
141 static_cast<void (*)(Ptr<Node>, Ptr<Node>, Ptr<OutputStreamWrapper>, bool, Time::Unit)>(
143 sourceNode,
144 dest,
145 stream,
146 nodeIdLookup,
147 unit);
148}
149
150void
152 Ptr<Node> dest,
153 Time printTime,
154 bool nodeIdLookup,
155 Time::Unit unit)
156{
157 Simulator::Schedule(printTime,
158 static_cast<void (*)(Ptr<Node>, Ptr<Node>, bool, Time::Unit)>(
160 sourceNode,
161 dest,
162 nodeIdLookup,
163 unit);
164}
165
166void
173
174} // namespace ns3
static void PrintRoute(Ptr< Node > sourceNode, IpAddress dest, Ptr< OutputStreamWrapper > stream, bool nodeIdLookup=true, Time::Unit unit=Time::S)
prints the path from this node to the destination node at a particular time.
Ipv4 addresses are stored in host order in this class.
Helper class that adds ns3::Ipv4GlobalRouting objects.
static void PrintRouteAt(Ptr< Node > sourceNode, Ipv4Address dest, Time printTime, bool nodeIdLookup=true, Time::Unit unit=Time::S)
prints the routing path for the source and destination at a particular time to the standard cout outp...
static void PrintRoute(Ptr< Node > sourceNode, Ipv4Address dest, bool nodeIdLookup=true, Time::Unit unit=Time::S)
prints the routing path for a source and destination to the standard cout output stream.
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
static void RecomputeRoutingTables()
Remove all routes that were previously installed in a prior call to either PopulateRoutingTables() or...
Ptr< Ipv4RoutingProtocol > Create(Ptr< Node > node) const override
Ipv4GlobalRoutingHelper()
Construct a GlobalRoutingHelper to make life easier for managing global routing tasks.
Ipv4GlobalRoutingHelper * Copy() const override
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:580
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
Unit
The unit to use to interpret a number representing time.
Definition nstime.h:101
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:274
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:627
Every class exported by the ns3 library is enclosed in the ns3 namespace.