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