author | Andrey Mazo <mazo@iitp.ru> |
Fri, 23 Apr 2010 15:09:31 +0400 | |
changeset 6273 | 8d70de29d514 |
parent 5227 | ecb08c1fc273 |
permissions | -rw-r--r-- |
1111 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
1457
562a7017ed93
Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents:
1280
diff
changeset
|
3 |
* Copyright 2007 University of Washington |
562a7017ed93
Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents:
1280
diff
changeset
|
4 |
* |
1111 | 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 |
|
1457
562a7017ed93
Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents:
1280
diff
changeset
|
17 |
* |
562a7017ed93
Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents:
1280
diff
changeset
|
18 |
* Authors: Craig Dowell (craigdo@ee.washington.edu) |
562a7017ed93
Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents:
1280
diff
changeset
|
19 |
* Tom Henderson (tomhend@u.washington.edu) |
1111 | 20 |
*/ |
21 |
||
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
22 |
#ifndef GLOBAL_ROUTER_INTERFACE_H |
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
23 |
#define GLOBAL_ROUTER_INTERFACE_H |
1111 | 24 |
|
25 |
#include <stdint.h> |
|
26 |
#include <list> |
|
27 |
#include "ns3/object.h" |
|
28 |
#include "ns3/ptr.h" |
|
29 |
#include "ns3/node.h" |
|
30 |
#include "ns3/channel.h" |
|
31 |
#include "ns3/ipv4-address.h" |
|
3939
206f627bd5af
factor DiscoverLSAs into understandable modules
Craig Dowell <craigdo@ee.washington.edu>
parents:
3938
diff
changeset
|
32 |
#include "ns3/net-device-container.h" |
3941
476c3bed16c0
teach global routing about bridges
Craig Dowell <craigdo@ee.washington.edu>
parents:
3940
diff
changeset
|
33 |
#include "ns3/bridge-net-device.h" |
1113
5b63b39161e7
remove routing environment, move router interface creation to global-route-manager
Craig Dowell <craigdo@ee.washington.edu>
parents:
1112
diff
changeset
|
34 |
#include "ns3/global-route-manager.h" |
4745
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
35 |
#include "ns3/ipv4-routing-table-entry.h" |
1111 | 36 |
|
37 |
namespace ns3 { |
|
38 |
||
3942
eef10dbce686
fix bug 114 and bug 66
Craig Dowell <craigdo@ee.washington.edu>
parents:
3941
diff
changeset
|
39 |
class GlobalRouter; |
4616
a84f60b6cd12
bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4372
diff
changeset
|
40 |
class Ipv4GlobalRouting; |
3942
eef10dbce686
fix bug 114 and bug 66
Craig Dowell <craigdo@ee.washington.edu>
parents:
3941
diff
changeset
|
41 |
|
1111 | 42 |
/** |
43 |
* @brief A single link record for a link state advertisement. |
|
44 |
* |
|
1278 | 45 |
* The GlobalRoutingLinkRecord is modeled after the OSPF link record field of |
1111 | 46 |
* a Link State Advertisement. Right now we will only see two types of link |
47 |
* records corresponding to a stub network and a point-to-point link (channel). |
|
48 |
*/ |
|
1278 | 49 |
class GlobalRoutingLinkRecord |
1111 | 50 |
{ |
51 |
public: |
|
3942
eef10dbce686
fix bug 114 and bug 66
Craig Dowell <craigdo@ee.washington.edu>
parents:
3941
diff
changeset
|
52 |
friend class GlobalRoutingLSA; |
1111 | 53 |
/** |
54 |
* @enum LinkType |
|
1278 | 55 |
* @brief Enumeration of the possible types of Global Routing Link Records. |
1111 | 56 |
* |
57 |
* These values are defined in the OSPF spec. We currently only use |
|
58 |
* PointToPoint and StubNetwork types. |
|
59 |
*/ |
|
60 |
enum LinkType { |
|
61 |
Unknown = 0, /**< Uninitialized Link Record */ |
|
62 |
PointToPoint, /**< Record representing a point to point channel */ |
|
63 |
TransitNetwork, /**< Unused -- for future OSPF compatibility */ |
|
64 |
StubNetwork, /**< Record represents a leaf node network */ |
|
65 |
VirtualLink /**< Unused -- for future OSPF compatibility */ |
|
66 |
}; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
67 |
|
1111 | 68 |
/** |
1278 | 69 |
* @brief Construct an empty ("uninitialized") Global Routing Link Record. |
1111 | 70 |
* |
71 |
* The Link ID and Link Data Ipv4 addresses are set to "0.0.0.0"; |
|
72 |
* The Link Type is set to Unknown; |
|
73 |
* The metric is set to 0. |
|
74 |
*/ |
|
1278 | 75 |
GlobalRoutingLinkRecord (); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
76 |
|
1111 | 77 |
/** |
1278 | 78 |
* Construct an initialized Global Routing Link Record. |
1111 | 79 |
* |
80 |
* @param linkType The type of link record to construct. |
|
81 |
* @param linkId The link ID for the record. |
|
82 |
* @param linkData The link data field for the record. |
|
83 |
* @param metric The metric field for the record. |
|
84 |
* @see LinkType |
|
85 |
* @see SetLinkId |
|
86 |
* @see SetLinkData |
|
87 |
*/ |
|
1278 | 88 |
GlobalRoutingLinkRecord ( |
1111 | 89 |
LinkType linkType, |
90 |
Ipv4Address linkId, |
|
91 |
Ipv4Address linkData, |
|
1776
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1457
diff
changeset
|
92 |
uint16_t metric); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
93 |
|
1111 | 94 |
/** |
1278 | 95 |
* @brief Destroy a Global Routing Link Record. |
1111 | 96 |
* |
97 |
* Currently does nothing. Here as a placeholder only. |
|
98 |
*/ |
|
1278 | 99 |
~GlobalRoutingLinkRecord (); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
100 |
|
1111 | 101 |
/** |
1278 | 102 |
* Get the Link ID field of the Global Routing Link Record. |
1111 | 103 |
* |
104 |
* For an OSPF type 1 link (PointToPoint) the Link ID will be the Router ID |
|
105 |
* of the neighboring router. |
|
106 |
* |
|
107 |
* For an OSPF type 3 link (StubNetwork), the Link ID will be the adjacent |
|
108 |
* neighbor's IP address |
|
109 |
* |
|
110 |
* @returns The Ipv4Address corresponding to the Link ID field of the record. |
|
111 |
*/ |
|
112 |
Ipv4Address GetLinkId(void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
113 |
|
1111 | 114 |
/** |
1278 | 115 |
* @brief Set the Link ID field of the Global Routing Link Record. |
1111 | 116 |
* |
117 |
* For an OSPF type 1 link (PointToPoint) the Link ID must be the Router ID |
|
118 |
* of the neighboring router. |
|
119 |
* |
|
120 |
* For an OSPF type 3 link (StubNetwork), the Link ID must be the adjacent |
|
121 |
* neighbor's IP address |
|
122 |
* |
|
123 |
* @param addr An Ipv4Address to store in the Link ID field of the record. |
|
124 |
*/ |
|
125 |
void SetLinkId(Ipv4Address addr); |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
126 |
|
1111 | 127 |
/** |
1278 | 128 |
* @brief Get the Link Data field of the Global Routing Link Record. |
1111 | 129 |
* |
130 |
* For an OSPF type 1 link (PointToPoint) the Link Data will be the IP |
|
131 |
* address of the node of the local side of the link. |
|
132 |
* |
|
133 |
* For an OSPF type 3 link (StubNetwork), the Link Data will be the |
|
134 |
* network mask |
|
135 |
* |
|
136 |
* @returns The Ipv4Address corresponding to the Link Data field of the record. |
|
137 |
*/ |
|
138 |
Ipv4Address GetLinkData(void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
139 |
|
1111 | 140 |
/** |
1278 | 141 |
* @brief Set the Link Data field of the Global Routing Link Record. |
1111 | 142 |
* |
143 |
* For an OSPF type 1 link (PointToPoint) the Link Data must be the IP |
|
144 |
* address of the node of the local side of the link. |
|
145 |
* |
|
146 |
* For an OSPF type 3 link (StubNetwork), the Link Data must be set to the |
|
147 |
* network mask |
|
148 |
* |
|
149 |
* @param addr An Ipv4Address to store in the Link Data field of the record. |
|
150 |
*/ |
|
151 |
void SetLinkData(Ipv4Address addr); |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
152 |
|
1111 | 153 |
/** |
1278 | 154 |
* @brief Get the Link Type field of the Global Routing Link Record. |
1111 | 155 |
* |
156 |
* The Link Type describes the kind of link a given record represents. The |
|
157 |
* values are defined by OSPF. |
|
158 |
* |
|
159 |
* @see LinkType |
|
1278 | 160 |
* @returns The LinkType of the current Global Routing Link Record. |
1111 | 161 |
*/ |
162 |
LinkType GetLinkType(void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
163 |
|
1111 | 164 |
/** |
1278 | 165 |
* @brief Set the Link Type field of the Global Routing Link Record. |
1111 | 166 |
* |
167 |
* The Link Type describes the kind of link a given record represents. The |
|
168 |
* values are defined by OSPF. |
|
169 |
* |
|
170 |
* @see LinkType |
|
1278 | 171 |
* @param linkType The new LinkType for the current Global Routing Link Record. |
1111 | 172 |
*/ |
173 |
void SetLinkType(LinkType linkType); |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
174 |
|
1111 | 175 |
/** |
1278 | 176 |
* @brief Get the Metric Data field of the Global Routing Link Record. |
1111 | 177 |
* |
178 |
* The metric is an abstract cost associated with forwarding a packet across |
|
179 |
* a link. A sum of metrics must have a well-defined meaning. That is, you |
|
180 |
* shouldn't use bandwidth as a metric (how does the sum of the bandwidth of |
|
181 |
* two hops relate to the cost of sending a packet); rather you should use |
|
182 |
* something like delay. |
|
183 |
* |
|
1278 | 184 |
* @returns The metric field of the Global Routing Link Record. |
1111 | 185 |
*/ |
1776
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1457
diff
changeset
|
186 |
uint16_t GetMetric(void) const; |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
187 |
|
1111 | 188 |
/** |
1278 | 189 |
* @brief Set the Metric Data field of the Global Routing Link Record. |
1111 | 190 |
* |
191 |
* The metric is an abstract cost associated with forwarding a packet across |
|
192 |
* a link. A sum of metrics must have a well-defined meaning. That is, you |
|
193 |
* shouldn't use bandwidth as a metric (how does the sum of the bandwidth of |
|
194 |
* two hops relate to the cost of sending a packet); rather you should use |
|
195 |
* something like delay. |
|
196 |
* |
|
1278 | 197 |
* @param metric The new metric for the current Global Routing Link Record. |
1111 | 198 |
*/ |
1776
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1457
diff
changeset
|
199 |
void SetMetric(uint16_t metric); |
1111 | 200 |
|
201 |
private: |
|
202 |
/** |
|
203 |
* m_linkId and m_linkData are defined by OSPF to have different meanings |
|
204 |
* depending on the type of link a given link records represents. They work |
|
205 |
* together. |
|
206 |
* |
|
207 |
* For Type 1 link (PointToPoint), set m_linkId to Router ID of |
|
208 |
* neighboring router. |
|
209 |
* |
|
210 |
* For Type 3 link (Stub), set m_linkId to neighbor's IP address |
|
211 |
*/ |
|
212 |
Ipv4Address m_linkId; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
213 |
|
1111 | 214 |
/** |
215 |
* m_linkId and m_linkData are defined by OSPF to have different meanings |
|
216 |
* depending on the type of link a given link records represents. They work |
|
217 |
* together. |
|
218 |
* |
|
219 |
* For Type 1 link (PointToPoint), set m_linkData to local IP address |
|
220 |
* |
|
221 |
* For Type 3 link (Stub), set m_linkData to mask |
|
222 |
*/ |
|
223 |
Ipv4Address m_linkData; // for links to RouterLSA, |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
224 |
|
1111 | 225 |
/** |
1278 | 226 |
* The type of the Global Routing Link Record. Defined in the OSPF spec. |
1111 | 227 |
* We currently only use PointToPoint and StubNetwork types. |
228 |
*/ |
|
229 |
LinkType m_linkType; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
230 |
|
1111 | 231 |
/** |
232 |
* The metric for a given link. |
|
233 |
* |
|
234 |
* A metric is abstract cost associated with forwarding a packet across a |
|
235 |
* link. A sum of metrics must have a well-defined meaning. That is, you |
|
236 |
* shouldn't use bandwidth as a metric (how does the sum of the bandwidth |
|
237 |
* of two hops relate to the cost of sending a packet); rather you should |
|
238 |
* use something like delay. |
|
239 |
*/ |
|
1776
0d5be0c3d229
Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents:
1457
diff
changeset
|
240 |
uint16_t m_metric; |
1111 | 241 |
}; |
242 |
||
243 |
/** |
|
244 |
* @brief a Link State Advertisement (LSA) for a router, used in global |
|
245 |
* routing. |
|
246 |
* |
|
247 |
* Roughly equivalent to a global incarnation of the OSPF link state header |
|
248 |
* combined with a list of Link Records. Since it's global, there's |
|
249 |
* no need for age or sequence number. See RFC 2328, Appendix A. |
|
250 |
*/ |
|
1278 | 251 |
class GlobalRoutingLSA |
1111 | 252 |
{ |
253 |
public: |
|
254 |
/** |
|
1278 | 255 |
* @enum LSType |
256 |
* @brief corresponds to LS type field of RFC 2328 OSPF LSA header |
|
257 |
*/ |
|
258 |
enum LSType { |
|
259 |
Unknown = 0, /**< Uninitialized Type */ |
|
260 |
RouterLSA, |
|
261 |
NetworkLSA, |
|
262 |
SummaryLSA, |
|
263 |
SummaryLSA_ASBR, |
|
264 |
ASExternalLSAs |
|
265 |
}; |
|
266 |
/** |
|
1111 | 267 |
* @enum SPFStatus |
1278 | 268 |
* @brief Enumeration of the possible values of the status flag in the Routing |
1111 | 269 |
* Link State Advertisements. |
270 |
*/ |
|
271 |
enum SPFStatus { |
|
272 |
LSA_SPF_NOT_EXPLORED = 0, /**< New vertex not yet considered */ |
|
273 |
LSA_SPF_CANDIDATE, /**< Vertex is in the SPF candidate queue */ |
|
274 |
LSA_SPF_IN_SPFTREE /**< Vertex is in the SPF tree */ |
|
275 |
}; |
|
276 |
/** |
|
1278 | 277 |
* @brief Create a blank Global Routing Link State Advertisement. |
1111 | 278 |
* |
279 |
* On completion Ipv4Address variables initialized to 0.0.0.0 and the |
|
280 |
* list of Link State Records is empty. |
|
281 |
*/ |
|
1278 | 282 |
GlobalRoutingLSA(); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
283 |
|
1111 | 284 |
/** |
1278 | 285 |
* @brief Create an initialized Global Routing Link State Advertisement. |
1111 | 286 |
* |
287 |
* On completion the list of Link State Records is empty. |
|
288 |
* |
|
289 |
* @param status The status to of the new LSA. |
|
290 |
* @param linkStateId The Ipv4Address for the link state ID field. |
|
291 |
* @param advertisingRtr The Ipv4Address for the advertising router field. |
|
292 |
*/ |
|
1278 | 293 |
GlobalRoutingLSA(SPFStatus status, Ipv4Address linkStateId, |
1111 | 294 |
Ipv4Address advertisingRtr); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
295 |
|
1111 | 296 |
/** |
1278 | 297 |
* @brief Copy constructor for a Global Routing Link State Advertisement. |
1111 | 298 |
* |
299 |
* Takes a piece of memory and constructs a semantically identical copy of |
|
300 |
* the given LSA. |
|
301 |
* |
|
302 |
* @param lsa The existing LSA to be used as the source. |
|
303 |
*/ |
|
1278 | 304 |
GlobalRoutingLSA (GlobalRoutingLSA& lsa); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
305 |
|
1111 | 306 |
/** |
1278 | 307 |
* @brief Destroy an existing Global Routing Link State Advertisement. |
1111 | 308 |
* |
1278 | 309 |
* Any Global Routing Link Records present in the list are freed. |
1111 | 310 |
*/ |
1278 | 311 |
~GlobalRoutingLSA(); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
312 |
|
1111 | 313 |
/** |
1278 | 314 |
* @brief Assignment operator for a Global Routing Link State Advertisement. |
1111 | 315 |
* |
1278 | 316 |
* Takes an existing Global Routing Link State Advertisement and overwrites |
1111 | 317 |
* it to make a semantically identical copy of a given prototype LSA. |
318 |
* |
|
1278 | 319 |
* If there are any Global Routing Link Records present in the existing |
1111 | 320 |
* LSA, they are freed before the assignment happens. |
321 |
* |
|
322 |
* @param lsa The existing LSA to be used as the source. |
|
323 |
* @returns Reference to the overwritten LSA. |
|
324 |
*/ |
|
1278 | 325 |
GlobalRoutingLSA& operator= (const GlobalRoutingLSA& lsa); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
326 |
|
1111 | 327 |
/** |
1278 | 328 |
* @brief Copy any Global Routing Link Records in a given Global Routing Link |
1111 | 329 |
* State Advertisement to the current LSA. |
330 |
* |
|
331 |
* Existing Link Records are not deleted -- this is a concatenation of Link |
|
332 |
* Records. |
|
333 |
* |
|
334 |
* @see ClearLinkRecords () |
|
335 |
* @param lsa The LSA to copy the Link Records from. |
|
336 |
*/ |
|
1278 | 337 |
void CopyLinkRecords (const GlobalRoutingLSA& lsa); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
338 |
|
1111 | 339 |
/** |
1278 | 340 |
* @brief Add a given Global Routing Link Record to the LSA. |
1111 | 341 |
* |
1278 | 342 |
* @param lr The Global Routing Link Record to be added. |
1111 | 343 |
* @returns The number of link records in the list. |
344 |
*/ |
|
1278 | 345 |
uint32_t AddLinkRecord (GlobalRoutingLinkRecord* lr); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
346 |
|
1111 | 347 |
/** |
1278 | 348 |
* @brief Return the number of Global Routing Link Records in the LSA. |
1111 | 349 |
* |
350 |
* @returns The number of link records in the list. |
|
351 |
*/ |
|
352 |
uint32_t GetNLinkRecords (void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
353 |
|
1111 | 354 |
/** |
1278 | 355 |
* @brief Return a pointer to the specified Global Routing Link Record. |
1111 | 356 |
* |
357 |
* @param n The LSA number desired. |
|
358 |
* @returns The number of link records in the list. |
|
359 |
*/ |
|
1278 | 360 |
GlobalRoutingLinkRecord* GetLinkRecord (uint32_t n) const; |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
361 |
|
1111 | 362 |
/** |
1278 | 363 |
* @brief Release all of the Global Routing Link Records present in the Global |
364 |
* Routing Link State Advertisement and make the list of link records empty. |
|
1111 | 365 |
*/ |
366 |
void ClearLinkRecords(void); |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
367 |
|
1111 | 368 |
/** |
1278 | 369 |
* @brief Check to see if the list of Global Routing Link Records present in the |
370 |
* Global Routing Link State Advertisement is empty. |
|
1111 | 371 |
* |
372 |
* @returns True if the list is empty, false otherwise. |
|
373 |
*/ |
|
374 |
bool IsEmpty(void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
375 |
|
1111 | 376 |
/** |
1278 | 377 |
* @brief Print the contents of the Global Routing Link State Advertisement and |
378 |
* any Global Routing Link Records present in the list. Quite verbose. |
|
1111 | 379 |
*/ |
380 |
void Print (std::ostream &os) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
381 |
|
1111 | 382 |
/** |
1278 | 383 |
* @brief Return the LSType field of the LSA |
384 |
*/ |
|
385 |
LSType GetLSType (void) const; |
|
386 |
/** |
|
387 |
* @brief Set the LS type field of the LSA |
|
388 |
*/ |
|
389 |
void SetLSType (LSType typ); |
|
390 |
||
391 |
/** |
|
1111 | 392 |
* @brief Get the Link State ID as defined by the OSPF spec. We always set it |
393 |
* to the router ID of the router making the advertisement. |
|
394 |
* |
|
395 |
* @see RoutingEnvironment::AllocateRouterId () |
|
1278 | 396 |
* @see GlobalRouting::GetRouterId () |
1111 | 397 |
* @returns The Ipv4Address stored as the link state ID. |
398 |
*/ |
|
399 |
Ipv4Address GetLinkStateId (void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
400 |
|
1111 | 401 |
/** |
402 |
* @brief Set the Link State ID is defined by the OSPF spec. We always set it |
|
403 |
* to the router ID of the router making the advertisement. |
|
5227
ecb08c1fc273
Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4757
diff
changeset
|
404 |
* @param addr IPv4 address which will act as ID |
1111 | 405 |
* @see RoutingEnvironment::AllocateRouterId () |
1278 | 406 |
* @see GlobalRouting::GetRouterId () |
1111 | 407 |
*/ |
408 |
void SetLinkStateId (Ipv4Address addr); |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
409 |
|
1111 | 410 |
/** |
411 |
* @brief Get the Advertising Router as defined by the OSPF spec. We always |
|
412 |
* set it to the router ID of the router making the advertisement. |
|
413 |
* |
|
414 |
* @see RoutingEnvironment::AllocateRouterId () |
|
1278 | 415 |
* @see GlobalRouting::GetRouterId () |
6273
8d70de29d514
spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents:
5227
diff
changeset
|
416 |
* @returns The Ipv4Address stored as the advertising router. |
1111 | 417 |
*/ |
418 |
Ipv4Address GetAdvertisingRouter (void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
419 |
|
1111 | 420 |
/** |
421 |
* @brief Set the Advertising Router as defined by the OSPF spec. We always |
|
422 |
* set it to the router ID of the router making the advertisement. |
|
423 |
* |
|
5227
ecb08c1fc273
Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4757
diff
changeset
|
424 |
* @param rtr ID of the router making advertisement |
1111 | 425 |
* @see RoutingEnvironment::AllocateRouterId () |
1278 | 426 |
* @see GlobalRouting::GetRouterId () |
1111 | 427 |
*/ |
428 |
void SetAdvertisingRouter (Ipv4Address rtr); |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
429 |
|
1111 | 430 |
/** |
1278 | 431 |
* @brief For a Network LSA, set the Network Mask field that precedes |
432 |
* the list of attached routers. |
|
433 |
*/ |
|
434 |
void SetNetworkLSANetworkMask (Ipv4Mask mask); |
|
435 |
||
436 |
/** |
|
437 |
* @brief For a Network LSA, get the Network Mask field that precedes |
|
438 |
* the list of attached routers. |
|
439 |
* |
|
440 |
* @returns the NetworkLSANetworkMask |
|
441 |
*/ |
|
442 |
Ipv4Mask GetNetworkLSANetworkMask (void) const; |
|
443 |
||
444 |
/** |
|
445 |
* @brief Add an attached router to the list in the NetworkLSA |
|
446 |
* |
|
1280 | 447 |
* @param addr The Ipv4Address of the interface on the network link |
1278 | 448 |
* @returns The number of addresses in the list. |
449 |
*/ |
|
450 |
uint32_t AddAttachedRouter (Ipv4Address addr); |
|
451 |
||
452 |
/** |
|
453 |
* @brief Return the number of attached routers listed in the NetworkLSA |
|
454 |
* |
|
455 |
* @returns The number of attached routers. |
|
456 |
*/ |
|
457 |
uint32_t GetNAttachedRouters (void) const; |
|
458 |
||
459 |
/** |
|
460 |
* @brief Return an Ipv4Address corresponding to the specified attached router |
|
461 |
* |
|
462 |
* @param n The attached router number desired (number in the list). |
|
463 |
* @returns The Ipv4Address of the requested router |
|
464 |
*/ |
|
465 |
Ipv4Address GetAttachedRouter (uint32_t n) const; |
|
466 |
||
467 |
/** |
|
1111 | 468 |
* @brief Get the SPF status of the advertisement. |
469 |
* |
|
470 |
* @see SPFStatus |
|
471 |
* @returns The SPFStatus of the LSA. |
|
472 |
*/ |
|
473 |
SPFStatus GetStatus (void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
474 |
|
1111 | 475 |
/** |
476 |
* @brief Set the SPF status of the advertisement |
|
5227
ecb08c1fc273
Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4757
diff
changeset
|
477 |
* @param status SPF status to set |
1111 | 478 |
* @see SPFStatus |
479 |
*/ |
|
480 |
void SetStatus (SPFStatus status); |
|
481 |
||
4628
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
482 |
/** |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
483 |
* @brief Get the Node pointer of the node that originated this LSA |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
484 |
* @returns Node pointer |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
485 |
*/ |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
486 |
Ptr<Node> GetNode (void) const; |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
487 |
|
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
488 |
/** |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
489 |
* @brief Set the Node pointer of the node that originated this LSA |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
490 |
* @param node Node pointer |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
491 |
*/ |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
492 |
void SetNode (Ptr<Node> node); |
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
493 |
|
1111 | 494 |
private: |
495 |
/** |
|
1278 | 496 |
* The type of the LSA. Each LSA type has a separate advertisement |
497 |
* format. |
|
498 |
*/ |
|
499 |
LSType m_lsType; |
|
500 |
/** |
|
1111 | 501 |
* The Link State ID is defined by the OSPF spec. We always set it to the |
502 |
* router ID of the router making the advertisement. |
|
503 |
* |
|
504 |
* @see RoutingEnvironment::AllocateRouterId () |
|
1278 | 505 |
* @see GlobalRouting::GetRouterId () |
1111 | 506 |
*/ |
507 |
Ipv4Address m_linkStateId; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
508 |
|
1111 | 509 |
/** |
510 |
* The Advertising Router is defined by the OSPF spec. We always set it to |
|
511 |
* the router ID of the router making the advertisement. |
|
512 |
* |
|
513 |
* @see RoutingEnvironment::AllocateRouterId () |
|
1278 | 514 |
* @see GlobalRouting::GetRouterId () |
1111 | 515 |
*/ |
516 |
Ipv4Address m_advertisingRtr; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
517 |
|
1111 | 518 |
/** |
519 |
* A convenience typedef to avoid too much writers cramp. |
|
520 |
*/ |
|
1278 | 521 |
typedef std::list<GlobalRoutingLinkRecord*> ListOfLinkRecords_t; |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
522 |
|
1111 | 523 |
/** |
524 |
* Each Link State Advertisement contains a number of Link Records that |
|
525 |
* describe the kinds of links that are attached to a given node. We |
|
526 |
* consider PointToPoint and StubNetwork links. |
|
527 |
* |
|
528 |
* m_linkRecords is an STL list container to hold the Link Records that have |
|
529 |
* been discovered and prepared for the advertisement. |
|
530 |
* |
|
1278 | 531 |
* @see GlobalRouting::DiscoverLSAs () |
1111 | 532 |
*/ |
533 |
ListOfLinkRecords_t m_linkRecords; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
534 |
|
1111 | 535 |
/** |
1278 | 536 |
* Each Network LSA contains the network mask of the attached network |
537 |
*/ |
|
538 |
Ipv4Mask m_networkLSANetworkMask; |
|
539 |
||
540 |
/** |
|
541 |
* A convenience typedef to avoid too much writers cramp. |
|
542 |
*/ |
|
543 |
typedef std::list<Ipv4Address> ListOfAttachedRouters_t; |
|
544 |
||
545 |
/** |
|
546 |
* Each Network LSA contains a list of attached routers |
|
547 |
* |
|
548 |
* m_attachedRouters is an STL list container to hold the addresses that have |
|
549 |
* been discovered and prepared for the advertisement. |
|
550 |
* |
|
551 |
* @see GlobalRouting::DiscoverLSAs () |
|
552 |
*/ |
|
553 |
ListOfAttachedRouters_t m_attachedRouters; |
|
554 |
||
555 |
/** |
|
1111 | 556 |
* This is a tristate flag used internally in the SPF computation to mark |
557 |
* if an SPFVertex (a data structure representing a vertex in the SPF tree |
|
558 |
* -- a router) is new, is a candidate for a shortest path, or is in its |
|
559 |
* proper position in the tree. |
|
560 |
*/ |
|
561 |
SPFStatus m_status; |
|
4628
a5a8c44e4240
bug 521. Ipv4 global routing inefficient. Updated Tom's patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
4616
diff
changeset
|
562 |
uint32_t m_node_id; |
1111 | 563 |
}; |
564 |
||
1278 | 565 |
std::ostream& operator<< (std::ostream& os, GlobalRoutingLSA& lsa); |
1111 | 566 |
|
567 |
/** |
|
568 |
* @brief An interface aggregated to a node to provide global routing info |
|
569 |
* |
|
570 |
* An interface aggregated to a node that provides global routing information |
|
571 |
* to a global route manager. The presence of the interface indicates that |
|
572 |
* the node is a router. The interface is the mechanism by which the router |
|
573 |
* advertises its connections to neighboring routers. We're basically |
|
574 |
* allowing the route manager to query for link state advertisements. |
|
575 |
*/ |
|
576 |
class GlobalRouter : public Object |
|
577 |
{ |
|
578 |
public: |
|
579 |
/** |
|
580 |
* @brief The Interface ID of the Global Router interface. |
|
581 |
* |
|
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
582 |
* @see Object::GetObject () |
1111 | 583 |
*/ |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
584 |
static TypeId GetTypeId (void); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
585 |
|
1111 | 586 |
/** |
1881
24285ca5e94f
fix bug 113 on m_node parameter for GlobalRouter
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
587 |
* @brief Create a Global Router class |
1111 | 588 |
*/ |
1881
24285ca5e94f
fix bug 113 on m_node parameter for GlobalRouter
Tom Henderson <tomh@tomh.org>
parents:
1776
diff
changeset
|
589 |
GlobalRouter (); |
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
590 |
|
4616
a84f60b6cd12
bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4372
diff
changeset
|
591 |
|
a84f60b6cd12
bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4372
diff
changeset
|
592 |
void SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing); |
a84f60b6cd12
bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4372
diff
changeset
|
593 |
Ptr<Ipv4GlobalRouting> GetRoutingProtocol (void); |
a84f60b6cd12
bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4372
diff
changeset
|
594 |
|
1111 | 595 |
/** |
596 |
* @brief Get the Router ID associated with this Global Router. |
|
597 |
* |
|
598 |
* The Router IDs are allocated in the RoutingEnvironment -- one per Router, |
|
599 |
* starting at 0.0.0.1 and incrementing with each instantiation of a router. |
|
600 |
* |
|
601 |
* @see RoutingEnvironment::AllocateRouterId () |
|
602 |
* @returns The Router ID associated with the Global Router. |
|
603 |
*/ |
|
604 |
Ipv4Address GetRouterId (void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
605 |
|
1111 | 606 |
/** |
607 |
* @brief Walk the connected channels, discover the adjacent routers and build |
|
1278 | 608 |
* the associated number of Global Routing Link State Advertisements that |
1111 | 609 |
* this router can export. |
610 |
* |
|
611 |
* This is a fairly expensive operation in that every time it is called |
|
612 |
* the current list of LSAs is built by walking connected point-to-point |
|
613 |
* channels and peeking into adjacent IPV4 stacks to get address information. |
|
6273
8d70de29d514
spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents:
5227
diff
changeset
|
614 |
* This is done to allow for limited dynamics of the Global Routing |
1111 | 615 |
* environment. By that we mean that you can discover new link state |
616 |
* advertisements after a network topology change by calling DiscoverLSAs |
|
617 |
* and then by reading those advertisements. |
|
618 |
* |
|
1278 | 619 |
* @see GlobalRoutingLSA |
1111 | 620 |
* @see GlobalRouter::GetLSA () |
1278 | 621 |
* @returns The number of Global Routing Link State Advertisements. |
1111 | 622 |
*/ |
623 |
uint32_t DiscoverLSAs (void); |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
624 |
|
1111 | 625 |
/** |
1278 | 626 |
* @brief Get the Number of Global Routing Link State Advertisements that this |
1111 | 627 |
* router can export. |
628 |
* |
|
629 |
* To get meaningful information you must have previously called DiscoverLSAs. |
|
630 |
* After you know how many LSAs are present in the router, you may call |
|
631 |
* GetLSA () to retrieve the actual advertisement. |
|
632 |
* |
|
633 |
* @see GlobalRouterLSA |
|
1278 | 634 |
* @see GlobalRouting::DiscoverLSAs () |
635 |
* @see GlobalRouting::GetLSA () |
|
636 |
* @returns The number of Global Routing Link State Advertisements. |
|
1111 | 637 |
*/ |
638 |
uint32_t GetNumLSAs (void) const; |
|
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
639 |
|
1111 | 640 |
/** |
1278 | 641 |
* @brief Get a Global Routing Link State Advertisements that this router has |
1111 | 642 |
* said that it can export. |
643 |
* |
|
644 |
* This is a fairly inexpensive expensive operation in that the hard work |
|
1278 | 645 |
* was done in GetNumLSAs. We just copy the indicated Global Routing Link |
646 |
* State Advertisement into the requested GlobalRoutingLSA object. |
|
1111 | 647 |
* |
648 |
* You must call GlobalRouter::GetNumLSAs before calling this method in |
|
649 |
* order to discover the adjacent routers and build the advertisements. |
|
650 |
* GetNumLSAs will return the number of LSAs this router advertises. |
|
651 |
* The parameter n (requested LSA number) must be in the range 0 to |
|
652 |
* GetNumLSAs() - 1. |
|
653 |
* |
|
1278 | 654 |
* @see GlobalRoutingLSA |
655 |
* @see GlobalRouting::GetNumLSAs () |
|
1111 | 656 |
* @param n The index number of the LSA you want to read. |
1278 | 657 |
* @param lsa The GlobalRoutingLSA class to receive the LSA information. |
1111 | 658 |
* @returns The number of Global Router Link State Advertisements. |
659 |
*/ |
|
1278 | 660 |
bool GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const; |
1111 | 661 |
|
4745
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
662 |
/** |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
663 |
* @brief Inject a route to be circulated to other routers as an external |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
664 |
* route |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
665 |
* |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
666 |
* @param network The Network to inject |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
667 |
* @param networkMask The Network Mask to inject |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
668 |
*/ |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
669 |
void InjectRoute (Ipv4Address network, Ipv4Mask networkMask); |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
670 |
|
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
671 |
/** |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
672 |
* @brief Get the number of injected routes that have been added |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
673 |
* to the routing table. |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
674 |
* @return number of injected routes |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
675 |
*/ |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
676 |
uint32_t GetNInjectedRoutes (void); |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
677 |
|
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
678 |
/** |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
679 |
* @brief Return the injected route indexed by i |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
680 |
* @param i the index of the route |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
681 |
* @return a pointer to that Ipv4RoutingTableEntry is returned |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
682 |
* |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
683 |
*/ |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
684 |
Ipv4RoutingTableEntry *GetInjectedRoute (uint32_t i); |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
685 |
|
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
686 |
/** |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
687 |
* @brief Withdraw a route from the global unicast routing table. |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
688 |
* |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
689 |
* Calling this function will cause all indexed routes numbered above |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
690 |
* index i to have their index decremented. For instance, it is possible to |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
691 |
* remove N injected routes by calling RemoveInjectedRoute (0) N times. |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
692 |
* |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
693 |
* @param i The index (into the injected routing list) of the route to remove. |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
694 |
* |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
695 |
* @see GlobalRouter::WithdrawRoute () |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
696 |
*/ |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
697 |
void RemoveInjectedRoute (uint32_t i); |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
698 |
|
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
699 |
/** |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
700 |
* @brief Withdraw a route from the global unicast routing table. |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
701 |
* |
4757 | 702 |
* @param network The Network to withdraw |
703 |
* @param networkMask The Network Mask to withdraw |
|
4745
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
704 |
* @return whether the operation succeeded (will return false if no such route) |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
705 |
* |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
706 |
* @see GlobalRouter::RemoveInjectedRoute () |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
707 |
*/ |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
708 |
bool WithdrawRoute (Ipv4Address network, Ipv4Mask networkMask); |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
709 |
|
1210
599a311daef6
fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
Craig Dowell <craigdo@ee.washington.edu>
parents:
1202
diff
changeset
|
710 |
private: |
1111 | 711 |
virtual ~GlobalRouter (); |
712 |
void ClearLSAs (void); |
|
713 |
||
714 |
Ptr<NetDevice> GetAdjacent(Ptr<NetDevice> nd, Ptr<Channel> ch) const; |
|
4372
d99061f1167c
Ipv4::ifIndex -> Ipv4::interface
Tom Henderson <tomh@tomh.org>
parents:
3942
diff
changeset
|
715 |
bool FindInterfaceForDevice(Ptr<Node> node, Ptr<NetDevice> nd, uint32_t &index) const; |
3942
eef10dbce686
fix bug 114 and bug 66
Craig Dowell <craigdo@ee.washington.edu>
parents:
3941
diff
changeset
|
716 |
Ipv4Address FindDesignatedRouterForLink (Ptr<NetDevice> ndLocal, bool allowRecursion) const; |
3941
476c3bed16c0
teach global routing about bridges
Craig Dowell <craigdo@ee.washington.edu>
parents:
3940
diff
changeset
|
717 |
bool AnotherRouterOnLink (Ptr<NetDevice> nd, bool allowRecursion) const; |
3939
206f627bd5af
factor DiscoverLSAs into understandable modules
Craig Dowell <craigdo@ee.washington.edu>
parents:
3938
diff
changeset
|
718 |
void ProcessBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c); |
3940
49b432aefbd0
deal with bridged stub/transit networks on routers
Craig Dowell <craigdo@ee.washington.edu>
parents:
3939
diff
changeset
|
719 |
void ProcessSingleBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c); |
49b432aefbd0
deal with bridged stub/transit networks on routers
Craig Dowell <craigdo@ee.washington.edu>
parents:
3939
diff
changeset
|
720 |
void ProcessBridgedBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c); |
49b432aefbd0
deal with bridged stub/transit networks on routers
Craig Dowell <craigdo@ee.washington.edu>
parents:
3939
diff
changeset
|
721 |
|
3939
206f627bd5af
factor DiscoverLSAs into understandable modules
Craig Dowell <craigdo@ee.washington.edu>
parents:
3938
diff
changeset
|
722 |
void ProcessPointToPointLink (Ptr<NetDevice> ndLocal, GlobalRoutingLSA *pLSA); |
206f627bd5af
factor DiscoverLSAs into understandable modules
Craig Dowell <craigdo@ee.washington.edu>
parents:
3938
diff
changeset
|
723 |
void BuildNetworkLSAs (NetDeviceContainer c); |
3941
476c3bed16c0
teach global routing about bridges
Craig Dowell <craigdo@ee.washington.edu>
parents:
3940
diff
changeset
|
724 |
Ptr<BridgeNetDevice> NetDeviceIsBridged (Ptr<NetDevice> nd) const; |
3939
206f627bd5af
factor DiscoverLSAs into understandable modules
Craig Dowell <craigdo@ee.washington.edu>
parents:
3938
diff
changeset
|
725 |
|
1111 | 726 |
|
1278 | 727 |
typedef std::list<GlobalRoutingLSA*> ListOfLSAs_t; |
1111 | 728 |
ListOfLSAs_t m_LSAs; |
729 |
||
730 |
Ipv4Address m_routerId; |
|
4616
a84f60b6cd12
bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4372
diff
changeset
|
731 |
Ptr<Ipv4GlobalRouting> m_routingProtocol; |
1111 | 732 |
|
4745
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
733 |
typedef std::list<Ipv4RoutingTableEntry *> InjectedRoutes; |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
734 |
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator InjectedRoutesCI; |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
735 |
typedef std::list<Ipv4RoutingTableEntry *>::iterator InjectedRoutesI; |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
736 |
InjectedRoutes m_injectedRoutes; // Routes we are exporting |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4628
diff
changeset
|
737 |
|
1202
953cc2fadcef
fix memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1121
diff
changeset
|
738 |
// inherited from Object |
953cc2fadcef
fix memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1121
diff
changeset
|
739 |
virtual void DoDispose (void); |
1210
599a311daef6
fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
Craig Dowell <craigdo@ee.washington.edu>
parents:
1202
diff
changeset
|
740 |
|
1111 | 741 |
/** |
742 |
* @brief Global Router copy construction is disallowed. |
|
743 |
*/ |
|
744 |
GlobalRouter (GlobalRouter& sr); |
|
1210
599a311daef6
fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
Craig Dowell <craigdo@ee.washington.edu>
parents:
1202
diff
changeset
|
745 |
|
1111 | 746 |
/** |
747 |
* @brief Global Router assignment operator is disallowed. |
|
748 |
*/ |
|
749 |
GlobalRouter& operator= (GlobalRouter& sr); |
|
750 |
}; |
|
751 |
||
752 |
} // namespace ns3 |
|
753 |
||
1115
453f36d7bead
small readability change
Craig Dowell <craigdo@ee.washington.edu>
parents:
1113
diff
changeset
|
754 |
#endif /* GLOBAL_ROUTER_INTERFACE_H */ |