#include <list>
#include "fib-entry.hpp"
#include "nexthop.hpp"

namespace nlsr {

using namespace std;

bool
FibEntry::isEqualNextHops(NexthopList& nhlOther)
{
  if (m_nhl.getSize() != nhlOther.getSize())
  {
    return false;
  }
  else
  {
    int nhCount = 0;
    std::list<NextHop>::iterator it1, it2;
    for (it1 = m_nhl.getNextHopList().begin(),
         it2 = nhlOther.getNextHopList().begin() ;
         it1 != m_nhl.getNextHopList().end() ; it1++, it2++)
    {
      if (it1->getConnectingFace() == it2->getConnectingFace())
      {
        it1->setRouteCost(it2->getRouteCost());
        nhCount++;
      }
      else
      {
        break;
      }
    }
    return nhCount == m_nhl.getSize();
  }
}

ostream&
operator<<(ostream& os, FibEntry fe)
{
  os << "Name Prefix: " << fe.getName() << endl;
  os << "Time to Refresh: " << fe.getTimeToRefresh() << endl;
  os << fe.getNhl() << endl;
  return os;
}

}//namespace nlsr
