akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 1 | #include <list> |
2 | #include "nlsr_fe.hpp" | ||||
3 | #include "nlsr_nexthop.hpp" | ||||
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame] | 4 | #include "utility/nlsr_logger.hpp" |
5 | |||||
6 | #define THIS_FILE "nlsr_fe.cpp" | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 7 | |
8 | namespace nlsr | ||||
9 | { | ||||
10 | |||||
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 11 | using namespace std; |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 12 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 13 | bool |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame] | 14 | FibEntry::isEqualNextHops(Nhl& nhlOther) |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 15 | { |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame] | 16 | if ( m_nhl.getSize() != nhlOther.getSize() ) |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 17 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 18 | return false; |
19 | } | ||||
20 | else | ||||
21 | { | ||||
22 | int nhCount=0; | ||||
23 | std::list<NextHop>::iterator it1, it2; | ||||
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame] | 24 | for ( it1=m_nhl.getNextHopList().begin(), |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 25 | it2 = nhlOther.getNextHopList().begin() ; |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame] | 26 | it1 != m_nhl.getNextHopList().end() ; it1++, it2++) |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 27 | { |
28 | if (it1->getConnectingFace() == it2->getConnectingFace() ) | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 29 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 30 | it1->setRouteCost(it2->getRouteCost()); |
31 | nhCount++; | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 32 | } |
33 | else | ||||
34 | { | ||||
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 35 | break; |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 36 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 37 | } |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame] | 38 | return nhCount == m_nhl.getSize(); |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 39 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 40 | } |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 41 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 42 | 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 | } | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 50 | |
51 | }//namespace nlsr |