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