src: Renaming class to spell out them (Adl, Nhl, Npl, Npt, Npte)
Refs: #1534
Change-Id: If4a205e8ad2419505cc796027a5c863471ef5439
diff --git a/src/communication/data-manager.cpp b/src/communication/data-manager.cpp
index 8525ce7..3a153a3 100644
--- a/src/communication/data-manager.cpp
+++ b/src/communication/data-manager.cpp
@@ -61,8 +61,7 @@
string chkString("info");
string neighbor = nt.getTokenString(0, nt.getTokenPosition(chkString) - 1);
int oldStatus = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
- int infoIntTimedOutCount = m_nlsr.getAdjacencyList().getTimedOutInterestCount(
- neighbor);
+ int infoIntTimedOutCount = m_nlsr.getAdjacencyList().getTimedOutInterestCount(neighbor);
//debugging purpose start
std::cout << "Before Updates: " << std::endl;
std::cout << "Neighbor : " << neighbor << std::endl;
@@ -72,8 +71,7 @@
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);
+ 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 86c2e42..ce10b88 100644
--- a/src/communication/data-manager.hpp
+++ b/src/communication/data-manager.hpp
@@ -1,5 +1,7 @@
-#ifndef NLSR_DM_HPP
-#define NLSR_DM_HPP
+#ifndef NLSR_DATA_MANAGER_HPP
+#define NLSR_DATA_MANAGER_HPP
+
+#include <boost/cstdint.hpp>
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/key-chain.hpp>
@@ -50,4 +52,4 @@
}//namespace nlsr
-#endif //NLSR_DM_HPP
+#endif //NLSR_DATA_MANAGER_HPP
diff --git a/src/communication/interest-manager.cpp b/src/communication/interest-manager.cpp
index edcfec7..23ce579 100644
--- a/src/communication/interest-manager.cpp
+++ b/src/communication/interest-manager.cpp
@@ -1,7 +1,6 @@
#include <iostream>
#include <cstdlib>
-
#include <ndn-cxx/security/identity-certificate.hpp>
#include <ndn-cxx/util/io.hpp>
@@ -55,7 +54,7 @@
// m_nlsr.getKeyManager().signData(data);
m_keyChain.sign(data);
cout << ">> D: " << data << endl;
- m_nlsr.getNlsrFace()->put(data);
+ m_nlsr.getNlsrFace().put(data);
int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
if (status == 0)
{
@@ -129,7 +128,7 @@
// m_nlsr.getKeyManager().signData(data);
m_keyChain.sign(data);
std::cout << ">> D: " << data << std::endl;
- m_nlsr.getNlsrFace()->put(data);
+ m_nlsr.getNlsrFace().put(data);
}
}
}
@@ -150,7 +149,7 @@
// m_nlsr.getKeyManager().signData(data);
m_keyChain.sign(data);
std::cout << ">> D: " << data << std::endl;
- m_nlsr.getNlsrFace()->put(data);
+ m_nlsr.getNlsrFace().put(data);
}
}
}
@@ -171,7 +170,7 @@
// m_nlsr.getKeyManager().signData(data);
m_keyChain.sign(data);
std::cout << ">> D: " << data << std::endl;
- m_nlsr.getNlsrFace()->put(data);
+ m_nlsr.getNlsrFace().put(data);
}
}
}
@@ -258,8 +257,7 @@
{
m_nlsr.getAdjacencyList().incrementTimedOutInterestCount(neighbor);
int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
- int infoIntTimedOutCount = m_nlsr.getAdjacencyList().getTimedOutInterestCount(
- neighbor);
+ uint32_t 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;
@@ -294,23 +292,23 @@
void
InterestManager::expressInterest(const string& interestNamePrefix,
- int scope, int seconds)
+ int32_t scope, int32_t seconds)
{
std::cout << "Expressing Interest :" << interestNamePrefix << std::endl;
ndn::Interest i((ndn::Name(interestNamePrefix)));
i.setInterestLifetime(time::seconds(seconds));
i.setMustBeFresh(true);
- m_nlsr.getNlsrFace()->expressInterest(i,
- ndn::bind(&DataManager::processContent,
- &m_nlsr.getDataManager(),
- _1, _2, boost::ref(*this)),
- ndn::bind(&InterestManager::processInterestTimedOut,
- this, _1));
+ m_nlsr.getNlsrFace().expressInterest(i,
+ ndn::bind(&DataManager::processContent,
+ &m_nlsr.getDataManager(),
+ _1, _2, boost::ref(*this)),
+ ndn::bind(&InterestManager::processInterestTimedOut,
+ this, _1));
}
void
-InterestManager::sendScheduledInfoInterest(int seconds)
+InterestManager::sendScheduledInfoInterest(int32_t seconds)
{
std::list<Adjacent> adjList = m_nlsr.getAdjacencyList().getAdjList();
for (std::list<Adjacent>::iterator it = adjList.begin(); it != adjList.end();
@@ -325,7 +323,7 @@
}
void
-InterestManager::scheduleInfoInterest(int seconds)
+InterestManager::scheduleInfoInterest(int32_t seconds)
{
EventId eid = m_nlsr.getScheduler().scheduleEvent(ndn::time::seconds(seconds),
ndn::bind(&InterestManager::sendScheduledInfoInterest, this,
diff --git a/src/communication/interest-manager.hpp b/src/communication/interest-manager.hpp
index 7fe7655..00c798b 100644
--- a/src/communication/interest-manager.hpp
+++ b/src/communication/interest-manager.hpp
@@ -1,5 +1,7 @@
-#ifndef NLSR_IM_HPP
-#define NLSR_IM_HPP
+#ifndef NLSR_INTEREST_MANAGER_HPP
+#define NLSR_INTEREST_MANAGER_HPP
+
+#include <boost/cstdint.hpp>
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/key-chain.hpp>
@@ -51,13 +53,13 @@
processInterestTimedOutLsa(const ndn::Interest& interest);
void
- expressInterest(const std::string& interestNamePrefix, int scope, int seconds);
+ expressInterest(const std::string& interestNamePrefix, int32_t scope, int32_t seconds);
void
- sendScheduledInfoInterest(int seconds);
+ sendScheduledInfoInterest(int32_t seconds);
void
- scheduleInfoInterest(int seconds);
+ scheduleInfoInterest(int32_t seconds);
private:
Nlsr& m_nlsr;
@@ -67,4 +69,4 @@
}//namespace nlsr
-#endif //NLSR_IM_HPP
+#endif //NLSR_INTEREST_MANAGER_HPP
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 51ec319..c8b5ec9 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -6,6 +6,9 @@
namespace nlsr {
+using namespace ndn;
+using namespace std;
+
void
SyncLogicHandler::createSyncSocket(Nlsr& pnlsr)
{
@@ -24,8 +27,8 @@
Sync::SyncSocket* socket, Nlsr& pnlsr)
{
std::cout << "nsyncUpdateCallBack called ...." << std::endl;
- int n = v.size();
- for (int i = 0; i < n; i++)
+ int32_t n = v.size();
+ for (int32_t i = 0; i < n; i++)
{
std::cout << "Data Name: " << v[i].prefix << " Seq: " << v[i].high.getSeq() <<
endl;
@@ -40,12 +43,12 @@
}
void
-SyncLogicHandler::removeRouterFromSyncing(string& routerPrefix)
+SyncLogicHandler::removeRouterFromSyncing(const string& routerPrefix)
{
}
void
-SyncLogicHandler::processUpdateFromSync(std::string updateName,
+SyncLogicHandler::processUpdateFromSync(const std::string& updateName,
uint64_t seqNo, Nlsr& pnlsr)
{
Tokenizer nt(updateName, "/");
@@ -66,7 +69,7 @@
}
void
-SyncLogicHandler::processRoutingUpdateFromSync(std::string routerName,
+SyncLogicHandler::processRoutingUpdateFromSync(const std::string& routerName,
uint64_t seqNo, Nlsr& pnlsr)
{
if (routerName != pnlsr.getConfParameter().getRouterPrefix())
@@ -123,7 +126,7 @@
void
SyncLogicHandler::publishRoutingUpdate(SequencingManager& sm,
- string updatePrefix)
+ const string& updatePrefix)
{
sm.writeSeqNoToFile();
publishSyncUpdate(updatePrefix, sm.getCombinedSeqNo());
@@ -136,13 +139,13 @@
// }
void
-SyncLogicHandler::publishIdentityUpdate(string identityName)
+SyncLogicHandler::publishIdentityUpdate(const string& identityName)
{
publishSyncUpdate(identityName, 0);
}
void
-SyncLogicHandler::publishSyncUpdate(string updatePrefix, uint64_t seqNo)
+SyncLogicHandler::publishSyncUpdate(const string& updatePrefix, uint64_t seqNo)
{
std::cout << "Publishing Sync Update ......" << std::endl;
std::cout << "Update in prefix: " << updatePrefix << std::endl;
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp
index 1896484..9f6badd 100644
--- a/src/communication/sync-logic-handler.hpp
+++ b/src/communication/sync-logic-handler.hpp
@@ -1,7 +1,8 @@
-#ifndef NLSR_SLH_HPP
-#define NLSR_SLH_HPP
+#ifndef NLSR_SYNC_LOGIC_HANDLER_HPP
+#define NLSR_SYNC_LOGIC_HANDLER_HPP
#include <iostream>
+#include <boost/cstdint.hpp>
#include <ndn-cxx/face.hpp>
#include <nsync/sync-socket.h>
@@ -24,7 +25,7 @@
class SyncLogicHandler
{
public:
- SyncLogicHandler(ndn::shared_ptr<boost::asio::io_service> ioService)
+ SyncLogicHandler(boost::asio::io_service& ioService)
: m_validator(new ndn::ValidatorNull())
, m_syncFace(new ndn::Face(ioService))
{}
@@ -34,26 +35,26 @@
createSyncSocket(Nlsr& pnlsr);
void
- nsyncUpdateCallBack(const vector<Sync::MissingDataInfo>& v,
+ nsyncUpdateCallBack(const std::vector<Sync::MissingDataInfo>& v,
Sync::SyncSocket* socket, Nlsr& pnlsr);
void
- nsyncRemoveCallBack(const string& prefix, Nlsr& pnlsr);
+ nsyncRemoveCallBack(const std::string& prefix, Nlsr& pnlsr);
void
- removeRouterFromSyncing(string& routerPrefix);
+ removeRouterFromSyncing(const std::string& routerPrefix);
void
- publishRoutingUpdate(SequencingManager& sm, string updatePrefix);
+ publishRoutingUpdate(SequencingManager& sm, const std::string& updatePrefix);
// void
// publishKeyUpdate(KeyManager& km);
void
- publishIdentityUpdate(string identityName);
+ publishIdentityUpdate(const std::string& identityName);
void
- setSyncPrefix(string sp)
+ setSyncPrefix(const std::string& sp)
{
m_syncPrefix.clear();
m_syncPrefix.set(sp);
@@ -61,17 +62,17 @@
private:
void
- processUpdateFromSync(std::string updateName, uint64_t seqNo, Nlsr& pnlsr);
+ processUpdateFromSync(const std::string& updateName, uint64_t seqNo, Nlsr& pnlsr);
void
- processRoutingUpdateFromSync(std::string routerName, uint64_t seqNo,
+ processRoutingUpdateFromSync(const std::string& routerName, uint64_t seqNo,
Nlsr& pnlsr);
// void
// processKeysUpdateFromSync(std::string certName, uint64_t seqNo, Nlsr& pnlsr);
void
- publishSyncUpdate(string updatePrefix, uint64_t seqNo);
+ publishSyncUpdate(const std::string& updatePrefix, uint64_t seqNo);
private:
ndn::shared_ptr<ndn::ValidatorNull> m_validator;
@@ -82,4 +83,4 @@
} //namespace nlsr
-#endif //NLSR_SLH_HPP
+#endif //NLSR_SYNC_LOGIC_HANDLER_HPP