blob: f0f9d064a992347a33e56446d374c4810c4f1994 [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#include <list>
2#include "nlsr_fe.hpp"
3#include "nlsr_nexthop.hpp"
4
akmhoque1fd8c1e2014-02-19 19:41:49 -06005namespace nlsr
akmhoque298385a2014-02-13 14:13:09 -06006{
akmhoque298385a2014-02-13 14:13:09 -06007
akmhoque1fd8c1e2014-02-19 19:41:49 -06008 using namespace std;
akmhoque298385a2014-02-13 14:13:09 -06009
akmhoque1fd8c1e2014-02-19 19:41:49 -060010 bool
11 FibEntry::isEqualNextHops(Nhl &nhlOther)
12 {
13 if ( nhl.getNhlSize() != nhlOther.getNhlSize() )
14 {
15 return false;
16 }
17 else
18 {
19 int nhCount=0;
20 std::list<NextHop>::iterator it1, it2;
akmhoque298385a2014-02-13 14:13:09 -060021
akmhoque1fd8c1e2014-02-19 19:41:49 -060022 for ( it1=nhl.getNextHopList().begin(),
23 it2 = nhlOther.getNextHopList().begin() ;
24 it1 != nhl.getNextHopList().end() ; it1++, it2++)
25 {
26 if ((*it1).getConnectingFace() == (*it2).getConnectingFace() )
27 {
28 (*it1).setRouteCost((*it2).getRouteCost());
29 nhCount++;
30 }
31 else
32 {
33 break;
34 }
35 }
36
37 return nhCount == nhl.getNhlSize();
38 }
39 }
40
41 ostream&
42 operator<<(ostream& os, FibEntry& fe)
43 {
44 os<<"Name Prefix: "<<fe.getName()<<endl;
45 os<<"Time to Refresh: "<<fe.getTimeToRefresh()<<endl;
46 os<<fe.getNhl()<<endl;
47 return os;
48 }
akmhoqueb1710aa2014-02-19 17:13:36 -060049
50}//namespace nlsr