akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 1 | #include <list> |
| 2 | #include "nlsr_fe.hpp" |
| 3 | #include "nlsr_nexthop.hpp" |
| 4 | |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 5 | namespace nlsr |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 6 | { |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 7 | |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 8 | using namespace std; |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 9 | |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 10 | bool |
| 11 | FibEntry::isEqualNextHops(Nhl &nhlOther) |
| 12 | { |
| 13 | if ( nhl.getNhlSize() != nhlOther.getNhlSize() ) |
| 14 | { |
| 15 | return false; |
| 16 | } |
| 17 | else |
| 18 | { |
| 19 | int nhCount=0; |
| 20 | std::list<NextHop>::iterator it1, it2; |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 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() ) |
| 26 | { |
| 27 | (*it1).setRouteCost((*it2).getRouteCost()); |
| 28 | nhCount++; |
| 29 | } |
| 30 | else |
| 31 | { |
| 32 | break; |
| 33 | } |
| 34 | } |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 35 | return nhCount == nhl.getNhlSize(); |
| 36 | } |
| 37 | } |
| 38 | |
| 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 | b1710aa | 2014-02-19 17:13:36 -0600 | [diff] [blame] | 47 | |
| 48 | }//namespace nlsr |