A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
17
namespace
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
*/
33
class
GlobalRouteManager
34
{
35
public
:
36
// Delete copy constructor and assignment operator to avoid misuse
37
GlobalRouteManager
(
const
GlobalRouteManager
&) =
delete
;
38
GlobalRouteManager
&
operator=
(
const
GlobalRouteManager
&) =
delete
;
39
40
/**
41
* @brief Allocate a 32-bit router ID from monotonically increasing counter.
42
* @returns A new new RouterId.
43
*/
44
static
uint32_t
AllocateRouterId
();
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,
83
Ptr<OutputStreamWrapper>
stream,
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,
111
Ptr<OutputStreamWrapper>
stream,
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 */
ns3::GlobalRouteManager::DeleteGlobalRoutes
static void DeleteGlobalRoutes()
Delete all static routes on all nodes that have a GlobalRouterInterface.
Definition
global-route-manager.cc:33
ns3::GlobalRouteManager::routerId
static uint32_t routerId
Router ID counter.
Definition
global-route-manager.h:129
ns3::GlobalRouteManager::ResetRouterId
static void ResetRouterId()
Reset the router ID counter to zero.
Definition
global-route-manager.cc:61
ns3::GlobalRouteManager::GlobalRouteManager
GlobalRouteManager(const GlobalRouteManager &)=delete
ns3::GlobalRouteManager::AllocateRouterId
static uint32_t AllocateRouterId()
Allocate a 32-bit router ID from monotonically increasing counter.
Definition
global-route-manager.cc:54
ns3::GlobalRouteManager::PrintRoute
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.
Definition
global-route-manager.cc:67
ns3::GlobalRouteManager::InitializeRoutes
static void InitializeRoutes()
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.
Definition
global-route-manager.cc:47
ns3::GlobalRouteManager::BuildGlobalRoutingDatabase
static void BuildGlobalRoutingDatabase()
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRo...
Definition
global-route-manager.cc:40
ns3::GlobalRouteManager::operator=
GlobalRouteManager & operator=(const GlobalRouteManager &)=delete
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:33
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:70
ns3::Time::Unit
Unit
The unit to use to interpret a number representing time.
Definition
nstime.h:102
ns3::Time::S
@ S
second
Definition
nstime.h:107
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet
model
global-route-manager.h
Generated on
for ns-3 by
1.15.0