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/route/name-prefix-table.cpp b/src/route/name-prefix-table.cpp
index f791d0a..61b2722 100644
--- a/src/route/name-prefix-table.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -25,30 +25,26 @@
NamePrefixTable::addEntry(const ndn::Name& name, RoutingTableEntry& rte)
{
std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_table.begin(),
- m_table.end(), bind(&npteCompare, _1, name));
- if (it == m_table.end())
- {
+ m_table.end(),
+ ndn::bind(&npteCompare, _1, name));
+ if (it == m_table.end()) {
NamePrefixTableEntry newEntry(name);
newEntry.addRoutingTableEntry(rte);
newEntry.generateNhlfromRteList();
newEntry.getNexthopList().sort();
m_table.push_back(newEntry);
- if (rte.getNexthopList().getSize() > 0)
- {
+ if (rte.getNexthopList().getSize() > 0) {
m_nlsr.getFib().update(name, newEntry.getNexthopList());
}
}
- else
- {
- if (rte.getNexthopList().getSize() > 0)
- {
+ else {
+ if (rte.getNexthopList().getSize() > 0) {
(*it).addRoutingTableEntry(rte);
(*it).generateNhlfromRteList();
(*it).getNexthopList().sort();
m_nlsr.getFib().update(name, (*it).getNexthopList());
}
- else
- {
+ else {
(*it).resetRteListNextHop();
(*it).getNexthopList().reset();
m_nlsr.getFib().remove(name);
@@ -60,9 +56,9 @@
NamePrefixTable::removeEntry(const ndn::Name& name, RoutingTableEntry& rte)
{
std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_table.begin(),
- m_table.end(), bind(&npteCompare, _1, name));
- if (it != m_table.end())
- {
+ m_table.end(),
+ ndn::bind(&npteCompare, _1, name));
+ if (it != m_table.end()) {
ndn::Name destRouter = rte.getDestination();
(*it).removeRoutingTableEntry(rte);
if (((*it).getRteListSize() == 0) &&
@@ -71,13 +67,11 @@
(!m_nlsr.getLsdb().doesLsaExist(destRouter.append("/adjacency"),
std::string("adjacency"))) &&
(!m_nlsr.getLsdb().doesLsaExist(destRouter.append("/coordinate"),
- std::string("coordinate"))))
- {
+ std::string("coordinate")))) {
m_table.erase(it);
m_nlsr.getFib().remove(name);
}
- else
- {
+ else {
(*it).generateNhlfromRteList();
m_nlsr.getFib().update(name, (*it).getNexthopList());
}
@@ -91,12 +85,10 @@
//
RoutingTableEntry* rteCheck =
m_nlsr.getRoutingTable().findRoutingTableEntry(destRouter);
- if (rteCheck != 0)
- {
+ if (rteCheck != 0) {
addEntry(name, *(rteCheck));
}
- else
- {
+ else {
RoutingTableEntry rte(destRouter);
addEntry(name, rte);
}
@@ -108,12 +100,10 @@
//
RoutingTableEntry* rteCheck =
m_nlsr.getRoutingTable().findRoutingTableEntry(destRouter);
- if (rteCheck != 0)
- {
+ if (rteCheck != 0) {
removeEntry(name, *(rteCheck));
}
- else
- {
+ else {
RoutingTableEntry rte(destRouter);
removeEntry(name, rte);
}
@@ -123,20 +113,16 @@
NamePrefixTable::updateWithNewRoute()
{
for (std::list<NamePrefixTableEntry>::iterator it = m_table.begin();
- it != m_table.end(); ++it)
- {
+ it != m_table.end(); ++it) {
std::list<RoutingTableEntry> rteList = (*it).getRteList();
for (std::list<RoutingTableEntry>::iterator rteit = rteList.begin();
- rteit != rteList.end(); ++rteit)
- {
+ rteit != rteList.end(); ++rteit) {
RoutingTableEntry* rteCheck =
m_nlsr.getRoutingTable().findRoutingTableEntry((*rteit).getDestination());
- if (rteCheck != 0)
- {
+ if (rteCheck != 0) {
addEntry((*it).getNamePrefix(), *(rteCheck));
}
- else
- {
+ else {
RoutingTableEntry rte((*rteit).getDestination());
addEntry((*it).getNamePrefix(), rte);
}
@@ -150,8 +136,7 @@
std::cout << "----------------NPT----------------------" << std::endl;
for (std::list<NamePrefixTableEntry>::iterator it = m_table.begin();
it != m_table.end();
- ++it)
- {
+ ++it) {
cout << (*it) << endl;
}
}