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 | |
| 8 | using namespace std; |
| 9 | |
| 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; |
| 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 | } |
| 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 | } |
| 47 | |
| 48 | }//namespace nlsr |