Fixing Coding Style
diff --git a/src/security/nlsr_cert_store.cpp b/src/security/nlsr_cert_store.cpp
index 897d44a..fa84ad9 100644
--- a/src/security/nlsr_cert_store.cpp
+++ b/src/security/nlsr_cert_store.cpp
@@ -4,6 +4,8 @@
#include "nlsr_wle.hpp"
#include "nlsr_km.hpp"
+#define THIS_FILE "nlsr_cert_store.cpp"
+
namespace nlsr
{
static bool
@@ -36,7 +38,7 @@
ndn::Name tmpName(respCertName);
respCertName=tmpName.getPrefix(-1).toUri();
std::pair<WaitingListEntry, bool> chkWle=
- waitingList.getWaitingListEntry(respCertName);
+ m_waitingList.getWaitingListEntry(respCertName);
if( chkWle.second )
{
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> sc=
@@ -62,7 +64,7 @@
}
//remove that entry from waiting list
- waitingList.removeFromWaitingList(respCertName);
+ m_waitingList.remove(respCertName);
}
void
@@ -75,7 +77,7 @@
else
{
ndn::SignatureSha256WithRsa signature(ncse.getCert()->getSignature());
- waitingList.addtoWaitingList(signature.getKeyLocator().getName().toUri(),
+ m_waitingList.add(signature.getKeyLocator().getName().toUri(),
ncse.getCert()->getName().toUri());
}
}
@@ -84,20 +86,20 @@
NlsrCertificateStore::addCertificate(NlsrCertificateStoreEntry & ncse)
{
std::list<NlsrCertificateStoreEntry>::iterator it =
- std::find_if( certTable.begin(), certTable.end(),
+ std::find_if( m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompare, _1, ncse));
- if(it == certTable.end())
+ if(it == m_certTable.end())
{
- certTable.push_back(ncse);
+ m_certTable.push_back(ncse);
updateWaitingList(ncse);
return true;
}
- else if( it != certTable.end() )
+ else if( it != m_certTable.end() )
{
if ( (*it).getCertSeqNum() < ncse.getCertSeqNum() )
{
- certTable.erase(it);
- certTable.push_back(ncse);
+ m_certTable.erase(it);
+ m_certTable.push_back(ncse);
updateWaitingList(ncse);
return true;
}
@@ -117,9 +119,9 @@
NlsrCertificateStore::getCertificateSeqNum(std::string certName)
{
std::list<NlsrCertificateStoreEntry>::iterator it =
- std::find_if( certTable.begin(), certTable.end(),
+ std::find_if( m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
- if(it == certTable.end())
+ if(it == m_certTable.end())
{
return std::make_pair(0,false);
}
@@ -133,9 +135,9 @@
bool isVerified)
{
std::list<NlsrCertificateStoreEntry>::iterator it =
- std::find_if( certTable.begin(), certTable.end(),
+ std::find_if( m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
- if(it != certTable.end())
+ if(it != m_certTable.end())
{
it->setIsSignerVerified(true);
}
@@ -145,9 +147,9 @@
NlsrCertificateStore::getCertificateIsVerified( std::string certName )
{
std::list<NlsrCertificateStoreEntry>::iterator it =
- std::find_if( certTable.begin(), certTable.end(),
+ std::find_if( m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
- if(it != certTable.end())
+ if(it != m_certTable.end())
{
return it->getIsSignerVerified();
}
@@ -159,9 +161,9 @@
NlsrCertificateStore::getCertificateFromStore(const std::string certName)
{
std::list<NlsrCertificateStoreEntry>::iterator it =
- std::find_if( certTable.begin(), certTable.end(),
+ std::find_if( m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
- if(it == certTable.end())
+ if(it == m_certTable.end())
{
ndn::shared_ptr<ndn::IdentityCertificate> cert=
ndn::make_shared<ndn::IdentityCertificate>();
@@ -175,9 +177,9 @@
const std::string certName, int checkSeqNum)
{
std::list<NlsrCertificateStoreEntry>::iterator it =
- std::find_if( certTable.begin(), certTable.end(),
+ std::find_if( m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
- if(it == certTable.end())
+ if(it == m_certTable.end())
{
ndn::shared_ptr<ndn::IdentityCertificate> cert=
ndn::make_shared<ndn::IdentityCertificate>();
@@ -198,9 +200,9 @@
int checkSeqNo)
{
std::list<NlsrCertificateStoreEntry>::iterator it =
- std::find_if( certTable.begin(), certTable.end(),
+ std::find_if( m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
- if(it != certTable.end())
+ if(it != m_certTable.end())
{
return (*it).getCertSeqNum() < checkSeqNo ;
}
@@ -211,24 +213,24 @@
NlsrCertificateStore::removeCertificateFromStroe(const std::string certName)
{
std::list<NlsrCertificateStoreEntry>::iterator it =
- std::find_if( certTable.begin(), certTable.end(),
+ std::find_if( m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
- if(it != certTable.end())
+ if(it != m_certTable.end())
{
- certTable.erase(it);
+ m_certTable.erase(it);
return true;
}
return false;
}
void
- NlsrCertificateStore::printCertStore()
+ NlsrCertificateStore::print()
{
std::list<NlsrCertificateStoreEntry>::iterator it;
- for(it=certTable.begin(); it!=certTable.end(); ++it)
+ for(it=m_certTable.begin(); it!=m_certTable.end(); ++it)
{
std::cout<<(*it)<<std::endl;
}
- std::cout<<waitingList<<std::endl;
+ std::cout<<m_waitingList<<std::endl;
}
}
diff --git a/src/security/nlsr_cert_store.hpp b/src/security/nlsr_cert_store.hpp
index d9c9b64..2ef4513 100644
--- a/src/security/nlsr_cert_store.hpp
+++ b/src/security/nlsr_cert_store.hpp
@@ -12,11 +12,11 @@
{
public:
NlsrCertificateStore()
- : certTable()
- , waitingList()
+ : m_certTable()
+ , m_waitingList()
{}
- bool addCertificate(NlsrCertificateStoreEntry & ncse);
+ bool addCertificate(NlsrCertificateStoreEntry& ncse);
bool addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert
, uint32_t csn, bool isv);
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
@@ -26,7 +26,7 @@
bool removeCertificateFromStroe(const std::string certName);
bool isCertificateNewInStore(const std::string certName, int checkSeqNo);
std::pair<uint32_t, bool> getCertificateSeqNum(std::string certName);
- void printCertStore();
+ void print();
void setCertificateIsVerified(std::string certName, bool isVerified);
bool getCertificateIsVerified(std::string certName);
private:
@@ -34,8 +34,8 @@
void updateWaitingList(std::string respCertName);
private:
- std::list<NlsrCertificateStoreEntry> certTable;
- WaitingList waitingList;
+ std::list<NlsrCertificateStoreEntry> m_certTable;
+ WaitingList m_waitingList;
};
}
diff --git a/src/security/nlsr_cse.cpp b/src/security/nlsr_cse.cpp
index f2f5f06..91c0150 100644
--- a/src/security/nlsr_cse.cpp
+++ b/src/security/nlsr_cse.cpp
@@ -1,6 +1,8 @@
#include <ndn-cpp-dev/security/signature-sha256-with-rsa.hpp>
#include "nlsr_cse.hpp"
+#define THIS_FILE "nlsr_cse.cpp"
+
namespace nlsr
{
std::ostream&
diff --git a/src/security/nlsr_cse.hpp b/src/security/nlsr_cse.hpp
index f91e9e2..238d511 100644
--- a/src/security/nlsr_cse.hpp
+++ b/src/security/nlsr_cse.hpp
@@ -11,52 +11,52 @@
{
public:
NlsrCertificateStoreEntry()
- : cert(ndn::make_shared<ndn::IdentityCertificate>())
- , certSeqNum(0)
- , isSignerVerified(false)
+ : m_cert(ndn::make_shared<ndn::IdentityCertificate>())
+ , m_certSeqNum(0)
+ , m_isSignerVerified(false)
{}
NlsrCertificateStoreEntry(ndn::shared_ptr<ndn::IdentityCertificate> pcert
, uint32_t csn, bool isv)
- : cert(pcert)
- , certSeqNum(csn)
- , isSignerVerified(isv)
+ : m_cert(pcert)
+ , m_certSeqNum(csn)
+ , m_isSignerVerified(isv)
{}
ndn::shared_ptr<ndn::IdentityCertificate> getCert() const
{
- return cert;
+ return m_cert;
}
void setCert(ndn::shared_ptr<ndn::IdentityCertificate> pcert)
{
- cert=pcert;
+ m_cert=pcert;
}
uint32_t getCertSeqNum() const
{
- return certSeqNum;
+ return m_certSeqNum;
}
void setCertSeqNum(uint32_t csn)
{
- certSeqNum=csn;
+ m_certSeqNum=csn;
}
bool getIsSignerVerified() const
{
- return isSignerVerified;
+ return m_isSignerVerified;
}
void setIsSignerVerified(bool isv)
{
- isSignerVerified=isv;
+ m_isSignerVerified=isv;
}
private:
- ndn::shared_ptr<ndn::IdentityCertificate> cert;
- uint32_t certSeqNum;
- bool isSignerVerified;
+ ndn::shared_ptr<ndn::IdentityCertificate> m_cert;
+ uint32_t m_certSeqNum;
+ bool m_isSignerVerified;
};
/* Debugging Purpose */
std::ostream&
diff --git a/src/security/nlsr_km.cpp b/src/security/nlsr_km.cpp
index 183e934..d357795 100644
--- a/src/security/nlsr_km.cpp
+++ b/src/security/nlsr_km.cpp
@@ -6,17 +6,19 @@
#include "nlsr_km.hpp"
#include "nlsr.hpp"
+#define THIS_FILE "nlsr_km.cpp"
+
namespace nlsr
{
bool
- KeyManager::initKeyManager(ConfParameter &cp)
+ KeyManager::initialize(ConfParameter &cp)
{
initCertSeqFromFile(cp.getSeqFileDir());
if( !loadAllCertificates(cp.getCertDir()) )
{
return false;
}
- nlsrRootKeyPrefix=cp.getRootKeyPrefix();
+ m_nlsrRootKeyPrefix=cp.getRootKeyPrefix();
string processIdentityName(cp.getRootKeyPrefix());
processIdentityName += "/";
processIdentityName += cp.getSiteName();
@@ -26,22 +28,22 @@
processIdentityName += cp.getRouterName();
ndn::Name ri(processIdentityName);
std::cout<<"Router Identity: "<<ri.toUri()<<std::endl;
- routerIdentity=ri;
+ m_routerIdentity=ri;
processIdentityName += "/";
processIdentityName += "nlsr";
cout<<"Proces Identity Name: "<<processIdentityName<<endl;
ndn::Name identityName(processIdentityName);
- processIdentity=identityName;
- ndn::KeyChain::deleteIdentity(processIdentity);
- processCertName = ndn::KeyChain::createIdentity(processIdentity);
- cout<<"Certificate Name: "<<processCertName.toUri()<<endl;
- processKeyName=processCertName.getPrefix(-2);
- cout<<"Key Name: "<<processKeyName.toUri()<<endl;
+ m_processIdentity=identityName;
+ ndn::KeyChain::deleteIdentity(m_processIdentity);
+ m_processCertName = ndn::KeyChain::createIdentity(m_processIdentity);
+ cout<<"Certificate Name: "<<m_processCertName.toUri()<<endl;
+ m_processKeyName=m_processCertName.getPrefix(-2);
+ cout<<"Key Name: "<<m_processKeyName.toUri()<<endl;
ndn::shared_ptr<ndn::IdentityCertificate> cert =
- getCertificate(processCertName);
- signByIdentity(*(cert),routerIdentity);
- certStore.addCertificate(cert, certSeqNo, true);
- certStore.printCertStore();
+ getCertificate(m_processCertName);
+ signByIdentity(*(cert),m_routerIdentity);
+ m_certStore.addCertificate(cert, m_certSeqNo, true);
+ m_certStore.print();
return true;
}
@@ -70,35 +72,35 @@
ndn::io::load<ndn::IdentityCertificate>(inputFile, ndn::io::BASE_64);
ndn::Name certName=cert->getName();
switch(keyType)
- {
+ {
case KEY_TYPE_ROOT:
- certStore.addCertificate(cert, 10, true);
- rootCertName=certName;
- std::cout<<"Root Cert: "<<rootCertName<<std::endl;
+ m_certStore.addCertificate(cert, 10, true);
+ m_rootCertName=certName;
+ std::cout<<"Root Cert: "<<m_rootCertName<<std::endl;
break;
case KEY_TYPE_SITE:
- certStore.addCertificate(cert, 10, true);
- siteCertName=certName;
- std::cout<<"Site Cert: "<<siteCertName<<std::endl;
+ m_certStore.addCertificate(cert, 10, true);
+ m_siteCertName=certName;
+ std::cout<<"Site Cert: "<<m_siteCertName<<std::endl;
break;
case KEY_TYPE_OPERATOR:
- certStore.addCertificate(cert, 10, true);
- opCertName=certName;
- std::cout<<"Operator Cert: "<<opCertName<<std::endl;
+ m_certStore.addCertificate(cert, 10, true);
+ m_opCertName=certName;
+ std::cout<<"Operator Cert: "<<m_opCertName<<std::endl;
break;
case KEY_TYPE_ROUTER:
- certStore.addCertificate(cert, certSeqNo, true);
- routerCertName=certName;
- std::cout<<"Router Cert: "<<routerCertName<<std::endl;
+ m_certStore.addCertificate(cert, m_certSeqNo, true);
+ m_routerCertName=certName;
+ std::cout<<"Router Cert: "<<m_routerCertName<<std::endl;
break;
case KEY_TYPE_PROCESS:
- certStore.addCertificate(cert, certSeqNo, true);
- processCertName=certName;
- std::cout<<"Process Cert: "<<processCertName<<std::endl;
+ m_certStore.addCertificate(cert, m_certSeqNo, true);
+ m_processCertName=certName;
+ std::cout<<"Process Cert: "<<m_processCertName<<std::endl;
break;
default:
break;
- }
+ }
return true;
}
catch(std::exception& e)
@@ -111,65 +113,65 @@
ndn::Name
KeyManager::getProcessCertName()
{
- return processCertName;
+ return m_processCertName;
}
ndn::Name
KeyManager::getRouterCertName()
{
- return routerCertName;
+ return m_routerCertName;
}
ndn::Name
KeyManager::getOperatorCertName()
{
- return opCertName;
+ return m_opCertName;
}
ndn::Name
KeyManager::getSiteCertName()
{
- return siteCertName;
+ return m_siteCertName;
}
ndn::Name
KeyManager::getRootCertName()
{
- return rootCertName;
+ return m_rootCertName;
}
uint32_t
KeyManager::getCertSeqNo()
{
- return certSeqNo;
+ return m_certSeqNo;
}
void
KeyManager::setCerSeqNo(uint32_t csn)
{
- certSeqNo=csn;
+ m_certSeqNo=csn;
}
void
KeyManager::initCertSeqFromFile(string certSeqFileDir)
{
- certSeqFileNameWithPath=certSeqFileDir;
- if( certSeqFileNameWithPath.empty() )
+ m_certSeqFileNameWithPath=certSeqFileDir;
+ if( m_certSeqFileNameWithPath.empty() )
{
SequencingManager sm;
- certSeqFileNameWithPath=sm.getUserHomeDirectory();
+ m_certSeqFileNameWithPath=sm.getUserHomeDirectory();
}
- certSeqFileNameWithPath += "/nlsrCertSeqNo.txt";
- cout<<"Key Seq File Name: "<< certSeqFileNameWithPath<<endl;
- std::ifstream inputFile(certSeqFileNameWithPath.c_str(),ios::binary);
+ m_certSeqFileNameWithPath += "/nlsrCertSeqNo.txt";
+ cout<<"Key Seq File Name: "<< m_certSeqFileNameWithPath<<endl;
+ std::ifstream inputFile(m_certSeqFileNameWithPath.c_str(),ios::binary);
if ( inputFile.good() )
{
- inputFile>>certSeqNo;
- certSeqNo++;
+ inputFile>>m_certSeqNo;
+ m_certSeqNo++;
}
else
{
- certSeqNo=1;
+ m_certSeqNo=1;
}
writeCertSeqToFile();
}
@@ -177,40 +179,40 @@
void
KeyManager::writeCertSeqToFile()
{
- std::ofstream outputFile(certSeqFileNameWithPath.c_str(),ios::binary);
- outputFile<<certSeqNo;
+ std::ofstream outputFile(m_certSeqFileNameWithPath.c_str(),ios::binary);
+ outputFile<<m_certSeqNo;
outputFile.close();
}
bool
KeyManager::isNewCertificate(std::string certName, int checkSeqNum)
{
- return certStore.isCertificateNewInStore(certName,checkSeqNum);
+ return m_certStore.isCertificateNewInStore(certName,checkSeqNum);
}
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
KeyManager::getCertificateFromStore(const std::string certName, int checkSeqNum)
{
- return certStore.getCertificateFromStore(certName, checkSeqNum);
+ return m_certStore.getCertificateFromStore(certName, checkSeqNum);
}
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
KeyManager::getCertificateFromStore(const std::string certName)
{
- return certStore.getCertificateFromStore(certName);
+ return m_certStore.getCertificateFromStore(certName);
}
bool
KeyManager::addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert
, uint32_t csn, bool isv)
{
- return certStore.addCertificate(pcert, csn, isv);
+ return m_certStore.addCertificate(pcert, csn, isv);
}
std::pair<uint32_t, bool>
KeyManager::getCertificateSeqNum(std::string certName)
{
- return certStore.getCertificateSeqNum(certName);
+ return m_certStore.getCertificateSeqNum(certName);
}
nlsrKeyType
@@ -221,7 +223,7 @@
std::string opHandle("O.Start");
std::string routerHandle("R.Start");
std::string processHandle("nlsr");
- if ( nt.getTokenString(0,nt.getTokenPosition(KEY)-1) == nlsrRootKeyPrefix)
+ if ( nt.getTokenString(0,nt.getTokenPosition(KEY)-1) == m_nlsrRootKeyPrefix)
{
return KEY_TYPE_ROOT;
}
@@ -249,7 +251,7 @@
KeyManager::getRouterName(const std::string name)
{
std::string routerName;
- std::string rkp(nlsrRootKeyPrefix);
+ std::string rkp(m_nlsrRootKeyPrefix);
nlsrTokenizer ntRkp(rkp,"/");
nlsrTokenizer nt(name,"/");
std::string KEY("KEY");
@@ -295,7 +297,7 @@
{
std::string siteName;
std::string routerName;
- std::string rkp(nlsrRootKeyPrefix);
+ std::string rkp(m_nlsrRootKeyPrefix);
nlsrTokenizer ntRkp(rkp,"/");
nlsrTokenizer nt(name,"/");
std::string KEY("KEY");
@@ -324,7 +326,7 @@
{
std::string rName;
nlsrTokenizer nt(name,"/");
- std::string rkp(nlsrRootKeyPrefix);
+ std::string rkp(m_nlsrRootKeyPrefix);
nlsrTokenizer ntRkp(rkp,"/");
rName=nt.getTokenString(0,ntRkp.getTokenNumber()-1);
return rName;
@@ -356,37 +358,37 @@
}
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> signee=
- certStore.getCertificateFromStore(signingCertName);
+ m_certStore.getCertificateFromStore(signingCertName);
if( signee.second )
{
switch(paketCertType)
- {
+ {
case KEY_TYPE_ROOT:
- return ((getRootName(packetName) == nlsrRootKeyPrefix) &&
+ return ((getRootName(packetName) == m_nlsrRootKeyPrefix) &&
verifySignature(packet,signee.first->getPublicKeyInfo()));
break;
case KEY_TYPE_SITE:
return ((getRootName(packetName) == getRootName(signingCertName)) &&
verifySignature(packet,signee.first->getPublicKeyInfo()) &&
- certStore.getCertificateIsVerified(signingCertName));
+ m_certStore.getCertificateIsVerified(signingCertName));
break;
case KEY_TYPE_OPERATOR:
return ((getSiteName(packetName) == getSiteName(signingCertName)) &&
verifySignature(packet,signee.first->getPublicKeyInfo()) &&
- certStore.getCertificateIsVerified(signingCertName));
+ m_certStore.getCertificateIsVerified(signingCertName));
break;
case KEY_TYPE_ROUTER:
return ((getSiteName(packetName) == getSiteName(signingCertName)) &&
verifySignature(packet,signee.first->getPublicKeyInfo()) &&
- certStore.getCertificateIsVerified(signingCertName));
+ m_certStore.getCertificateIsVerified(signingCertName));
break;
case KEY_TYPE_PROCESS:
return ((getRouterName(packetName) == getRouterName(signingCertName)) &&
verifySignature(packet,signee.first->getPublicKeyInfo()) &&
- certStore.getCertificateIsVerified(signingCertName));
+ m_certStore.getCertificateIsVerified(signingCertName));
break;
- }
+ }
}
else
{
diff --git a/src/security/nlsr_km.hpp b/src/security/nlsr_km.hpp
index 7d75fb2..291d55c 100644
--- a/src/security/nlsr_km.hpp
+++ b/src/security/nlsr_km.hpp
@@ -37,35 +37,35 @@
typedef SecTpm::Error TpmError;
public:
KeyManager()
- : certSeqNo(1)
- , certStore()
- , nlsrRootKeyPrefix()
+ : m_certSeqNo(1)
+ , m_certStore()
+ , m_nlsrRootKeyPrefix()
{
}
- bool initKeyManager(ConfParameter &cp);
+ bool initialize(ConfParameter &cp);
void
checkPolicy (const ndn::Data& data,
int stepCount,
- const ndn::OnDataValidated &onValidated,
- const ndn::OnDataValidationFailed &onValidationFailed,
- std::vector<ndn::shared_ptr<ndn::ValidationRequest> > &nextSteps)
+ const ndn::OnDataValidated& onValidated,
+ const ndn::OnDataValidationFailed& onValidationFailed,
+ std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps)
{}
void
checkPolicy (const ndn::Interest& interest,
int stepCount,
- const ndn::OnInterestValidated &onValidated,
- const ndn::OnInterestValidationFailed &onValidationFailed,
- std::vector<ndn::shared_ptr<ndn::ValidationRequest> > &nextSteps)
+ const ndn::OnInterestValidated& onValidated,
+ const ndn::OnInterestValidationFailed& onValidationFailed,
+ std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps)
{}
void signData(ndn::Data& data)
{
- ndn::KeyChain::signByIdentity(data,processIdentity);
+ ndn::KeyChain::signByIdentity(data,m_processIdentity);
}
template<typename T>
@@ -83,7 +83,7 @@
ndn::shared_ptr<ndn::IdentityCertificate>
getCertificate()
{
- return getCertificate(processCertName);
+ return getCertificate(m_processCertName);
}
ndn::Name
@@ -127,8 +127,8 @@
certificateName.append("KEY").append(
keyName.get(-1)).append("ID-CERT").appendVersion();
certificate->setName(certificateName);
- certificate->setNotBefore(ndn::getNow());
- certificate->setNotAfter(ndn::getNow() + 31536000 /* 1 year*/);
+ certificate->setNotBefore(ndn::time::system_clock::now());
+ certificate->setNotAfter(ndn::time::system_clock::now() + ndn::time::days(7300) /* 1 year*/);
certificate->setPublicKeyInfo(*pubKey);
certificate->addSubjectDescription(
ndn::CertificateSubjectDescription("2.5.4.41",
@@ -156,7 +156,7 @@
void printCertStore()
{
- certStore.printCertStore();
+ m_certStore.print();
}
private:
@@ -168,14 +168,14 @@
std::string signingCertName=signature.getKeyLocator().getName().toUri();
std::string packetName=packet.getName().toUri();
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> signee=
- certStore.getCertificateFromStore(signingCertName);
+ m_certStore.getCertificateFromStore(signingCertName);
if( signee.second )
{
std::string routerNameFromPacketName=getRouterName(packetName);
std::string routerNameFromCertName=getRouterName(signingCertName);
return ( (routerNameFromPacketName== routerNameFromCertName) &&
verifySignature(packet, signee.first->getPublicKeyInfo()) &&
- certStore.getCertificateIsVerified(signingCertName));
+ m_certStore.getCertificateIsVerified(signingCertName));
}
return false;
}
@@ -230,18 +230,18 @@
std::string getRootName(const std::string name);
private:
- ndn::Name processIdentity;
- ndn::Name routerIdentity;
- ndn::Name processCertName;
- ndn::Name routerCertName;
- ndn::Name opCertName;
- ndn::Name siteCertName;
- ndn::Name rootCertName;
- ndn::Name processKeyName;
- uint32_t certSeqNo;
- string certSeqFileNameWithPath;
- string nlsrRootKeyPrefix;
- NlsrCertificateStore certStore;
+ ndn::Name m_processIdentity;
+ ndn::Name m_routerIdentity;
+ ndn::Name m_processCertName;
+ ndn::Name m_routerCertName;
+ ndn::Name m_opCertName;
+ ndn::Name m_siteCertName;
+ ndn::Name m_rootCertName;
+ ndn::Name m_processKeyName;
+ uint32_t m_certSeqNo;
+ string m_certSeqFileNameWithPath;
+ string m_nlsrRootKeyPrefix;
+ NlsrCertificateStore m_certStore;
};
}
diff --git a/src/security/nlsr_wl.cpp b/src/security/nlsr_wl.cpp
index 39ddfe3..442afe3 100644
--- a/src/security/nlsr_wl.cpp
+++ b/src/security/nlsr_wl.cpp
@@ -1,6 +1,8 @@
#include <ndn-cpp-dev/face.hpp>
#include "nlsr_wl.hpp"
+#define THIS_FILE "nlsr_wl.cpp"
+
namespace nlsr
{
static bool
@@ -12,9 +14,9 @@
std::pair<WaitingListEntry, bool>
WaitingList::getWaitingListEntry(std::string respCert)
{
- std::list<WaitingListEntry>::iterator it = std::find_if( waitingTable.begin(),
- waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
- if( it != waitingTable.end() )
+ std::list<WaitingListEntry>::iterator it = std::find_if( m_waitingTable.begin(),
+ m_waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
+ if( it != m_waitingTable.end() )
{
return std::make_pair(*(it),true);
}
@@ -25,15 +27,15 @@
}
bool
- WaitingList::addtoWaitingList(std::string respCert, std::string waitee)
+ WaitingList::add(std::string respCert, std::string waitee)
{
- std::list<WaitingListEntry>::iterator it = std::find_if( waitingTable.begin(),
- waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
- if( it == waitingTable.end() )
+ std::list<WaitingListEntry>::iterator it = std::find_if( m_waitingTable.begin(),
+ m_waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
+ if( it == m_waitingTable.end() )
{
WaitingListEntry newWle(respCert);
newWle.addWaitee(waitee);
- waitingTable.push_back(newWle);
+ m_waitingTable.push_back(newWle);
return true;
}
else
@@ -44,17 +46,17 @@
}
bool
- WaitingList::removeFromWaitingList(std::string respCert)
+ WaitingList::remove(std::string respCert)
{
- std::list<WaitingListEntry>::iterator it = std::find_if( waitingTable.begin(),
- waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
- if( it == waitingTable.end() )
+ std::list<WaitingListEntry>::iterator it = std::find_if( m_waitingTable.begin(),
+ m_waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
+ if( it == m_waitingTable.end() )
{
return false;
}
else
{
- waitingTable.erase(it);
+ m_waitingTable.erase(it);
return true;
}
return false;
diff --git a/src/security/nlsr_wl.hpp b/src/security/nlsr_wl.hpp
index c287842..1a752ca 100644
--- a/src/security/nlsr_wl.hpp
+++ b/src/security/nlsr_wl.hpp
@@ -9,20 +9,20 @@
{
public:
WaitingList()
- : waitingTable()
+ : m_waitingTable()
{}
std::list<WaitingListEntry>& getWaitingTable()
{
- return waitingTable;
+ return m_waitingTable;
}
- bool addtoWaitingList(std::string respCert, std::string waitee);
+ bool add(std::string respCert, std::string waitee);
std::pair<WaitingListEntry, bool> getWaitingListEntry(std::string respCert);
- bool removeFromWaitingList(std::string respCert);
+ bool remove(std::string respCert);
private:
- std::list<WaitingListEntry> waitingTable;
+ std::list<WaitingListEntry> m_waitingTable;
};
std::ostream& operator<<(std::ostream& os, WaitingList wl);
diff --git a/src/security/nlsr_wle.cpp b/src/security/nlsr_wle.cpp
index df83544..37caf6d 100644
--- a/src/security/nlsr_wle.cpp
+++ b/src/security/nlsr_wle.cpp
@@ -3,6 +3,8 @@
#include <ndn-cpp-dev/face.hpp>
#include "nlsr_wle.hpp"
+#define THIS_FILE "nlsr_wle.cpp"
+
namespace nlsr
{
static bool
@@ -14,11 +16,11 @@
bool
WaitingListEntry::addWaitee(std::string waiteeName)
{
- std::list<std::string>::iterator it = std::find_if( waitingCerts.begin(),
- waitingCerts.end(),ndn::bind(&waiteeCompare, _1, waiteeName));
- if( it == waitingCerts.end() )
+ std::list<std::string>::iterator it = std::find_if( m_waitingCerts.begin(),
+ m_waitingCerts.end(),ndn::bind(&waiteeCompare, _1, waiteeName));
+ if( it == m_waitingCerts.end() )
{
- waitingCerts.push_back(waiteeName);
+ m_waitingCerts.push_back(waiteeName);
return true;
}
diff --git a/src/security/nlsr_wle.hpp b/src/security/nlsr_wle.hpp
index c8e6fd6..0647382 100644
--- a/src/security/nlsr_wle.hpp
+++ b/src/security/nlsr_wle.hpp
@@ -10,35 +10,35 @@
{
public:
WaitingListEntry()
- : responsibleCert()
- , waitingCerts()
+ : m_responsibleCert()
+ , m_waitingCerts()
{}
WaitingListEntry(std::string resCert)
- : responsibleCert(resCert)
- , waitingCerts()
+ : m_responsibleCert(resCert)
+ , m_waitingCerts()
{}
std::string getResponsibleCert() const
{
- return responsibleCert;
+ return m_responsibleCert;
}
void setResponsibleCert(std::string resCert)
{
- responsibleCert=resCert;
+ m_responsibleCert=resCert;
}
std::list<std::string> getWaitingCerts() const
{
- return waitingCerts;
+ return m_waitingCerts;
}
bool addWaitee(std::string waiteeName);
private:
- std::string responsibleCert;
- std::list<std::string> waitingCerts;
+ std::string m_responsibleCert;
+ std::list<std::string> m_waitingCerts;
};
std::ostream& operator<<(std::ostream& os, const WaitingListEntry& we);