blob: ba3d77a84546972ed6df6bc1087b11f1076bfd8c [file] [log] [blame]
#include <list>
#include "fib-entry.hpp"
#include "nexthop.hpp"
namespace nlsr {
using namespace std;
bool
FibEntry::isEqualNextHops(NexthopList& nhlOther)
{
if (m_nexthopList.getSize() != nhlOther.getSize()) {
return false;
}
else {
uint32_t nhCount = 0;
std::list<NextHop>::iterator it1, it2;
for (it1 = m_nexthopList.getNextHops().begin(),
it2 = nhlOther.getNextHops().begin() ;
it1 != m_nexthopList.getNextHops().end() ; it1++, it2++) {
if (it1->getConnectingFaceUri() == it2->getConnectingFaceUri()) {
it1->setRouteCost(it2->getRouteCost());
nhCount++;
}
else {
break;
}
}
return nhCount == m_nexthopList.getSize();
}
}
ostream&
operator<<(ostream& os, FibEntry fe)
{
os << "Name Prefix: " << fe.getName() << endl;
os << "Time to Refresh: " << fe.getTimeToRefresh() << endl;
os << fe.getNexthopList() << endl;
return os;
}
}//namespace nlsr