A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
global-route-manager.h
Go to the documentation of this file.
1/*
2 * Copyright 2007 University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Craig Dowell (craigdo@ee.washington.edu)
7 * Tom Henderson (tomhend@u.washington.edu)
8 */
9
10#ifndef GLOBAL_ROUTE_MANAGER_H
11#define GLOBAL_ROUTE_MANAGER_H
12
13#include "ns3/ipv4-routing-helper.h"
14
15#include <cstdint>
16
17namespace ns3
18{
19
20/**
21 * @ingroup globalrouting
22 *
23 * @brief A global global router
24 *
25 * This singleton object can query interface each node in the system
26 * for a GlobalRouter interface. For those nodes, it fetches one or
27 * more Link State Advertisements and stores them in a local database.
28 * Then, it can compute shortest paths on a per-node basis to all routers,
29 * and finally configure each of the node's forwarding tables.
30 *
31 * The design is guided by OSPFv2 \RFC{2328} section 16.1.1 and quagga ospfd.
32 */
34{
35 public:
36 // Delete copy constructor and assignment operator to avoid misuse
39
40 /**
41 * @brief Allocate a 32-bit router ID from monotonically increasing counter.
42 * @returns A new new RouterId.
43 */
45
46 /**
47 * @brief Delete all static routes on all nodes that have a
48 * GlobalRouterInterface
49 *
50 */
51 static void DeleteGlobalRoutes();
52
53 /**
54 * @brief Build the routing database by gathering Link State Advertisements
55 * from each node exporting a GlobalRouter interface.
56 */
57 static void BuildGlobalRoutingDatabase();
58
59 /**
60 * @brief Compute routes using a Dijkstra SPF computation and populate
61 * per-node forwarding tables
62 */
63 static void InitializeRoutes();
64
65 /**
66 * @brief Reset the router ID counter to zero. This should only be called by tests to reset the
67 * router ID counter between simulations within the same program. This function should not be
68 * called In typical simulations or when using the GlobalRouting helper.
69 */
70 static void ResetRouterId();
71
72 /**
73 * @brief prints the path from this node to the destination node at a particular time.
74 * @param sourceNode The source node.
75 * @param dest The IPv4 address of the destination node.
76 * @param stream The output stream to which the routing path will be written.
77 * @param nodeIdLookup Print the Node Id
78 * @param unit The time unit for timestamps in the printed output.
79 * @see Ipv4GlobalRoutingHelper::PrintRoute
80 */
81 static void PrintRoute(Ptr<Node> sourceNode,
82 Ipv4Address dest,
84 bool nodeIdLookup = true,
85 Time::Unit unit = Time::S);
86
87 /**
88 *@brief prints the path from this node to the destination node at a particular time.
89 * @param sourceNode The source node.
90 * @param dest The IPv4 address of the destination node.
91 * @param nodeIdLookup Print the Node Id
92 * @param unit The time unit for timestamps in the printed output.
93 * @see Ipv4GlobalRoutingHelper::PrintRoute
94 */
95 static void PrintRoute(Ptr<Node> sourceNode,
96 Ipv4Address dest,
97 bool nodeIdLookup = true,
98 Time::Unit unit = Time::S);
99
100 /**
101 *@brief prints the path from this node to the destination node at a particular time.
102 * @param sourceNode The source node.
103 * @param dest The destination node.
104 * @param stream The output stream to which the routing path will be written.
105 * @param nodeIdLookup Print the Node Id
106 * @param unit The time unit for timestamps in the printed output.
107 * @see Ipv4GlobalRoutingHelper::PrintRoute
108 */
109 static void PrintRoute(Ptr<Node> sourceNode,
110 Ptr<Node> dest,
112 bool nodeIdLookup = true,
113 Time::Unit unit = Time::S);
114
115 /**
116 *@brief prints the path from this node to the destination node at a particular time.
117 * @param sourceNode The source node.
118 * @param dest The destination node.
119 * @param nodeIdLookup Print the Node Id
120 * @param unit The time unit for timestamps in the printed output.
121 * @see Ipv4GlobalRoutingHelper::PrintRoute
122 */
123 static void PrintRoute(Ptr<Node> sourceNode,
124 Ptr<Node> dest,
125 bool nodeIdLookup = true,
126 Time::Unit unit = Time::S);
127
128 private:
129 static uint32_t routerId; //!< Router ID counter
130};
131
132} // namespace ns3
133
134#endif /* GLOBAL_ROUTE_MANAGER_H */
static void DeleteGlobalRoutes()
Delete all static routes on all nodes that have a GlobalRouterInterface.
static uint32_t routerId
Router ID counter.
static void ResetRouterId()
Reset the router ID counter to zero.
GlobalRouteManager(const GlobalRouteManager &)=delete
static uint32_t AllocateRouterId()
Allocate a 32-bit router ID from monotonically increasing counter.
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...
GlobalRouteManager & operator=(const GlobalRouteManager &)=delete
Ipv4 addresses are stored in host order in this class.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
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.