1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright 2007 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  * Authors:  Craig Dowell (craigdo@ee.washington.edu)
19  *           Tom Henderson (tomhend@u.washington.edu)
20  */
21 
22 #ifndef GLOBAL_ROUTE_MANAGER_H
23 #define GLOBAL_ROUTE_MANAGER_H
24 
25 namespace ns3 {
26 
27 /**
28  * \ingroup globalrouting
29  *
30  * @brief A global global router
31  *
32  * This singleton object can query interface each node in the system
33  * for a GlobalRouter interface.  For those nodes, it fetches one or
34  * more Link State Advertisements and stores them in a local database.
35  * Then, it can compute shortest paths on a per-node basis to all routers,
36  * and finally configure each of the node's forwarding tables.
37  *
38  * The design is guided by OSPFv2 \RFC{2328} section 16.1.1 and quagga ospfd.
39  */
40 class GlobalRouteManager
41 {
42 public:
43 /**
44  * @brief Allocate a 32-bit router ID from monotonically increasing counter.
45  * @returns A new new RouterId.
46  */
47   static uint32_t AllocateRouterId ();
48 
49 /**
50  * @brief Delete all static routes on all nodes that have a
51  * GlobalRouterInterface
52  *
53  */
54   static void DeleteGlobalRoutes ();
55 
56 /**
57  * @brief Build the routing database by gathering Link State Advertisements
58  * from each node exporting a GlobalRouter interface.
59  */
60   static void BuildGlobalRoutingDatabase ();
61 
62 /**
63  * @brief Compute routes using a Dijkstra SPF computation and populate
64  * per-node forwarding tables
65  */
66   static void InitializeRoutes ();
67 
68 private:
69 /**
70  * @brief Global Route Manager copy construction is disallowed.  There's no
71  * need for it and a compiler provided shallow copy would be wrong.
72  *
73  * @param srm object to copy from
74  */
75   GlobalRouteManager (GlobalRouteManager& srm);
76 
77 /**
78  * @brief Global Router copy assignment operator is disallowed.  There's no
79  * need for it and a compiler provided shallow copy would be wrong.
80  *
81  * @param srm object to copy from
82  * @returns the copied object
83  */
84   GlobalRouteManager& operator= (GlobalRouteManager& srm);
85 };
86 
87 } // namespace ns3
88 
89 #endif /* GLOBAL_ROUTE_MANAGER_H */
90