akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 1 | #include <list> |
2 | #include "nlsr_fe.hpp" | ||||
3 | #include "nlsr_nexthop.hpp" | ||||
4 | |||||
5 | namespace nlsr | ||||
6 | { | ||||
7 | |||||
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 8 | using namespace std; |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 9 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 10 | bool |
11 | FibEntry::isEqualNextHops(Nhl &nhlOther) | ||||
12 | { | ||||
13 | if ( nhl.getNhlSize() != nhlOther.getNhlSize() ) | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 14 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 15 | return false; |
16 | } | ||||
17 | else | ||||
18 | { | ||||
19 | int nhCount=0; | ||||
20 | std::list<NextHop>::iterator it1, it2; | ||||
21 | for ( it1=nhl.getNextHopList().begin(), | ||||
22 | it2 = nhlOther.getNextHopList().begin() ; | ||||
23 | it1 != nhl.getNextHopList().end() ; it1++, it2++) | ||||
24 | { | ||||
25 | if (it1->getConnectingFace() == it2->getConnectingFace() ) | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 26 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 27 | it1->setRouteCost(it2->getRouteCost()); |
28 | nhCount++; | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 29 | } |
30 | else | ||||
31 | { | ||||
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 32 | break; |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 33 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 34 | } |
35 | return nhCount == nhl.getNhlSize(); | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 36 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 37 | } |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 38 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 39 | ostream& |
40 | operator<<(ostream& os, FibEntry fe) | ||||
41 | { | ||||
42 | os<<"Name Prefix: "<<fe.getName()<<endl; | ||||
43 | os<<"Time to Refresh: "<<fe.getTimeToRefresh()<<endl; | ||||
44 | os<<fe.getNhl()<<endl; | ||||
45 | return os; | ||||
46 | } | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 47 | |
48 | }//namespace nlsr |