src: Adding log4cxx logging
Refs: #1505 Change-Id: Ib154d91f81acf3f1dd8bbcf552062a16d03fec74
This commit is contained in:
1 parent
157b0a473a
commit
674b0b1ffe
33 files changed
+521
-45
No files matched your search
@@ -14,7 +14,9 @@ general
|
||||
|
||||
; log-level is to set the levels of log for NLSR
|
||||
|
||||
log-level INFO ; default value INFO, valid value DEBUG, INFO
|
||||
log-level INFO ; default value INFO, valid value DEBUG, INFO
|
||||
log-dir /var/log/nlsr/ ; path for log directory (Absolute path)
|
||||
seq-dir /var/lib/nlsr/ ; path for sequence directory (Absolute path)
|
||||
}
|
||||
|
||||
; the neighbors section contains the configuration for router's neighbors and hello's behavior
|
||||
|
||||
+13
-1
@@ -4,10 +4,12 @@
|
||||
#include "adjacency-list.hpp"
|
||||
#include "adjacent.hpp"
|
||||
#include "nlsr.hpp"
|
||||
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("AdjacencyList");
|
||||
|
||||
using namespace std;
|
||||
|
||||
AdjacencyList::AdjacencyList()
|
||||
@@ -210,6 +212,16 @@ AdjacencyList::find(const ndn::Name& adjName)
|
||||
return it;
|
||||
}
|
||||
|
||||
void
|
||||
AdjacencyList::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("-------Adjacency List--------");
|
||||
for (std::list<Adjacent>::iterator it = m_adjList.begin();
|
||||
it != m_adjList.end(); it++) {
|
||||
(*it).writeLog();
|
||||
}
|
||||
}
|
||||
|
||||
// used for debugging purpose
|
||||
void
|
||||
AdjacencyList::print()
|
||||
|
||||
@@ -79,6 +79,9 @@ public:
|
||||
void
|
||||
print();
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
private:
|
||||
std::list<Adjacent>::iterator
|
||||
find(const ndn::Name& adjName);
|
||||
|
||||
@@ -5,9 +5,12 @@
|
||||
|
||||
|
||||
#include "adjacent.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("Adjacent");
|
||||
|
||||
using namespace std;
|
||||
|
||||
const float Adjacent::DEFAULT_LINK_COST = 10.0;
|
||||
@@ -55,6 +58,16 @@ Adjacent::compare(const ndn::Name& adjacencyName)
|
||||
return m_name == adjacencyName;
|
||||
}
|
||||
|
||||
void
|
||||
Adjacent::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("Adjacent : " << m_name);
|
||||
_LOG_DEBUG("Connecting FaceUri: " << m_connectingFaceUri);
|
||||
_LOG_DEBUG("Link Cost: " << m_linkCost);
|
||||
_LOG_DEBUG("Status: " << m_status);
|
||||
_LOG_DEBUG("Interest Timed out: " << m_interestTimedOutNo);
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os, const Adjacent& adj)
|
||||
{
|
||||
|
||||
@@ -89,6 +89,9 @@ public:
|
||||
bool
|
||||
compare(const ndn::Name& adjacencyName);
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
public:
|
||||
static const float DEFAULT_LINK_COST;
|
||||
|
||||
|
||||
@@ -2,16 +2,19 @@
|
||||
#include "sync-logic-handler.hpp"
|
||||
#include "utility/name-helper.hpp"
|
||||
#include "lsa.hpp"
|
||||
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("SyncLogicHandler");
|
||||
|
||||
using namespace ndn;
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
SyncLogicHandler::createSyncSocket(Nlsr& pnlsr)
|
||||
{
|
||||
_LOG_DEBUG("Creating Sync socket. Sync Prefix: " << m_syncPrefix);
|
||||
std::cout << "Creating Sync socket ......" << std::endl;
|
||||
std::cout << "Sync prefix: " << m_syncPrefix << std::endl;
|
||||
m_syncSocket = ndn::make_shared<Sync::SyncSocket>(m_syncPrefix, m_validator,
|
||||
@@ -26,9 +29,11 @@ void
|
||||
SyncLogicHandler::nsyncUpdateCallBack(const vector<Sync::MissingDataInfo>& v,
|
||||
Sync::SyncSocket* socket, Nlsr& pnlsr)
|
||||
{
|
||||
_LOG_DEBUG("nsyncUpdateCallBack called ....");
|
||||
std::cout << "nsyncUpdateCallBack called ...." << std::endl;
|
||||
int32_t n = v.size();
|
||||
for (int32_t i = 0; i < n; i++){
|
||||
_LOG_DEBUG("Data Name: " << v[i].prefix << " Seq: " << v[i].high.getSeq());
|
||||
std::cout << "Data Name: " << v[i].prefix << " Seq: " << v[i].high.getSeq() <<
|
||||
endl;
|
||||
processUpdateFromSync(v[i].prefix, v[i].high.getSeq(), pnlsr);
|
||||
@@ -38,6 +43,7 @@ SyncLogicHandler::nsyncUpdateCallBack(const vector<Sync::MissingDataInfo>& v,
|
||||
void
|
||||
SyncLogicHandler::nsyncRemoveCallBack(const string& prefix, Nlsr& pnlsr)
|
||||
{
|
||||
_LOG_DEBUG("nsyncRemoveCallBack called ....");
|
||||
std::cout << "nsyncRemoveCallBack called ...." << std::endl;
|
||||
}
|
||||
|
||||
@@ -67,10 +73,11 @@ SyncLogicHandler::processRoutingUpdateFromSync(const ndn::Name& routerName,
|
||||
if (routerName != pnlsr.getConfParameter().getRouterPrefix()) {
|
||||
SequencingManager sm(seqNo);
|
||||
std::cout << sm;
|
||||
std::cout << "Router Name: " << routerName << endl;
|
||||
//std::cout << "Router Name: " << routerName << endl;
|
||||
try {
|
||||
if (pnlsr.getLsdb().isNameLsaNew(rName.append("name"), sm.getNameLsaSeq())) {
|
||||
std::cout << "Updated Name LSA. Need to fetch it" << std::endl;
|
||||
_LOG_DEBUG("Updated Name LSA. Need to fetch it");
|
||||
ndn::Name interestName(pnlsr.getConfParameter().getLsaPrefix());
|
||||
interestName.append(routerName);
|
||||
interestName.append("name");
|
||||
@@ -81,6 +88,7 @@ SyncLogicHandler::processRoutingUpdateFromSync(const ndn::Name& routerName,
|
||||
if (pnlsr.getLsdb().isAdjLsaNew(rName.append("adjacency"),
|
||||
sm.getAdjLsaSeq())) {
|
||||
std::cout << "Updated Adj LSA. Need to fetch it" << std::endl;
|
||||
_LOG_DEBUG("Updated Adj LSA. Need to fetch it");
|
||||
ndn::Name interestName(pnlsr.getConfParameter().getLsaPrefix());
|
||||
interestName.append(routerName);
|
||||
interestName.append("adjacency");
|
||||
@@ -91,6 +99,7 @@ SyncLogicHandler::processRoutingUpdateFromSync(const ndn::Name& routerName,
|
||||
if (pnlsr.getLsdb().isCoordinateLsaNew(rName.append("coordinate"),
|
||||
sm.getCorLsaSeq())) {
|
||||
std::cout << "Updated Cor LSA. Need to fetch it" << std::endl;
|
||||
_LOG_DEBUG("Updated Cor LSA. Need to fetch it");
|
||||
ndn::Name interestName(pnlsr.getConfParameter().getLsaPrefix());
|
||||
interestName.append(routerName);
|
||||
interestName.append("coordinate");
|
||||
@@ -121,6 +130,7 @@ SyncLogicHandler::publishSyncUpdate(const ndn::Name& updatePrefix,
|
||||
std::cout << "Publishing Sync Update ......" << std::endl;
|
||||
std::cout << "Update in prefix: " << updatePrefix << std::endl;
|
||||
std::cout << "Seq No: " << seqNo << std::endl;
|
||||
_LOG_DEBUG("Publishing Sync Update. Prefix: " << updatePrefix << "Seq no: " << seqNo);
|
||||
ndn::Name updateName(updatePrefix);
|
||||
string data("NoData");
|
||||
m_syncSocket->publishData(updateName.toUri(), 0, data.c_str(), data.size(),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/property_tree/info_parser.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <ndn-cxx/name.hpp>
|
||||
|
||||
@@ -163,6 +164,72 @@ ConfFileProcessor::processConfSectionGeneral(boost::property_tree::ptree
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
std::string logDir = SectionAttributeTree.get<string>("log-dir");
|
||||
if (boost::filesystem::exists(logDir)) {
|
||||
if (boost::filesystem::is_directory(logDir)) {
|
||||
std::string testFileName=logDir+"/test.log";
|
||||
ofstream testOutFile;
|
||||
testOutFile.open(testFileName.c_str());
|
||||
if (testOutFile.is_open() && testOutFile.good()) {
|
||||
m_nlsr.getConfParameter().setLogDir(logDir);
|
||||
}
|
||||
else {
|
||||
std::cerr << "User does not have read and write permission on the directory";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
testOutFile.close();
|
||||
remove(testFileName.c_str());
|
||||
}
|
||||
else {
|
||||
std::cerr << "Provided path is not a directory" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cerr << "Log directory provided does not exists" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
std::cerr << "You must configure log directory" << std::endl;
|
||||
std::cerr << ex.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
std::string seqDir = SectionAttributeTree.get<string>("seq-dir");
|
||||
if (boost::filesystem::exists(seqDir)) {
|
||||
if (boost::filesystem::is_directory(seqDir)) {
|
||||
std::string testFileName=seqDir+"/test.seq";
|
||||
ofstream testOutFile;
|
||||
testOutFile.open(testFileName.c_str());
|
||||
if (testOutFile.is_open() && testOutFile.good()) {
|
||||
m_nlsr.getConfParameter().setSeqFileDir(seqDir);
|
||||
}
|
||||
else {
|
||||
std::cerr << "User does not have read and write permission on the directory";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
testOutFile.close();
|
||||
remove(testFileName.c_str());
|
||||
}
|
||||
else {
|
||||
std::cerr << "Provided path is not a directory" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cerr << "Seq directory provided does not exists" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
std::cerr << "You must configure sequence directory" << std::endl;
|
||||
std::cerr << ex.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -233,7 +300,7 @@ ConfFileProcessor::processConfSectionNeighbors(boost::property_tree::ptree
|
||||
m_nlsr.getAdjacencyList().insert(adj);
|
||||
}
|
||||
else {
|
||||
cerr << " Wrong command format ! [name /nbr/name/ \n face-uri /uri\n]";
|
||||
std::cerr << " Wrong command format ! [name /nbr/name/ \n face-uri /uri\n]";
|
||||
std::cerr << " or bad URI format" << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -336,8 +403,7 @@ ConfFileProcessor::processConfSectionAdvertising(boost::property_tree::ptree
|
||||
m_nlsr.getNamePrefixList().insert(namePrefix);
|
||||
}
|
||||
else {
|
||||
std::cerr << " Wrong command format ! [prefix /name/prefix] or bad URI";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << " Wrong command format ! [prefix /name/prefix] or bad URI" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "conf-parameter.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("ConfParameter");
|
||||
|
||||
void
|
||||
ConfParameter::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("Router Name: " << m_routerName);
|
||||
_LOG_DEBUG("Site Name: " << m_siteName);
|
||||
_LOG_DEBUG("Network: " << m_network);
|
||||
_LOG_DEBUG("Router Prefix: " << m_routerPrefix);
|
||||
_LOG_DEBUG("ChronoSync sync Prifex: " << m_chronosyncPrefix);
|
||||
_LOG_DEBUG("ChronoSync LSA prefix: " << m_lsaPrefix);
|
||||
_LOG_DEBUG("Interest Retry number: " << m_interestRetryNumber);
|
||||
_LOG_DEBUG("Interest Resend second: " << m_interestResendTime);
|
||||
_LOG_DEBUG("Info Interest Interval: " << m_infoInterestInterval);
|
||||
_LOG_DEBUG("LSA refresh time: " << m_lsaRefreshTime);
|
||||
_LOG_DEBUG("Max Faces Per Prefix: " << m_maxFacesPerPrefix);
|
||||
_LOG_DEBUG("Hyperbolic ROuting: " << m_hyperbolicState);
|
||||
_LOG_DEBUG("Hyp R: " << m_corR);
|
||||
_LOG_DEBUG("Hyp theta: " << m_corTheta);
|
||||
_LOG_DEBUG("Log Directory: " << m_logDir);
|
||||
_LOG_DEBUG("Seq Directory: " << m_seqFileDir);
|
||||
}
|
||||
|
||||
} // namespace nlsr
|
||||
+33
-14
@@ -6,6 +6,8 @@
|
||||
#include <ndn-cxx/common.hpp>
|
||||
#include <ndn-cxx/face.hpp>
|
||||
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
enum {
|
||||
@@ -255,6 +257,18 @@ public:
|
||||
return m_maxFacesPerPrefix;
|
||||
}
|
||||
|
||||
void
|
||||
setLogDir(const std::string& logDir)
|
||||
{
|
||||
m_logDir = logDir;
|
||||
}
|
||||
|
||||
const std::string&
|
||||
getLogDir()
|
||||
{
|
||||
return m_logDir;
|
||||
}
|
||||
|
||||
void
|
||||
setSeqFileDir(const std::string& ssfd)
|
||||
{
|
||||
@@ -267,6 +281,8 @@ public:
|
||||
return m_seqFileDir;
|
||||
}
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
private:
|
||||
ndn::Name m_routerName;
|
||||
@@ -295,6 +311,7 @@ private:
|
||||
|
||||
int32_t m_maxFacesPerPrefix;
|
||||
|
||||
std::string m_logDir;
|
||||
std::string m_seqFileDir;
|
||||
|
||||
};
|
||||
@@ -302,20 +319,22 @@ private:
|
||||
inline std::ostream&
|
||||
operator<<(std::ostream& os, ConfParameter& cfp)
|
||||
{
|
||||
os << "Router Name: " << cfp.getRouterName() << std::endl;
|
||||
os << "Site Name: " << cfp.getSiteName() << std::endl;
|
||||
os << "Network: " << cfp.getNetwork() << std::endl;
|
||||
os << "Router Prefix: " << cfp.getRouterPrefix() << std::endl;
|
||||
os << "ChronoSync sync Prifex: " << cfp.getChronosyncPrefix() << std::endl;
|
||||
os << "ChronoSync LSA prefix: " << cfp.getLsaPrefix() << std::endl;
|
||||
os << "Interest Retry number: " << cfp.getInterestRetryNumber() << std::endl;
|
||||
os << "Interest Resend second: " << cfp.getInterestResendTime() << std::endl;
|
||||
os << "Info Interest Interval: " << cfp.getInfoInterestInterval() << std::endl;
|
||||
os << "LSA refresh time: " << cfp.getLsaRefreshTime() << std::endl;
|
||||
os << "Max Faces Per Prefix: " << cfp.getMaxFacesPerPrefix() << std::endl;
|
||||
os << "Hyperbolic ROuting: " << cfp.getHyperbolicState() << std::endl;
|
||||
os << "Hyp R: " << cfp.getCorR() << std::endl;
|
||||
os << "Hyp theta: " << cfp.getCorTheta() << std::endl;
|
||||
os << "Router Name: " << cfp.getRouterName() << std::endl;
|
||||
os << "Site Name: " << cfp.getSiteName() << std::endl;
|
||||
os << "Network: " << cfp.getNetwork() << std::endl;
|
||||
os << "Router Prefix: " << cfp.getRouterPrefix() << std::endl;
|
||||
os << "ChronoSync sync Prifex: " << cfp.getChronosyncPrefix() << std::endl;
|
||||
os << "ChronoSync LSA prefix: " << cfp.getLsaPrefix() << std::endl;
|
||||
os << "Interest Retry number: " << cfp.getInterestRetryNumber() << std::endl;
|
||||
os << "Interest Resend second: " << cfp.getInterestResendTime() << std::endl;
|
||||
os << "Info Interest Interval: " << cfp.getInfoInterestInterval() << std::endl;
|
||||
os << "LSA refresh time: " << cfp.getLsaRefreshTime() << std::endl;
|
||||
os << "Max Faces Per Prefix: " << cfp.getMaxFacesPerPrefix() << std::endl;
|
||||
os << "Hyperbolic ROuting: " << cfp.getHyperbolicState() << std::endl;
|
||||
os << "Hyp R: " << cfp.getCorR() << std::endl;
|
||||
os << "Hyp theta: " << cfp.getCorTheta() << std::endl;
|
||||
os << "Log Directory: " << cfp.getLogDir() << std::endl;
|
||||
os << "Seq Directory: " << cfp.getSeqFileDir() << std::endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,15 +2,19 @@
|
||||
#include "lsdb.hpp"
|
||||
#include "hello-protocol.hpp"
|
||||
#include "utility/name-helper.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("HelloProtocol");
|
||||
|
||||
const std::string HelloProtocol::INFO_COMPONENT="info";
|
||||
|
||||
void
|
||||
HelloProtocol::expressInterest(const ndn::Name& interestName, uint32_t seconds)
|
||||
{
|
||||
std::cout << "Expressing Interest :" << interestName << std::endl;
|
||||
_LOG_DEBUG("Expressing Interest :" << interestName);
|
||||
ndn::Interest i(interestName);
|
||||
i.setInterestLifetime(ndn::time::seconds(seconds));
|
||||
i.setMustBeFresh(true);
|
||||
@@ -51,12 +55,14 @@ HelloProtocol::processInterest(const ndn::Name& name,
|
||||
{
|
||||
const ndn::Name interestName = interest.getName();
|
||||
std::cout << "Interest Received for Name: " << interestName << std::endl;
|
||||
_LOG_DEBUG("Interest Received for Name: " << interestName);
|
||||
if (interestName.get(-2).toUri() != INFO_COMPONENT) {
|
||||
return;
|
||||
}
|
||||
ndn::Name neighbor;
|
||||
neighbor.wireDecode(interestName.get(-1).blockFromValue());
|
||||
std::cout << "Neighbor: " << neighbor << std::endl;
|
||||
_LOG_DEBUG("Neighbor: " << neighbor);
|
||||
if (m_nlsr.getAdjacencyList().isNeighbor(neighbor)) {
|
||||
ndn::Data data(ndn::Name(interest.getName()).appendVersion());
|
||||
data.setFreshnessPeriod(ndn::time::seconds(10)); // 10 sec
|
||||
@@ -64,6 +70,7 @@ HelloProtocol::processInterest(const ndn::Name& name,
|
||||
INFO_COMPONENT.size());
|
||||
m_keyChain.sign(data);
|
||||
std::cout << ">> D: " << data << std::endl;
|
||||
_LOG_DEBUG("Sending out data for name: " << data.getName());
|
||||
m_nlsr.getNlsrFace().put(data);
|
||||
int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
|
||||
if (status == 0) {
|
||||
@@ -81,11 +88,13 @@ HelloProtocol::processInterestTimedOut(const ndn::Interest& interest)
|
||||
{
|
||||
const ndn::Name interestName(interest.getName());
|
||||
std::cout << "Interest timed out for Name: " << interestName << std::endl;
|
||||
_LOG_DEBUG("Interest timed out for Name: " << interestName);
|
||||
if (interestName.get(-2).toUri() != INFO_COMPONENT) {
|
||||
return;
|
||||
}
|
||||
ndn::Name neighbor = interestName.getPrefix(-2);
|
||||
std::cout << "Neighbor: " << neighbor << std::endl;
|
||||
_LOG_DEBUG("Neighbor: " << neighbor);
|
||||
m_nlsr.getAdjacencyList().incrementTimedOutInterestCount(neighbor);
|
||||
int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
|
||||
uint32_t infoIntTimedOutCount =
|
||||
@@ -93,6 +102,8 @@ HelloProtocol::processInterestTimedOut(const ndn::Interest& interest)
|
||||
std::cout << "Neighbor: " << neighbor << std::endl;
|
||||
std::cout << "Status: " << status << std::endl;
|
||||
std::cout << "Info Interest Timed out: " << infoIntTimedOutCount << std::endl;
|
||||
_LOG_DEBUG("Status: " << status);
|
||||
_LOG_DEBUG("Info Interest Timed out: " << infoIntTimedOutCount);
|
||||
if ((infoIntTimedOutCount < m_nlsr.getConfParameter().getInterestRetryNumber())) {
|
||||
ndn::Name interestName(neighbor);
|
||||
interestName.append(INFO_COMPONENT);
|
||||
@@ -105,6 +116,7 @@ HelloProtocol::processInterestTimedOut(const ndn::Interest& interest)
|
||||
m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, 0);
|
||||
m_nlsr.incrementAdjBuildCount();
|
||||
if (m_nlsr.getIsBuildAdjLsaSheduled() == false) {
|
||||
_LOG_DEBUG("Scheduling scheduledAdjLsaBuild");
|
||||
m_nlsr.setIsBuildAdjLsaSheduled(true);
|
||||
// event here
|
||||
m_nlsr.getScheduler().scheduleEvent(ndn::time::seconds(5),
|
||||
@@ -121,6 +133,7 @@ HelloProtocol::processContent(const ndn::Interest& interest,
|
||||
{
|
||||
ndn::Name dataName = data.getName();
|
||||
std::cout << "Data received for name: " << dataName << std::endl;
|
||||
_LOG_DEBUG("Data received for name: " << dataName);
|
||||
if (dataName.get(-3).toUri() == INFO_COMPONENT) {
|
||||
ndn::Name neighbor = dataName.getPrefix(-3);
|
||||
int oldStatus = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
|
||||
@@ -142,12 +155,14 @@ HelloProtocol::processContent(const ndn::Interest& interest,
|
||||
std::cout << "Neighbor : " << neighbor << std::endl;
|
||||
std::cout << "Status: " << newStatus << std::endl;
|
||||
std::cout << "Info Interest Timed out: " << infoIntTimedOutCount << std::endl;
|
||||
_LOG_DEBUG("Old Status: " << oldStatus << " New Status: " << newStatus);
|
||||
//debugging purpose end
|
||||
// change in Adjacency list
|
||||
if ((oldStatus - newStatus) != 0) {
|
||||
m_nlsr.incrementAdjBuildCount();
|
||||
/* Need to schedule event for Adjacency LSA building */
|
||||
if (m_nlsr.getIsBuildAdjLsaSheduled() == false) {
|
||||
_LOG_DEBUG("Scheduling scheduledAdjLsaBuild");
|
||||
m_nlsr.setIsBuildAdjLsaSheduled(true);
|
||||
// event here
|
||||
m_nlsr.getScheduler().scheduleEvent(ndn::time::seconds(5),
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#include <log4cxx/logger.h>
|
||||
#include <log4cxx/basicconfigurator.h>
|
||||
#include <log4cxx/patternlayout.h>
|
||||
#include <log4cxx/level.h>
|
||||
#include <log4cxx/helpers/exception.h>
|
||||
#include <log4cxx/rollingfileappender.h>
|
||||
|
||||
#include "logger.hpp"
|
||||
|
||||
void
|
||||
INIT_LOGGERS(const std::string& logDir)
|
||||
{
|
||||
static bool configured = false;
|
||||
if (configured) return;
|
||||
|
||||
log4cxx::PatternLayoutPtr
|
||||
layout(new log4cxx::PatternLayout("%date{yyyyMMddHHmmssSSS} %c %L: %m%n"));
|
||||
log4cxx::RollingFileAppender* rollingFileAppender =
|
||||
new log4cxx::RollingFileAppender(layout, logDir+"/nlsr.log", true);
|
||||
rollingFileAppender->setMaxFileSize("10MB");
|
||||
rollingFileAppender->setMaxBackupIndex(10);
|
||||
log4cxx::helpers::Pool p;
|
||||
rollingFileAppender->activateOptions(p);
|
||||
log4cxx::BasicConfigurator::configure(log4cxx::AppenderPtr(rollingFileAppender));
|
||||
log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getDebug());
|
||||
|
||||
configured = true;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef NLSR_LOGGER_HPP
|
||||
#define NLSR_LOGGER_HPP
|
||||
|
||||
#include <log4cxx/logger.h>
|
||||
|
||||
|
||||
#define INIT_LOGGER(name) \
|
||||
static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger(name)
|
||||
|
||||
#define _LOG_DEBUG(x) \
|
||||
LOG4CXX_DEBUG(staticModuleLogger,x)
|
||||
|
||||
#define _LOG_INFO(x) \
|
||||
LOG4CXX_INFO(staticModuleLogger, x)
|
||||
|
||||
void
|
||||
INIT_LOGGERS(const std::string& logDir);
|
||||
|
||||
#endif // NLSR_LOGGER_HPP
|
||||
+46
-1
@@ -11,10 +11,13 @@
|
||||
#include "lsa.hpp"
|
||||
#include "name-prefix-list.hpp"
|
||||
#include "adjacent.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("Lsa");
|
||||
|
||||
using namespace std;
|
||||
|
||||
const ndn::Name
|
||||
@@ -87,6 +90,18 @@ NameLsa::initializeFromContent(const std::string& content)
|
||||
void
|
||||
NameLsa::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("Name Lsa: ");
|
||||
_LOG_DEBUG(" Origination Router: " << m_origRouter);
|
||||
_LOG_DEBUG(" Ls Type: " << m_lsType);
|
||||
_LOG_DEBUG(" Ls Seq No: " << m_lsSeqNo);
|
||||
_LOG_DEBUG(" Ls Lifetime: " << m_lifeTime);
|
||||
_LOG_DEBUG(" Names: ");
|
||||
int i = 1;
|
||||
std::list<ndn::Name> nl = m_npl.getNameList();
|
||||
for (std::list<ndn::Name>::iterator it = nl.begin(); it != nl.end(); it++)
|
||||
{
|
||||
_LOG_DEBUG(" Name " << i << ": " << (*it));
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
@@ -177,6 +192,18 @@ CoordinateLsa::initializeFromContent(const std::string& content)
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CoordinateLsa::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("Cor Lsa: ");
|
||||
_LOG_DEBUG(" Origination Router: " << m_origRouter);
|
||||
_LOG_DEBUG(" Ls Type: " << m_lsType);
|
||||
_LOG_DEBUG(" Ls Seq No: " << m_lsSeqNo);
|
||||
_LOG_DEBUG(" Ls Lifetime: " << m_lifeTime);
|
||||
_LOG_DEBUG(" Hyperbolic Radius: " << m_corRad);
|
||||
_LOG_DEBUG(" Hyperbolic Theta: " << m_corRad);
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os, const CoordinateLsa& cLsa)
|
||||
{
|
||||
@@ -298,7 +325,25 @@ AdjLsa::removeNptEntries(Nlsr& pnlsr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AdjLsa::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("Adj Lsa: ");
|
||||
_LOG_DEBUG(" Origination Router: " << m_origRouter);
|
||||
_LOG_DEBUG(" Ls Type: " << m_lsType);
|
||||
_LOG_DEBUG(" Ls Seq No: " << m_lsSeqNo);
|
||||
_LOG_DEBUG(" Ls Lifetime: " << m_lifeTime);
|
||||
_LOG_DEBUG(" Adjacents: ");
|
||||
int i = 1;
|
||||
std::list<Adjacent> al = m_adl.getAdjList();
|
||||
for (std::list<Adjacent>::iterator it = al.begin(); it != al.end(); it++)
|
||||
{
|
||||
_LOG_DEBUG(" Adjacent " << i << ": ");;
|
||||
_LOG_DEBUG(" Adjacent Name: " << (*it).getName());
|
||||
_LOG_DEBUG(" Connecting FaceUri: " << (*it).getConnectingFaceUri());
|
||||
_LOG_DEBUG(" Link Cost: " << (*it).getLinkCost());
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os, AdjLsa& aLsa)
|
||||
|
||||
@@ -190,6 +190,9 @@ public:
|
||||
void
|
||||
removeNptEntries(Nlsr& pnlsr);
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
private:
|
||||
uint32_t m_noLink;
|
||||
AdjacencyList m_adl;
|
||||
@@ -249,6 +252,9 @@ public:
|
||||
bool
|
||||
isEqualContent(const CoordinateLsa& clsa);
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
private:
|
||||
double m_corRad;
|
||||
double m_corTheta;
|
||||
|
||||
+65
-14
@@ -5,9 +5,12 @@
|
||||
#include "nlsr.hpp"
|
||||
#include "conf-parameter.hpp"
|
||||
#include "utility/name-helper.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("Lsdb");
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
@@ -77,7 +80,9 @@ Lsdb::installNameLsa(NameLsa& nlsa)
|
||||
NameLsa* chkNameLsa = findNameLsa(nlsa.getKey());
|
||||
if (chkNameLsa == 0) {
|
||||
addNameLsa(nlsa);
|
||||
_LOG_DEBUG("New Name LSA. Adding to LSDB");
|
||||
nlsa.writeLog();
|
||||
|
||||
printNameLsdb();
|
||||
if (nlsa.getOrigRouter() != m_nlsr.getConfParameter().getRouterPrefix()) {
|
||||
m_nlsr.getNamePrefixTable().addEntry(nlsa.getOrigRouter(),
|
||||
@@ -99,6 +104,8 @@ Lsdb::installNameLsa(NameLsa& nlsa)
|
||||
}
|
||||
else {
|
||||
if (chkNameLsa->getLsSeqNo() < nlsa.getLsSeqNo()) {
|
||||
_LOG_DEBUG("Updated Name LSA. Updating LSDB");
|
||||
_LOG_DEBUG("Old Name LSA ");
|
||||
chkNameLsa->writeLog();
|
||||
chkNameLsa->setLsSeqNo(nlsa.getLsSeqNo());
|
||||
chkNameLsa->setLifeTime(nlsa.getLifeTime());
|
||||
@@ -141,6 +148,7 @@ Lsdb::installNameLsa(NameLsa& nlsa)
|
||||
chkNameLsa->setExpiringEventId(scheduleNameLsaExpiration(nlsa.getKey(),
|
||||
nlsa.getLsSeqNo(),
|
||||
timeToExpire));
|
||||
_LOG_DEBUG("Updated Name LSA");
|
||||
chkNameLsa->writeLog();
|
||||
}
|
||||
}
|
||||
@@ -168,6 +176,7 @@ Lsdb::removeNameLsa(const ndn::Name& key)
|
||||
m_nameLsdb.end(),
|
||||
ndn::bind(nameLsaCompareByKey, _1, key));
|
||||
if (it != m_nameLsdb.end()) {
|
||||
_LOG_DEBUG("Removing Name LSA");
|
||||
(*it).writeLog();
|
||||
if ((*it).getOrigRouter() !=
|
||||
m_nlsr.getConfParameter().getRouterPrefix()) {
|
||||
@@ -273,6 +282,8 @@ Lsdb::installCoordinateLsa(CoordinateLsa& clsa)
|
||||
int timeToExpire = m_lsaRefreshTime;
|
||||
CoordinateLsa* chkCorLsa = findCoordinateLsa(clsa.getKey());
|
||||
if (chkCorLsa == 0) {
|
||||
_LOG_DEBUG("New Coordinate LSA. Adding to LSDB");
|
||||
clsa.writeLog();
|
||||
addCoordinateLsa(clsa);
|
||||
//debugging purpose
|
||||
printCorLsdb();
|
||||
@@ -291,6 +302,9 @@ Lsdb::installCoordinateLsa(CoordinateLsa& clsa)
|
||||
}
|
||||
else {
|
||||
if (chkCorLsa->getLsSeqNo() < clsa.getLsSeqNo()) {
|
||||
_LOG_DEBUG("Updated Coordinate LSA. Updating LSDB");
|
||||
_LOG_DEBUG("Old Coordinate LSA");
|
||||
chkCorLsa->writeLog();
|
||||
chkCorLsa->setLsSeqNo(clsa.getLsSeqNo());
|
||||
chkCorLsa->setLifeTime(clsa.getLifeTime());
|
||||
if (!chkCorLsa->isEqualContent(clsa)) {
|
||||
@@ -307,6 +321,8 @@ Lsdb::installCoordinateLsa(CoordinateLsa& clsa)
|
||||
chkCorLsa->setExpiringEventId(scheduleCoordinateLsaExpiration(clsa.getKey(),
|
||||
clsa.getLsSeqNo(),
|
||||
timeToExpire));
|
||||
_LOG_DEBUG("Updated Coordinate LSA");
|
||||
chkCorLsa->writeLog();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -334,6 +350,8 @@ Lsdb::removeCoordinateLsa(const ndn::Name& key)
|
||||
ndn::bind(corLsaCompareByKey,
|
||||
_1, key));
|
||||
if (it != m_corLsdb.end()) {
|
||||
_LOG_DEBUG("Removing Coordinate LSA");
|
||||
(*it).writeLog();
|
||||
if ((*it).getOrigRouter() !=
|
||||
m_nlsr.getConfParameter().getRouterPrefix()) {
|
||||
m_nlsr.getNamePrefixTable().removeEntry((*it).getOrigRouter(),
|
||||
@@ -382,12 +400,14 @@ adjLsaCompareByKey(AdjLsa& alsa, const ndn::Name& key)
|
||||
void
|
||||
Lsdb::scheduledAdjLsaBuild()
|
||||
{
|
||||
cout << "scheduledAdjLsaBuild Called" << endl;
|
||||
m_nlsr.setIsBuildAdjLsaSheduled(0);
|
||||
std::cout << "scheduledAdjLsaBuild Called" << endl;
|
||||
_LOG_DEBUG("scheduledAdjLsaBuild Called");
|
||||
m_nlsr.setIsBuildAdjLsaSheduled(false);
|
||||
if (m_nlsr.getAdjacencyList().isAdjLsaBuildable(m_nlsr)) {
|
||||
int adjBuildCount = m_nlsr.getAdjBuildCount();
|
||||
if (adjBuildCount > 0) {
|
||||
if (m_nlsr.getAdjacencyList().getNumOfActiveNeighbor() > 0) {
|
||||
_LOG_DEBUG("Building and installing Adj LSA");
|
||||
buildAndInstallOwnAdjLsa();
|
||||
}
|
||||
else {
|
||||
@@ -400,7 +420,7 @@ Lsdb::scheduledAdjLsaBuild()
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_nlsr.setIsBuildAdjLsaSheduled(1);
|
||||
m_nlsr.setIsBuildAdjLsaSheduled(true);
|
||||
int schedulingTime = m_nlsr.getConfParameter().getInterestRetryNumber() *
|
||||
m_nlsr.getConfParameter().getInterestResendTime();
|
||||
m_nlsr.getScheduler().scheduleEvent(ndn::time::seconds(schedulingTime),
|
||||
@@ -467,6 +487,8 @@ Lsdb::installAdjLsa(AdjLsa& alsa)
|
||||
int timeToExpire = m_lsaRefreshTime;
|
||||
AdjLsa* chkAdjLsa = findAdjLsa(alsa.getKey());
|
||||
if (chkAdjLsa == 0) {
|
||||
_LOG_DEBUG("New Adj LSA. Adding to LSDB");
|
||||
alsa.writeLog();
|
||||
addAdjLsa(alsa);
|
||||
alsa.addNptEntries(m_nlsr);
|
||||
m_nlsr.getRoutingTable().scheduleRoutingTableCalculation(m_nlsr);
|
||||
@@ -478,6 +500,9 @@ Lsdb::installAdjLsa(AdjLsa& alsa)
|
||||
}
|
||||
else {
|
||||
if (chkAdjLsa->getLsSeqNo() < alsa.getLsSeqNo()) {
|
||||
_LOG_DEBUG("Updated Adj LSA. Updating LSDB");
|
||||
_LOG_DEBUG("Old Adj LSA");
|
||||
chkAdjLsa->writeLog();
|
||||
chkAdjLsa->setLsSeqNo(alsa.getLsSeqNo());
|
||||
chkAdjLsa->setLifeTime(alsa.getLifeTime());
|
||||
if (!chkAdjLsa->isEqualContent(alsa)) {
|
||||
@@ -492,6 +517,8 @@ Lsdb::installAdjLsa(AdjLsa& alsa)
|
||||
chkAdjLsa->setExpiringEventId(scheduleAdjLsaExpiration(alsa.getKey(),
|
||||
alsa.getLsSeqNo(),
|
||||
timeToExpire));
|
||||
_LOG_DEBUG("Updated Adj LSA");
|
||||
chkAdjLsa->writeLog();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -522,6 +549,8 @@ Lsdb::removeAdjLsa(const ndn::Name& key)
|
||||
m_adjLsdb.end(),
|
||||
ndn::bind(adjLsaCompareByKey, _1, key));
|
||||
if (it != m_adjLsdb.end()) {
|
||||
_LOG_DEBUG("Removing Adj LSA");
|
||||
(*it).writeLog();
|
||||
(*it).removeNptEntries(m_nlsr);
|
||||
m_adjLsdb.erase(it);
|
||||
return true;
|
||||
@@ -562,15 +591,19 @@ Lsdb::setThisRouterPrefix(string trp)
|
||||
void
|
||||
Lsdb::exprireOrRefreshNameLsa(const ndn::Name& lsaKey, uint64_t seqNo)
|
||||
{
|
||||
cout << "Lsdb::exprireOrRefreshNameLsa Called " << endl;
|
||||
cout << "LSA Key : " << lsaKey << " Seq No: " << seqNo << endl;
|
||||
std::cout << "Lsdb::exprireOrRefreshNameLsa Called " << std::endl;
|
||||
std::cout << "LSA Key : " << lsaKey << " Seq No: " << seqNo << std::endl;
|
||||
_LOG_DEBUG("Lsdb::exprireOrRefreshNameLsa Called");
|
||||
_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
|
||||
NameLsa* chkNameLsa = findNameLsa(lsaKey);
|
||||
if (chkNameLsa != 0) {
|
||||
cout << " LSA Exists with seq no: " << chkNameLsa->getLsSeqNo() << endl;
|
||||
std::cout << "LSA Exists with seq no: " << chkNameLsa->getLsSeqNo() << std::endl;
|
||||
_LOG_DEBUG("LSA Exists with seq no: " << chkNameLsa->getLsSeqNo());
|
||||
if (chkNameLsa->getLsSeqNo() == seqNo) {
|
||||
if (chkNameLsa->getOrigRouter() == m_thisRouterPrefix) {
|
||||
chkNameLsa->writeLog();
|
||||
cout << "Own Name LSA, so refreshing name LSA" << endl;
|
||||
std::cout << "Own Name LSA, so refreshing name LSA" << std::endl;
|
||||
_LOG_DEBUG("Own Name LSA, so refreshing name LSA");
|
||||
chkNameLsa->setLsSeqNo(chkNameLsa->getLsSeqNo() + 1);
|
||||
m_nlsr.getSequencingManager().setNameLsaSeq(chkNameLsa->getLsSeqNo());
|
||||
chkNameLsa->writeLog();
|
||||
@@ -585,7 +618,8 @@ Lsdb::exprireOrRefreshNameLsa(const ndn::Name& lsaKey, uint64_t seqNo)
|
||||
lsaPrefix);
|
||||
}
|
||||
else {
|
||||
cout << "Other's Name LSA, so removing form LSDB" << endl;
|
||||
std::cout << "Other's Name LSA, so removing form LSDB" << std::endl;
|
||||
_LOG_DEBUG("Other's Name LSA, so removing form LSDB");
|
||||
removeNameLsa(lsaKey);
|
||||
}
|
||||
}
|
||||
@@ -597,12 +631,16 @@ Lsdb::exprireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo)
|
||||
{
|
||||
cout << "Lsdb::exprireOrRefreshAdjLsa Called " << endl;
|
||||
cout << "LSA Key : " << lsaKey << " Seq No: " << seqNo << endl;
|
||||
_LOG_DEBUG("Lsdb::exprireOrRefreshAdjLsa Called");
|
||||
_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
|
||||
AdjLsa* chkAdjLsa = findAdjLsa(lsaKey);
|
||||
if (chkAdjLsa != 0) {
|
||||
cout << " LSA Exists with seq no: " << chkAdjLsa->getLsSeqNo() << endl;
|
||||
cout << "LSA Exists with seq no: " << chkAdjLsa->getLsSeqNo() << endl;
|
||||
_LOG_DEBUG("LSA Exists with seq no: ");
|
||||
if (chkAdjLsa->getLsSeqNo() == seqNo) {
|
||||
if (chkAdjLsa->getOrigRouter() == m_thisRouterPrefix) {
|
||||
cout << "Own Adj LSA, so refreshing Adj LSA" << endl;
|
||||
_LOG_DEBUG("Own Adj LSA, so refreshing Adj LSA");
|
||||
chkAdjLsa->setLsSeqNo(chkAdjLsa->getLsSeqNo() + 1);
|
||||
m_nlsr.getSequencingManager().setAdjLsaSeq(chkAdjLsa->getLsSeqNo());
|
||||
// schedule refreshing event again
|
||||
@@ -617,6 +655,7 @@ Lsdb::exprireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo)
|
||||
}
|
||||
else {
|
||||
cout << "Other's Adj LSA, so removing form LSDB" << endl;
|
||||
_LOG_DEBUG("Other's Adj LSA, so removing form LSDB");
|
||||
removeAdjLsa(lsaKey);
|
||||
}
|
||||
// schedule Routing table calculaiton
|
||||
@@ -631,12 +670,16 @@ Lsdb::exprireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
|
||||
{
|
||||
cout << "Lsdb::exprireOrRefreshCorLsa Called " << endl;
|
||||
cout << "LSA Key : " << lsaKey << " Seq No: " << seqNo << endl;
|
||||
_LOG_DEBUG("Lsdb::exprireOrRefreshCorLsa Called ");
|
||||
_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
|
||||
CoordinateLsa* chkCorLsa = findCoordinateLsa(lsaKey);
|
||||
if (chkCorLsa != 0) {
|
||||
cout << " LSA Exists with seq no: " << chkCorLsa->getLsSeqNo() << endl;
|
||||
_LOG_DEBUG("LSA Exists with seq no: " << chkCorLsa->getLsSeqNo());
|
||||
if (chkCorLsa->getLsSeqNo() == seqNo) {
|
||||
if (chkCorLsa->getOrigRouter() == m_thisRouterPrefix) {
|
||||
cout << "Own Cor LSA, so refreshing Cor LSA" << endl;
|
||||
_LOG_DEBUG("Own Cor LSA, so refreshing Cor LSA");
|
||||
chkCorLsa->setLsSeqNo(chkCorLsa->getLsSeqNo() + 1);
|
||||
m_nlsr.getSequencingManager().setCorLsaSeq(chkCorLsa->getLsSeqNo());
|
||||
// schedule refreshing event again
|
||||
@@ -652,6 +695,7 @@ Lsdb::exprireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
|
||||
}
|
||||
else {
|
||||
cout << "Other's Cor LSA, so removing form LSDB" << endl;
|
||||
_LOG_DEBUG("Other's Cor LSA, so removing form LSDB");
|
||||
removeCoordinateLsa(lsaKey);
|
||||
}
|
||||
if (m_nlsr.getConfParameter().getHyperbolicState() >= HYPERBOLIC_STATE_ON) {
|
||||
@@ -666,6 +710,7 @@ void
|
||||
Lsdb::expressInterest(const ndn::Name& interestName, uint32_t interestLifeTime)
|
||||
{
|
||||
std::cout << "Expressing Interest :" << interestName << std::endl;
|
||||
_LOG_DEBUG("Expressing Interest for LSA(name): " << interestName);
|
||||
ndn::Interest interest(interestName);
|
||||
interest.setInterestLifetime(ndn::time::seconds(interestLifeTime));
|
||||
interest.setMustBeFresh(true);
|
||||
@@ -681,6 +726,7 @@ Lsdb::processInterest(const ndn::Name& name, const ndn::Interest& interest)
|
||||
{
|
||||
const ndn::Name& intName(interest.getName());
|
||||
std::cout << "Interest recevied for LSA: " << intName << std::endl;
|
||||
_LOG_DEBUG("Interest recevied for LSA(name): " << intName);
|
||||
string chkString("LSA");
|
||||
int32_t lsaPosition = util::getNameComponentPosition(interest.getName(),
|
||||
chkString);
|
||||
@@ -728,12 +774,13 @@ Lsdb::processInterestForNameLsa(const ndn::Interest& interest,
|
||||
if (nameLsa != 0) {
|
||||
if (nameLsa->getLsSeqNo() >= interestedlsSeqNo) {
|
||||
ndn::Data data(ndn::Name(interest.getName()).appendVersion());
|
||||
_LOG_DEBUG("Sending data for LSA(name): " << interest.getName());
|
||||
data.setFreshnessPeriod(ndn::time::seconds(10)); // 10 sec
|
||||
std::string content = nameLsa->getData();
|
||||
data.setContent(reinterpret_cast<const uint8_t*>(content.c_str()),
|
||||
content.size());
|
||||
m_keyChain.sign(data);
|
||||
std::cout << ">> D: " << data << std::endl;
|
||||
//std::cout << ">> D: " << data << std::endl;
|
||||
m_nlsr.getNlsrFace().put(data);
|
||||
}
|
||||
}
|
||||
@@ -748,12 +795,13 @@ Lsdb::processInterestForAdjacencyLsa(const ndn::Interest& interest,
|
||||
if (adjLsa != 0) {
|
||||
if (adjLsa->getLsSeqNo() >= interestedlsSeqNo) {
|
||||
ndn::Data data(ndn::Name(interest.getName()).appendVersion());
|
||||
_LOG_DEBUG("Sending data for LSA(name): " << interest.getName());
|
||||
data.setFreshnessPeriod(ndn::time::seconds(10)); // 10 sec
|
||||
std::string content = adjLsa->getData();
|
||||
data.setContent(reinterpret_cast<const uint8_t*>(content.c_str()),
|
||||
content.size());
|
||||
m_keyChain.sign(data);
|
||||
std::cout << ">> D: " << data << std::endl;
|
||||
//std::cout << ">> D: " << data << std::endl;
|
||||
m_nlsr.getNlsrFace().put(data);
|
||||
}
|
||||
}
|
||||
@@ -768,12 +816,13 @@ Lsdb::processInterestForCoordinateLsa(const ndn::Interest& interest,
|
||||
if (corLsa != 0) {
|
||||
if (corLsa->getLsSeqNo() >= interestedlsSeqNo) {
|
||||
ndn::Data data(ndn::Name(interest.getName()).appendVersion());
|
||||
_LOG_DEBUG("Sending data for LSA(name): " << interest.getName());
|
||||
data.setFreshnessPeriod(ndn::time::seconds(10)); // 10 sec
|
||||
std::string content = corLsa->getData();
|
||||
data.setContent(reinterpret_cast<const uint8_t*>(content.c_str()),
|
||||
content.size());
|
||||
m_keyChain.sign(data);
|
||||
std::cout << ">> D: " << data << std::endl;
|
||||
//std::cout << ">> D: " << data << std::endl;
|
||||
m_nlsr.getNlsrFace().put(data);
|
||||
}
|
||||
}
|
||||
@@ -783,7 +832,8 @@ void
|
||||
Lsdb::processContent(const ndn::Interest& interest, const ndn::Data& data)
|
||||
{
|
||||
const ndn::Name& dataName = data.getName();
|
||||
std::cout << "Data received for name: " << dataName << std::endl;
|
||||
std::cout << "Data received for LSA(name): " << dataName << std::endl;
|
||||
_LOG_DEBUG("Data received for LSA(name): " << dataName);
|
||||
string dataContent(reinterpret_cast<const char*>(data.getContent().value()));
|
||||
string chkString("LSA");
|
||||
int32_t lsaPosition = util::getNameComponentPosition(dataName, chkString);
|
||||
@@ -867,7 +917,8 @@ void
|
||||
Lsdb::processInterestTimedOut(const ndn::Interest& interest)
|
||||
{
|
||||
const ndn::Name& interestName(interest.getName());
|
||||
cout << "Interest timed out for Name: " << interestName << endl;
|
||||
cout << "Interest timed out for LSA(name): " << interestName << endl;
|
||||
_LOG_DEBUG("Interest timed out for LSA(name): " << interestName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-2
@@ -20,6 +20,7 @@
|
||||
#include <boost/cstdint.hpp>
|
||||
#include "nlsr.hpp"
|
||||
#include "conf-file-processor.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
using namespace nlsr;
|
||||
|
||||
@@ -54,12 +55,13 @@ main(int32_t argc, char** argv)
|
||||
}
|
||||
}
|
||||
ConfFileProcessor cfp(nlsr, nlsr.getConfFileName());
|
||||
int32_t res = cfp.processConfFile();
|
||||
if (res < 0) {
|
||||
if(!cfp.processConfFile()) {
|
||||
std::cerr << "Error in configuration file processing! Exiting from NLSR" <<
|
||||
std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
INIT_LOGGERS(nlsr.getConfParameter().getLogDir());
|
||||
INIT_LOGGER("Main");
|
||||
nlsr.initialize();
|
||||
try {
|
||||
nlsr.startEventLoop();
|
||||
|
||||
@@ -4,9 +4,12 @@
|
||||
#include <ndn-cxx/common.hpp>
|
||||
|
||||
#include "name-prefix-list.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("NamePrefixList");
|
||||
|
||||
using namespace std;
|
||||
|
||||
NamePrefixList::NamePrefixList()
|
||||
@@ -56,6 +59,18 @@ NamePrefixList::sort()
|
||||
m_nameList.sort();
|
||||
}
|
||||
|
||||
void
|
||||
NamePrefixList::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("-------Name Prefix List--------");
|
||||
int i = 1;
|
||||
for (std::list<ndn::Name>::iterator it = m_nameList.begin();
|
||||
it != m_nameList.end(); it++) {
|
||||
_LOG_DEBUG("Name " << i << " : " << (*it));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NamePrefixList::print()
|
||||
{
|
||||
|
||||
@@ -37,6 +37,9 @@ public:
|
||||
return m_nameList;
|
||||
}
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
void
|
||||
print();
|
||||
|
||||
|
||||
+13
-2
@@ -5,10 +5,13 @@
|
||||
|
||||
#include "nlsr.hpp"
|
||||
#include "adjacent.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("nlsr");
|
||||
|
||||
using namespace ndn;
|
||||
using namespace std;
|
||||
|
||||
@@ -28,6 +31,7 @@ void
|
||||
Nlsr::setInfoInterestFilter()
|
||||
{
|
||||
ndn::Name name(m_confParam.getRouterPrefix());
|
||||
_LOG_DEBUG("Setting interest filter for name: " << name);
|
||||
getNlsrFace().setInterestFilter(name,
|
||||
ndn::bind(&HelloProtocol::processInterest,
|
||||
&m_helloProtocol, _1, _2),
|
||||
@@ -40,6 +44,7 @@ Nlsr::setLsaInterestFilter()
|
||||
{
|
||||
ndn::Name name = m_confParam.getLsaPrefix();
|
||||
name.append(m_confParam.getRouterPrefix());
|
||||
_LOG_DEBUG("Setting interest filter for name: " << name);
|
||||
getNlsrFace().setInterestFilter(name,
|
||||
ndn::bind(&Lsdb::processInterest,
|
||||
&m_nlsrLsdb, _1, _2),
|
||||
@@ -70,6 +75,7 @@ Nlsr::registerPrefixes()
|
||||
void
|
||||
Nlsr::initialize()
|
||||
{
|
||||
_LOG_DEBUG("Initializing Nlsr");
|
||||
m_confParam.buildRouterPrefix();
|
||||
m_nlsrLsdb.setLsaRefreshTime(m_confParam.getLsaRefreshTime());
|
||||
m_nlsrLsdb.setThisRouterPrefix(m_confParam.getRouterPrefix().toUri());
|
||||
@@ -81,11 +87,16 @@ Nlsr::initialize()
|
||||
m_adjacencyList.print();
|
||||
m_namePrefixList.print();
|
||||
/* debugging purpose end */
|
||||
/* Logging start */
|
||||
m_confParam.writeLog();
|
||||
m_adjacencyList.writeLog();
|
||||
m_namePrefixList.writeLog();
|
||||
/* Logging end */
|
||||
registerPrefixes();
|
||||
m_nlsrLsdb.buildAndInstallOwnNameLsa();
|
||||
m_nlsrLsdb.buildAndInstallOwnCoordinateLsa();
|
||||
setInfoInterestFilter();
|
||||
setLsaInterestFilter();
|
||||
m_nlsrLsdb.buildAndInstallOwnNameLsa();
|
||||
m_nlsrLsdb.buildAndInstallOwnCoordinateLsa();
|
||||
m_syncLogicHandler.setSyncPrefix(m_confParam.getChronosyncPrefix().toUri());
|
||||
m_syncLogicHandler.createSyncSocket(boost::ref(*this));
|
||||
//m_interestManager.scheduleInfoInterest(10);
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include <list>
|
||||
#include "fib-entry.hpp"
|
||||
#include "nexthop.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("FibEntry");
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool
|
||||
@@ -30,6 +33,14 @@ FibEntry::isEqualNextHops(NexthopList& nhlOther)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FibEntry::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("Name Prefix: " << m_name);
|
||||
_LOG_DEBUG("Seq No: " << m_seqNo);
|
||||
m_nexthopList.writeLog();
|
||||
}
|
||||
|
||||
ostream&
|
||||
operator<<(ostream& os, FibEntry fe)
|
||||
{
|
||||
|
||||
@@ -82,6 +82,9 @@ public:
|
||||
bool
|
||||
isEqualNextHops(NexthopList& nhlOther);
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
private:
|
||||
ndn::Name m_name;
|
||||
int32_t m_timeToRefresh;
|
||||
|
||||
+21
-1
@@ -6,12 +6,14 @@
|
||||
#include "nexthop-list.hpp"
|
||||
#include "face-map.hpp"
|
||||
#include "fib.hpp"
|
||||
|
||||
#include "logger.hpp"
|
||||
|
||||
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("Fib");
|
||||
|
||||
using namespace std;
|
||||
using namespace ndn;
|
||||
|
||||
@@ -34,6 +36,8 @@ Fib::scheduleEntryRefreshing(const ndn::Name& name, int32_t feSeqNum,
|
||||
{
|
||||
std::cout << "Fib::scheduleEntryRefreshing Called" << std::endl;
|
||||
std::cout << "Name: " << name << " Seq Num: " << feSeqNum << std::endl;
|
||||
_LOG_DEBUG("Fib::scheduleEntryRefreshing Called");
|
||||
_LOG_DEBUG("Name: " << name << " Seq Num: " << feSeqNum);
|
||||
return m_nlsr.getScheduler().scheduleEvent(ndn::time::seconds(refreshTime),
|
||||
ndn::bind(&Fib::refreshEntry, this,
|
||||
name, feSeqNum));
|
||||
@@ -51,6 +55,7 @@ Fib::refreshEntry(const ndn::Name& name, int32_t feSeqNum)
|
||||
std::cout << "Entry found with Seq Num: " << feSeqNum << std::endl;
|
||||
if (it->getSeqNo() == feSeqNum) {
|
||||
std::cout << "Refreshing the FIB entry" << std::endl;
|
||||
_LOG_DEBUG("Refreshing the FIB entry. Name: " << name);
|
||||
for (std::list<NextHop>::iterator nhit =
|
||||
(*it).getNexthopList().getNextHops().begin();
|
||||
nhit != (*it).getNexthopList().getNextHops().end(); nhit++) {
|
||||
@@ -70,6 +75,7 @@ Fib::refreshEntry(const ndn::Name& name, int32_t feSeqNum)
|
||||
void
|
||||
Fib::remove(const ndn::Name& name)
|
||||
{
|
||||
_LOG_DEBUG("Fib::remove called");
|
||||
std::list<FibEntry>::iterator it = std::find_if(m_table.begin(),
|
||||
m_table.end(),
|
||||
bind(&fibEntryNameCompare, _1, name));
|
||||
@@ -91,6 +97,7 @@ Fib::remove(const ndn::Name& name)
|
||||
}
|
||||
std::cout << "Cancellling Scheduled event" << std::endl;
|
||||
std::cout << "Name: " << name << "Seq num: " << it->getSeqNo() << std::endl;
|
||||
_LOG_DEBUG("Cancelling Scheduled event. Name: " << name);
|
||||
cancelScheduledExpiringEvent((*it).getExpiringEventId());
|
||||
m_table.erase(it);
|
||||
}
|
||||
@@ -101,6 +108,7 @@ void
|
||||
Fib::update(const ndn::Name& name, NexthopList& nextHopList)
|
||||
{
|
||||
std::cout << "Fib::updateFib Called" << std::endl;
|
||||
_LOG_DEBUG("Fib::updateFib Called");
|
||||
int startFace = 0;
|
||||
int endFace = getNumberOfFacesForName(nextHopList,
|
||||
m_nlsr.getConfParameter().getMaxFacesPerPrefix());
|
||||
@@ -151,6 +159,7 @@ Fib::update(const ndn::Name& name, NexthopList& nextHopList)
|
||||
it->setTimeToRefresh(m_refreshTime);
|
||||
std::cout << "Cancellling Scheduled event" << std::endl;
|
||||
std::cout << "Name: " << name << "Seq num: " << it->getSeqNo() << std::endl;
|
||||
_LOG_DEBUG("Cancelling Scheduled event. Name: " << name);
|
||||
cancelScheduledExpiringEvent(it->getExpiringEventId());
|
||||
it->setSeqNo(it->getSeqNo() + 1);
|
||||
(*it).setExpiringEventId(scheduleEntryRefreshing(it->getName() ,
|
||||
@@ -167,11 +176,13 @@ Fib::update(const ndn::Name& name, NexthopList& nextHopList)
|
||||
void
|
||||
Fib::clean()
|
||||
{
|
||||
_LOG_DEBUG("Fib::clean called");
|
||||
for (std::list<FibEntry>::iterator it = m_table.begin(); it != m_table.end();
|
||||
++it) {
|
||||
std::cout << "Cancellling Scheduled event" << std::endl;
|
||||
std::cout << "Name: " << it->getName() << "Seq num: " << it->getSeqNo() <<
|
||||
std::endl;
|
||||
_LOG_DEBUG("Cancelling Scheduled event. Name: " << it->getName());
|
||||
cancelScheduledExpiringEvent((*it).getExpiringEventId());
|
||||
for (std::list<NextHop>::iterator nhit =
|
||||
(*it).getNexthopList().getNextHops().begin();
|
||||
@@ -320,6 +331,15 @@ Fib::onFailure(uint32_t code, const std::string& error,
|
||||
std::cout << message << ": " << error << " (code: " << code << ")";
|
||||
}
|
||||
|
||||
void
|
||||
Fib::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("-------------------FIB-----------------------------");
|
||||
for (std::list<FibEntry>::iterator it = m_table.begin(); it != m_table.end();
|
||||
++it) {
|
||||
(*it).writeLog();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Fib::print()
|
||||
|
||||
@@ -76,6 +76,9 @@ public:
|
||||
void
|
||||
setStrategy(const ndn::Name& name, const std::string& strategy);
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
private:
|
||||
void
|
||||
unregisterPrefix(const ndn::Name& namePrefix, const std::string& faceUri);
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
#include "name-prefix-table-entry.hpp"
|
||||
#include "routing-table-entry.hpp"
|
||||
#include "nexthop.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("NamePrefixTableEntry");
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
@@ -65,6 +68,19 @@ NamePrefixTableEntry::addRoutingTableEntry(RoutingTableEntry& rte)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NamePrefixTableEntry::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("Name: " << m_namePrefix);
|
||||
for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin();
|
||||
it != m_rteList.end(); ++it) {
|
||||
_LOG_DEBUG("Destination: " << (*it).getDestination());
|
||||
_LOG_DEBUG("Nexthops: ");
|
||||
(*it).getNexthopList().writeLog();
|
||||
}
|
||||
m_nexthopList.writeLog();
|
||||
}
|
||||
|
||||
//debugging purpose
|
||||
ostream&
|
||||
operator<<(ostream& os, NamePrefixTableEntry& npte)
|
||||
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
void
|
||||
addRoutingTableEntry(RoutingTableEntry& rte);
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
private:
|
||||
ndn::Name m_namePrefix;
|
||||
std::list<RoutingTableEntry> m_rteList;
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
#include "name-prefix-table.hpp"
|
||||
#include "name-prefix-table-entry.hpp"
|
||||
#include "routing-table.hpp"
|
||||
|
||||
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("NamePrefixTable");
|
||||
|
||||
using namespace std;
|
||||
|
||||
static bool
|
||||
@@ -130,6 +131,17 @@ NamePrefixTable::updateWithNewRoute()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NamePrefixTable::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("----------------NPT----------------------");
|
||||
for (std::list<NamePrefixTableEntry>::iterator it = m_table.begin();
|
||||
it != m_table.end();
|
||||
++it) {
|
||||
(*it).writeLog();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NamePrefixTable::print()
|
||||
{
|
||||
|
||||
@@ -27,6 +27,9 @@ public:
|
||||
void
|
||||
updateWithNewRoute();
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
void
|
||||
print();
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include <iostream>
|
||||
#include "nexthop-list.hpp"
|
||||
#include "nexthop.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("NexthopList");
|
||||
|
||||
using namespace std;
|
||||
|
||||
static bool
|
||||
@@ -69,6 +72,17 @@ NexthopList::sort()
|
||||
m_nexthopList.sort(nextHopSortingComparator);
|
||||
}
|
||||
|
||||
void
|
||||
NexthopList::writeLog()
|
||||
{
|
||||
int i = 1;
|
||||
for (std::list<NextHop>::iterator it = m_nexthopList.begin();
|
||||
it != m_nexthopList.end() ; it++, i++) {
|
||||
_LOG_DEBUG("Nexthop " << i << ": " << (*it).getConnectingFaceUri()
|
||||
<< " Route Cost: " << (*it).getRouteCost());
|
||||
}
|
||||
}
|
||||
|
||||
ostream&
|
||||
operator<<(ostream& os, NexthopList& nhl)
|
||||
{
|
||||
|
||||
@@ -50,6 +50,9 @@ public:
|
||||
return m_nexthopList;
|
||||
}
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
private:
|
||||
std::list<NextHop> m_nexthopList;
|
||||
};
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
#include "routing-table-calculator.hpp"
|
||||
#include "routing-table-entry.hpp"
|
||||
#include "name-prefix-table.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("RoutingTable");
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
@@ -22,6 +25,7 @@ RoutingTable::calculate(Nlsr& pnlsr)
|
||||
pnlsr.getLsdb().printAdjLsdb();
|
||||
pnlsr.getLsdb().printCorLsdb();
|
||||
pnlsr.getLsdb().printNameLsdb();
|
||||
pnlsr.getNamePrefixTable().writeLog();
|
||||
if (pnlsr.getIsRoutingTableCalculating() == false) {
|
||||
//setting routing table calculation
|
||||
pnlsr.setIsRoutingTableCalculating(true);
|
||||
@@ -30,6 +34,7 @@ RoutingTable::calculate(Nlsr& pnlsr)
|
||||
std::string("adjacency"))) {
|
||||
if (pnlsr.getIsBuildAdjLsaSheduled() != 1) {
|
||||
std::cout << "CLearing old routing table ....." << std::endl;
|
||||
_LOG_DEBUG("CLearing old routing table .....");
|
||||
clearRoutingTable();
|
||||
// for dry run options
|
||||
clearDryRoutingTable();
|
||||
@@ -52,16 +57,23 @@ RoutingTable::calculate(Nlsr& pnlsr)
|
||||
printRoutingTable();
|
||||
pnlsr.getNamePrefixTable().print();
|
||||
pnlsr.getFib().print();
|
||||
writeLog();
|
||||
pnlsr.getNamePrefixTable().writeLog();
|
||||
pnlsr.getFib().writeLog();
|
||||
//debugging purpose end
|
||||
}
|
||||
else {
|
||||
std::cout << "Adjacency building is scheduled, so ";
|
||||
std::cout << "routing table can not be calculated :(" << std::endl;
|
||||
_LOG_DEBUG("Adjacency building is scheduled, so"
|
||||
" routing table can not be calculated :(");
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cout << "No Adj LSA of router itself,";
|
||||
std::cout << " so Routing table can not be calculated :(" << std::endl;
|
||||
_LOG_DEBUG("No Adj LSA of router itself,"
|
||||
" so Routing table can not be calculated :(");
|
||||
clearRoutingTable();
|
||||
clearDryRoutingTable(); // for dry run options
|
||||
// need to update NPT here
|
||||
@@ -71,6 +83,9 @@ RoutingTable::calculate(Nlsr& pnlsr)
|
||||
printRoutingTable();
|
||||
pnlsr.getNamePrefixTable().print();
|
||||
pnlsr.getFib().print();
|
||||
writeLog();
|
||||
pnlsr.getNamePrefixTable().writeLog();
|
||||
pnlsr.getFib().writeLog();
|
||||
//debugging purpose end
|
||||
}
|
||||
pnlsr.setIsRouteCalculationScheduled(false); //clear scheduled flag
|
||||
@@ -158,6 +173,18 @@ RoutingTable::findRoutingTableEntry(const ndn::Name& destRouter)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
RoutingTable::writeLog()
|
||||
{
|
||||
_LOG_DEBUG("---------------Routing Table------------------");
|
||||
for (std::list<RoutingTableEntry>::iterator it = m_rTable.begin() ;
|
||||
it != m_rTable.end(); ++it) {
|
||||
_LOG_DEBUG("Destination: " << (*it).getDestination());
|
||||
_LOG_DEBUG("Nexthops: ");
|
||||
(*it).getNexthopList().writeLog();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RoutingTable::printRoutingTable()
|
||||
{
|
||||
|
||||
@@ -63,6 +63,9 @@ private:
|
||||
void
|
||||
clearDryRoutingTable();
|
||||
|
||||
void
|
||||
writeLog();
|
||||
|
||||
const int m_NO_NEXT_HOP;
|
||||
|
||||
std::list<RoutingTableEntry> m_rTable;
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sequencing-manager.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace nlsr {
|
||||
|
||||
INIT_LOGGER("SequencingManager");
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
|
||||
@@ -46,7 +46,10 @@ def configure(conf):
|
||||
conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
|
||||
uselib_store='NDN_CPP', mandatory=True)
|
||||
|
||||
boost_libs = 'system chrono program_options iostreams thread regex'
|
||||
conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'],
|
||||
uselib_store='LOG4CXX', mandatory=True)
|
||||
|
||||
boost_libs = 'system chrono program_options iostreams thread regex filesystem'
|
||||
if conf.options.with_tests:
|
||||
conf.env['WITH_TESTS'] = 1
|
||||
conf.define('WITH_TESTS', 1);
|
||||
@@ -85,7 +88,7 @@ def build (bld):
|
||||
features='cxx',
|
||||
source=bld.path.ant_glob(['src/**/*.cpp'],
|
||||
excl=['src/main.cpp']),
|
||||
use='nsync-objects NDN_CPP BOOST',
|
||||
use='nsync-objects NDN_CPP BOOST LOG4CXX',
|
||||
includes='. src',
|
||||
export_includes='. src',
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user