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-router-interface.h"
11#include "ns3/ipv4-global-routing.h"
12#include "ns3/ipv4-list-routing.h"
13#include "ns3/log.h"
14
15namespace ns3
16{
17
18NS_LOG_COMPONENT_DEFINE("GlobalRoutingHelper");
19
23
27
30{
31 return new Ipv4GlobalRoutingHelper(*this);
32}
33
36{
37 NS_LOG_LOGIC("Adding GlobalRouter interface to node " << node->GetId());
38
40 node->AggregateObject(globalRouter);
41
42 NS_LOG_LOGIC("Adding GlobalRouting Protocol to node " << node->GetId());
44 globalRouter->SetRoutingProtocol(globalRouting);
45
46 return globalRouting;
47}
48
49void
55
56void
58 Ipv4Address dest,
60 bool nodeIdLookup,
61 Time::Unit unit)
62{
63 GlobalRouteManager::PrintRoute(sourceNode, dest, stream, nodeIdLookup, unit);
64}
65
66void
68 Ipv4Address dest,
69 bool nodeIdLookup,
70 Time::Unit unit)
71{
72 GlobalRouteManager::PrintRoute(sourceNode, dest, nodeIdLookup, unit);
73}
74
75void
77 Ptr<Node> dest,
79 bool nodeIdLookup,
80 Time::Unit unit)
81{
82 GlobalRouteManager::PrintRoute(sourceNode, dest, stream, nodeIdLookup, unit);
83}
84
85void
87 Ptr<Node> dest,
88 bool nodeIdLookup,
89 Time::Unit unit)
90{
91 GlobalRouteManager::PrintRoute(sourceNode, dest, nodeIdLookup, unit);
92}
93
94void
96 Ipv4Address dest,
97 Time printTime,
99 bool nodeIdLookup,
100 Time::Unit unit)
101{
103 printTime,
104 static_cast<void (*)(Ptr<Node>, Ipv4Address, Ptr<OutputStreamWrapper>, bool, Time::Unit)>(
106 sourceNode,
107 dest,
108 stream,
109 nodeIdLookup,
110 unit);
111}
112
113void
115 Ipv4Address dest,
116 Time printTime,
117 bool nodeIdLookup,
118 Time::Unit unit)
119{
120 Simulator::Schedule(printTime,
121 static_cast<void (*)(Ptr<Node>, Ipv4Address, bool, Time::Unit)>(
123 sourceNode,
124 dest,
125 nodeIdLookup,
126 unit);
127}
128
129void
131 Ptr<Node> dest,
132 Time printTime,
134 bool nodeIdLookup,
135 Time::Unit unit)
136{
138 printTime,
139 static_cast<void (*)(Ptr<Node>, Ptr<Node>, Ptr<OutputStreamWrapper>, bool, Time::Unit)>(
141 sourceNode,
142 dest,
143 stream,
144 nodeIdLookup,
145 unit);
146}
147
148void
150 Ptr<Node> dest,
151 Time printTime,
152 bool nodeIdLookup,
153 Time::Unit unit)
154{
155 Simulator::Schedule(printTime,
156 static_cast<void (*)(Ptr<Node>, Ptr<Node>, bool, Time::Unit)>(
158 sourceNode,
159 dest,
160 nodeIdLookup,
161 unit);
162}
163
164void
171
172} // namespace ns3
static void DeleteGlobalRoutes()
Delete all static routes on all nodes that have a GlobalRouterInterface.
static void PrintRoute(Ptr< Node > sourceNode, Ipv4Address 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.
static void InitializeRoutes()
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.
static void BuildGlobalRoutingDatabase()
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRo...
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:96
Unit
The unit to use to interpret a number representing time.
Definition nstime.h:102
#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.