blob: 9464f633c5f76ef1815d4d5afdece09d7468efdf [file] [log] [blame]
akmhoqueba094742014-02-28 11:47:21 -06001#include <list>
2#include "nlsr_fe.hpp"
3#include "nlsr_nexthop.hpp"
4
5namespace nlsr
6{
7
akmhoque5a44dd42014-03-12 18:11:32 -05008 using namespace std;
akmhoqueba094742014-02-28 11:47:21 -06009
akmhoque5a44dd42014-03-12 18:11:32 -050010 bool
11 FibEntry::isEqualNextHops(Nhl &nhlOther)
12 {
13 if ( nhl.getNhlSize() != nhlOther.getNhlSize() )
akmhoqueba094742014-02-28 11:47:21 -060014 {
akmhoque5a44dd42014-03-12 18:11:32 -050015 return false;
16 }
17 else
18 {
19 int nhCount=0;
20 std::list<NextHop>::iterator it1, it2;
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() )
akmhoqueba094742014-02-28 11:47:21 -060026 {
akmhoque5a44dd42014-03-12 18:11:32 -050027 it1->setRouteCost(it2->getRouteCost());
28 nhCount++;
akmhoqueba094742014-02-28 11:47:21 -060029 }
30 else
31 {
akmhoque5a44dd42014-03-12 18:11:32 -050032 break;
akmhoqueba094742014-02-28 11:47:21 -060033 }
akmhoque5a44dd42014-03-12 18:11:32 -050034 }
35 return nhCount == nhl.getNhlSize();
akmhoqueba094742014-02-28 11:47:21 -060036 }
akmhoque5a44dd42014-03-12 18:11:32 -050037 }
akmhoqueba094742014-02-28 11:47:21 -060038
akmhoque5a44dd42014-03-12 18:11:32 -050039 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 }
akmhoqueba094742014-02-28 11:47:21 -060047
48}//namespace nlsr