src: configuration file parsing
used boost::property_tree::info_parser for parsing nlsr's configuration file and
changed configuration command style to info command style. Removed tokenizer from
nlsr
Refs: #1542
Change-Id: If017ddd7eef5caa59b33940bfc27a71aa4de266b
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 10a40ec..85b1da0 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -14,12 +14,12 @@
{
std::cout << "Creating Sync socket ......" << std::endl;
std::cout << "Sync prefix: " << m_syncPrefix << std::endl;
- m_syncSocket = make_shared<Sync::SyncSocket>(m_syncPrefix, m_validator,
- m_syncFace,
- bind(&SyncLogicHandler::nsyncUpdateCallBack, this,
- _1, _2, boost::ref(pnlsr)),
- bind(&SyncLogicHandler::nsyncRemoveCallBack, this,
- _1, boost::ref(pnlsr)));
+ m_syncSocket = ndn::make_shared<Sync::SyncSocket>(m_syncPrefix, m_validator,
+ m_syncFace,
+ ndn::bind(&SyncLogicHandler::nsyncUpdateCallBack,
+ this, _1, _2, ndn::ref(pnlsr)),
+ ndn::bind(&SyncLogicHandler::nsyncRemoveCallBack,
+ this, _1, ndn::ref(pnlsr)));
}
void
@@ -28,8 +28,7 @@
{
std::cout << "nsyncUpdateCallBack called ...." << std::endl;
int32_t n = v.size();
- for (int32_t i = 0; i < n; i++)
- {
+ for (int32_t i = 0; i < n; i++){
std::cout << "Data Name: " << v[i].prefix << " Seq: " << v[i].high.getSeq() <<
endl;
processUpdateFromSync(v[i].prefix, v[i].high.getSeq(), pnlsr);
@@ -51,11 +50,9 @@
SyncLogicHandler::processUpdateFromSync(const ndn::Name& updateName,
uint64_t seqNo, Nlsr& pnlsr)
{
- //const ndn::Name name(updateName);
string chkString("LSA");
int32_t lasPosition = util::getNameComponentPosition(updateName, chkString);
- if (lasPosition >= 0)
- {
+ if (lasPosition >= 0) {
ndn::Name routerName = updateName.getSubName(lasPosition + 1);
processRoutingUpdateFromSync(routerName, seqNo, pnlsr);
return;
@@ -67,17 +64,14 @@
uint64_t seqNo, Nlsr& pnlsr)
{
ndn::Name rName = routerName;
- if (routerName != pnlsr.getConfParameter().getRouterPrefix())
- {
+ if (routerName != pnlsr.getConfParameter().getRouterPrefix()) {
SequencingManager sm(seqNo);
std::cout << sm;
std::cout << "Router Name: " << routerName << endl;
- try
- {
- if (pnlsr.getLsdb().isNameLsaNew(rName.append("name"), sm.getNameLsaSeq()))
- {
+ try {
+ if (pnlsr.getLsdb().isNameLsaNew(rName.append("name"), sm.getNameLsaSeq())) {
std::cout << "Updated Name LSA. Need to fetch it" << std::endl;
- ndn::Name interestName(pnlsr.getConfParameter().getChronosyncLsaPrefix());
+ ndn::Name interestName(pnlsr.getConfParameter().getLsaPrefix());
interestName.append(routerName);
interestName.append("name");
interestName.appendNumber(sm.getNameLsaSeq());
@@ -85,10 +79,9 @@
pnlsr.getConfParameter().getInterestResendTime());
}
if (pnlsr.getLsdb().isAdjLsaNew(rName.append("adjacency"),
- sm.getAdjLsaSeq()))
- {
+ sm.getAdjLsaSeq())) {
std::cout << "Updated Adj LSA. Need to fetch it" << std::endl;
- ndn::Name interestName(pnlsr.getConfParameter().getChronosyncLsaPrefix());
+ ndn::Name interestName(pnlsr.getConfParameter().getLsaPrefix());
interestName.append(routerName);
interestName.append("adjacency");
interestName.appendNumber(sm.getAdjLsaSeq());
@@ -96,10 +89,9 @@
pnlsr.getConfParameter().getInterestResendTime());
}
if (pnlsr.getLsdb().isCoordinateLsaNew(rName.append("coordinate"),
- sm.getCorLsaSeq()))
- {
+ sm.getCorLsaSeq())) {
std::cout << "Updated Cor LSA. Need to fetch it" << std::endl;
- ndn::Name interestName(pnlsr.getConfParameter().getChronosyncLsaPrefix());
+ ndn::Name interestName(pnlsr.getConfParameter().getLsaPrefix());
interestName.append(routerName);
interestName.append("coordinate");
interestName.appendNumber(sm.getCorLsaSeq());
@@ -107,8 +99,7 @@
pnlsr.getConfParameter().getInterestResendTime());
}
}
- catch (std::exception& e)
- {
+ catch (std::exception& e) {
std::cerr << e.what() << std::endl;
return;
}