blob: 5f4811ccacfeeb1acabc93965a713d9c53f36666 [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;
akmhoque1fd8c1e2014-02-19 19:41:49 -060021 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 }
akmhoque1fd8c1e2014-02-19 19:41:49 -060035 return nhCount == nhl.getNhlSize();
36 }
37 }
38
39 ostream&
40 operator<<(ostream& os, FibEntry& fe)
41 {
42 os<<"Name Prefix: "<<fe.getName()<<endl;
43 os<<"Time to Refresh: "<<fe.getTimeToRefresh()<<endl;
44 os<<fe.getNhl()<<endl;
45 return os;
46 }
akmhoqueb1710aa2014-02-19 17:13:36 -060047
48}//namespace nlsr