blob: 05bee41067924dca3f4b5228f89dcc6fb92caec6 [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#include <list>
2#include "fib-entry.hpp"
3#include "nexthop.hpp"
4
5namespace nlsr {
6
7using namespace std;
8
9bool
akmhoquec8a10f72014-04-25 18:42:55 -050010FibEntry::isEqualNextHops(NexthopList& nhlOther)
akmhoque53353462014-04-22 08:43:45 -050011{
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
38ostream&
39operator<<(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