Fixing Coding Style
diff --git a/src/communication/nlsr_dm.cpp b/src/communication/nlsr_dm.cpp
index ffb85e3..249b5e7 100644
--- a/src/communication/nlsr_dm.cpp
+++ b/src/communication/nlsr_dm.cpp
@@ -10,6 +10,9 @@
#include "utility/nlsr_tokenizer.hpp"
#include "nlsr_lsdb.hpp"
#include "security/nlsr_km.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_dm.cpp"
namespace nlsr
{
@@ -19,7 +22,7 @@
void
DataManager::processContent(Nlsr& pnlsr, const ndn::Interest &interest,
- const ndn::Data & data, interestManager& im)
+ const ndn::Data & data, InterestManager& im)
{
cout << "I: " << interest.toUri() << endl;
string dataName(data.getName().toUri());
@@ -141,7 +144,7 @@
if ( pnlsr.getLsdb().isNameLsaNew(lsaKey,lsSeqNo))
{
NameLsa nameLsa;
- if( nameLsa.initNameLsaFromContent(dataContent) )
+ if( nameLsa.initializeFromContent(dataContent) )
{
pnlsr.getLsdb().installNameLsa(pnlsr, nameLsa);
}
@@ -159,7 +162,7 @@
if ( pnlsr.getLsdb().isAdjLsaNew(lsaKey,lsSeqNo))
{
AdjLsa adjLsa;
- if( adjLsa.initAdjLsaFromContent(dataContent) )
+ if( adjLsa.initializeFromContent(dataContent) )
{
pnlsr.getLsdb().installAdjLsa(pnlsr, adjLsa);
}
@@ -177,7 +180,7 @@
if ( pnlsr.getLsdb().isCorLsaNew(lsaKey,lsSeqNo))
{
CorLsa corLsa;
- if( corLsa.initCorLsaFromContent(dataContent) )
+ if( corLsa.initializeFromContent(dataContent) )
{
pnlsr.getLsdb().installCorLsa(pnlsr, corLsa);
}
diff --git a/src/communication/nlsr_dm.hpp b/src/communication/nlsr_dm.hpp
index 4a807f2..fc231d3 100644
--- a/src/communication/nlsr_dm.hpp
+++ b/src/communication/nlsr_dm.hpp
@@ -18,8 +18,8 @@
class DataManager
{
public:
- void processContent(Nlsr& pnlsr, const ndn::Interest &interest,
- const ndn::Data& data, interestManager& im);
+ void processContent(Nlsr& pnlsr, const ndn::Interest& interest,
+ const ndn::Data& data, InterestManager& im);
private:
void processContentInfo(Nlsr& pnlsr, string& dataName,
string& dataContent);
diff --git a/src/communication/nlsr_im.cpp b/src/communication/nlsr_im.cpp
index 16d0c72..d708812 100644
--- a/src/communication/nlsr_im.cpp
+++ b/src/communication/nlsr_im.cpp
@@ -10,6 +10,9 @@
#include "nlsr_dm.hpp"
#include "utility/nlsr_tokenizer.hpp"
#include "nlsr_lsdb.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_im.cpp"
namespace nlsr
{
@@ -18,9 +21,9 @@
using namespace ndn;
void
- interestManager::processInterest( Nlsr& pnlsr,
- const ndn::Name &name,
- const ndn::Interest &interest)
+ InterestManager::processInterest( Nlsr& pnlsr,
+ const ndn::Name& name,
+ const ndn::Interest& interest)
{
cout << "<< I: " << interest << endl;
string intName=interest.getName().toUri();
@@ -46,13 +49,13 @@
}
void
- interestManager::processInterestInfo(Nlsr& pnlsr, string& neighbor,
- const ndn::Interest &interest)
+ InterestManager::processInterestInfo(Nlsr& pnlsr, string& neighbor,
+ const ndn::Interest& interest)
{
if ( pnlsr.getAdl().isNeighbor(neighbor) )
{
Data data(ndn::Name(interest.getName()).appendVersion());
- data.setFreshnessPeriod(1000); // 10 sec
+ data.setFreshnessPeriod(time::seconds(10)); // 10 sec
data.setContent((const uint8_t*)"info", sizeof("info"));
pnlsr.getKeyManager().signData(data);
cout << ">> D: " << data << endl;
@@ -69,7 +72,7 @@
}
void
- interestManager::processInterestLsa(Nlsr& pnlsr,const ndn::Interest &interest)
+ InterestManager::processInterestLsa(Nlsr& pnlsr,const ndn::Interest& interest)
{
string intName=interest.getName().toUri();
nlsrTokenizer nt(intName,"/");
@@ -115,8 +118,8 @@
}
void
- interestManager::processInterestForNameLsa(Nlsr& pnlsr,
- const ndn::Interest &interest,
+ InterestManager::processInterestForNameLsa(Nlsr& pnlsr,
+ const ndn::Interest& interest,
string lsaKey, uint32_t interestedlsSeqNo)
{
std::pair<NameLsa&, bool> nameLsa=pnlsr.getLsdb().getNameLsa(lsaKey);
@@ -125,8 +128,8 @@
if ( nameLsa.first.getLsSeqNo() >= interestedlsSeqNo )
{
Data data(ndn::Name(interest.getName()).appendVersion());
- data.setFreshnessPeriod(1000); // 10 sec
- string content=nameLsa.first.getNameLsaData();
+ data.setFreshnessPeriod(time::seconds(10)); // 10 sec
+ string content=nameLsa.first.getData();
data.setContent((const uint8_t*)content.c_str(),content.size());
pnlsr.getKeyManager().signData(data);
cout << ">> D: " << data << endl;
@@ -136,8 +139,8 @@
}
void
- interestManager::processInterestForAdjLsa(Nlsr& pnlsr,
- const ndn::Interest &interest,
+ InterestManager::processInterestForAdjLsa(Nlsr& pnlsr,
+ const ndn::Interest& interest,
string lsaKey, uint32_t interestedlsSeqNo)
{
std::pair<AdjLsa&, bool> adjLsa=pnlsr.getLsdb().getAdjLsa(lsaKey);
@@ -146,8 +149,8 @@
if ( adjLsa.first.getLsSeqNo() >= interestedlsSeqNo )
{
Data data(ndn::Name(interest.getName()).appendVersion());
- data.setFreshnessPeriod(1000); // 10 sec
- string content=adjLsa.first.getAdjLsaData();
+ data.setFreshnessPeriod(time::seconds(10)); // 10 sec
+ string content=adjLsa.first.getData();
data.setContent((const uint8_t*)content.c_str(),content.size());
pnlsr.getKeyManager().signData(data);
cout << ">> D: " << data << endl;
@@ -157,8 +160,8 @@
}
void
- interestManager::processInterestForCorLsa(Nlsr& pnlsr,
- const ndn::Interest &interest,
+ InterestManager::processInterestForCorLsa(Nlsr& pnlsr,
+ const ndn::Interest& interest,
string lsaKey, uint32_t interestedlsSeqNo)
{
std::pair<CorLsa&, bool> corLsa=pnlsr.getLsdb().getCorLsa(lsaKey);
@@ -167,8 +170,8 @@
if ( corLsa.first.getLsSeqNo() >= interestedlsSeqNo )
{
Data data(ndn::Name(interest.getName()).appendVersion());
- data.setFreshnessPeriod(1000); // 10 sec
- string content=corLsa.first.getCorLsaData();
+ data.setFreshnessPeriod(time::seconds(10)); // 10 sec
+ string content=corLsa.first.getData();
data.setContent((const uint8_t*)content.c_str(),content.size());
pnlsr.getKeyManager().signData(data);
cout << ">> D: " << data << endl;
@@ -178,7 +181,7 @@
}
void
- interestManager::processInterestKeys(Nlsr& pnlsr,const ndn::Interest &interest)
+ InterestManager::processInterestKeys(Nlsr& pnlsr,const ndn::Interest& interest)
{
cout<<"processInterestKeys called "<<endl;
string intName=interest.getName().toUri();
@@ -227,7 +230,7 @@
dataName=ndn::Name(interest.getName());
}
Data data(dataName.appendVersion());
- data.setFreshnessPeriod(1000); //10 sec
+ data.setFreshnessPeriod(time::seconds(10)); //10 sec
data.setContent(chkCert.first->wireEncode());
pnlsr.getKeyManager().signData(data);
pnlsr.getNlsrFace()->put(data);
@@ -236,8 +239,8 @@
void
- interestManager::processInterestTimedOut(Nlsr& pnlsr,
- const ndn::Interest &interest)
+ InterestManager::processInterestTimedOut(Nlsr& pnlsr,
+ const ndn::Interest& interest)
{
cout << "Timed out interest : " << interest.getName().toUri() << endl;
string intName= interest.getName().toUri();
@@ -256,8 +259,8 @@
}
void
- interestManager::processInterestTimedOutInfo(Nlsr& pnlsr, string& neighbor,
- const ndn::Interest &interest)
+ InterestManager::processInterestTimedOutInfo(Nlsr& pnlsr, string& neighbor,
+ const ndn::Interest& interest)
{
pnlsr.getAdl().incrementTimedOutInterestCount(neighbor);
int status=pnlsr.getAdl().getStatusOfNeighbor(neighbor);
@@ -289,35 +292,35 @@
}
void
- interestManager::processInterestTimedOutLsa(Nlsr& pnlsr,
- const ndn::Interest &interest)
+ InterestManager::processInterestTimedOutLsa(Nlsr& pnlsr,
+ const ndn::Interest& interest)
{
}
void
- interestManager::expressInterest(Nlsr& pnlsr,const string& interestNamePrefix,
+ InterestManager::expressInterest(Nlsr& pnlsr,const string& interestNamePrefix,
int scope, int seconds)
{
cout<<"Expressing Interest :"<<interestNamePrefix<<endl;
ndn::Interest i((ndn::Name(interestNamePrefix)));
//i.setScope(scope);
- i.setInterestLifetime(seconds*1000);
+ i.setInterestLifetime(time::seconds(seconds));
i.setMustBeFresh(true);
pnlsr.getNlsrFace()->expressInterest(i,
ndn::func_lib::bind(&DataManager::processContent,
&pnlsr.getDm(), boost::ref(pnlsr),_1, _2,boost::ref(*this)),
- ndn::func_lib::bind(&interestManager::processInterestTimedOut,
+ ndn::func_lib::bind(&InterestManager::processInterestTimedOut,
this,boost::ref(pnlsr),_1));
}
void
- interestManager::sendScheduledInfoInterest(Nlsr& pnlsr, int seconds)
+ InterestManager::sendScheduledInfoInterest(Nlsr& pnlsr, int seconds)
{
std::list<Adjacent> adjList=pnlsr.getAdl().getAdjList();
for(std::list<Adjacent>::iterator it=adjList.begin(); it!=adjList.end(); ++it)
{
- string adjName=(*it).getAdjacentName()+"/"+"info"+
+ string adjName=(*it).getName()+"/"+"info"+
pnlsr.getConfParameter().getRouterPrefix();
expressInterest( pnlsr,adjName,2,
pnlsr.getConfParameter().getInterestResendTime());
@@ -326,10 +329,10 @@
}
void
- interestManager::scheduleInfoInterest(Nlsr& pnlsr, int seconds)
+ InterestManager::scheduleInfoInterest(Nlsr& pnlsr, int seconds)
{
EventId eid=pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(seconds),
- ndn::bind(&interestManager::sendScheduledInfoInterest, this,
+ ndn::bind(&InterestManager::sendScheduledInfoInterest, this,
boost::ref(pnlsr),seconds));
}
diff --git a/src/communication/nlsr_im.hpp b/src/communication/nlsr_im.hpp
index c150e8f..5b74174 100644
--- a/src/communication/nlsr_im.hpp
+++ b/src/communication/nlsr_im.hpp
@@ -13,30 +13,30 @@
class Nlsr;
- class interestManager
+ class InterestManager
{
public:
- interestManager()
+ InterestManager()
{
}
- void processInterest(Nlsr& pnlsr, const ndn::Name &name,
- const ndn::Interest &interest);
+ void processInterest(Nlsr& pnlsr, const ndn::Name& name,
+ const ndn::Interest& interest);
void processInterestInfo(Nlsr& pnlsr, string& neighbor,
- const ndn::Interest &interest);
- void processInterestLsa(Nlsr& pnlsr,const ndn::Interest &interest);
- void processInterestForNameLsa(Nlsr& pnlsr, const ndn::Interest &interest,
+ const ndn::Interest& interest);
+ void processInterestLsa(Nlsr& pnlsr,const ndn::Interest& interest);
+ void processInterestForNameLsa(Nlsr& pnlsr, const ndn::Interest& interest,
string lsaKey, uint32_t interestedlsSeqNo);
- void processInterestForAdjLsa(Nlsr& pnlsr, const ndn::Interest &interest,
+ void processInterestForAdjLsa(Nlsr& pnlsr, const ndn::Interest& interest,
string lsaKey, uint32_t interestedlsSeqNo);
- void processInterestForCorLsa(Nlsr& pnlsr, const ndn::Interest &interest,
+ void processInterestForCorLsa(Nlsr& pnlsr, const ndn::Interest& interest,
string lsaKey, uint32_t interestedlsSeqNo);
- void processInterestKeys(Nlsr& pnlsr,const ndn::Interest &interest);
+ void processInterestKeys(Nlsr& pnlsr,const ndn::Interest& interest);
- void processInterestTimedOut(Nlsr& pnlsr, const ndn::Interest &interest);
+ void processInterestTimedOut(Nlsr& pnlsr, const ndn::Interest& interest);
void processInterestTimedOutInfo(Nlsr& pnlsr, string& neighbor,
- const ndn::Interest &interest);
- void processInterestTimedOutLsa(Nlsr& pnlsr,const ndn::Interest &interest);
+ const ndn::Interest& interest);
+ void processInterestTimedOutLsa(Nlsr& pnlsr,const ndn::Interest& interest);
void expressInterest(Nlsr& pnlsr,const string& interestNamePrefix, int scope,
int seconds);
void sendScheduledInfoInterest(Nlsr& pnlsr, int seconds);
diff --git a/src/communication/nlsr_slh.cpp b/src/communication/nlsr_slh.cpp
index 189612a..70295aa 100644
--- a/src/communication/nlsr_slh.cpp
+++ b/src/communication/nlsr_slh.cpp
@@ -2,16 +2,19 @@
#include "nlsr_slh.hpp"
#include "security/nlsr_km.hpp"
#include "utility/nlsr_tokenizer.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_slh.cpp"
namespace nlsr
{
void
- SyncLogicHandler::createSyncSocket(Nlsr &pnlsr )
+ SyncLogicHandler::createSyncSocket(Nlsr& pnlsr )
{
cout<<"Creating Sync socket ......"<<endl;
- cout<<"Sync prefix: "<<syncPrefix.toUri()<<endl;
- syncSocket=make_shared<SyncSocket>(syncPrefix, validator, syncFace,
+ cout<<"Sync prefix: "<<m_syncPrefix.toUri()<<endl;
+ m_syncSocket=make_shared<SyncSocket>(m_syncPrefix, m_validator, m_syncFace,
bind(&SyncLogicHandler::nsyncUpdateCallBack,this,
_1, _2,boost::ref(pnlsr)),
bind(&SyncLogicHandler::nsyncRemoveCallBack, this,
@@ -130,10 +133,6 @@
void
SyncLogicHandler::publishKeyUpdate(KeyManager& km)
{
- //publishSyncUpdate(km.getRootCertName().toUri(), 10);
- //publishSyncUpdate(km.getSiteCertName().toUri(), 10);
- //publishSyncUpdate(km.getOperatorCertName().toUri(), 10);
- //publishSyncUpdate(km.getRouterCertName().toUri(), km.getCertSeqNo());
publishSyncUpdate(km.getProcessCertName().toUri(),km.getCertSeqNo());
}
@@ -151,7 +150,7 @@
cout<<"Seq No: "<<seqNo<<endl;
ndn::Name updateName(updatePrefix);
string data("NoData");
- syncSocket->publishData(updateName,0,data.c_str(),data.size(),1000,seqNo);
+ m_syncSocket->publishData(updateName,0,data.c_str(),data.size(),1000,seqNo);
}
}
diff --git a/src/communication/nlsr_slh.hpp b/src/communication/nlsr_slh.hpp
index 420210d..4f90fd6 100644
--- a/src/communication/nlsr_slh.hpp
+++ b/src/communication/nlsr_slh.hpp
@@ -20,7 +20,7 @@
using namespace Sync;
using namespace std;
-class interestManager;
+class InterestManager;
class ConfParameter;
namespace nlsr
@@ -29,23 +29,23 @@
{
public:
SyncLogicHandler(ndn::shared_ptr<boost::asio::io_service> ioService)
- : validator(new ndn::ValidatorNull())
- , syncFace(new ndn::Face(ioService))
+ : m_validator(new ndn::ValidatorNull())
+ , m_syncFace(new ndn::Face(ioService))
{}
void createSyncSocket(Nlsr& pnlsr);
- void nsyncUpdateCallBack(const vector<MissingDataInfo> &v,
+ void nsyncUpdateCallBack(const vector<MissingDataInfo>& v,
SyncSocket *socket, Nlsr& pnlsr );
- void nsyncRemoveCallBack(const string& prefix, Nlsr &pnlsr);
+ void nsyncRemoveCallBack(const string& prefix, Nlsr& pnlsr);
void removeRouterFromSyncing(string& routerPrefix);
void publishRoutingUpdate(SequencingManager& sm, string updatePrefix);
void publishKeyUpdate(KeyManager& km);
void publishIdentityUpdate(string identityName);
void setSyncPrefix(string sp)
{
- syncPrefix.clear();
- syncPrefix.set(sp);
+ m_syncPrefix.clear();
+ m_syncPrefix.set(sp);
}
private:
void processUpdateFromSync(std::string updateName, uint64_t seqNo,
@@ -56,10 +56,10 @@
Nlsr& pnlsr);
void publishSyncUpdate(string updatePrefix, uint64_t seqNo);
private:
- ndn::shared_ptr<ndn::ValidatorNull> validator;
- ndn::shared_ptr<ndn::Face> syncFace;
- ndn::shared_ptr<SyncSocket> syncSocket;
- ndn::Name syncPrefix;
+ ndn::shared_ptr<ndn::ValidatorNull> m_validator;
+ ndn::shared_ptr<ndn::Face> m_syncFace;
+ ndn::shared_ptr<SyncSocket> m_syncSocket;
+ ndn::Name m_syncPrefix;
};
}
#endif