author | Craig Dowell <craigdo@ee.washington.edu> |
Sun, 12 Aug 2007 15:51:12 -0700 | |
changeset 1429 | 31cb0668defd |
parent 1428 | a8f3d01d4a2c |
child 1430 | 25fa26a6533e |
permissions | -rw-r--r-- |
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
1 |
// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
2 |
// |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
3 |
// Copyright (c) 2006 Georgia Tech Research Corporation |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
4 |
// All rights reserved. |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
5 |
// |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
6 |
// This program is free software; you can redistribute it and/or modify |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
7 |
// it under the terms of the GNU General Public License version 2 as |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
8 |
// published by the Free Software Foundation; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
9 |
// |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
10 |
// This program is distributed in the hope that it will be useful, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
11 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
12 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
13 |
// GNU General Public License for more details. |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
14 |
// |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
15 |
// You should have received a copy of the GNU General Public License |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
16 |
// along with this program; if not, write to the Free Software |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
17 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
18 |
// |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
19 |
// Author: George F. Riley<riley@ece.gatech.edu> |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
20 |
// Gustavo Carneiro <gjc@inescporto.pt> |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
21 |
|
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
22 |
#include "ns3/debug.h" |
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
23 |
#include "ipv4-static-routing.h" |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
24 |
#include "ns3/packet.h" |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
25 |
|
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
26 |
NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRouting"); |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
27 |
|
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
28 |
namespace ns3 { |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
29 |
|
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
30 |
|
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
31 |
void |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
32 |
Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
33 |
Ipv4Address nextHop, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
34 |
uint32_t interface) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
35 |
{ |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
36 |
|
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
37 |
Ipv4Route *route = new Ipv4Route (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
38 |
*route = Ipv4Route::CreateHostRouteTo (dest, nextHop, interface); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
39 |
m_hostRoutes.push_back (route); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
40 |
} |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
41 |
|
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
42 |
void |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
43 |
Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
44 |
uint32_t interface) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
45 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
46 |
Ipv4Route *route = new Ipv4Route (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
47 |
*route = Ipv4Route::CreateHostRouteTo (dest, interface); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
48 |
m_hostRoutes.push_back (route); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
49 |
} |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
50 |
|
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
51 |
void |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
52 |
Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
53 |
Ipv4Mask networkMask, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
54 |
Ipv4Address nextHop, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
55 |
uint32_t interface) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
56 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
57 |
Ipv4Route *route = new Ipv4Route (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
58 |
*route = Ipv4Route::CreateNetworkRouteTo (network, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
59 |
networkMask, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
60 |
nextHop, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
61 |
interface); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
62 |
m_networkRoutes.push_back (route); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
63 |
} |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
64 |
|
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
65 |
void |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
66 |
Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
67 |
Ipv4Mask networkMask, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
68 |
uint32_t interface) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
69 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
70 |
Ipv4Route *route = new Ipv4Route (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
71 |
*route = Ipv4Route::CreateNetworkRouteTo (network, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
72 |
networkMask, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
73 |
interface); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
74 |
m_networkRoutes.push_back (route); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
75 |
} |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
76 |
|
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
77 |
void |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
78 |
Ipv4StaticRouting::SetDefaultRoute (Ipv4Address nextHop, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
79 |
uint32_t interface) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
80 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
81 |
Ipv4Route *route = new Ipv4Route (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
82 |
*route = Ipv4Route::CreateDefaultRoute (nextHop, interface); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
83 |
delete m_defaultRoute; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
84 |
m_defaultRoute = route; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
85 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
86 |
|
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
87 |
void |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
88 |
Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
89 |
Ipv4Address group, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
90 |
uint32_t inputInterface, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
91 |
std::vector<uint32_t> outputInterfaces) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
92 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
93 |
Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
94 |
*route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
95 |
inputInterface, outputInterfaces); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
96 |
m_multicastRoutes.push_back (route); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
97 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
98 |
|
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
99 |
uint32_t |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
100 |
Ipv4StaticRouting::GetNMulticastRoutes (void) const |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
101 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
102 |
return m_multicastRoutes.size (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
103 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
104 |
|
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
105 |
Ipv4MulticastRoute * |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
106 |
Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
107 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
108 |
NS_ASSERT_MSG(index < m_multicastRoutes.size (), |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
109 |
"Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
110 |
|
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
111 |
uint32_t tmp = 0; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
112 |
for (MulticastRoutesCI i = m_multicastRoutes.begin (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
113 |
i != m_multicastRoutes.end (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
114 |
i++) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
115 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
116 |
if (tmp == index) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
117 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
118 |
return *i; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
119 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
120 |
tmp++; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
121 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
122 |
return 0; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
123 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
124 |
|
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
125 |
void |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
126 |
Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
127 |
Ipv4Address group, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
128 |
uint32_t inputInterface) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
129 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
130 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
131 |
i != m_multicastRoutes.end (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
132 |
i++) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
133 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
134 |
Ipv4MulticastRoute *route = *i; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
135 |
if (origin == route->GetOrigin () && |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
136 |
group == route->GetGroup () && |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
137 |
inputInterface == route->GetInputInterface ()) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
138 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
139 |
delete *i; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
140 |
m_multicastRoutes.erase (i); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
141 |
return; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
142 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
143 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
144 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
145 |
|
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
146 |
void |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
147 |
Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
148 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
149 |
uint32_t tmp = 0; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
150 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
151 |
i != m_multicastRoutes.end (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
152 |
i++) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
153 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
154 |
if (tmp == index) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
155 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
156 |
delete *i; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
157 |
m_multicastRoutes.erase (i); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
158 |
return; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
159 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
160 |
tmp++; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
161 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
162 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
163 |
|
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
164 |
Ipv4Route * |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
165 |
Ipv4StaticRouting::LookupStatic (Ipv4Address dest) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
166 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
167 |
for (HostRoutesCI i = m_hostRoutes.begin (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
168 |
i != m_hostRoutes.end (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
169 |
i++) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
170 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
171 |
NS_ASSERT ((*i)->IsHost ()); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
172 |
if ((*i)->GetDest ().IsEqual (dest)) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
173 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
174 |
return (*i); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
175 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
176 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
177 |
for (NetworkRoutesI j = m_networkRoutes.begin (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
178 |
j != m_networkRoutes.end (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
179 |
j++) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
180 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
181 |
NS_ASSERT ((*j)->IsNetwork ()); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
182 |
Ipv4Mask mask = (*j)->GetDestNetworkMask (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
183 |
Ipv4Address entry = (*j)->GetDestNetwork (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
184 |
if (mask.IsMatch (dest, entry)) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
185 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
186 |
return (*j); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
187 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
188 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
189 |
if (m_defaultRoute != 0) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
190 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
191 |
NS_ASSERT (m_defaultRoute->IsDefault ()); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
192 |
return m_defaultRoute; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
193 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
194 |
return 0; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
195 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
196 |
|
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
197 |
Ipv4MulticastRoute * |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
198 |
Ipv4StaticRouting::LookupStatic ( |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
199 |
Ipv4Address origin, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
200 |
Ipv4Address group) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
201 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
202 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
203 |
i != m_multicastRoutes.end (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
204 |
i++) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
205 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
206 |
Ipv4MulticastRoute *route = *i; |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
207 |
if ( (origin == route->GetOrigin () || |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
208 |
origin == Ipv4Address::GetAny ()) && |
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
209 |
group == route->GetGroup ()) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
210 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
211 |
return *i; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
212 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
213 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
214 |
return 0; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
215 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
216 |
|
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
217 |
uint32_t |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
218 |
Ipv4StaticRouting::GetNRoutes (void) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
219 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
220 |
uint32_t n = 0; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
221 |
if (m_defaultRoute != 0) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
222 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
223 |
n++; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
224 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
225 |
n += m_hostRoutes.size (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
226 |
n += m_networkRoutes.size (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
227 |
return n; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
228 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
229 |
Ipv4Route * |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
230 |
Ipv4StaticRouting::GetRoute (uint32_t index) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
231 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
232 |
if (index == 0 && m_defaultRoute != 0) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
233 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
234 |
return m_defaultRoute; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
235 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
236 |
if (index > 0 && m_defaultRoute != 0) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
237 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
238 |
index--; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
239 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
240 |
if (index < m_hostRoutes.size ()) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
241 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
242 |
uint32_t tmp = 0; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
243 |
for (HostRoutesCI i = m_hostRoutes.begin (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
244 |
i != m_hostRoutes.end (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
245 |
i++) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
246 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
247 |
if (tmp == index) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
248 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
249 |
return *i; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
250 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
251 |
tmp++; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
252 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
253 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
254 |
index -= m_hostRoutes.size (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
255 |
uint32_t tmp = 0; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
256 |
for (NetworkRoutesI j = m_networkRoutes.begin (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
257 |
j != m_networkRoutes.end (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
258 |
j++) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
259 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
260 |
if (tmp == index) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
261 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
262 |
return *j; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
263 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
264 |
tmp++; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
265 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
266 |
NS_ASSERT (false); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
267 |
// quiet compiler. |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
268 |
return 0; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
269 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
270 |
void |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
271 |
Ipv4StaticRouting::RemoveRoute (uint32_t index) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
272 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
273 |
if (index == 0 && m_defaultRoute != 0) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
274 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
275 |
delete m_defaultRoute; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
276 |
m_defaultRoute = 0; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
277 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
278 |
if (index > 0 && m_defaultRoute != 0) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
279 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
280 |
index--; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
281 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
282 |
if (index < m_hostRoutes.size ()) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
283 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
284 |
uint32_t tmp = 0; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
285 |
for (HostRoutesI i = m_hostRoutes.begin (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
286 |
i != m_hostRoutes.end (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
287 |
i++) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
288 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
289 |
if (tmp == index) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
290 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
291 |
delete *i; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
292 |
m_hostRoutes.erase (i); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
293 |
return; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
294 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
295 |
tmp++; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
296 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
297 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
298 |
index -= m_hostRoutes.size (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
299 |
uint32_t tmp = 0; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
300 |
for (NetworkRoutesI j = m_networkRoutes.begin (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
301 |
j != m_networkRoutes.end (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
302 |
j++) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
303 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
304 |
if (tmp == index) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
305 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
306 |
delete *j; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
307 |
m_networkRoutes.erase (j); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
308 |
return; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
309 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
310 |
tmp++; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
311 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
312 |
NS_ASSERT (false); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
313 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
314 |
|
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
315 |
bool |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
316 |
Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
317 |
Packet packet, |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
318 |
RouteReplyCallback routeReply) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
319 |
{ |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
320 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (" << &ipHeader << ", " << |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
321 |
&packet << ", " << &routeReply << ")"); |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
322 |
|
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
323 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): source = " << |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
324 |
ipHeader.GetSource ()); |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
325 |
|
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
326 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): destination = " << |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
327 |
ipHeader.GetDestination ()); |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
328 |
|
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
329 |
// |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
330 |
// First, see if this is a multicast packet we have a route for. If we |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
331 |
// have a route, then send the packet down each of the specified interfaces. |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
332 |
// |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
333 |
Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
334 |
ipHeader.GetDestination ()); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
335 |
if (mRoute) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
336 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
337 |
for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
338 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
339 |
Packet p = packet; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
340 |
Ipv4Route route = |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
341 |
Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
342 |
mRoute->GetOutputInterface(i)); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
343 |
routeReply (true, route, p, ipHeader); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
344 |
return true; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
345 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
346 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
347 |
// |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
348 |
// See if this is a unicast packet we have a route for. |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
349 |
// |
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
350 |
Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
351 |
if (route != 0) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
352 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
353 |
routeReply (true, *route, packet, ipHeader); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
354 |
return true; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
355 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
356 |
else |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
357 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
358 |
return false; // Let other routing protocols try to handle this |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
359 |
// route request. |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
360 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
361 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
362 |
|
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
363 |
void |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
364 |
Ipv4StaticRouting::DoDispose (void) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
365 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
366 |
for (HostRoutesI i = m_hostRoutes.begin (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
367 |
i != m_hostRoutes.end (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
368 |
i = m_hostRoutes.erase (i)) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
369 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
370 |
delete (*i); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
371 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
372 |
for (NetworkRoutesI j = m_networkRoutes.begin (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
373 |
j != m_networkRoutes.end (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
374 |
j = m_networkRoutes.erase (j)) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
375 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
376 |
delete (*j); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
377 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
378 |
if (m_defaultRoute != 0) |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
379 |
{ |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
380 |
delete m_defaultRoute; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
381 |
m_defaultRoute = 0; |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
382 |
} |
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
383 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
384 |
i != m_multicastRoutes.end (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
385 |
i = m_multicastRoutes.erase (i)) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
386 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
387 |
delete (*i); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
388 |
} |
983
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
389 |
Ipv4RoutingProtocol::DoDispose (); |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
390 |
} |
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
391 |
|
47c42bd66fb7
Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
392 |
}//namespace ns3 |