blob: 1b9621f434ab0aa9ff56ae651cdc480154215e5f [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#include <list>
2#include "nlsr_fe.hpp"
3#include "nlsr_nexthop.hpp"
4
5using namespace std;
6
7bool
8FibEntry::isEqualNextHops(Nhl &nhlOther)
9{
10 if ( nhl.getNhlSize() != nhlOther.getNhlSize() )
11 {
12 return false;
13 }
14 else
15 {
16 int nhCount=0;
17 std::list<NextHop>::iterator it1, it2;
18
19 for ( it1=nhl.getNextHopList().begin(),
20 it2 = nhlOther.getNextHopList().begin() ;
21 it1 != nhl.getNextHopList().end() ; it1++, it2++)
22 {
23 if ((*it1).getConnectingFace() == (*it2).getConnectingFace() )
24 {
25 (*it1).setRouteCost((*it2).getRouteCost());
26 nhCount++;
27 }
28 else
29 {
30 break;
31 }
32 }
33
34 return nhCount == nhl.getNhlSize();
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}