author | Craig Dowell <craigdo@ee.washington.edu> |
Mon, 13 Aug 2007 12:08:01 -0700 | |
changeset 1432 | 3aef7d7a71c2 |
parent 1430 | 25fa26a6533e |
child 1434 | 2b63aafb050b |
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 |
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
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
{ |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
35 |
|
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
|
36 |
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
|
37 |
*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
|
38 |
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
|
39 |
} |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
40 |
|
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
|
41 |
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
|
42 |
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
|
43 |
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
|
44 |
{ |
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 |
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
|
46 |
*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
|
47 |
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
|
48 |
} |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
49 |
|
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
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
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
|
54 |
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
|
55 |
{ |
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 |
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
|
57 |
*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
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
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
|
62 |
} |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
63 |
|
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
|
64 |
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
|
65 |
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
|
66 |
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
|
67 |
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
|
68 |
{ |
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 |
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
|
70 |
*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
|
71 |
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
|
72 |
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
|
73 |
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
|
74 |
} |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
75 |
|
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
|
76 |
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
|
77 |
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
|
78 |
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
|
79 |
{ |
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 |
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
|
81 |
*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
|
82 |
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
|
83 |
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
|
84 |
} |
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 |
|
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
86 |
void |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
87 |
Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
88 |
Ipv4Address group, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
89 |
uint32_t inputInterface, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
90 |
std::vector<uint32_t> outputInterfaces) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
91 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
92 |
Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
93 |
*route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
94 |
inputInterface, outputInterfaces); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
95 |
m_multicastRoutes.push_back (route); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
96 |
} |
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 |
uint32_t |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
99 |
Ipv4StaticRouting::GetNMulticastRoutes (void) const |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
100 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
101 |
return m_multicastRoutes.size (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
102 |
} |
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 |
Ipv4MulticastRoute * |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
105 |
Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
106 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
107 |
NS_ASSERT_MSG(index < m_multicastRoutes.size (), |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
108 |
"Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
109 |
|
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
110 |
uint32_t tmp = 0; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
111 |
for (MulticastRoutesCI i = m_multicastRoutes.begin (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
112 |
i != m_multicastRoutes.end (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
113 |
i++) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
114 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
115 |
if (tmp == index) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
116 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
117 |
return *i; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
118 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
119 |
tmp++; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
120 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
121 |
return 0; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
122 |
} |
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 |
void |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
125 |
Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
126 |
Ipv4Address group, |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
127 |
uint32_t inputInterface) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
128 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
129 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
130 |
i != m_multicastRoutes.end (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
131 |
i++) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
132 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
133 |
Ipv4MulticastRoute *route = *i; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
134 |
if (origin == route->GetOrigin () && |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
135 |
group == route->GetGroup () && |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
136 |
inputInterface == route->GetInputInterface ()) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
137 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
138 |
delete *i; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
139 |
m_multicastRoutes.erase (i); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
140 |
return; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
141 |
} |
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 |
void |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
146 |
Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
147 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
148 |
uint32_t tmp = 0; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
149 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
150 |
i != m_multicastRoutes.end (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
151 |
i++) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
152 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
153 |
if (tmp == index) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
154 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
155 |
delete *i; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
156 |
m_multicastRoutes.erase (i); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
157 |
return; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
158 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
159 |
tmp++; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
160 |
} |
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 |
|
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
|
163 |
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
|
164 |
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
|
165 |
{ |
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 |
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
|
167 |
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
|
168 |
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
|
169 |
{ |
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 |
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
|
171 |
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
|
172 |
{ |
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 |
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
|
174 |
} |
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 |
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
|
177 |
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
|
178 |
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
|
179 |
{ |
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 |
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
|
181 |
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
|
182 |
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
|
183 |
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
|
184 |
{ |
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 |
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
|
186 |
} |
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 |
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
|
189 |
{ |
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 |
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
|
191 |
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
|
192 |
} |
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 |
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
|
194 |
} |
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 |
|
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
196 |
Ipv4MulticastRoute * |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
197 |
Ipv4StaticRouting::LookupStatic ( |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
198 |
Ipv4Address origin, |
1432
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
199 |
Ipv4Address group, |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
200 |
uint32_t ifIndex) |
1428
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 |
{ |
1432
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
211 |
if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY || |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
212 |
ifIndex == route->GetInputInterface ()) |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
213 |
{ |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
214 |
return *i; |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
215 |
} |
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
216 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
217 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
218 |
return 0; |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
219 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
220 |
|
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
|
221 |
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
|
222 |
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
|
223 |
{ |
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 |
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
|
225 |
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
|
226 |
{ |
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 |
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 |
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
|
230 |
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
|
231 |
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
|
232 |
} |
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 |
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
|
234 |
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
|
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 |
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
|
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 > 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
|
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 |
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
|
243 |
} |
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 |
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
|
245 |
{ |
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 |
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
|
247 |
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
|
248 |
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
|
249 |
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 |
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
|
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 |
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
|
254 |
} |
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 |
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
|
256 |
} |
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 |
} |
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 |
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
|
259 |
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
|
260 |
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
|
261 |
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
|
262 |
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 |
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
|
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 |
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
|
267 |
} |
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 |
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
|
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 |
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
|
271 |
// 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
|
272 |
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
|
273 |
} |
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 |
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
|
275 |
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
|
276 |
{ |
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 |
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
|
278 |
{ |
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 |
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
|
280 |
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
|
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 > 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
|
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 |
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
|
285 |
} |
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 |
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
|
287 |
{ |
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 |
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
|
289 |
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
|
290 |
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
|
291 |
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 |
{ |
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 |
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
|
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 |
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
|
296 |
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
|
297 |
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
|
298 |
} |
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 |
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
|
300 |
} |
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 |
} |
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 |
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
|
303 |
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
|
304 |
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
|
305 |
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
|
306 |
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 |
{ |
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 |
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
|
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 |
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
|
311 |
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
|
312 |
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
|
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 |
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
|
315 |
} |
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 |
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
|
317 |
} |
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 |
|
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 |
bool |
1432
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
320 |
Ipv4StaticRouting::RequestRoute ( |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
321 |
uint32_t ifIndex, |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
322 |
Ipv4Header const &ipHeader, |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
323 |
Packet packet, |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
324 |
RouteReplyCallback routeReply) |
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
|
325 |
{ |
1429
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
326 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (" << &ipHeader << ", " << |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
327 |
&packet << ", " << &routeReply << ")"); |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
328 |
|
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
329 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): source = " << |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
330 |
ipHeader.GetSource ()); |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
331 |
|
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
332 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): destination = " << |
31cb0668defd
debug prints to make validation easier
Craig Dowell <craigdo@ee.washington.edu>
parents:
1428
diff
changeset
|
333 |
ipHeader.GetDestination ()); |
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
334 |
// |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
335 |
// 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
|
336 |
// 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
|
337 |
// |
1432
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
338 |
if (ipHeader.GetDestination ().IsMulticast ()) |
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
339 |
{ |
1432
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
340 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast destination"); |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
341 |
|
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
342 |
Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
343 |
ipHeader.GetDestination (), ifIndex); |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
344 |
|
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
345 |
if (mRoute) |
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
346 |
{ |
1430
25fa26a6533e
many debug prints
Craig Dowell <craigdo@ee.washington.edu>
parents:
1429
diff
changeset
|
347 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " |
1432
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
348 |
"Multicast route found"); |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
349 |
for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
350 |
{ |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
351 |
Packet p = packet; |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
352 |
Ipv4Route route = |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
353 |
Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
354 |
mRoute->GetOutputInterface(i)); |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
355 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
356 |
"Send via interface " << mRoute->GetOutputInterface(i)); |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
357 |
routeReply (true, route, p, ipHeader); |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
358 |
return true; |
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
359 |
} |
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
360 |
} |
1432
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
361 |
return false; // Let other routing protocols try to handle this |
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
362 |
} |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
363 |
// |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
364 |
// 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
|
365 |
// |
1432
3aef7d7a71c2
more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents:
1430
diff
changeset
|
366 |
NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast destination"); |
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
|
367 |
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
|
368 |
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
|
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 |
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
|
371 |
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
|
372 |
} |
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 |
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
|
374 |
{ |
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 |
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
|
376 |
// 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
|
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 |
} |
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 |
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
|
381 |
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
|
382 |
{ |
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
|
383 |
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
|
384 |
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
|
385 |
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
|
386 |
{ |
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
|
387 |
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
|
388 |
} |
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 |
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
|
390 |
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
|
391 |
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
|
392 |
{ |
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
|
393 |
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
|
394 |
} |
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
|
395 |
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
|
396 |
{ |
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
|
397 |
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
|
398 |
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
|
399 |
} |
1428
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
400 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
401 |
i != m_multicastRoutes.end (); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
402 |
i = m_multicastRoutes.erase (i)) |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
403 |
{ |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
404 |
delete (*i); |
a8f3d01d4a2c
untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents:
983
diff
changeset
|
405 |
} |
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
|
406 |
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
|
407 |
} |
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
|
408 |
|
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
|
409 |
}//namespace ns3 |