blob: bbffd9625c1344128b3cc15d871bc3acbb8df136 [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#include <list>
2#include "nlsr_fe.hpp"
3#include "nlsr_nexthop.hpp"
4
akmhoqueb1710aa2014-02-19 17:13:36 -06005namespace nlsr {
6
akmhoque298385a2014-02-13 14:13:09 -06007using namespace std;
8
9bool
10FibEntry::isEqualNextHops(Nhl &nhlOther)
11{
12 if ( nhl.getNhlSize() != nhlOther.getNhlSize() )
13 {
14 return false;
15 }
16 else
17 {
18 int nhCount=0;
19 std::list<NextHop>::iterator it1, it2;
20
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
36 return nhCount == nhl.getNhlSize();
37 }
38}
39
40ostream&
41operator<<(ostream& os, FibEntry& fe)
42{
43 os<<"Name Prefix: "<<fe.getName()<<endl;
44 os<<"Time to Refresh: "<<fe.getTimeToRefresh()<<endl;
45 os<<fe.getNhl()<<endl;
46 return os;
47}
akmhoqueb1710aa2014-02-19 17:13:36 -060048
49}//namespace nlsr