author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Fri, 26 Sep 2014 15:51:00 -0700 | |
changeset 10968 | 2d29fee2b7b8 |
parent 10440 | 1e48ff9185f1 |
permissions | -rw-r--r-- |
1111 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
1457
562a7017ed93
Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents:
1121
diff
changeset
|
3 |
* Copyright 2007 University of Washington |
562a7017ed93
Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents:
1121
diff
changeset
|
4 |
* |
1111 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License version 2 as |
|
7 |
* published by the Free Software Foundation; |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
*/ |
|
18 |
||
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
19 |
#include <algorithm> |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
20 |
#include <iostream> |
1505 | 21 |
#include "ns3/log.h" |
1111 | 22 |
#include "ns3/assert.h" |
23 |
#include "candidate-queue.h" |
|
2196
fb01b99ce66d
Don't include the 'global-route-manager-impl.h' private header from the public header 'candidate-queue.h'.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1828
diff
changeset
|
24 |
#include "global-route-manager-impl.h" |
1111 | 25 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10440
diff
changeset
|
26 |
namespace ns3 { |
1111 | 27 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10440
diff
changeset
|
28 |
NS_LOG_COMPONENT_DEFINE ("CandidateQueue"); |
1111 | 29 |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9704
diff
changeset
|
30 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9704
diff
changeset
|
31 |
* \brief Stream insertion operator. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9704
diff
changeset
|
32 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9704
diff
changeset
|
33 |
* \param os the reference to the output stream |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9704
diff
changeset
|
34 |
* \param t the SPFVertex type |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9704
diff
changeset
|
35 |
* \returns the reference to the output stream |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9704
diff
changeset
|
36 |
*/ |
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
37 |
std::ostream& |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
38 |
operator<< (std::ostream& os, const SPFVertex::VertexType& t) |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
39 |
{ |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
40 |
switch (t) |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
41 |
{ |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
42 |
case SPFVertex::VertexRouter: os << "router"; break; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
43 |
case SPFVertex::VertexNetwork: os << "network"; break; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
44 |
default: os << "unknown"; break; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
45 |
}; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
46 |
return os; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
47 |
} |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
48 |
|
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
49 |
std::ostream& |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
50 |
operator<< (std::ostream& os, const CandidateQueue& q) |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
51 |
{ |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
52 |
typedef CandidateQueue::CandidateList_t List_t; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
53 |
typedef List_t::const_iterator CIter_t; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
54 |
const CandidateQueue::CandidateList_t& list = q.m_candidates; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
55 |
|
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
56 |
os << "*** CandidateQueue Begin (<id, distance, LSA-type>) ***" << std::endl; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
57 |
for (CIter_t iter = list.begin (); iter != list.end (); iter++) |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
58 |
{ |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
59 |
os << "<" |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
60 |
<< (*iter)->GetVertexId () << ", " |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
61 |
<< (*iter)->GetDistanceFromRoot () << ", " |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
62 |
<< (*iter)->GetVertexType () << ">" << std::endl; |
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
63 |
} |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
64 |
os << "*** CandidateQueue End ***"; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
65 |
return os; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
66 |
} |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
67 |
|
1111 | 68 |
CandidateQueue::CandidateQueue() |
69 |
: m_candidates () |
|
70 |
{ |
|
9704
1db7690f8e8f
Partially clean up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents:
7256
diff
changeset
|
71 |
NS_LOG_FUNCTION (this); |
1111 | 72 |
} |
73 |
||
74 |
CandidateQueue::~CandidateQueue() |
|
75 |
{ |
|
9704
1db7690f8e8f
Partially clean up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents:
7256
diff
changeset
|
76 |
NS_LOG_FUNCTION (this); |
1111 | 77 |
Clear (); |
78 |
} |
|
79 |
||
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
80 |
void |
1111 | 81 |
CandidateQueue::Clear (void) |
82 |
{ |
|
9704
1db7690f8e8f
Partially clean up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents:
7256
diff
changeset
|
83 |
NS_LOG_FUNCTION (this); |
1111 | 84 |
while (!m_candidates.empty ()) |
85 |
{ |
|
86 |
SPFVertex *p = Pop (); |
|
87 |
delete p; |
|
88 |
p = 0; |
|
89 |
} |
|
90 |
} |
|
91 |
||
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
92 |
void |
1111 | 93 |
CandidateQueue::Push (SPFVertex *vNew) |
94 |
{ |
|
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2196
diff
changeset
|
95 |
NS_LOG_FUNCTION (this << vNew); |
1111 | 96 |
|
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
97 |
CandidateList_t::iterator i = std::upper_bound ( |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
98 |
m_candidates.begin (), m_candidates.end (), vNew, |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
99 |
&CandidateQueue::CompareSPFVertex |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
100 |
); |
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
101 |
m_candidates.insert (i, vNew); |
1111 | 102 |
} |
103 |
||
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
104 |
SPFVertex * |
1111 | 105 |
CandidateQueue::Pop (void) |
106 |
{ |
|
9704
1db7690f8e8f
Partially clean up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents:
7256
diff
changeset
|
107 |
NS_LOG_FUNCTION (this); |
1111 | 108 |
if (m_candidates.empty ()) |
109 |
{ |
|
110 |
return 0; |
|
111 |
} |
|
112 |
||
113 |
SPFVertex *v = m_candidates.front (); |
|
114 |
m_candidates.pop_front (); |
|
115 |
return v; |
|
116 |
} |
|
117 |
||
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
118 |
SPFVertex * |
1111 | 119 |
CandidateQueue::Top (void) const |
120 |
{ |
|
9704
1db7690f8e8f
Partially clean up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents:
7256
diff
changeset
|
121 |
NS_LOG_FUNCTION (this); |
1111 | 122 |
if (m_candidates.empty ()) |
123 |
{ |
|
124 |
return 0; |
|
125 |
} |
|
126 |
||
127 |
return m_candidates.front (); |
|
128 |
} |
|
129 |
||
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
130 |
bool |
1111 | 131 |
CandidateQueue::Empty (void) const |
132 |
{ |
|
9704
1db7690f8e8f
Partially clean up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents:
7256
diff
changeset
|
133 |
NS_LOG_FUNCTION (this); |
1111 | 134 |
return m_candidates.empty (); |
135 |
} |
|
136 |
||
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
137 |
uint32_t |
1111 | 138 |
CandidateQueue::Size (void) const |
139 |
{ |
|
9704
1db7690f8e8f
Partially clean up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents:
7256
diff
changeset
|
140 |
NS_LOG_FUNCTION (this); |
1111 | 141 |
return m_candidates.size (); |
142 |
} |
|
143 |
||
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
144 |
SPFVertex * |
1111 | 145 |
CandidateQueue::Find (const Ipv4Address addr) const |
146 |
{ |
|
9704
1db7690f8e8f
Partially clean up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents:
7256
diff
changeset
|
147 |
NS_LOG_FUNCTION (this); |
1111 | 148 |
CandidateList_t::const_iterator i = m_candidates.begin (); |
149 |
||
150 |
for (; i != m_candidates.end (); i++) |
|
151 |
{ |
|
152 |
SPFVertex *v = *i; |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7252
diff
changeset
|
153 |
if (v->GetVertexId () == addr) |
1111 | 154 |
{ |
155 |
return v; |
|
156 |
} |
|
157 |
} |
|
158 |
||
159 |
return 0; |
|
160 |
} |
|
161 |
||
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
162 |
void |
1111 | 163 |
CandidateQueue::Reorder (void) |
164 |
{ |
|
9704
1db7690f8e8f
Partially clean up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents:
7256
diff
changeset
|
165 |
NS_LOG_FUNCTION (this); |
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
166 |
|
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
167 |
m_candidates.sort (&CandidateQueue::CompareSPFVertex); |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
168 |
NS_LOG_LOGIC ("After reordering the CandidateQueue"); |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
169 |
NS_LOG_LOGIC (*this); |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
170 |
} |
1111 | 171 |
|
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
172 |
/* |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
173 |
* In this implementation, SPFVertex follows the ordering where |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
174 |
* a vertex is ranked first if its GetDistanceFromRoot () is smaller; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
175 |
* In case of a tie, NetworkLSA is always ranked before RouterLSA. |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
176 |
* |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
177 |
* This ordering is necessary for implementing ECMP |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
178 |
*/ |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
179 |
bool |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
180 |
CandidateQueue::CompareSPFVertex (const SPFVertex* v1, const SPFVertex* v2) |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
181 |
{ |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
182 |
NS_LOG_FUNCTION (&v1 << &v2); |
1111 | 183 |
|
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
184 |
bool result = false; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
185 |
if (v1->GetDistanceFromRoot () < v2->GetDistanceFromRoot ()) |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
186 |
{ |
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
187 |
result = true; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
188 |
} |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
189 |
else if (v1->GetDistanceFromRoot () == v2->GetDistanceFromRoot ()) |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
190 |
{ |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
191 |
if (v1->GetVertexType () == SPFVertex::VertexNetwork |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
192 |
&& v2->GetVertexType () == SPFVertex::VertexRouter) |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
193 |
{ |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
194 |
result = true; |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
195 |
} |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
196 |
} |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
2983
diff
changeset
|
197 |
return result; |
1111 | 198 |
} |
199 |
||
200 |
} // namespace ns3 |