build: == Dependency change == NLSR now depends on ndn-cxx library
Refs: #1535
Change-Id: I4c7c0c3dcfcac6ee91648a46c07e426adbb5bd20
diff --git a/src/adl.cpp b/src/adjacency-list.cpp
similarity index 78%
rename from src/adl.cpp
rename to src/adjacency-list.cpp
index 605cbd6..7f21a80 100644
--- a/src/adl.cpp
+++ b/src/adjacency-list.cpp
@@ -1,18 +1,18 @@
#include <iostream>
#include <algorithm>
-#include "adl.hpp"
+#include "adjacency-list.hpp"
#include "adjacent.hpp"
#include "nlsr.hpp"
namespace nlsr {
-Adl::Adl()
+AdjacencyList::AdjacencyList()
{
}
-Adl::~Adl()
+AdjacencyList::~AdjacencyList()
{
}
@@ -23,7 +23,7 @@
}
int
-Adl::insert(Adjacent& adj)
+AdjacencyList::insert(Adjacent& adj)
{
std::list<Adjacent>::iterator it = find(adj.getName());
if (it != m_adjList.end())
@@ -35,7 +35,7 @@
}
void
-Adl::addAdjacentsFromAdl(Adl& adl)
+AdjacencyList::addAdjacentsFromAdl(AdjacencyList& adl)
{
for (std::list<Adjacent>::iterator it = adl.getAdjList().begin();
it != adl.getAdjList().end(); ++it)
@@ -45,7 +45,7 @@
}
int
-Adl::updateAdjacentStatus(const string& adjName, int s)
+AdjacencyList::updateAdjacentStatus(const string& adjName, int s)
{
std::list<Adjacent>::iterator it = find(adjName);
if (it == m_adjList.end())
@@ -57,7 +57,7 @@
}
Adjacent
-Adl::getAdjacent(const string& adjName)
+AdjacencyList::getAdjacent(const string& adjName)
{
Adjacent adj(adjName);
std::list<Adjacent>::iterator it = find(adjName);
@@ -70,7 +70,7 @@
bool
-Adl::isEqual(Adl& adl)
+AdjacencyList::isEqual(AdjacencyList& adl)
{
if (getSize() != adl.getSize())
{
@@ -96,7 +96,7 @@
int
-Adl::updateAdjacentLinkCost(const string& adjName, double lc)
+AdjacencyList::updateAdjacentLinkCost(const string& adjName, double lc)
{
std::list<Adjacent>::iterator it = find(adjName);
if (it == m_adjList.end())
@@ -108,7 +108,7 @@
}
bool
-Adl::isNeighbor(const string& adjName)
+AdjacencyList::isNeighbor(const string& adjName)
{
std::list<Adjacent>::iterator it = find(adjName);
if (it == m_adjList.end())
@@ -119,7 +119,7 @@
}
void
-Adl::incrementTimedOutInterestCount(const string& neighbor)
+AdjacencyList::incrementTimedOutInterestCount(const string& neighbor)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it == m_adjList.end())
@@ -130,7 +130,7 @@
}
void
-Adl::setTimedOutInterestCount(const string& neighbor, int count)
+AdjacencyList::setTimedOutInterestCount(const string& neighbor, int count)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it != m_adjList.end())
@@ -140,7 +140,7 @@
}
int
-Adl::getTimedOutInterestCount(const string& neighbor)
+AdjacencyList::getTimedOutInterestCount(const string& neighbor)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it == m_adjList.end())
@@ -151,7 +151,7 @@
}
int
-Adl::getStatusOfNeighbor(const string& neighbor)
+AdjacencyList::getStatusOfNeighbor(const string& neighbor)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it == m_adjList.end())
@@ -162,7 +162,7 @@
}
void
-Adl::setStatusOfNeighbor(const string& neighbor, int status)
+AdjacencyList::setStatusOfNeighbor(const string& neighbor, int status)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it != m_adjList.end())
@@ -172,13 +172,13 @@
}
std::list<Adjacent>&
-Adl::getAdjList()
+AdjacencyList::getAdjList()
{
return m_adjList;
}
bool
-Adl::isAdjLsaBuildable(Nlsr& pnlsr)
+AdjacencyList::isAdjLsaBuildable(Nlsr& pnlsr)
{
uint32_t nbrCount = 0;
for (std::list<Adjacent>::iterator it = m_adjList.begin();
@@ -205,7 +205,7 @@
}
int
-Adl::getNumOfActiveNeighbor()
+AdjacencyList::getNumOfActiveNeighbor()
{
int actNbrCount = 0;
for (std::list<Adjacent>::iterator it = m_adjList.begin();
@@ -220,7 +220,7 @@
}
std::list<Adjacent>::iterator
-Adl::find(std::string adjName)
+AdjacencyList::find(std::string adjName)
{
Adjacent adj(adjName);
std::list<Adjacent>::iterator it = std::find_if(m_adjList.begin(),
@@ -231,7 +231,7 @@
// used for debugging purpose
void
-Adl::printAdl()
+AdjacencyList::print()
{
for (std::list<Adjacent>::iterator it = m_adjList.begin();
it != m_adjList.end(); it++)
diff --git a/src/adl.hpp b/src/adjacency-list.hpp
similarity index 86%
rename from src/adl.hpp
rename to src/adjacency-list.hpp
index 76f9280..45123df 100644
--- a/src/adl.hpp
+++ b/src/adjacency-list.hpp
@@ -1,19 +1,20 @@
#ifndef NLSR_ADL_HPP
#define NLSR_ADL_HPP
-#include <ndn-cpp-dev/face.hpp>
-#include "adjacent.hpp"
+#include <ndn-cxx/common.hpp>
#include <list>
+#include "adjacent.hpp"
+
namespace nlsr {
class Nlsr;
-class Adl
+class AdjacencyList
{
public:
- Adl();
- ~Adl();
+ AdjacencyList();
+ ~AdjacencyList();
int
insert(Adjacent& adj);
@@ -46,7 +47,7 @@
setTimedOutInterestCount(const std::string& neighbor, int count);
void
- addAdjacentsFromAdl(Adl& adl);
+ addAdjacentsFromAdl(AdjacencyList& adl);
bool
isAdjLsaBuildable(Nlsr& pnlsr);
@@ -58,7 +59,7 @@
getAdjacent(const std::string& adjName);
bool
- isEqual(Adl& adl);
+ isEqual(AdjacencyList& adl);
int
getSize()
@@ -76,7 +77,7 @@
}
void
- printAdl();
+ print();
private:
std::list<Adjacent>::iterator
diff --git a/src/adjacent.cpp b/src/adjacent.cpp
index 807eb0b..3212c1e 100644
--- a/src/adjacent.cpp
+++ b/src/adjacent.cpp
@@ -2,6 +2,7 @@
#include <string>
#include <cmath>
#include <limits>
+
#include "adjacent.hpp"
namespace nlsr {
diff --git a/src/communication/data-manager.cpp b/src/communication/data-manager.cpp
index f56dd79..8525ce7 100644
--- a/src/communication/data-manager.cpp
+++ b/src/communication/data-manager.cpp
@@ -1,9 +1,9 @@
#include <iostream>
#include <cstdlib>
-#include <ndn-cpp-dev/security/signature-sha256-with-rsa.hpp>
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
-#include <ndn-cpp-dev/util/io.hpp>
+#include <ndn-cxx/security/signature-sha256-with-rsa.hpp>
+#include <ndn-cxx/security/identity-certificate.hpp>
+#include <ndn-cxx/util/io.hpp>
#include "nlsr.hpp"
#include "data-manager.hpp"
@@ -60,18 +60,20 @@
Tokenizer nt(dataName, "/");
string chkString("info");
string neighbor = nt.getTokenString(0, nt.getTokenPosition(chkString) - 1);
- int oldStatus = m_nlsr.getAdl().getStatusOfNeighbor(neighbor);
- int infoIntTimedOutCount = m_nlsr.getAdl().getTimedOutInterestCount(neighbor);
+ int oldStatus = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
+ int infoIntTimedOutCount = m_nlsr.getAdjacencyList().getTimedOutInterestCount(
+ neighbor);
//debugging purpose start
std::cout << "Before Updates: " << std::endl;
std::cout << "Neighbor : " << neighbor << std::endl;
std::cout << "Status: " << oldStatus << std::endl;
std::cout << "Info Interest Timed out: " << infoIntTimedOutCount << std::endl;
//debugging purpose end
- m_nlsr.getAdl().setStatusOfNeighbor(neighbor, 1);
- m_nlsr.getAdl().setTimedOutInterestCount(neighbor, 0);
- int newStatus = m_nlsr.getAdl().getStatusOfNeighbor(neighbor);
- infoIntTimedOutCount = m_nlsr.getAdl().getTimedOutInterestCount(neighbor);
+ m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, 1);
+ m_nlsr.getAdjacencyList().setTimedOutInterestCount(neighbor, 0);
+ int newStatus = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
+ infoIntTimedOutCount = m_nlsr.getAdjacencyList().getTimedOutInterestCount(
+ neighbor);
//debugging purpose
std::cout << "After Updates: " << std::endl;
std::cout << "Neighbor : " << neighbor << std::endl;
diff --git a/src/communication/data-manager.hpp b/src/communication/data-manager.hpp
index ece3fca..86c2e42 100644
--- a/src/communication/data-manager.hpp
+++ b/src/communication/data-manager.hpp
@@ -1,9 +1,9 @@
#ifndef NLSR_DM_HPP
#define NLSR_DM_HPP
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include "interest-manager.hpp"
diff --git a/src/communication/interest-manager.cpp b/src/communication/interest-manager.cpp
index 070c92b..edcfec7 100644
--- a/src/communication/interest-manager.cpp
+++ b/src/communication/interest-manager.cpp
@@ -2,8 +2,8 @@
#include <cstdlib>
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
-#include <ndn-cpp-dev/util/io.hpp>
+#include <ndn-cxx/security/identity-certificate.hpp>
+#include <ndn-cxx/util/io.hpp>
#include "nlsr.hpp"
#include "interest-manager.hpp"
@@ -47,7 +47,7 @@
InterestManager::processInterestInfo(const string& neighbor,
const ndn::Interest& interest)
{
- if (m_nlsr.getAdl().isNeighbor(neighbor))
+ if (m_nlsr.getAdjacencyList().isNeighbor(neighbor))
{
Data data(ndn::Name(interest.getName()).appendVersion());
data.setFreshnessPeriod(time::seconds(10)); // 10 sec
@@ -56,7 +56,7 @@
m_keyChain.sign(data);
cout << ">> D: " << data << endl;
m_nlsr.getNlsrFace()->put(data);
- int status = m_nlsr.getAdl().getStatusOfNeighbor(neighbor);
+ int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
if (status == 0)
{
string intName = neighbor + "/" + "info" +
@@ -256,9 +256,10 @@
InterestManager::processInterestTimedOutInfo(const string& neighbor,
const ndn::Interest& interest)
{
- m_nlsr.getAdl().incrementTimedOutInterestCount(neighbor);
- int status = m_nlsr.getAdl().getStatusOfNeighbor(neighbor);
- int infoIntTimedOutCount = m_nlsr.getAdl().getTimedOutInterestCount(neighbor);
+ m_nlsr.getAdjacencyList().incrementTimedOutInterestCount(neighbor);
+ int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
+ int infoIntTimedOutCount = m_nlsr.getAdjacencyList().getTimedOutInterestCount(
+ neighbor);
std::cout << "Neighbor: " << neighbor << std::endl;
std::cout << "Status: " << status << std::endl;
std::cout << "Info Interest Timed out: " << infoIntTimedOutCount << std::endl;
@@ -272,7 +273,7 @@
else if ((status == 1) &&
(infoIntTimedOutCount == m_nlsr.getConfParameter().getInterestRetryNumber()))
{
- m_nlsr.getAdl().setStatusOfNeighbor(neighbor, 0);
+ m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, 0);
m_nlsr.incrementAdjBuildCount();
if (m_nlsr.getIsBuildAdjLsaSheduled() == 0)
{
@@ -301,7 +302,7 @@
i.setMustBeFresh(true);
m_nlsr.getNlsrFace()->expressInterest(i,
ndn::bind(&DataManager::processContent,
- &m_nlsr.getDm(),
+ &m_nlsr.getDataManager(),
_1, _2, boost::ref(*this)),
ndn::bind(&InterestManager::processInterestTimedOut,
this, _1));
@@ -311,7 +312,7 @@
void
InterestManager::sendScheduledInfoInterest(int seconds)
{
- std::list<Adjacent> adjList = m_nlsr.getAdl().getAdjList();
+ std::list<Adjacent> adjList = m_nlsr.getAdjacencyList().getAdjList();
for (std::list<Adjacent>::iterator it = adjList.begin(); it != adjList.end();
++it)
{
diff --git a/src/communication/interest-manager.hpp b/src/communication/interest-manager.hpp
index 725103d..7fe7655 100644
--- a/src/communication/interest-manager.hpp
+++ b/src/communication/interest-manager.hpp
@@ -1,9 +1,9 @@
#ifndef NLSR_IM_HPP
#define NLSR_IM_HPP
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
namespace nlsr {
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 16b92bc..51ec319 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -81,8 +81,8 @@
pnlsr.getConfParameter().getChronosyncLsaPrefix() +
routerName + "/1/" +
boost::lexical_cast<std::string>(sm.getNameLsaSeq());
- pnlsr.getIm().expressInterest(lsaPrefix, 3,
- pnlsr.getConfParameter().getInterestResendTime());
+ pnlsr.getInterestManager().expressInterest(lsaPrefix, 3,
+ pnlsr.getConfParameter().getInterestResendTime());
}
if (pnlsr.getLsdb().isAdjLsaNew(routerName + "/2", sm.getAdjLsaSeq()))
{
@@ -91,8 +91,8 @@
pnlsr.getConfParameter().getChronosyncLsaPrefix() +
routerName + "/2/" +
boost::lexical_cast<std::string>(sm.getAdjLsaSeq());
- pnlsr.getIm().expressInterest(lsaPrefix, 3,
- pnlsr.getConfParameter().getInterestResendTime());
+ pnlsr.getInterestManager().expressInterest(lsaPrefix, 3,
+ pnlsr.getConfParameter().getInterestResendTime());
}
if (pnlsr.getLsdb().isCoordinateLsaNew(routerName + "/3", sm.getCorLsaSeq()))
{
@@ -101,8 +101,8 @@
pnlsr.getConfParameter().getChronosyncLsaPrefix() +
routerName + "/3/" +
boost::lexical_cast<std::string>(sm.getCorLsaSeq());
- pnlsr.getIm().expressInterest(lsaPrefix, 3,
- pnlsr.getConfParameter().getInterestResendTime());
+ pnlsr.getInterestManager().expressInterest(lsaPrefix, 3,
+ pnlsr.getConfParameter().getInterestResendTime());
}
}
}
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp
index 05123ff..1896484 100644
--- a/src/communication/sync-logic-handler.hpp
+++ b/src/communication/sync-logic-handler.hpp
@@ -3,10 +3,10 @@
#include <iostream>
-#include <ndn-cpp-dev/face.hpp>
+#include <ndn-cxx/face.hpp>
#include <nsync/sync-socket.h>
-#include <ndn-cpp-dev/security/validator-null.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
+#include <ndn-cxx/security/validator-null.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include "sequencing-manager.hpp"
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index eac9db6..fcb8d33 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -504,7 +504,7 @@
int faceId;
sst >> faceId;
Adjacent adj(nt.getFirstToken(), faceId, 0.0, 0, 0);
- m_nlsr.getAdl().insert(adj);
+ m_nlsr.getAdjacencyList().insert(adj);
}
}
return 0;
@@ -519,7 +519,7 @@
}
else
{
- m_nlsr.getNpl().insert(command);
+ m_nlsr.getNamePrefixList().insert(command);
}
return 0;
}
@@ -542,7 +542,7 @@
stringstream sst(nt.getRestOfLine().c_str());
double cost;
sst >> cost;
- m_nlsr.getAdl().updateAdjacentLinkCost(nt.getFirstToken(), cost);
+ m_nlsr.getAdjacencyList().updateAdjacentLinkCost(nt.getFirstToken(), cost);
}
return 0;
}
diff --git a/src/lsa.cpp b/src/lsa.cpp
index e2b6dcf..dac54a2 100644
--- a/src/lsa.cpp
+++ b/src/lsa.cpp
@@ -7,7 +7,7 @@
#include "nlsr.hpp"
#include "lsa.hpp"
-#include "npl.hpp"
+#include "name-prefix-list.hpp"
#include "adjacent.hpp"
#include "utility/tokenizer.hpp"
@@ -25,7 +25,8 @@
return key;
}
-NameLsa::NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl npl)
+NameLsa::NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
+ NamePrefixList npl)
{
m_origRouter = origR;
m_lsType = lst;
@@ -191,14 +192,14 @@
AdjLsa::AdjLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
- uint32_t nl , Adl padl)
+ uint32_t nl , AdjacencyList adl)
{
m_origRouter = origR;
m_lsType = lst;
m_lsSeqNo = lsn;
m_lifeTime = lt;
m_noLink = nl;
- std::list<Adjacent> al = padl.getAdjList();
+ std::list<Adjacent> al = adl.getAdjList();
for (std::list<Adjacent>::iterator it = al.begin(); it != al.end(); it++)
{
if ((*it).getStatus() == 1)
@@ -290,7 +291,8 @@
{
if (getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().addNpteByDestName(getOrigRouter(), getOrigRouter(), pnlsr);
+ pnlsr.getNamePrefixTable().addNpteByDestName(getOrigRouter(), getOrigRouter(),
+ pnlsr);
}
}
@@ -300,7 +302,7 @@
{
if (getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().removeNpte(getOrigRouter(), getOrigRouter(), pnlsr);
+ pnlsr.getNamePrefixTable().removeNpte(getOrigRouter(), getOrigRouter(), pnlsr);
}
}
diff --git a/src/lsa.hpp b/src/lsa.hpp
index c795159..1db70d7 100644
--- a/src/lsa.hpp
+++ b/src/lsa.hpp
@@ -1,10 +1,10 @@
#ifndef NLSR_LSA_HPP
#define NLSR_LSA_HPP
-#include <ndn-cpp-dev/util/scheduler.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include "adjacent.hpp"
-#include "npl.hpp"
-#include "adl.hpp"
+#include "name-prefix-list.hpp"
+#include "adjacency-list.hpp"
namespace nlsr {
class Lsa
@@ -97,9 +97,10 @@
setLsType(1);
}
- NameLsa(std::string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl npl);
+ NameLsa(std::string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
+ NamePrefixList npl);
- Npl&
+ NamePrefixList&
getNpl()
{
return m_npl;
@@ -130,7 +131,7 @@
writeLog();
private:
- Npl m_npl;
+ NamePrefixList m_npl;
};
@@ -148,9 +149,9 @@
}
AdjLsa(std::string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
- uint32_t nl , Adl padl);
+ uint32_t nl , AdjacencyList adl);
- Adl&
+ AdjacencyList&
getAdl()
{
return m_adl;
@@ -188,7 +189,7 @@
private:
uint32_t m_noLink;
- Adl m_adl;
+ AdjacencyList m_adl;
};
std::ostream&
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index e4bbb4f..a96cecb 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -25,10 +25,11 @@
{
NameLsa nameLsa(pnlsr.getConfParameter().getRouterPrefix()
, 1
- , pnlsr.getSm().getNameLsaSeq() + 1
+ , pnlsr.getSequencingManager().getNameLsaSeq() + 1
, pnlsr.getConfParameter().getRouterDeadInterval()
- , pnlsr.getNpl());
- pnlsr.getSm().setNameLsaSeq(pnlsr.getSm().getNameLsaSeq() + 1);
+ , pnlsr.getNamePrefixList());
+ pnlsr.getSequencingManager().setNameLsaSeq(
+ pnlsr.getSequencingManager().getNameLsaSeq() + 1);
return installNameLsa(pnlsr, nameLsa);
}
@@ -83,15 +84,17 @@
printNameLsdb();
if (nlsa.getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().addNpteByDestName(nlsa.getOrigRouter(), nlsa.getOrigRouter(),
- pnlsr);
+ pnlsr.getNamePrefixTable().addNpteByDestName(nlsa.getOrigRouter(),
+ nlsa.getOrigRouter(),
+ pnlsr);
std::list<string> nameList = nlsa.getNpl().getNameList();
for (std::list<string>::iterator it = nameList.begin(); it != nameList.end();
it++)
{
if ((*it) != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().addNpteByDestName((*it), nlsa.getOrigRouter(), pnlsr);
+ pnlsr.getNamePrefixTable().addNpteByDestName((*it), nlsa.getOrigRouter(),
+ pnlsr);
}
}
}
@@ -127,7 +130,8 @@
{
if ((*it) != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().addNpteByDestName((*it), nlsa.getOrigRouter(), pnlsr);
+ pnlsr.getNamePrefixTable().addNpteByDestName((*it), nlsa.getOrigRouter(),
+ pnlsr);
}
}
}
@@ -145,7 +149,7 @@
{
if ((*it) != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().removeNpte((*it), nlsa.getOrigRouter(), pnlsr);
+ pnlsr.getNamePrefixTable().removeNpte((*it), nlsa.getOrigRouter(), pnlsr);
}
}
}
@@ -191,13 +195,14 @@
(*it).writeLog();
if ((*it).getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().removeNpte((*it).getOrigRouter(), (*it).getOrigRouter(), pnlsr);
+ pnlsr.getNamePrefixTable().removeNpte((*it).getOrigRouter(),
+ (*it).getOrigRouter(), pnlsr);
for (std::list<string>::iterator nit = (*it).getNpl().getNameList().begin();
nit != (*it).getNpl().getNameList().end(); ++nit)
{
if ((*nit) != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().removeNpte((*nit), (*it).getOrigRouter(), pnlsr);
+ pnlsr.getNamePrefixTable().removeNpte((*nit), (*it).getOrigRouter(), pnlsr);
}
}
}
@@ -245,11 +250,12 @@
{
CoordinateLsa corLsa(pnlsr.getConfParameter().getRouterPrefix()
, 3
- , pnlsr.getSm().getCorLsaSeq() + 1
+ , pnlsr.getSequencingManager().getCorLsaSeq() + 1
, pnlsr.getConfParameter().getRouterDeadInterval()
, pnlsr.getConfParameter().getCorR()
, pnlsr.getConfParameter().getCorTheta());
- pnlsr.getSm().setCorLsaSeq(pnlsr.getSm().getCorLsaSeq() + 1);
+ pnlsr.getSequencingManager().setCorLsaSeq(
+ pnlsr.getSequencingManager().getCorLsaSeq() + 1);
installCoordinateLsa(pnlsr, corLsa);
return true;
}
@@ -306,8 +312,9 @@
printCorLsdb(); //debugging purpose
if (clsa.getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().addNpteByDestName(clsa.getOrigRouter(), clsa.getOrigRouter(),
- pnlsr);
+ pnlsr.getNamePrefixTable().addNpteByDestName(clsa.getOrigRouter(),
+ clsa.getOrigRouter(),
+ pnlsr);
}
if (pnlsr.getConfParameter().getIsHyperbolicCalc() >= 1)
{
@@ -375,7 +382,8 @@
{
if ((*it).getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix())
{
- pnlsr.getNpt().removeNpte((*it).getOrigRouter(), (*it).getOrigRouter(), pnlsr);
+ pnlsr.getNamePrefixTable().removeNpte((*it).getOrigRouter(),
+ (*it).getOrigRouter(), pnlsr);
}
m_corLsdb.erase(it);
return true;
@@ -422,12 +430,12 @@
{
cout << "scheduledAdjLsaBuild Called" << endl;
pnlsr.setIsBuildAdjLsaSheduled(0);
- if (pnlsr.getAdl().isAdjLsaBuildable(pnlsr))
+ if (pnlsr.getAdjacencyList().isAdjLsaBuildable(pnlsr))
{
int adjBuildCount = pnlsr.getAdjBuildCount();
if (adjBuildCount > 0)
{
- if (pnlsr.getAdl().getNumOfActiveNeighbor() > 0)
+ if (pnlsr.getAdjacencyList().getNumOfActiveNeighbor() > 0)
{
buildAndInstallOwnAdjLsa(pnlsr);
}
@@ -557,14 +565,16 @@
{
AdjLsa adjLsa(pnlsr.getConfParameter().getRouterPrefix()
, 2
- , pnlsr.getSm().getAdjLsaSeq() + 1
+ , pnlsr.getSequencingManager().getAdjLsaSeq() + 1
, pnlsr.getConfParameter().getRouterDeadInterval()
- , pnlsr.getAdl().getNumOfActiveNeighbor()
- , pnlsr.getAdl());
- pnlsr.getSm().setAdjLsaSeq(pnlsr.getSm().getAdjLsaSeq() + 1);
+ , pnlsr.getAdjacencyList().getNumOfActiveNeighbor()
+ , pnlsr.getAdjacencyList());
+ pnlsr.getSequencingManager().setAdjLsaSeq(
+ pnlsr.getSequencingManager().getAdjLsaSeq() + 1);
string lsaPrefix = pnlsr.getConfParameter().getChronosyncLsaPrefix()
+ pnlsr.getConfParameter().getRouterPrefix();
- pnlsr.getSlh().publishRoutingUpdate(pnlsr.getSm(), lsaPrefix);
+ pnlsr.getSyncLogicHandler().publishRoutingUpdate(pnlsr.getSequencingManager(),
+ lsaPrefix);
return pnlsr.getLsdb().installAdjLsa(pnlsr, adjLsa);
}
@@ -630,12 +640,13 @@
chkNameLsa->writeLog();
cout << "Own Name LSA, so refreshing name LSA" << endl;
chkNameLsa->setLsSeqNo(chkNameLsa->getLsSeqNo() + 1);
- pnlsr.getSm().setNameLsaSeq(chkNameLsa->getLsSeqNo());
+ pnlsr.getSequencingManager().setNameLsaSeq(chkNameLsa->getLsSeqNo());
chkNameLsa->writeLog();
// publish routing update
string lsaPrefix = pnlsr.getConfParameter().getChronosyncLsaPrefix()
+ pnlsr.getConfParameter().getRouterPrefix();
- pnlsr.getSlh().publishRoutingUpdate(pnlsr.getSm(), lsaPrefix);
+ pnlsr.getSyncLogicHandler().publishRoutingUpdate(pnlsr.getSequencingManager(),
+ lsaPrefix);
}
else
{
@@ -661,11 +672,12 @@
{
cout << "Own Adj LSA, so refreshing Adj LSA" << endl;
chkAdjLsa->setLsSeqNo(chkAdjLsa->getLsSeqNo() + 1);
- pnlsr.getSm().setAdjLsaSeq(chkAdjLsa->getLsSeqNo());
+ pnlsr.getSequencingManager().setAdjLsaSeq(chkAdjLsa->getLsSeqNo());
// publish routing update
string lsaPrefix = pnlsr.getConfParameter().getChronosyncLsaPrefix()
+ pnlsr.getConfParameter().getRouterPrefix();
- pnlsr.getSlh().publishRoutingUpdate(pnlsr.getSm(), lsaPrefix);
+ pnlsr.getSyncLogicHandler().publishRoutingUpdate(pnlsr.getSequencingManager(),
+ lsaPrefix);
}
else
{
@@ -694,11 +706,12 @@
{
cout << "Own Cor LSA, so refreshing Cor LSA" << endl;
chkCorLsa->setLsSeqNo(chkCorLsa->getLsSeqNo() + 1);
- pnlsr.getSm().setCorLsaSeq(chkCorLsa->getLsSeqNo());
+ pnlsr.getSequencingManager().setCorLsaSeq(chkCorLsa->getLsSeqNo());
// publish routing update
string lsaPrefix = pnlsr.getConfParameter().getChronosyncLsaPrefix()
+ pnlsr.getConfParameter().getRouterPrefix();
- pnlsr.getSlh().publishRoutingUpdate(pnlsr.getSm(), lsaPrefix);
+ pnlsr.getSyncLogicHandler().publishRoutingUpdate(pnlsr.getSequencingManager(),
+ lsaPrefix);
}
else
{
diff --git a/src/main.cpp b/src/main.cpp
index b074385..b6c4b5c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -33,7 +33,7 @@
while ((opt = getopt(argc, argv, "df:p:h")) != -1)
{
switch (opt)
- {
+ {
case 'f':
nlsr.setConfFileName(optarg);
break;
@@ -52,7 +52,7 @@
default:
nlsr.usage(programName);
return EXIT_FAILURE;
- }
+ }
}
ConfFileProcessor cfp(nlsr, nlsr.getConfFileName());
int res = cfp.processConfFile();
diff --git a/src/npl.cpp b/src/name-prefix-list.cpp
similarity index 63%
rename from src/npl.cpp
rename to src/name-prefix-list.cpp
index 557640f..763fc0d 100644
--- a/src/npl.cpp
+++ b/src/name-prefix-list.cpp
@@ -1,32 +1,34 @@
#include <iostream>
#include <algorithm>
-#include "npl.hpp"
+#include <ndn-cxx/common.hpp>
+
+#include "name-prefix-list.hpp"
namespace nlsr {
using namespace std;
-Npl::Npl()
+NamePrefixList::NamePrefixList()
{
}
-Npl::~Npl()
+NamePrefixList::~NamePrefixList()
{
}
static bool
-nameCompare(string& s1, string& s2)
+nameCompare(const string& s1, const string& s2)
{
return s1 == s2;
}
int
-Npl::insert(string& name)
+NamePrefixList::insert(string& name)
{
std::list<string>::iterator it = std::find_if(m_nameList.begin(),
m_nameList.end(),
- bind(&nameCompare, _1 , name));
+ ndn::bind(&nameCompare, _1 , name));
if (it != m_nameList.end())
{
return -1;
@@ -36,11 +38,11 @@
}
int
-Npl::remove(string& name)
+NamePrefixList::remove(string& name)
{
std::list<string>::iterator it = std::find_if(m_nameList.begin(),
m_nameList.end(),
- bind(&nameCompare, _1 , name));
+ ndn::bind(&nameCompare, _1 , name));
if (it != m_nameList.end())
{
m_nameList.erase(it);
@@ -49,13 +51,13 @@
}
void
-Npl::sort()
+NamePrefixList::sort()
{
m_nameList.sort();
}
void
-Npl::print()
+NamePrefixList::print()
{
int i = 1;
for (std::list<string>::iterator it = m_nameList.begin();
diff --git a/src/npl.hpp b/src/name-prefix-list.hpp
similarity index 86%
rename from src/npl.hpp
rename to src/name-prefix-list.hpp
index 91de260..9d32dde 100644
--- a/src/npl.hpp
+++ b/src/name-prefix-list.hpp
@@ -3,16 +3,16 @@
#include <list>
#include <string>
-#include <ndn-cpp-dev/face.hpp>
+
namespace nlsr {
-class Npl
+class NamePrefixList
{
public:
- Npl();
+ NamePrefixList();
- ~Npl();
+ ~NamePrefixList();
int
insert(std::string& name);
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 53a9556..f4616ce 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -2,11 +2,6 @@
#include <string>
#include <sstream>
#include <cstdio>
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
-
#include "nlsr.hpp"
@@ -28,7 +23,7 @@
Nlsr::setInterestFilterNlsr(const string& name)
{
getNlsrFace()->setInterestFilter(name,
- ndn::bind(&InterestManager::processInterest, &m_im,_1, _2),
+ ndn::bind(&InterestManager::processInterest, &m_interestManager, _1, _2),
ndn::bind(&Nlsr::registrationFailed, this, _1));
}
@@ -43,12 +38,12 @@
// {
// std::cerr << "Can not initiate/load certificate" << endl;
// }
- m_sm.setSeqFileName(m_confParam.getSeqFileDir());
- m_sm.initiateSeqNoFromFile();
+ m_sequencingManager.setSeqFileName(m_confParam.getSeqFileDir());
+ m_sequencingManager.initiateSeqNoFromFile();
/* debugging purpose start */
cout << m_confParam;
- m_adl.printAdl();
- m_npl.print();
+ m_adjacencyList.print();
+ m_namePrefixList.print();
/* debugging purpose end */
m_nlsrLsdb.buildAndInstallOwnNameLsa(boost::ref(*this));
m_nlsrLsdb.buildAndInstallOwnCoordinateLsa(boost::ref(*this));
@@ -56,10 +51,10 @@
setInterestFilterNlsr(m_confParam.getChronosyncLsaPrefix() +
m_confParam.getRouterPrefix());
setInterestFilterNlsr(m_confParam.getRootKeyPrefix());
- m_slh.setSyncPrefix(m_confParam.getChronosyncSyncPrefix());
- m_slh.createSyncSocket(boost::ref(*this));
+ m_syncLogicHandler.setSyncPrefix(m_confParam.getChronosyncSyncPrefix());
+ m_syncLogicHandler.createSyncSocket(boost::ref(*this));
// m_slh.publishKeyUpdate(m_km);
- m_im.scheduleInfoInterest(10);
+ m_interestManager.scheduleInfoInterest(10);
}
void
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index ffa4b05..f6e3ba0 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -1,19 +1,19 @@
#ifndef NLSR_HPP
#define NLSR_HPP
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include "conf-parameter.hpp"
-#include "adl.hpp"
-#include "npl.hpp"
+#include "adjacency-list.hpp"
+#include "name-prefix-list.hpp"
#include "communication/interest-manager.hpp"
#include "communication/data-manager.hpp"
#include "lsdb.hpp"
#include "sequencing-manager.hpp"
#include "route/routing-table.hpp"
-#include "route/npt.hpp"
+#include "route/name-prefix-table.hpp"
#include "route/fib.hpp"
// #include "security/key-manager.hpp"
#include "communication/sync-logic-handler.hpp"
@@ -36,11 +36,11 @@
&NullDeleter)))
, m_scheduler(*m_io)
, m_confParam()
- , m_adl()
- , m_npl()
- , m_im(*this)
- , m_dm(*this)
- , m_sm()
+ , m_adjacencyList()
+ , m_namePrefixList()
+ , m_interestManager(*this)
+ , m_dataManager(*this)
+ , m_sequencingManager()
// , m_km()
, m_isDaemonProcess(false)
, m_configFileName("nlsr.conf")
@@ -50,9 +50,9 @@
, m_isRouteCalculationScheduled(false)
, m_isRoutingTableCalculating(false)
, m_routingTable()
- , m_npt()
+ , m_namePrefixTable()
, m_fib()
- , m_slh(m_io)
+ , m_syncLogicHandler(m_io)
{}
void
@@ -97,16 +97,16 @@
return m_confParam;
}
- Adl&
- getAdl()
+ AdjacencyList&
+ getAdjacencyList()
{
- return m_adl;
+ return m_adjacencyList;
}
- Npl&
- getNpl()
+ NamePrefixList&
+ getNamePrefixList()
{
- return m_npl;
+ return m_namePrefixList;
}
ndn::shared_ptr<boost::asio::io_service>&
@@ -135,21 +135,21 @@
InterestManager&
- getIm()
+ getInterestManager()
{
- return m_im;
+ return m_interestManager;
}
DataManager&
- getDm()
+ getDataManager()
{
- return m_dm;
+ return m_dataManager;
}
SequencingManager&
- getSm()
+ getSequencingManager()
{
- return m_sm;
+ return m_sequencingManager;
}
Lsdb&
@@ -164,10 +164,10 @@
return m_routingTable;
}
- Npt&
- getNpt()
+ NamePrefixTable&
+ getNamePrefixTable()
{
- return m_npt;
+ return m_namePrefixTable;
}
Fib&
@@ -244,9 +244,9 @@
}
SyncLogicHandler&
- getSlh()
+ getSyncLogicHandler()
{
- return m_slh;
+ return m_syncLogicHandler;
}
void
@@ -257,11 +257,11 @@
ndn::shared_ptr<ndn::Face> m_nlsrFace;
ndn::Scheduler m_scheduler;
ConfParameter m_confParam;
- Adl m_adl;
- Npl m_npl;
- InterestManager m_im;
- DataManager m_dm;
- SequencingManager m_sm;
+ AdjacencyList m_adjacencyList;
+ NamePrefixList m_namePrefixList;
+ InterestManager m_interestManager;
+ DataManager m_dataManager;
+ SequencingManager m_sequencingManager;
// KeyManager m_km;
bool m_isDaemonProcess;
string m_configFileName;
@@ -276,9 +276,9 @@
bool m_isRoutingTableCalculating;
RoutingTable m_routingTable;
- Npt m_npt;
+ NamePrefixTable m_namePrefixTable;
Fib m_fib;
- SyncLogicHandler m_slh;
+ SyncLogicHandler m_syncLogicHandler;
int m_apiPort;
diff --git a/src/route/fib-entry.cpp b/src/route/fib-entry.cpp
index ddb5dbd..05bee41 100644
--- a/src/route/fib-entry.cpp
+++ b/src/route/fib-entry.cpp
@@ -7,7 +7,7 @@
using namespace std;
bool
-FibEntry::isEqualNextHops(Nhl& nhlOther)
+FibEntry::isEqualNextHops(NexthopList& nhlOther)
{
if (m_nhl.getSize() != nhlOther.getSize())
{
diff --git a/src/route/fib-entry.hpp b/src/route/fib-entry.hpp
index 66e2e8b..d320c9a 100644
--- a/src/route/fib-entry.hpp
+++ b/src/route/fib-entry.hpp
@@ -3,10 +3,10 @@
#include <list>
#include <iostream>
-#include <ndn-cpp-dev/util/scheduler.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include "nexthop.hpp"
-#include "nhl.hpp"
+#include "nexthop-list.hpp"
namespace nlsr {
@@ -37,7 +37,7 @@
return m_name;
}
- Nhl&
+ NexthopList&
getNhl()
{
return m_nhl;
@@ -80,14 +80,14 @@
}
bool
- isEqualNextHops(Nhl& nhlOther);
+ isEqualNextHops(NexthopList& nhlOther);
private:
std::string m_name;
int m_timeToRefresh;
ndn::EventId m_expiringEventId;
int m_seqNo;
- Nhl m_nhl;
+ NexthopList m_nhl;
};
std::ostream&
diff --git a/src/route/fib.cpp b/src/route/fib.cpp
index 5304d0e..1d7582b 100644
--- a/src/route/fib.cpp
+++ b/src/route/fib.cpp
@@ -1,8 +1,10 @@
#include <list>
+
+#include "nlsr.hpp"
#include "fib-entry.hpp"
#include "fib.hpp"
-#include "nhl.hpp"
-#include "nlsr.hpp"
+#include "nexthop-list.hpp"
+
namespace nlsr {
@@ -40,7 +42,8 @@
Fib::remove(Nlsr& pnlsr, string name)
{
std::list<FibEntry>::iterator it = std::find_if(m_table.begin(),
- m_table.end(), bind(&fibEntryNameCompare, _1, name));
+ m_table.end(),
+ bind(&fibEntryNameCompare, _1, name));
if (it != m_table.end())
{
for (std::list<NextHop>::iterator nhit =
@@ -56,7 +59,7 @@
void
-Fib::update(Nlsr& pnlsr, string name, Nhl& nextHopList)
+Fib::update(Nlsr& pnlsr, string name, NexthopList& nextHopList)
{
std::cout << "Fib::updateFib Called" << std::endl;
int startFace = 0;
@@ -145,7 +148,7 @@
}
int
-Fib::getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix)
+Fib::getNumberOfFacesForName(NexthopList& nextHopList, int maxFacesPerPrefix)
{
int endFace = 0;
if ((maxFacesPerPrefix == 0) || (nextHopList.getSize() <= maxFacesPerPrefix))
@@ -160,7 +163,7 @@
}
void
-Fib::removeHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId)
+Fib::removeHop(Nlsr& pnlsr, NexthopList& nl, int doNotRemoveHopFaceId)
{
for (std::list<NextHop>::iterator it = nl.getNextHopList().begin();
it != nl.getNextHopList().end(); ++it)
diff --git a/src/route/fib.hpp b/src/route/fib.hpp
index f042362..4a80c48 100644
--- a/src/route/fib.hpp
+++ b/src/route/fib.hpp
@@ -24,7 +24,7 @@
remove(Nlsr& pnlsr, string name);
void
- update(Nlsr& pnlsr, string name, Nhl& nextHopList);
+ update(Nlsr& pnlsr, string name, NexthopList& nextHopList);
void
clean(Nlsr& pnlsr);
@@ -40,10 +40,10 @@
private:
void
- removeHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId);
+ removeHop(Nlsr& pnlsr, NexthopList& nl, int doNotRemoveHopFaceId);
int
- getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix);
+ getNumberOfFacesForName(NexthopList& nextHopList, int maxFacesPerPrefix);
ndn::EventId
scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
diff --git a/src/route/map.hpp b/src/route/map.hpp
index 9c9e6e8..bdacd4d 100644
--- a/src/route/map.hpp
+++ b/src/route/map.hpp
@@ -4,7 +4,7 @@
#include <iostream>
#include <list>
-#include <ndn-cpp-dev/face.hpp>
+#include <ndn-cxx/face.hpp>
namespace nlsr {
diff --git a/src/route/npte.cpp b/src/route/name-prefix-table-entry.cpp
similarity index 86%
rename from src/route/npte.cpp
rename to src/route/name-prefix-table-entry.cpp
index 3194635..4389373 100644
--- a/src/route/npte.cpp
+++ b/src/route/name-prefix-table-entry.cpp
@@ -1,6 +1,6 @@
#include <list>
#include <utility>
-#include "npte.hpp"
+#include "name-prefix-table-entry.hpp"
#include "routing-table-entry.hpp"
#include "nexthop.hpp"
@@ -9,7 +9,7 @@
using namespace std;
void
-Npte::generateNhlfromRteList()
+NamePrefixTableEntry::generateNhlfromRteList()
{
m_nhl.reset();
for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin();
@@ -33,7 +33,7 @@
}
void
-Npte::removeRoutingTableEntry(RoutingTableEntry& rte)
+NamePrefixTableEntry::removeRoutingTableEntry(RoutingTableEntry& rte)
{
std::list<RoutingTableEntry>::iterator it = std::find_if(m_rteList.begin(),
m_rteList.end(),
@@ -45,7 +45,7 @@
}
void
-Npte::addRoutingTableEntry(RoutingTableEntry& rte)
+NamePrefixTableEntry::addRoutingTableEntry(RoutingTableEntry& rte)
{
std::list<RoutingTableEntry>::iterator it = std::find_if(m_rteList.begin(),
m_rteList.end(),
@@ -67,7 +67,7 @@
//debugging purpose
ostream&
-operator<<(ostream& os, Npte& npte)
+operator<<(ostream& os, NamePrefixTableEntry& npte)
{
os << "Name: " << npte.getNamePrefix() << endl;
std::list<RoutingTableEntry> rteList = npte.getRteList();
diff --git a/src/route/npte.hpp b/src/route/name-prefix-table-entry.hpp
similarity index 84%
rename from src/route/npte.hpp
rename to src/route/name-prefix-table-entry.hpp
index 57fdfec..7f4f83a 100644
--- a/src/route/npte.hpp
+++ b/src/route/name-prefix-table-entry.hpp
@@ -9,16 +9,16 @@
using namespace std;
-class Npte
+class NamePrefixTableEntry
{
public:
- Npte()
+ NamePrefixTableEntry()
: m_namePrefix()
, m_nhl()
{
}
- Npte(string np)
+ NamePrefixTableEntry(string np)
: m_nhl()
{
m_namePrefix = np;
@@ -55,7 +55,7 @@
return m_rteList.size();
}
- Nhl&
+ NexthopList&
getNhl()
{
return m_nhl;
@@ -73,11 +73,11 @@
private:
std::string m_namePrefix;
std::list<RoutingTableEntry> m_rteList;
- Nhl m_nhl;
+ NexthopList m_nhl;
};
std::ostream&
-operator<<(std::ostream& os, Npte& npte);
+operator<<(std::ostream& os, NamePrefixTableEntry& npte);
}//namespace nlsr
diff --git a/src/route/npt.cpp b/src/route/name-prefix-table.cpp
similarity index 69%
rename from src/route/npt.cpp
rename to src/route/name-prefix-table.cpp
index e094fe3..e37751b 100644
--- a/src/route/npt.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -2,9 +2,10 @@
#include <utility>
#include <algorithm>
-#include "npt.hpp"
-#include "npte.hpp"
#include "nlsr.hpp"
+#include "name-prefix-table.hpp"
+#include "name-prefix-table-entry.hpp"
+
namespace nlsr {
@@ -12,7 +13,7 @@
using namespace std;
static bool
-npteCompare(Npte& npte, string& name)
+npteCompare(NamePrefixTableEntry& npte, string& name)
{
return npte.getNamePrefix() == name;
}
@@ -20,13 +21,13 @@
void
-Npt::addNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
+NamePrefixTable::addNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
{
- std::list<Npte>::iterator it = std::find_if(m_npteList.begin(),
- m_npteList.end(), bind(&npteCompare, _1, name));
+ std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_npteList.begin(),
+ m_npteList.end(), bind(&npteCompare, _1, name));
if (it == m_npteList.end())
{
- Npte newEntry(name);
+ NamePrefixTableEntry newEntry(name);
newEntry.addRoutingTableEntry(rte);
newEntry.generateNhlfromRteList();
newEntry.getNhl().sort();
@@ -55,10 +56,10 @@
}
void
-Npt::removeNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
+NamePrefixTable::removeNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
{
- std::list<Npte>::iterator it = std::find_if(m_npteList.begin(),
- m_npteList.end(), bind(&npteCompare, _1, name));
+ std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_npteList.begin(),
+ m_npteList.end(), bind(&npteCompare, _1, name));
if (it != m_npteList.end())
{
string destRouter = rte.getDestination();
@@ -81,7 +82,7 @@
void
-Npt::addNpteByDestName(string name, string destRouter, Nlsr& pnlsr)
+NamePrefixTable::addNpteByDestName(string name, string destRouter, Nlsr& pnlsr)
{
RoutingTableEntry* rteCheck =
pnlsr.getRoutingTable().findRoutingTableEntry(destRouter);
@@ -97,7 +98,7 @@
}
void
-Npt::removeNpte(string name, string destRouter, Nlsr& pnlsr)
+NamePrefixTable::removeNpte(string name, string destRouter, Nlsr& pnlsr)
{
RoutingTableEntry* rteCheck =
pnlsr.getRoutingTable().findRoutingTableEntry(destRouter);
@@ -113,9 +114,10 @@
}
void
-Npt::updateWithNewRoute(Nlsr& pnlsr)
+NamePrefixTable::updateWithNewRoute(Nlsr& pnlsr)
{
- for (std::list<Npte>::iterator it = m_npteList.begin(); it != m_npteList.end();
+ for (std::list<NamePrefixTableEntry>::iterator it = m_npteList.begin();
+ it != m_npteList.end();
++it)
{
std::list<RoutingTableEntry> rteList = (*it).getRteList();
@@ -138,10 +140,11 @@
}
void
-Npt::print()
+NamePrefixTable::print()
{
std::cout << "----------------NPT----------------------" << std::endl;
- for (std::list<Npte>::iterator it = m_npteList.begin(); it != m_npteList.end();
+ for (std::list<NamePrefixTableEntry>::iterator it = m_npteList.begin();
+ it != m_npteList.end();
++it)
{
cout << (*it) << endl;
diff --git a/src/route/npt.hpp b/src/route/name-prefix-table.hpp
similarity index 81%
rename from src/route/npt.hpp
rename to src/route/name-prefix-table.hpp
index 8e6cd0a..1a59af2 100644
--- a/src/route/npt.hpp
+++ b/src/route/name-prefix-table.hpp
@@ -2,16 +2,16 @@
#define NLSR_NPT_HPP
#include <list>
-#include "npte.hpp"
+#include "name-prefix-table-entry.hpp"
#include "routing-table-entry.hpp"
namespace nlsr {
class Nlsr;
-class Npt
+class NamePrefixTable
{
public:
- Npt()
+ NamePrefixTable()
{
}
void
@@ -34,7 +34,7 @@
removeNpte(std::string name, RoutingTableEntry& rte, Nlsr& pnlsr);
private:
- std::list<Npte> m_npteList;
+ std::list<NamePrefixTableEntry> m_npteList;
};
}//namespace nlsr
diff --git a/src/route/nhl.cpp b/src/route/nexthop-list.cpp
similarity index 91%
rename from src/route/nhl.cpp
rename to src/route/nexthop-list.cpp
index 50d6303..7edb96e 100644
--- a/src/route/nhl.cpp
+++ b/src/route/nexthop-list.cpp
@@ -1,5 +1,5 @@
#include <iostream>
-#include "nhl.hpp"
+#include "nexthop-list.hpp"
#include "nexthop.hpp"
namespace nlsr {
@@ -34,7 +34,7 @@
*/
void
-Nhl::addNextHop(NextHop& nh)
+NexthopList::addNextHop(NextHop& nh)
{
std::list<NextHop>::iterator it = std::find_if(m_nexthopList.begin(),
m_nexthopList.end(),
@@ -55,7 +55,7 @@
*/
void
-Nhl::removeNextHop(NextHop& nh)
+NexthopList::removeNextHop(NextHop& nh)
{
std::list<NextHop>::iterator it = std::find_if(m_nexthopList.begin(),
m_nexthopList.end(),
@@ -67,13 +67,13 @@
}
void
-Nhl::sort()
+NexthopList::sort()
{
m_nexthopList.sort(nextHopSortingComparator);
}
ostream&
-operator<<(ostream& os, Nhl& nhl)
+operator<<(ostream& os, NexthopList& nhl)
{
std::list<NextHop> nexthopList = nhl.getNextHopList();
int i = 1;
diff --git a/src/route/nhl.hpp b/src/route/nexthop-list.hpp
similarity index 82%
rename from src/route/nhl.hpp
rename to src/route/nexthop-list.hpp
index ef43373..a8ebe7b 100644
--- a/src/route/nhl.hpp
+++ b/src/route/nexthop-list.hpp
@@ -1,7 +1,7 @@
#ifndef NLSR_NHL_HPP
#define NLSR_NHL_HPP
-#include <ndn-cpp-dev/face.hpp>
+#include <ndn-cxx/face.hpp>
#include <list>
#include <iostream>
@@ -10,15 +10,15 @@
namespace nlsr {
-class Nhl
+class NexthopList
{
public:
- Nhl()
+ NexthopList()
: m_nexthopList()
{
}
- ~Nhl()
+ ~NexthopList()
{
}
void
@@ -56,7 +56,7 @@
};
std::ostream&
-operator<<(std::ostream& os, Nhl& nhl);
+operator<<(std::ostream& os, NexthopList& nhl);
}//namespace nlsr
diff --git a/src/route/routing-table-calculator.cpp b/src/route/routing-table-calculator.cpp
index d63904e..7ec8a23 100644
--- a/src/route/routing-table-calculator.cpp
+++ b/src/route/routing-table-calculator.cpp
@@ -262,7 +262,7 @@
string nextHopRouterName =
pMap.getRouterNameByMappingNo(nextHopRouter);
int nxtHopFace =
- pnlsr.getAdl().getAdjacent(nextHopRouterName).getConnectingFace();
+ pnlsr.getAdjacencyList().getAdjacent(nextHopRouterName).getConnectingFace();
std::cout << "Dest Router: " << pMap.getRouterNameByMappingNo(i) << std::endl;
std::cout << "Next hop Router: " << nextHopRouterName << std::endl;
std::cout << "Next hop Face: " << nxtHopFace << std::endl;
@@ -401,7 +401,7 @@
{
string nextHopRouterName = pMap.getRouterNameByMappingNo(links[j]);
int nextHopFace =
- pnlsr.getAdl().getAdjacent(nextHopRouterName).getConnectingFace();
+ pnlsr.getAdjacencyList().getAdjacent(nextHopRouterName).getConnectingFace();
double distToNbr = getHyperbolicDistance(pnlsr, pMap,
sourceRouter, links[j]);
double distToDestFromNbr = getHyperbolicDistance(pnlsr,
diff --git a/src/route/routing-table-entry.hpp b/src/route/routing-table-entry.hpp
index f185e61..8877275 100644
--- a/src/route/routing-table-entry.hpp
+++ b/src/route/routing-table-entry.hpp
@@ -3,7 +3,7 @@
#include <iostream>
-#include "nhl.hpp"
+#include "nexthop-list.hpp"
namespace nlsr {
@@ -32,7 +32,7 @@
return m_destination;
}
- Nhl&
+ NexthopList&
getNhl()
{
return m_nhl;
@@ -40,7 +40,7 @@
private:
std::string m_destination;
- Nhl m_nhl;
+ NexthopList m_nhl;
};
std::ostream&
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 097e95a..2bc827c 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -7,7 +7,7 @@
#include "map.hpp"
#include "routing-table-calculator.hpp"
#include "routing-table-entry.hpp"
-#include "npt.hpp"
+#include "name-prefix-table.hpp"
namespace nlsr {
@@ -18,7 +18,7 @@
{
//debugging purpose
std::cout << pnlsr.getConfParameter() << std::endl;
- pnlsr.getNpt().print();
+ pnlsr.getNamePrefixTable().print();
pnlsr.getLsdb().printAdjLsdb();
pnlsr.getLsdb().printCorLsdb();
pnlsr.getLsdb().printNameLsdb();
@@ -50,10 +50,10 @@
calculateHypDryRoutingTable(pnlsr);
}
//need to update NPT here
- pnlsr.getNpt().updateWithNewRoute(pnlsr);
+ pnlsr.getNamePrefixTable().updateWithNewRoute(pnlsr);
//debugging purpose
printRoutingTable();
- pnlsr.getNpt().print();
+ pnlsr.getNamePrefixTable().print();
pnlsr.getFib().print();
//debugging purpose end
}
@@ -71,10 +71,10 @@
clearDryRoutingTable(); // for dry run options
// need to update NPT here
std::cout << "Calling Update NPT With new Route" << std::endl;
- pnlsr.getNpt().updateWithNewRoute(pnlsr);
+ pnlsr.getNamePrefixTable().updateWithNewRoute(pnlsr);
//debugging purpose
printRoutingTable();
- pnlsr.getNpt().print();
+ pnlsr.getNamePrefixTable().print();
pnlsr.getFib().print();
//debugging purpose end
}
diff --git a/src/sequencing-manager.hpp b/src/sequencing-manager.hpp
index 32863a3..e933567 100644
--- a/src/sequencing-manager.hpp
+++ b/src/sequencing-manager.hpp
@@ -3,7 +3,7 @@
#include <list>
#include <string>
-#include <ndn-cpp-dev/face.hpp>
+#include <ndn-cxx/face.hpp>
namespace nlsr {
class SequencingManager
diff --git a/src/utility/tokenizer.cpp b/src/utility/tokenizer.cpp
index e326c2a..52473b2 100644
--- a/src/utility/tokenizer.cpp
+++ b/src/utility/tokenizer.cpp
@@ -4,6 +4,8 @@
#include <string>
#include <algorithm>
+#include <ndn-cxx/face.hpp>
+
#include "tokenizer.hpp"
namespace nlsr {
@@ -98,7 +100,7 @@
{
std::list<string>::iterator it = std::find_if(m_tokenList.begin(),
m_tokenList.end(),
- bind(&tokenCompare, _1 , token));
+ ndn::bind(&tokenCompare, _1 , token));
if (it != m_tokenList.end())
{
return true;
diff --git a/src/utility/tokenizer.hpp b/src/utility/tokenizer.hpp
index dd6254d..8ae6f88 100644
--- a/src/utility/tokenizer.hpp
+++ b/src/utility/tokenizer.hpp
@@ -7,7 +7,6 @@
#include <string>
#include <list>
#include <vector>
-#include <ndn-cpp-dev/face.hpp>
namespace nlsr {