blob: cc724fedb70f44a4132ea6af7248a8a085ee59ba [file] [log] [blame]
akmhoqueba094742014-02-28 11:47:21 -06001#include <list>
2#include "nlsr_fe.hpp"
3#include "nlsr_nexthop.hpp"
akmhoque05d5fcf2014-04-15 14:58:45 -05004#include "utility/nlsr_logger.hpp"
5
6#define THIS_FILE "nlsr_fe.cpp"
akmhoqueba094742014-02-28 11:47:21 -06007
8namespace nlsr
9{
10
akmhoque5a44dd42014-03-12 18:11:32 -050011 using namespace std;
akmhoqueba094742014-02-28 11:47:21 -060012
akmhoque5a44dd42014-03-12 18:11:32 -050013 bool
akmhoque05d5fcf2014-04-15 14:58:45 -050014 FibEntry::isEqualNextHops(Nhl& nhlOther)
akmhoque5a44dd42014-03-12 18:11:32 -050015 {
akmhoque05d5fcf2014-04-15 14:58:45 -050016 if ( m_nhl.getSize() != nhlOther.getSize() )
akmhoqueba094742014-02-28 11:47:21 -060017 {
akmhoque5a44dd42014-03-12 18:11:32 -050018 return false;
19 }
20 else
21 {
22 int nhCount=0;
23 std::list<NextHop>::iterator it1, it2;
akmhoque05d5fcf2014-04-15 14:58:45 -050024 for ( it1=m_nhl.getNextHopList().begin(),
akmhoque5a44dd42014-03-12 18:11:32 -050025 it2 = nhlOther.getNextHopList().begin() ;
akmhoque05d5fcf2014-04-15 14:58:45 -050026 it1 != m_nhl.getNextHopList().end() ; it1++, it2++)
akmhoque5a44dd42014-03-12 18:11:32 -050027 {
28 if (it1->getConnectingFace() == it2->getConnectingFace() )
akmhoqueba094742014-02-28 11:47:21 -060029 {
akmhoque5a44dd42014-03-12 18:11:32 -050030 it1->setRouteCost(it2->getRouteCost());
31 nhCount++;
akmhoqueba094742014-02-28 11:47:21 -060032 }
33 else
34 {
akmhoque5a44dd42014-03-12 18:11:32 -050035 break;
akmhoqueba094742014-02-28 11:47:21 -060036 }
akmhoque5a44dd42014-03-12 18:11:32 -050037 }
akmhoque05d5fcf2014-04-15 14:58:45 -050038 return nhCount == m_nhl.getSize();
akmhoqueba094742014-02-28 11:47:21 -060039 }
akmhoque5a44dd42014-03-12 18:11:32 -050040 }
akmhoqueba094742014-02-28 11:47:21 -060041
akmhoque5a44dd42014-03-12 18:11:32 -050042 ostream&
43 operator<<(ostream& os, FibEntry fe)
44 {
45 os<<"Name Prefix: "<<fe.getName()<<endl;
46 os<<"Time to Refresh: "<<fe.getTimeToRefresh()<<endl;
47 os<<fe.getNhl()<<endl;
48 return os;
49 }
akmhoqueba094742014-02-28 11:47:21 -060050
51}//namespace nlsr