A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv4-global-routing-helper.h
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 */
8#ifndef IPV4_GLOBAL_ROUTING_HELPER_H
9#define IPV4_GLOBAL_ROUTING_HELPER_H
10
11#include "ipv4-routing-helper.h"
12
13#include "ns3/node-container.h"
14
15namespace ns3
16{
17
18/**
19 * @ingroup ipv4Helpers
20 *
21 * @brief Helper class that adds ns3::Ipv4GlobalRouting objects
22 */
24{
25 public:
26 /**
27 * @brief Construct a GlobalRoutingHelper to make life easier for managing
28 * global routing tasks.
29 */
31
32 /**
33 * @brief Construct a GlobalRoutingHelper from another previously initialized
34 * instance (Copy Constructor).
35 * @param o object to be copied
36 */
38
39 // Delete assignment operator to avoid misuse
41
42 /**
43 * @returns pointer to clone of this Ipv4GlobalRoutingHelper
44 *
45 * This method is mainly for internal use by the other helpers;
46 * clients are expected to free the dynamic memory allocated by this method
47 */
48 Ipv4GlobalRoutingHelper* Copy() const override;
49
50 /**
51 * @param node the node on which the routing protocol will run
52 * @returns a newly-created routing protocol
53 *
54 * This method will be called by ns3::InternetStackHelper::Install
55 */
56 Ptr<Ipv4RoutingProtocol> Create(Ptr<Node> node) const override;
57
58 /**
59 * @brief Build a routing database and initialize the routing tables of
60 * the nodes in the simulation. Makes all nodes in the simulation into
61 * routers.
62 *
63 * All this function does is call the functions
64 * BuildGlobalRoutingDatabase () and InitializeRoutes ().
65 *
66 */
67 static void PopulateRoutingTables();
68
69 /**
70 * @brief prints the routing path for a source and destination to the standard cout output
71 * stream. If the routing path does not exist, it prints that the path does not exist between
72 * the nodes in the ostream. This is a scheduler for the PrintRoute call.
73 *
74 * @param sourceNode the source node
75 * @param dest the IPv4 destination address
76 * @param nodeIdLookup print the node id
77 * @param unit the time unit to be used in the report
78 *
79 * @details This method calls the PrintRoutingPath() method of the
80 * Ipv4GlobalRouting for the source and destination to provide
81 * the routing path at the specified time.
82 * Early return will be triggered if inputs are invalid. for example:
83 * if source or destination nodes do not exist, source or destination nodes lack IPv4 instances,
84 * or source node lacks a global routing instance.
85 * If the destination node has multiple IpAddresses, the routing path will be printed for the
86 * first Ip address of the destination Ipv4 Stack.
87 */
88 static void PrintRoute(Ptr<Node> sourceNode,
89 Ipv4Address dest,
90 bool nodeIdLookup = true,
91 Time::Unit unit = Time::S);
92
93 /**
94 * @brief prints the routing path for a source and destination.
95 * @copydetails PrintRoute(Ptr<Node>, Ipv4Address, bool, Time::Unit)
96 * @param stream the output stream object to use
97 */
98 static void PrintRoute(Ptr<Node> sourceNode,
99 Ipv4Address dest,
101 bool nodeIdLookup = true,
102 Time::Unit unit = Time::S);
103
104 /**
105 * @copybrief PrintRoute(Ptr<Node>, Ipv4Address, bool,
106 * Time::Unit)
107 * If the routing path does not exist, it prints that the path does not exist between
108 * the nodes in the ostream. This is a scheduler for the PrintRoute call.
109 *
110 * @param sourceNode the source node
111 * @param dest the destination node
112 * @param nodeIdLookup print the node id
113 * @param unit the time unit to be used in the report
114 *
115 * @details This method calls the PrintRoutingPath() method of the
116 * Ipv4GlobalRouting for the source and destination to provide
117 * the routing path at the specified time.
118 * Early return will be triggered if inputs are invalid. for example:
119 * if source or destination nodes do not exist, source or destination nodes lack IPv4 instances,
120 * or source node lacks a global routing instance.
121 * If the destination node has multiple IpAddresses, the routing path will be printed for the
122 * first Ip address of the destination Ipv4 Stack.
123 */
124 static void PrintRoute(Ptr<Node> sourceNode,
125 Ptr<Node> dest,
126 bool nodeIdLookup = true,
127 Time::Unit unit = Time::S);
128
129 /**
130 * @copybrief PrintRoute(Ptr<Node>, Ipv4Address, Ptr<OutputStreamWrapper>, bool,
131 * Time::Unit)
132 * @copydetails PrintRoute(Ptr<Node>, Ptr<Node>, bool, Time::Unit)
133 * @param stream the output stream object to use
134 */
135 static void PrintRoute(Ptr<Node> sourceNode,
136 Ptr<Node> dest,
138 bool nodeIdLookup = true,
139 Time::Unit unit = Time::S);
140
141 /**
142 * @brief prints the routing path for the source and destination at a particular time to the
143 * standard cout output stream.
144 * @copydetails PrintRoute(Ptr<Node>, Ipv4Address, bool, Time::Unit)
145 * @param printTime the time at which the routing path should be printed.
146 */
147 static void PrintRouteAt(Ptr<Node> sourceNode,
148 Ipv4Address dest,
149 Time printTime,
150 bool nodeIdLookup = true,
151 Time::Unit unit = Time::S);
152
153 /**
154 * @brief Prints the routing path for the source and destination at a particular time.
155 * @copydetails PrintRoute(Ptr<Node>, Ipv4Address,bool, Time::Unit)
156 * @param printTime the time at which the routing path should be printed.
157 * @param stream the output stream object to use
158 */
159 static void PrintRouteAt(Ptr<Node> sourceNode,
160 Ipv4Address dest,
161 Time printTime,
163 bool nodeIdLookup = true,
164 Time::Unit unit = Time::S);
165
166 /**
167 * @copybrief PrintRouteAt(Ptr<Node>, Ipv4Address, Time, bool, Time::Unit)
168 * @copydetails PrintRoute(Ptr<Node>, Ptr<Node>, bool, Time::Unit)
169 * @param printTime the time at which the routing path should be printed.
170 */
171 static void PrintRouteAt(Ptr<Node> sourceNode,
172 Ptr<Node> dest,
173 Time printTime,
174 bool nodeIdLookup = true,
175 Time::Unit unit = Time::S);
176
177 /**
178 * @copybrief PrintRouteAt(Ptr<Node>, Ipv4Address, Time, bool, Time::Unit)
179 * @copydetails PrintRoute(Ptr<Node>, Ptr<Node>, bool, Time::Unit)
180 * @param printTime the time at which the routing path should be printed.
181 * @param stream the output stream object to use.
182 */
183 static void PrintRouteAt(Ptr<Node> sourceNode,
184 Ptr<Node> dest,
185 Time printTime,
187 bool nodeIdLookup = true,
188 Time::Unit unit = Time::S);
189
190 /**
191 * @brief Remove all routes that were previously installed in a prior call
192 * to either PopulateRoutingTables() or RecomputeRoutingTables(), and
193 * add a new set of routes.
194 *
195 * This method does not change the set of nodes
196 * over which GlobalRouting is being used, but it will dynamically update
197 * its representation of the global topology before recomputing routes.
198 * Users must first call PopulateRoutingTables() and then may subsequently
199 * call RecomputeRoutingTables() at any later time in the simulation.
200 *
201 */
202 static void RecomputeRoutingTables();
203};
204
205} // namespace ns3
206
207#endif /* IPV4_GLOBAL_ROUTING_HELPER_H */
Ipv4 addresses are stored in host order in this class.
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.
Ipv4GlobalRoutingHelper & operator=(const Ipv4GlobalRoutingHelper &)=delete
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
a factory to create ns3::Ipv4RoutingProtocol objects
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
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
@ S
second
Definition nstime.h:107
Every class exported by the ns3 library is enclosed in the ns3 namespace.