Fixing Coding Style
diff --git a/src/route/nlsr_fe.cpp b/src/route/nlsr_fe.cpp
index 9464f63..cc724fe 100644
--- a/src/route/nlsr_fe.cpp
+++ b/src/route/nlsr_fe.cpp
@@ -1,6 +1,9 @@
#include <list>
#include "nlsr_fe.hpp"
#include "nlsr_nexthop.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_fe.cpp"
namespace nlsr
{
@@ -8,9 +11,9 @@
using namespace std;
bool
- FibEntry::isEqualNextHops(Nhl &nhlOther)
+ FibEntry::isEqualNextHops(Nhl& nhlOther)
{
- if ( nhl.getNhlSize() != nhlOther.getNhlSize() )
+ if ( m_nhl.getSize() != nhlOther.getSize() )
{
return false;
}
@@ -18,9 +21,9 @@
{
int nhCount=0;
std::list<NextHop>::iterator it1, it2;
- for ( it1=nhl.getNextHopList().begin(),
+ for ( it1=m_nhl.getNextHopList().begin(),
it2 = nhlOther.getNextHopList().begin() ;
- it1 != nhl.getNextHopList().end() ; it1++, it2++)
+ it1 != m_nhl.getNextHopList().end() ; it1++, it2++)
{
if (it1->getConnectingFace() == it2->getConnectingFace() )
{
@@ -32,7 +35,7 @@
break;
}
}
- return nhCount == nhl.getNhlSize();
+ return nhCount == m_nhl.getSize();
}
}
diff --git a/src/route/nlsr_fe.hpp b/src/route/nlsr_fe.hpp
index edd77ab..3cac2fc 100644
--- a/src/route/nlsr_fe.hpp
+++ b/src/route/nlsr_fe.hpp
@@ -17,69 +17,69 @@
{
public:
FibEntry()
- : name()
- , timeToRefresh(0)
- , feSeqNo(0)
- , nhl()
+ : m_name()
+ , m_timeToRefresh(0)
+ , m_seqNo(0)
+ , m_nhl()
{
}
FibEntry(string n)
- : timeToRefresh(0)
- , feSeqNo(0)
- , nhl()
+ : m_timeToRefresh(0)
+ , m_seqNo(0)
+ , m_nhl()
{
- name=n;
+ m_name=n;
}
string getName()
{
- return name;
+ return m_name;
}
Nhl& getNhl()
{
- return nhl;
+ return m_nhl;
}
int getTimeToRefresh()
{
- return timeToRefresh;
+ return m_timeToRefresh;
}
void setTimeToRefresh(int ttr)
{
- timeToRefresh=ttr;
+ m_timeToRefresh=ttr;
}
- void setFeExpiringEventId(ndn::EventId feid)
+ void setExpiringEventId(ndn::EventId feid)
{
- feExpiringEventId=feid;
+ m_expiringEventId=feid;
}
- ndn::EventId getFeExpiringEventId()
+ ndn::EventId getExpiringEventId()
{
- return feExpiringEventId;
+ return m_expiringEventId;
}
- void setFeSeqNo(int fsn)
+ void setSeqNo(int fsn)
{
- feSeqNo=fsn;
+ m_seqNo=fsn;
}
- int getFeSeqNo()
+ int getSeqNo()
{
- return feSeqNo;
+ return m_seqNo;
}
- bool isEqualNextHops(Nhl &nhlOther);
+ bool isEqualNextHops(Nhl& nhlOther);
private:
- string name;
- int timeToRefresh;
- ndn::EventId feExpiringEventId;
- int feSeqNo;
- Nhl nhl;
+ string m_name;
+ int m_timeToRefresh;
+ ndn::EventId m_expiringEventId;
+ int m_seqNo;
+ Nhl m_nhl;
};
ostream& operator<<(ostream& os,FibEntry fe);
diff --git a/src/route/nlsr_fib.cpp b/src/route/nlsr_fib.cpp
index 8b03409..141bf3a 100644
--- a/src/route/nlsr_fib.cpp
+++ b/src/route/nlsr_fib.cpp
@@ -3,6 +3,9 @@
#include "nlsr_fib.hpp"
#include "nlsr_nhl.hpp"
#include "nlsr.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_fib.cpp"
namespace nlsr
{
@@ -17,58 +20,58 @@
}
void
- Fib::cancelScheduledFeExpiringEvent(Nlsr& pnlsr, EventId eid)
+ Fib::cancelScheduledExpiringEvent(Nlsr& pnlsr, EventId eid)
{
pnlsr.getScheduler().cancelEvent(eid);
}
ndn::EventId
- Fib::scheduleFibEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
+ Fib::scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
int refreshTime)
{
return pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(refreshTime),
- ndn::bind(&Fib::refreshFibEntry,this,name,feSeqNum));
+ ndn::bind(&Fib::refreshEntry,this,name,feSeqNum));
}
void
- Fib::refreshFibEntry(string name, int feSeqNum)
+ Fib::refreshEntry(string name, int feSeqNum)
{
}
void
- Fib::removeFromFib(Nlsr& pnlsr, string name)
+ Fib::remove(Nlsr& pnlsr, string name)
{
- std::list<FibEntry >::iterator it = std::find_if( fibTable.begin(),
- fibTable.end(), bind(&fibEntryNameCompare, _1, name));
- if( it != fibTable.end() )
+ std::list<FibEntry >::iterator it = std::find_if( m_table.begin(),
+ m_table.end(), bind(&fibEntryNameCompare, _1, name));
+ if( it != m_table.end() )
{
for(std::list<NextHop>::iterator nhit=(*it).getNhl().getNextHopList().begin();
nhit != (*it).getNhl().getNextHopList().begin(); nhit++)
{
//remove entry from NDN-FIB
}
- cancelScheduledFeExpiringEvent(pnlsr, (*it).getFeExpiringEventId());
- fibTable.erase(it);
+ cancelScheduledExpiringEvent(pnlsr, (*it).getExpiringEventId());
+ m_table.erase(it);
}
}
void
- Fib::updateFib(Nlsr& pnlsr,string name, Nhl& nextHopList)
+ Fib::update(Nlsr& pnlsr,string name, Nhl& nextHopList)
{
std::cout<<"Fib::updateFib Called"<<std::endl;
int startFace=0;
int endFace=getNumberOfFacesForName(nextHopList,
pnlsr.getConfParameter().getMaxFacesPerPrefix());
- std::list<FibEntry >::iterator it = std::find_if( fibTable.begin(),
- fibTable.end(),
+ std::list<FibEntry >::iterator it = std::find_if( m_table.begin(),
+ m_table.end(),
bind(&fibEntryNameCompare, _1, name));
- if( it == fibTable.end() )
+ if( it == m_table.end() )
{
- if( nextHopList.getNhlSize() > 0 )
+ if( nextHopList.getSize() > 0 )
{
- nextHopList.sortNhl();
+ nextHopList.sort();
FibEntry newEntry(name);
std::list<NextHop> nhl=nextHopList.getNextHopList();
std::list<NextHop>::iterator nhit=nhl.begin();
@@ -77,27 +80,27 @@
newEntry.getNhl().addNextHop((*nhit));
//Add entry to NDN-FIB
}
- newEntry.getNhl().sortNhl();
- newEntry.setTimeToRefresh(fibEntryRefreshTime);
- newEntry.setFeSeqNo(1);
- newEntry.setFeExpiringEventId(scheduleFibEntryRefreshing(pnlsr,
- name ,1,fibEntryRefreshTime));
- fibTable.push_back(newEntry);
+ newEntry.getNhl().sort();
+ newEntry.setTimeToRefresh(m_refreshTime);
+ newEntry.setSeqNo(1);
+ newEntry.setExpiringEventId(scheduleEntryRefreshing(pnlsr,
+ name ,1,m_refreshTime));
+ m_table.push_back(newEntry);
}
}
else
{
std::cout<<"Old FIB Entry"<<std::endl;
- if( nextHopList.getNhlSize() > 0 )
+ if( nextHopList.getSize() > 0 )
{
- nextHopList.sortNhl();
+ nextHopList.sort();
if ( !it->isEqualNextHops(nextHopList) )
{
std::list<NextHop> nhl=nextHopList.getNextHopList();
std::list<NextHop>::iterator nhit=nhl.begin();
// Add first Entry to NDN-FIB
- removeFibEntryHop(pnlsr, it->getNhl(),nhit->getConnectingFace());
- it->getNhl().resetNhl();
+ removeHop(pnlsr, it->getNhl(),nhit->getConnectingFace());
+ it->getNhl().reset();
it->getNhl().addNextHop((*nhit));
++startFace;
++nhit;
@@ -107,37 +110,37 @@
//Add Entry to NDN_FIB
}
}
- it->setTimeToRefresh(fibEntryRefreshTime);
- cancelScheduledFeExpiringEvent(pnlsr, it->getFeExpiringEventId());
- it->setFeSeqNo(it->getFeSeqNo()+1);
- (*it).setFeExpiringEventId(scheduleFibEntryRefreshing(pnlsr,
+ it->setTimeToRefresh(m_refreshTime);
+ cancelScheduledExpiringEvent(pnlsr, it->getExpiringEventId());
+ it->setSeqNo(it->getSeqNo()+1);
+ (*it).setExpiringEventId(scheduleEntryRefreshing(pnlsr,
it->getName() ,
- it->getFeSeqNo(),fibEntryRefreshTime));
+ it->getSeqNo(),m_refreshTime));
}
else
{
- removeFromFib(pnlsr,name);
+ remove(pnlsr,name);
}
}
}
- void Fib::cleanFib(Nlsr& pnlsr)
+ void Fib::clean(Nlsr& pnlsr)
{
- for( std::list<FibEntry >::iterator it=fibTable.begin(); it != fibTable.end();
+ for( std::list<FibEntry >::iterator it=m_table.begin(); it != m_table.end();
++it)
{
for(std::list<NextHop>::iterator nhit=(*it).getNhl().getNextHopList().begin();
nhit != (*it).getNhl().getNextHopList().begin(); nhit++)
{
- cancelScheduledFeExpiringEvent(pnlsr,(*it).getFeExpiringEventId());
+ cancelScheduledExpiringEvent(pnlsr,(*it).getExpiringEventId());
//Remove entry from NDN-FIB
}
}
- if ( fibTable.size() > 0 )
+ if ( m_table.size() > 0 )
{
- fibTable.clear();
+ m_table.clear();
}
}
@@ -145,9 +148,9 @@
Fib::getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix)
{
int endFace=0;
- if((maxFacesPerPrefix == 0) || (nextHopList.getNhlSize() <= maxFacesPerPrefix))
+ if((maxFacesPerPrefix == 0) || (nextHopList.getSize() <= maxFacesPerPrefix))
{
- return nextHopList.getNhlSize();
+ return nextHopList.getSize();
}
else
{
@@ -157,7 +160,7 @@
}
void
- Fib::removeFibEntryHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId)
+ Fib::removeHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId)
{
for( std::list<NextHop >::iterator it=nl.getNextHopList().begin();
it != nl.getNextHopList().end(); ++it)
@@ -170,10 +173,10 @@
}
void
- Fib::printFib()
+ Fib::print()
{
cout<<"-------------------FIB-----------------------------"<<endl;
- for(std::list<FibEntry>::iterator it = fibTable.begin(); it!=fibTable.end();
+ for(std::list<FibEntry>::iterator it = m_table.begin(); it!=m_table.end();
++it)
{
cout<<(*it);
diff --git a/src/route/nlsr_fib.hpp b/src/route/nlsr_fib.hpp
index 50369d4..b36d0d8 100644
--- a/src/route/nlsr_fib.hpp
+++ b/src/route/nlsr_fib.hpp
@@ -16,33 +16,33 @@
{
public:
Fib()
- : fibTable()
- , fibEntryRefreshTime(0)
+ : m_table()
+ , m_refreshTime(0)
{
}
- void removeFromFib(Nlsr& pnlsr, string name);
- void updateFib(Nlsr& pnlsr, string name, Nhl& nextHopList);
- void cleanFib(Nlsr& pnlsr);
- void setFibEntryRefreshTime(int fert)
+ void remove(Nlsr& pnlsr, string name);
+ void update(Nlsr& pnlsr, string name, Nhl& nextHopList);
+ void clean(Nlsr& pnlsr);
+ void setEntryRefreshTime(int fert)
{
- fibEntryRefreshTime=fert;
+ m_refreshTime=fert;
}
- void printFib();
+ void print();
private:
- void removeFibEntryHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId);
+ void removeHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId);
int getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix);
ndn::EventId
- scheduleFibEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
+ scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
int refreshTime);
- void cancelScheduledFeExpiringEvent(Nlsr& pnlsr, EventId eid);
- void refreshFibEntry(string name, int feSeqNum);
+ void cancelScheduledExpiringEvent(Nlsr& pnlsr, EventId eid);
+ void refreshEntry(string name, int feSeqNum);
private:
- std::list<FibEntry> fibTable;
- int fibEntryRefreshTime;
+ std::list<FibEntry> m_table;
+ int m_refreshTime;
};
}//namespace nlsr
diff --git a/src/route/nlsr_map.cpp b/src/route/nlsr_map.cpp
index 19c57c1..f08f1ae 100644
--- a/src/route/nlsr_map.cpp
+++ b/src/route/nlsr_map.cpp
@@ -6,6 +6,9 @@
#include "nlsr_lsa.hpp"
#include "nlsr_lsdb.hpp"
#include "nlsr_map.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_map.cpp"
namespace nlsr
{
@@ -33,25 +36,25 @@
}
void
- Map::addMapElement(string& rtrName)
+ Map::addElement(string& rtrName)
{
- MapEntry me(rtrName,mappingIndex);
- if ( addMapElement(me) )
+ MapEntry me(rtrName,m_mappingIndex);
+ if ( addElement(me) )
{
- mappingIndex++;
+ m_mappingIndex++;
}
}
bool
- Map::addMapElement(MapEntry& mpe)
+ Map::addElement(MapEntry& mpe)
{
//cout << mpe;
- std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
- rMap.end(),
+ std::list<MapEntry >::iterator it = std::find_if( m_table.begin(),
+ m_table.end(),
bind(&mapEntryCompareByRouter, _1, mpe.getRouter()));
- if ( it == rMap.end() )
+ if ( it == m_table.end() )
{
- rMap.push_back(mpe);
+ m_table.push_back(mpe);
return true;
}
return false;
@@ -60,10 +63,10 @@
string
Map::getRouterNameByMappingNo(int mn)
{
- std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
- rMap.end(),
+ std::list<MapEntry >::iterator it = std::find_if( m_table.begin(),
+ m_table.end(),
bind(&mapEntryCompareByMappingNo, _1, mn));
- if ( it != rMap.end() )
+ if ( it != m_table.end() )
{
return (*it).getRouter();
}
@@ -73,10 +76,10 @@
int
Map::getMappingNoByRouterName(string& rName)
{
- std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
- rMap.end(),
+ std::list<MapEntry >::iterator it = std::find_if( m_table.begin(),
+ m_table.end(),
bind(&mapEntryCompareByRouter, _1, rName));
- if ( it != rMap.end() )
+ if ( it != m_table.end() )
{
return (*it).getMappingNumber();
}
@@ -84,36 +87,36 @@
}
void
- Map::createMapFromAdjLsdb(Nlsr& pnlsr)
+ Map::createFromAdjLsdb(Nlsr& pnlsr)
{
std::list<AdjLsa> adjLsdb=pnlsr.getLsdb().getAdjLsdb();
for( std::list<AdjLsa>::iterator it=adjLsdb.begin();
it!= adjLsdb.end() ; it++)
{
string linkStartRouter=(*it).getOrigRouter();
- addMapElement(linkStartRouter);
+ addElement(linkStartRouter);
std::list<Adjacent> adl=(*it).getAdl().getAdjList();
for( std::list<Adjacent>::iterator itAdl=adl.begin();
itAdl!= adl.end() ; itAdl++)
{
- string linkEndRouter=(*itAdl).getAdjacentName();
- addMapElement(linkEndRouter);
+ string linkEndRouter=(*itAdl).getName();
+ addElement(linkEndRouter);
}
}
}
void
- Map::resetMap()
+ Map::reset()
{
- rMap.clear();
- mappingIndex=0;
+ m_table.clear();
+ m_mappingIndex=0;
}
ostream&
- operator<<(ostream& os, Map& rMap)
+ operator<<(ostream& os, Map& map)
{
os<<"---------------Map----------------------"<<endl;
- std::list< MapEntry > ml=rMap.getMapList();
+ std::list< MapEntry > ml=map.getMapList();
for( std::list<MapEntry>::iterator it=ml.begin(); it!= ml.end() ; it++)
{
os<< (*it);
diff --git a/src/route/nlsr_map.hpp b/src/route/nlsr_map.hpp
index c362706..bf50aac 100644
--- a/src/route/nlsr_map.hpp
+++ b/src/route/nlsr_map.hpp
@@ -17,8 +17,8 @@
{
public:
MapEntry()
- : router()
- , mappingNumber(-1)
+ : m_router()
+ , m_mappingNumber(-1)
{
}
@@ -28,22 +28,22 @@
MapEntry(string rtr, int mn)
{
- router=rtr;
- mappingNumber=mn;
+ m_router=rtr;
+ m_mappingNumber=mn;
}
string getRouter()
{
- return router;
+ return m_router;
}
int getMappingNumber()
{
- return mappingNumber;
+ return m_mappingNumber;
}
private:
- string router;
- int mappingNumber;
+ string m_router;
+ int m_mappingNumber;
};
ostream&
@@ -53,36 +53,36 @@
{
public:
Map()
- : mappingIndex(0)
+ : m_mappingIndex(0)
{
}
- void addMapElement(string& rtrName);
- void createMapFromAdjLsdb(Nlsr& pnlsr);
+ void addElement(string& rtrName);
+ void createFromAdjLsdb(Nlsr& pnlsr);
string getRouterNameByMappingNo(int mn);
int getMappingNoByRouterName(string& rName);
- void resetMap();
+ void reset();
std::list< MapEntry >& getMapList()
{
- return rMap;
+ return m_table;
}
int getMapSize()
{
- return rMap.size();
+ return m_table.size();
}
private:
- bool addMapElement(MapEntry& mpe);
+ bool addElement(MapEntry& mpe);
- int mappingIndex;
- std::list< MapEntry > rMap;
+ int m_mappingIndex;
+ std::list< MapEntry > m_table;
};
ostream&
- operator<<(ostream& os, Map& rMap);
+ operator<<(ostream& os, Map& map);
} // namespace nlsr
#endif
diff --git a/src/route/nlsr_nexthop.cpp b/src/route/nlsr_nexthop.cpp
index 1c7257b..08dfe62 100644
--- a/src/route/nlsr_nexthop.cpp
+++ b/src/route/nlsr_nexthop.cpp
@@ -1,4 +1,6 @@
#include "nlsr_nexthop.hpp"
+#include "utility/nlsr_logger.hpp"
+#define THIS_FILE "nlsr_nexthop.cpp"
namespace nlsr
{
diff --git a/src/route/nlsr_nexthop.hpp b/src/route/nlsr_nexthop.hpp
index b8a0af0..0105fb6 100644
--- a/src/route/nlsr_nexthop.hpp
+++ b/src/route/nlsr_nexthop.hpp
@@ -12,39 +12,39 @@
{
public:
NextHop()
- : connectingFace(0)
- , routeCost(0)
+ : m_connectingFace(0)
+ , m_routeCost(0)
{
}
NextHop(int cf, double rc)
{
- connectingFace=cf;
- routeCost=rc;
+ m_connectingFace=cf;
+ m_routeCost=rc;
}
int getConnectingFace() const
{
- return connectingFace;
+ return m_connectingFace;
}
void setConnectingFace(int cf)
{
- connectingFace=cf;
+ m_connectingFace=cf;
}
double getRouteCost() const
{
- return routeCost;
+ return m_routeCost;
}
void setRouteCost(double rc)
{
- routeCost=rc;
+ m_routeCost=rc;
}
private:
- int connectingFace;
- double routeCost;
+ int m_connectingFace;
+ double m_routeCost;
};
diff --git a/src/route/nlsr_nhl.cpp b/src/route/nlsr_nhl.cpp
index 953a0b6..ed769c9 100644
--- a/src/route/nlsr_nhl.cpp
+++ b/src/route/nlsr_nhl.cpp
@@ -1,8 +1,10 @@
#include <iostream>
-
+#include "utility/nlsr_logger.hpp"
#include "nlsr_nhl.hpp"
#include "nlsr_nexthop.hpp"
+#define THIS_FILE "nlsr_nhl.cpp"
+
namespace nlsr
{
@@ -38,12 +40,12 @@
void
Nhl::addNextHop(NextHop& nh)
{
- std::list<NextHop >::iterator it = std::find_if( nexthopList.begin(),
- nexthopList.end(),
+ std::list<NextHop >::iterator it = std::find_if( m_nexthopList.begin(),
+ m_nexthopList.end(),
bind(&nexthopCompare, _1, nh));
- if ( it == nexthopList.end() )
+ if ( it == m_nexthopList.end() )
{
- nexthopList.push_back(nh);
+ m_nexthopList.push_back(nh);
}
if ( (*it).getRouteCost() > nh.getRouteCost() )
{
@@ -59,19 +61,19 @@
void
Nhl::removeNextHop(NextHop &nh)
{
- std::list<NextHop >::iterator it = std::find_if( nexthopList.begin(),
- nexthopList.end(),
+ std::list<NextHop >::iterator it = std::find_if( m_nexthopList.begin(),
+ m_nexthopList.end(),
bind(&nexthopRemoveCompare, _1, nh));
- if ( it != nexthopList.end() )
+ if ( it != m_nexthopList.end() )
{
- nexthopList.erase(it);
+ m_nexthopList.erase(it);
}
}
void
- Nhl::sortNhl()
+ Nhl::sort()
{
- nexthopList.sort(nextHopSortingComparator);
+ m_nexthopList.sort(nextHopSortingComparator);
}
ostream&
diff --git a/src/route/nlsr_nhl.hpp b/src/route/nlsr_nhl.hpp
index f82d37e..fd8b4ca 100644
--- a/src/route/nlsr_nhl.hpp
+++ b/src/route/nlsr_nhl.hpp
@@ -17,7 +17,7 @@
{
public:
Nhl()
- : nexthopList()
+ : m_nexthopList()
{
}
@@ -26,25 +26,25 @@
}
void addNextHop(NextHop &nh);
void removeNextHop(NextHop &nh);
- void sortNhl();
- int getNhlSize()
+ void sort();
+ int getSize()
{
- return nexthopList.size();
+ return m_nexthopList.size();
}
- void resetNhl()
+ void reset()
{
- if (nexthopList.size() > 0 )
+ if (m_nexthopList.size() > 0 )
{
- nexthopList.clear();
+ m_nexthopList.clear();
}
}
std::list< NextHop >& getNextHopList()
{
- return nexthopList;
+ return m_nexthopList;
}
private:
- std::list< NextHop > nexthopList;
+ std::list< NextHop > m_nexthopList;
};
ostream&
diff --git a/src/route/nlsr_npt.cpp b/src/route/nlsr_npt.cpp
index 2dfa311..89eba30 100644
--- a/src/route/nlsr_npt.cpp
+++ b/src/route/nlsr_npt.cpp
@@ -1,11 +1,13 @@
#include <list>
#include <utility>
#include <algorithm>
-
+#include "utility/nlsr_logger.hpp"
#include "nlsr_npt.hpp"
#include "nlsr_npte.hpp"
#include "nlsr.hpp"
+#define THIS_FILE "nlsr_npt.cpp"
+
namespace nlsr
{
@@ -22,34 +24,34 @@
void
Npt::addNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
{
- std::list<Npte >::iterator it = std::find_if( npteList.begin(),
- npteList.end(), bind(&npteCompare, _1, name));
- if ( it == npteList.end() )
+ std::list<Npte >::iterator it = std::find_if( m_npteList.begin(),
+ m_npteList.end(), bind(&npteCompare, _1, name));
+ if ( it == m_npteList.end() )
{
Npte newEntry(name);
newEntry.addRoutingTableEntry(rte);
newEntry.generateNhlfromRteList();
- newEntry.getNhl().sortNhl();
- npteList.push_back(newEntry);
- if(rte.getNhl().getNhlSize()> 0)
+ newEntry.getNhl().sort();
+ m_npteList.push_back(newEntry);
+ if(rte.getNhl().getSize()> 0)
{
- pnlsr.getFib().updateFib(pnlsr, name,newEntry.getNhl());
+ pnlsr.getFib().update(pnlsr, name,newEntry.getNhl());
}
}
else
{
- if ( rte.getNhl().getNhlSize()> 0 )
+ if ( rte.getNhl().getSize()> 0 )
{
(*it).addRoutingTableEntry(rte);
(*it).generateNhlfromRteList();
- (*it).getNhl().sortNhl();
- pnlsr.getFib().updateFib(pnlsr, name,(*it).getNhl());
+ (*it).getNhl().sort();
+ pnlsr.getFib().update(pnlsr, name,(*it).getNhl());
}
else
{
(*it).resetRteListNextHop();
- (*it).getNhl().resetNhl();
- pnlsr.getFib().removeFromFib(pnlsr,name);
+ (*it).getNhl().reset();
+ pnlsr.getFib().remove(pnlsr,name);
}
}
}
@@ -57,9 +59,9 @@
void
Npt::removeNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
{
- std::list<Npte >::iterator it = std::find_if( npteList.begin(),
- npteList.end(), bind(&npteCompare, _1, name));
- if ( it != npteList.end() )
+ std::list<Npte >::iterator it = std::find_if( m_npteList.begin(),
+ m_npteList.end(), bind(&npteCompare, _1, name));
+ if ( it != m_npteList.end() )
{
string destRouter=rte.getDestination();
(*it).removeRoutingTableEntry(rte);
@@ -68,13 +70,13 @@
(!pnlsr.getLsdb().doesLsaExist(destRouter+"/2",2) ) &&
(!pnlsr.getLsdb().doesLsaExist(destRouter+"/3",3) ) )
{
- npteList.erase(it);
- pnlsr.getFib().removeFromFib(pnlsr,name);
+ m_npteList.erase(it);
+ pnlsr.getFib().remove(pnlsr,name);
}
else
{
(*it).generateNhlfromRteList();
- pnlsr.getFib().updateFib(pnlsr, name,(*it).getNhl());
+ pnlsr.getFib().update(pnlsr, name,(*it).getNhl());
}
}
}
@@ -113,9 +115,9 @@
}
void
- Npt::updateNptWithNewRoute(Nlsr& pnlsr)
+ Npt::updateWithNewRoute(Nlsr& pnlsr)
{
- for(std::list<Npte >::iterator it=npteList.begin(); it!=npteList.end(); ++it)
+ for(std::list<Npte >::iterator it=m_npteList.begin(); it!=m_npteList.end(); ++it)
{
std::list<RoutingTableEntry> rteList=(*it).getRteList();
for(std::list<RoutingTableEntry >::iterator rteit=rteList.begin();
@@ -137,10 +139,10 @@
}
void
- Npt::printNpt()
+ Npt::print()
{
cout<<"----------------NPT----------------------"<<endl;
- for(std::list<Npte >::iterator it=npteList.begin(); it!=npteList.end(); ++it)
+ for(std::list<Npte >::iterator it=m_npteList.begin(); it!=m_npteList.end(); ++it)
{
cout <<(*it)<<endl;
}
diff --git a/src/route/nlsr_npt.hpp b/src/route/nlsr_npt.hpp
index 8e6a98c..89af33d 100644
--- a/src/route/nlsr_npt.hpp
+++ b/src/route/nlsr_npt.hpp
@@ -20,13 +20,13 @@
}
void addNpteByDestName(string name, string destRouter, Nlsr& pnlsr);
void removeNpte(string name, string destRouter, Nlsr& pnlsr);
- void updateNptWithNewRoute(Nlsr& pnlsr);
- void printNpt();
+ void updateWithNewRoute(Nlsr& pnlsr);
+ void print();
private:
void addNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr);
void removeNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr);
private:
- std::list<Npte> npteList;
+ std::list<Npte> m_npteList;
};
}//namespace nlsr
diff --git a/src/route/nlsr_npte.cpp b/src/route/nlsr_npte.cpp
index c342a21..d8e83c3 100644
--- a/src/route/nlsr_npte.cpp
+++ b/src/route/nlsr_npte.cpp
@@ -3,6 +3,9 @@
#include "nlsr_npte.hpp"
#include "nlsr_rte.hpp"
#include "nlsr_nexthop.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_npte.cpp"
namespace nlsr
{
@@ -12,14 +15,14 @@
void
Npte::generateNhlfromRteList()
{
- nhl.resetNhl();
- for( std::list<RoutingTableEntry>::iterator it=rteList.begin();
- it != rteList.end(); ++it )
+ m_nhl.reset();
+ for( std::list<RoutingTableEntry>::iterator it=m_rteList.begin();
+ it != m_rteList.end(); ++it )
{
for(std::list< NextHop >::iterator nhit=(*it).getNhl().getNextHopList().begin();
nhit != (*it).getNhl().getNextHopList().end(); ++nhit)
{
- nhl.addNextHop((*nhit));
+ m_nhl.addNextHop((*nhit));
}
}
}
@@ -35,28 +38,28 @@
void
Npte::removeRoutingTableEntry(RoutingTableEntry& rte)
{
- std::list<RoutingTableEntry >::iterator it = std::find_if( rteList.begin(),
- rteList.end(),
+ std::list<RoutingTableEntry >::iterator it = std::find_if( m_rteList.begin(),
+ m_rteList.end(),
bind(&rteCompare, _1, rte.getDestination()));
- if ( it != rteList.end() )
+ if ( it != m_rteList.end() )
{
- rteList.erase(it);
+ m_rteList.erase(it);
}
}
void
Npte::addRoutingTableEntry(RoutingTableEntry &rte)
{
- std::list<RoutingTableEntry >::iterator it = std::find_if( rteList.begin(),
- rteList.end(),
+ std::list<RoutingTableEntry >::iterator it = std::find_if( m_rteList.begin(),
+ m_rteList.end(),
bind(&rteCompare, _1, rte.getDestination()));
- if ( it == rteList.end() )
+ if ( it == m_rteList.end() )
{
- rteList.push_back(rte);
+ m_rteList.push_back(rte);
}
else
{
- (*it).getNhl().resetNhl(); // reseting existing routing table's next hop
+ (*it).getNhl().reset(); // reseting existing routing table's next hop
for(std::list< NextHop >::iterator nhit=rte.getNhl().getNextHopList().begin();
nhit != rte.getNhl().getNextHopList().end(); ++nhit)
{
diff --git a/src/route/nlsr_npte.hpp b/src/route/nlsr_npte.hpp
index 3dfa04a..bb4b1c8 100644
--- a/src/route/nlsr_npte.hpp
+++ b/src/route/nlsr_npte.hpp
@@ -14,55 +14,55 @@
{
public:
Npte()
- : namePrefix()
- , nhl()
+ : m_namePrefix()
+ , m_nhl()
{
}
Npte(string np)
- : nhl()
+ : m_nhl()
{
- namePrefix=np;
+ m_namePrefix=np;
}
string getNamePrefix()
{
- return namePrefix;
+ return m_namePrefix;
}
std::list<RoutingTableEntry>& getRteList()
{
- return rteList;
+ return m_rteList;
}
void resetRteListNextHop()
{
- if (rteList.size() > 0 )
+ if (m_rteList.size() > 0 )
{
- for( std::list<RoutingTableEntry>::iterator it=rteList.begin();
- it != rteList.end(); ++it )
+ for( std::list<RoutingTableEntry>::iterator it=m_rteList.begin();
+ it != m_rteList.end(); ++it )
{
- (*it).getNhl().resetNhl();
+ (*it).getNhl().reset();
}
}
}
int getRteListSize()
{
- return rteList.size();
+ return m_rteList.size();
}
Nhl& getNhl()
{
- return nhl;
+ return m_nhl;
}
void generateNhlfromRteList();
void removeRoutingTableEntry(RoutingTableEntry& rte);
void addRoutingTableEntry(RoutingTableEntry &rte);
private:
- string namePrefix;
- std::list<RoutingTableEntry> rteList;
- Nhl nhl;
+ string m_namePrefix;
+ std::list<RoutingTableEntry> m_rteList;
+ Nhl m_nhl;
};
ostream&
diff --git a/src/route/nlsr_rt.cpp b/src/route/nlsr_rt.cpp
index 2cd9b28..8267930 100644
--- a/src/route/nlsr_rt.cpp
+++ b/src/route/nlsr_rt.cpp
@@ -8,6 +8,9 @@
#include "nlsr_rtc.hpp"
#include "nlsr_rte.hpp"
#include "nlsr_npt.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_rt.cpp"
namespace nlsr
{
@@ -19,7 +22,7 @@
{
//debugging purpose
std::cout<<pnlsr.getConfParameter()<<std::endl;
- pnlsr.getNpt().printNpt();
+ pnlsr.getNpt().print();
pnlsr.getLsdb().printAdjLsdb();
pnlsr.getLsdb().printCorLsdb();
pnlsr.getLsdb().printNameLsdb();
@@ -51,11 +54,11 @@
calculateHypDryRoutingTable(pnlsr);
}
//need to update NPT here
- pnlsr.getNpt().updateNptWithNewRoute(pnlsr);
+ pnlsr.getNpt().updateWithNewRoute(pnlsr);
//debugging purpose
printRoutingTable();
- pnlsr.getNpt().printNpt();
- pnlsr.getFib().printFib();
+ pnlsr.getNpt().print();
+ pnlsr.getFib().print();
//debugging purpose end
}
else
@@ -72,11 +75,11 @@
clearDryRoutingTable(); // for dry run options
// need to update NPT here
std::cout<<"Calling Update NPT With new Route"<<std::endl;
- pnlsr.getNpt().updateNptWithNewRoute(pnlsr);
+ pnlsr.getNpt().updateWithNewRoute(pnlsr);
//debugging purpose
printRoutingTable();
- pnlsr.getNpt().printNpt();
- pnlsr.getFib().printFib();
+ pnlsr.getNpt().print();
+ pnlsr.getFib().print();
//debugging purpose end
}
pnlsr.setIsRouteCalculationScheduled(0); //clear scheduled flag
@@ -94,7 +97,7 @@
{
cout<<"RoutingTable::calculateLsRoutingTable Called"<<endl;
Map vMap;
- vMap.createMapFromAdjLsdb(pnlsr);
+ vMap.createFromAdjLsdb(pnlsr);
int numOfRouter=vMap.getMapSize();
LinkStateRoutingTableCalculator lsrtc(numOfRouter);
lsrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
@@ -104,7 +107,7 @@
RoutingTable::calculateHypRoutingTable(Nlsr& pnlsr)
{
Map vMap;
- vMap.createMapFromAdjLsdb(pnlsr);
+ vMap.createFromAdjLsdb(pnlsr);
int numOfRouter=vMap.getMapSize();
HypRoutingTableCalculator hrtc(numOfRouter,0);
hrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
@@ -114,7 +117,7 @@
RoutingTable::calculateHypDryRoutingTable(Nlsr& pnlsr)
{
Map vMap;
- vMap.createMapFromAdjLsdb(pnlsr);
+ vMap.createFromAdjLsdb(pnlsr);
int numOfRouter=vMap.getMapSize();
HypRoutingTableCalculator hrtc(numOfRouter,1);
hrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
@@ -146,7 +149,7 @@
{
RoutingTableEntry rte(destRouter);
rte.getNhl().addNextHop(nh);
- rTable.push_back(rte);
+ m_rTable.push_back(rte);
}
else
{
@@ -157,10 +160,10 @@
std::pair<RoutingTableEntry&, bool>
RoutingTable::findRoutingTableEntry(string destRouter)
{
- std::list<RoutingTableEntry >::iterator it = std::find_if( rTable.begin(),
- rTable.end(),
+ std::list<RoutingTableEntry >::iterator it = std::find_if( m_rTable.begin(),
+ m_rTable.end(),
bind(&routingTableEntryCompare, _1, destRouter));
- if ( it != rTable.end() )
+ if ( it != m_rTable.end() )
{
return std::make_pair(boost::ref((*it)),true);
}
@@ -172,8 +175,8 @@
RoutingTable::printRoutingTable()
{
cout<<"---------------Routing Table------------------"<<endl;
- for(std::list<RoutingTableEntry>::iterator it=rTable.begin() ;
- it != rTable.end(); ++it)
+ for(std::list<RoutingTableEntry>::iterator it=m_rTable.begin() ;
+ it != m_rTable.end(); ++it)
{
cout<<(*it)<<endl;
}
@@ -184,14 +187,14 @@
void
RoutingTable::addNextHopToDryTable(string destRouter, NextHop& nh)
{
- std::list<RoutingTableEntry >::iterator it = std::find_if( dryTable.begin(),
- dryTable.end(),
+ std::list<RoutingTableEntry >::iterator it = std::find_if( m_dryTable.begin(),
+ m_dryTable.end(),
bind(&routingTableEntryCompare, _1, destRouter));
- if ( it == dryTable.end() )
+ if ( it == m_dryTable.end() )
{
RoutingTableEntry rte(destRouter);
rte.getNhl().addNextHop(nh);
- dryTable.push_back(rte);
+ m_dryTable.push_back(rte);
}
else
{
@@ -203,8 +206,8 @@
RoutingTable::printDryRoutingTable()
{
cout<<"--------Dry Run's Routing Table--------------"<<endl;
- for(std::list<RoutingTableEntry>::iterator it=dryTable.begin() ;
- it != dryTable.end(); ++it)
+ for(std::list<RoutingTableEntry>::iterator it=m_dryTable.begin() ;
+ it != m_dryTable.end(); ++it)
{
cout<<(*it)<<endl;
}
@@ -214,18 +217,18 @@
void
RoutingTable::clearRoutingTable()
{
- if( rTable.size() > 0 )
+ if( m_rTable.size() > 0 )
{
- rTable.clear();
+ m_rTable.clear();
}
}
void
RoutingTable::clearDryRoutingTable()
{
- if (dryTable.size()>0 )
+ if (m_dryTable.size()>0 )
{
- dryTable.clear();
+ m_dryTable.clear();
}
}
diff --git a/src/route/nlsr_rt.hpp b/src/route/nlsr_rt.hpp
index bf4e489..e382b8b 100644
--- a/src/route/nlsr_rt.hpp
+++ b/src/route/nlsr_rt.hpp
@@ -34,15 +34,15 @@
private:
void calculateLsRoutingTable(Nlsr& pnlsr);
void calculateHypRoutingTable(Nlsr& pnlsr);
- void calculateHypDryRoutingTable(Nlsr&pnlsr);
+ void calculateHypDryRoutingTable(Nlsr& pnlsr);
void clearRoutingTable();
void clearDryRoutingTable();
const int NO_NEXT_HOP;
- std::list< RoutingTableEntry > rTable;
- std::list< RoutingTableEntry > dryTable;
+ std::list< RoutingTableEntry > m_rTable;
+ std::list< RoutingTableEntry > m_dryTable;
};
}//namespace nlsr
diff --git a/src/route/nlsr_rtc.cpp b/src/route/nlsr_rtc.cpp
index 90200e5..c6499f7 100644
--- a/src/route/nlsr_rtc.cpp
+++ b/src/route/nlsr_rtc.cpp
@@ -6,6 +6,9 @@
#include "nlsr_lsa.hpp"
#include "nlsr_nexthop.hpp"
#include "nlsr.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_rtc.cpp"
namespace nlsr
{
@@ -45,7 +48,7 @@
for( std::list<Adjacent>::iterator itAdl=adl.begin();
itAdl!= adl.end() ; itAdl++)
{
- string linkEndRouter=(*itAdl).getAdjacentName();
+ string linkEndRouter=(*itAdl).getName();
int col=pMap.getMappingNoByRouterName(linkEndRouter);
double cost=(*itAdl).getLinkCost();
if ( (row >= 0 && row<numOfRouter) && (col >= 0 && col<numOfRouter) )
@@ -206,18 +209,18 @@
/* Initiate the Parent */
for (i = 0 ; i < numOfRouter; i++)
{
- parent[i]=EMPTY_PARENT;
- distance[i]=INF_DISTANCE;
+ m_parent[i]=EMPTY_PARENT;
+ m_distance[i]=INF_DISTANCE;
Q[i]=i;
}
if ( sourceRouter != NO_MAPPING_NUM )
{
- distance[sourceRouter]=0;
- sortQueueByDistance(Q,distance,head,numOfRouter);
+ m_distance[sourceRouter]=0;
+ sortQueueByDistance(Q,m_distance,head,numOfRouter);
while (head < numOfRouter )
{
u=Q[head];
- if(distance[u] == INF_DISTANCE)
+ if(m_distance[u] == INF_DISTANCE)
{
break;
}
@@ -227,16 +230,16 @@
{
if ( isNotExplored(Q,v,head+1,numOfRouter) )
{
- if( distance[u] + adjMatrix[u][v] < distance[v])
+ if( m_distance[u] + adjMatrix[u][v] < m_distance[v])
{
- distance[v]=distance[u] + adjMatrix[u][v] ;
- parent[v]=u;
+ m_distance[v]=m_distance[u] + adjMatrix[u][v] ;
+ m_parent[v]=u;
}
}
}
}
head++;
- sortQueueByDistance(Q,distance,head,numOfRouter);
+ sortQueueByDistance(Q,m_distance,head,numOfRouter);
}
}
delete [] Q;
@@ -255,7 +258,7 @@
int nextHopRouter=getLsNextHop(i,sourceRouter);
if ( nextHopRouter != NO_NEXT_HOP )
{
- double routeCost=distance[i];
+ double routeCost=m_distance[i];
string nextHopRouterName=
pMap.getRouterNameByMappingNo(nextHopRouter);
int nxtHopFace=
@@ -277,10 +280,10 @@
LinkStateRoutingTableCalculator::getLsNextHop(int dest, int source)
{
int nextHop;
- while ( parent[dest] != EMPTY_PARENT )
+ while ( m_parent[dest] != EMPTY_PARENT )
{
nextHop=dest;
- dest=parent[dest];
+ dest=m_parent[dest];
}
if ( dest != source )
{
@@ -307,9 +310,9 @@
void
LinkStateRoutingTableCalculator::printLsPath(int destRouter)
{
- if (parent[destRouter] != EMPTY_PARENT )
+ if (m_parent[destRouter] != EMPTY_PARENT )
{
- printLsPath(parent[destRouter]);
+ printLsPath(m_parent[destRouter]);
}
cout<<" "<<destRouter;
}
@@ -351,24 +354,24 @@
void
LinkStateRoutingTableCalculator::allocateParent()
{
- parent=new int[numOfRouter];
+ m_parent=new int[numOfRouter];
}
void
LinkStateRoutingTableCalculator::allocateDistance()
{
- distance= new double[numOfRouter];
+ m_distance= new double[numOfRouter];
}
void
LinkStateRoutingTableCalculator::freeParent()
{
- delete [] parent;
+ delete [] m_parent;
}
void LinkStateRoutingTableCalculator::freeDistance()
{
- delete [] distance;
+ delete [] m_distance;
}
@@ -404,9 +407,9 @@
pMap,links[j],i);
if ( distToDestFromNbr >= 0 )
{
- linkFaces[k] = nextHopFace;
- distanceToNeighbor[k] = distToNbr;
- distFromNbrToDest[k] = distToDestFromNbr;
+ m_linkFaces[k] = nextHopFace;
+ m_distanceToNeighbor[k] = distToNbr;
+ m_distFromNbrToDest[k] = distToDestFromNbr;
k++;
}
}
@@ -428,9 +431,9 @@
for(int i=0 ; i < noFaces ; ++i)
{
string destRouter=pMap.getRouterNameByMappingNo(dest);
- NextHop nh(linkFaces[i],distFromNbrToDest[i]);
+ NextHop nh(m_linkFaces[i],m_distFromNbrToDest[i]);
rt.addNextHop(destRouter,nh);
- if( isDryRun == 1 )
+ if( m_isDryRun)
{
rt.addNextHopToDryTable(destRouter,nh);
}
@@ -472,37 +475,37 @@
void
HypRoutingTableCalculator::allocateLinkFaces()
{
- linkFaces=new int[vNoLink];
+ m_linkFaces=new int[vNoLink];
}
void
HypRoutingTableCalculator::allocateDistanceToNeighbor()
{
- distanceToNeighbor=new double[vNoLink];
+ m_distanceToNeighbor=new double[vNoLink];
}
void
HypRoutingTableCalculator::allocateDistFromNbrToDest()
{
- distFromNbrToDest=new double[vNoLink];
+ m_distFromNbrToDest=new double[vNoLink];
}
void
HypRoutingTableCalculator::freeLinkFaces()
{
- delete [] linkFaces;
+ delete [] m_linkFaces;
}
void
HypRoutingTableCalculator::freeDistanceToNeighbor()
{
- delete [] distanceToNeighbor;
+ delete [] m_distanceToNeighbor;
}
void
HypRoutingTableCalculator::freeDistFromNbrToDest()
{
- delete [] distFromNbrToDest;
+ delete [] m_distFromNbrToDest;
}
}//namespace nlsr
diff --git a/src/route/nlsr_rtc.hpp b/src/route/nlsr_rtc.hpp
index 730612c..dba45ca 100644
--- a/src/route/nlsr_rtc.hpp
+++ b/src/route/nlsr_rtc.hpp
@@ -45,12 +45,12 @@
}
protected:
- double ** adjMatrix;
+ double** adjMatrix;
int numOfRouter;
int vNoLink;
- int *links;
- double *linkCosts;
+ int* links;
+ double* linkCosts;
};
class LinkStateRoutingTableCalculator: public RoutingTableCalculator
@@ -71,8 +71,8 @@
private:
void doDijkstraPathCalculation(int sourceRouter);
- void sortQueueByDistance(int *Q, double *dist,int start,int element);
- int isNotExplored(int *Q, int u,int start, int element);
+ void sortQueueByDistance(int* Q, double* dist,int start,int element);
+ int isNotExplored(int* Q, int u,int start, int element);
void printAllLsPath(int sourceRouter);
void printLsPath(int destRouter);
void addAllLsNextHopsToRoutingTable(Nlsr& pnlsr, RoutingTable& rt,
@@ -88,8 +88,8 @@
private:
- int *parent;
- double *distance;
+ int* m_parent;
+ double* m_distance;
const int EMPTY_PARENT;
@@ -106,13 +106,13 @@
: MATH_PI(3.141592654)
{
numOfRouter=rn;
- isDryRun=0;
+ m_isDryRun=0;
}
HypRoutingTableCalculator(int rn, int idr)
: MATH_PI(3.141592654)
{
numOfRouter=rn;
- isDryRun=idr;
+ m_isDryRun=idr;
}
void calculatePath(Map& pMap, RoutingTable& rt, Nlsr& pnlsr);
@@ -130,11 +130,11 @@
RoutingTable& rt, int noFaces,int dest);
private:
- int isDryRun;
+ bool m_isDryRun;
- int *linkFaces;
- double *distanceToNeighbor;
- double *distFromNbrToDest;
+ int* m_linkFaces;
+ double* m_distanceToNeighbor;
+ double* m_distFromNbrToDest;
const double MATH_PI;
diff --git a/src/route/nlsr_rte.cpp b/src/route/nlsr_rte.cpp
index 129ab8a..7c06b03 100644
--- a/src/route/nlsr_rte.cpp
+++ b/src/route/nlsr_rte.cpp
@@ -2,6 +2,9 @@
#include <string>
#include "nlsr_rte.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_rte.cpp"
namespace nlsr
{
@@ -9,7 +12,7 @@
using namespace std;
ostream&
- operator<<(ostream& os, RoutingTableEntry &rte)
+ operator<<(ostream& os, RoutingTableEntry& rte)
{
os<<"Destination: "<<rte.getDestination()<<endl;
os<<"Nexthops: "<<endl;
diff --git a/src/route/nlsr_rte.hpp b/src/route/nlsr_rte.hpp
index 736909b..484edab 100644
--- a/src/route/nlsr_rte.hpp
+++ b/src/route/nlsr_rte.hpp
@@ -14,8 +14,8 @@
{
public:
RoutingTableEntry()
- : destination()
- , nhl()
+ : m_destination()
+ , m_nhl()
{
}
@@ -24,28 +24,28 @@
}
RoutingTableEntry(string dest)
- : nhl()
+ : m_nhl()
{
- destination=dest;
+ m_destination=dest;
}
string getDestination()
{
- return destination;
+ return m_destination;
}
Nhl& getNhl()
{
- return nhl;
+ return m_nhl;
}
private:
- string destination;
- Nhl nhl;
+ string m_destination;
+ Nhl m_nhl;
};
ostream&
- operator<<(ostream& os, RoutingTableEntry &rte);
+ operator<<(ostream& os, RoutingTableEntry& rte);
}