src: Small style corrections

Change-Id: I51d073e33f92c491667c2e3ac7ceab388db61a2e
diff --git a/nlsr.conf b/nlsr.conf
index 948c67a..8b10210 100644
--- a/nlsr.conf
+++ b/nlsr.conf
@@ -2,29 +2,29 @@
 
 general
 {
-; mandatory configuration command section network, site and router
+  ; mandatory configuration command section network, site and router
 
-    network /ndn/         ; name of the network the router belongs to in ndn URI format
-    site /edu/memphis    ; name of the site the router belongs to in ndn URI format
-    router /%C1.Router/cs/pollux    ; name of the router in ndn URI format
+  network /ndn/         ; name of the network the router belongs to in ndn URI format
+  site /edu/memphis    ; name of the site the router belongs to in ndn URI format
+  router /%C1.Router/cs/pollux    ; name of the router in ndn URI format
 
-; lsa-refresh-time is the time in seconds, after which router will refresh its LSAs
+  ; lsa-refresh-time is the time in seconds, after which router will refresh its LSAs
 
-    lsa-refresh-time 1800      ; default value 1800. Valid values 240-7200
+  lsa-refresh-time 1800      ; default value 1800. Valid values 240-7200
 
-; log-level is to set the levels of log for NLSR
+  ; log-level is to set the levels of log for NLSR
 
-    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)
+  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
 
 neighbors
 {
-; in case hello interest timed out, router will try 'hello-retries' times at 'hello-timeout'
-; seconds interval before giving up for any neighbors (deciding link is down)
+  ; in case hello interest timed out, router will try 'hello-retries' times at 'hello-timeout'
+  ; seconds interval before giving up for any neighbors (deciding link is down)
 
    hello-retries 3                     ; interest retries number in integer. Default value 3
                                        ; valid values 1-10
@@ -34,26 +34,27 @@
 
    hello-interval  60                  ; interest sending interval in seconds. Default value 60
                                        ; valid values 30-90
-; neighbor command is used to configure router's neighbor. Each neighbor will need
-; one block of neighbor command
 
-   neighbor
-   {
-       name /ndn/edu/memphis/%C1.Router/cs/castor        ; name prefix of the neighbor router consists
+  ; neighbor command is used to configure router's neighbor. Each neighbor will need
+  ; one block of neighbor command
+
+  neighbor
+  {
+    name /ndn/edu/memphis/%C1.Router/cs/castor  ; name prefix of the neighbor router consists
+                                                ; of network, site-name and router-name
+
+    face-uri  udp://castor.cs.memphis.edu       ; face uri of the face connected to the neighbor
+    link-cost 25                                ; cost of the connecting link to neighbor
+  }
+
+  neighbor
+  {
+    name /ndn/edu/memphis/%C1.Router/cs/mira  ; name prefix of the neighbor router consists
                                               ; of network, site-name and router-name
 
-       face-uri  udp://castor.cs.memphis.edu  ; face uri of the face connected to the neighbor
-       link-cost 25                         ; cost of the connecting link to neighbor
-   }
-
-   neighbor
-   {
-       name /ndn/edu/memphis/%C1.Router/cs/mira          ; name prefix of the neighbor router consists
-                                              ; of network, site-name and router-name
-
-       face-uri  udp://mira.cs.memphis.edu    ; face uri of the face connected to the neighbor
-       link-cost 30                        ; cost of the connecting link to neighbor
-   }
+    face-uri  udp://mira.cs.memphis.edu       ; face uri of the face connected to the neighbor
+    link-cost 30                              ; cost of the connecting link to neighbor
+  }
 }
 
 ; the hyperbolic section contains the configuration settings of enabling a router to calculate
@@ -61,16 +62,16 @@
 
 hyperbolic
 {
-; commands in this section follows a strict order
-; the switch is used to set hyperbolic routing calculation in NLSR
+  ; commands in this section follows a strict order
+  ; the switch is used to set hyperbolic routing calculation in NLSR
 
-    state off             ; default value 'off', set value 'on' to enable hyperbolic routing table
-                           ; calculation which turns link state routing 'off'. set value to 'dry-run"
-                           ; to test hyperbolic routing and compare with link state routing.
+  state off             ; default value 'off', set value 'on' to enable hyperbolic routing table
+                        ; calculation which turns link state routing 'off'. set value to 'dry-run"
+                        ; to test hyperbolic routing and compare with link state routing.
 
 
-    radius   123.456       ; radius of the router in hyperbolic coordinate system
-    angle    1.45          ; angle of the router in hyperbolic coordinate system
+  radius   123.456      ; radius of the router in hyperbolic coordinate system
+  angle    1.45         ; angle of the router in hyperbolic coordinate system
 }
 
 
@@ -78,12 +79,11 @@
 
 fib
 {
-; the max-faces-per-prefix is used to limit the number of faces for each name prefixes
-; by NLSR in ndn FIB
+  ; the max-faces-per-prefix is used to limit the number of faces for each name prefixes
+  ; by NLSR in ndn FIB
 
-    max-faces-per-prefix 3   ; default value 0. Valid value 0-60. By default (value 0) NLSR adds
-                             ; all available faces for each reachable name prefixes in NDN FIB
-
+  max-faces-per-prefix 3   ; default value 0. Valid value 0-60. By default (value 0) NLSR adds
+                           ; all available faces for each reachable name prefixes in NDN FIB
 }
 
 ; the advertising section contains the configuration settings of the name prefixes
@@ -91,11 +91,11 @@
 
 advertising
 {
-; the ndnname is used to advertised name from the router. To advertise each name prefix
-; configure one block of ndnname configuration command for every name prefix.
+  ; the ndnname is used to advertised name from the router. To advertise each name prefix
+  ; configure one block of ndnname configuration command for every name prefix.
 
-    prefix /ndn/edu/memphis/cs/netlab           ; name in ndn URI format
-    prefix /ndn/edu/memphis/sports/basketball
+  prefix /ndn/edu/memphis/cs/netlab           ; name in ndn URI format
+  prefix /ndn/edu/memphis/sports/basketball
 }
 
 security
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index 8949b42..0328ecd 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -35,7 +35,6 @@
 #include "adjacent.hpp"
 #include "utility/name-helper.hpp"
 
-
 namespace nlsr {
 
 using namespace std;
@@ -60,7 +59,7 @@
 bool
 ConfFileProcessor::load(istream& input)
 {
-  boost::property_tree::ptree pt;
+  ConfigSection pt;
   bool ret = true;
   try {
     boost::property_tree::read_info(input, pt);
@@ -71,11 +70,10 @@
     std::cerr << m_confFileName << std::endl;
     return false;
   }
-  for (boost::property_tree::ptree::const_iterator tn = pt.begin();
+
+  for (ConfigSection::const_iterator tn = pt.begin();
        tn != pt.end(); ++tn) {
-    std::string section = tn->first;
-    boost::property_tree::ptree SectionAttributeTree = tn ->second;
-    ret = processSection(section, SectionAttributeTree);
+    ret = processSection(tn->first, tn->second);
     if (ret == false) {
       break;
     }
@@ -84,49 +82,47 @@
 }
 
 bool
-ConfFileProcessor::processSection(const std::string& section,
-                                  boost::property_tree::ptree SectionAttributeTree)
+ConfFileProcessor::processSection(const std::string& sectionName, const ConfigSection& section)
 {
   bool ret = true;
-  if (section == "general")
+  if (sectionName == "general")
   {
-    ret = processConfSectionGeneral(SectionAttributeTree);
+    ret = processConfSectionGeneral(section);
   }
-  else if (section == "neighbors")
+  else if (sectionName == "neighbors")
   {
-    ret = processConfSectionNeighbors(SectionAttributeTree);
+    ret = processConfSectionNeighbors(section);
   }
-  else if (section == "hyperbolic")
+  else if (sectionName == "hyperbolic")
   {
-    ret = processConfSectionHyperbolic(SectionAttributeTree);
+    ret = processConfSectionHyperbolic(section);
   }
-  else if (section == "fib")
+  else if (sectionName == "fib")
   {
-    ret = processConfSectionFib(SectionAttributeTree);
+    ret = processConfSectionFib(section);
   }
-  else if (section == "advertising")
+  else if (sectionName == "advertising")
   {
-    ret = processConfSectionAdvertising(SectionAttributeTree);
+    ret = processConfSectionAdvertising(section);
   }
-  else if (section == "security")
+  else if (sectionName == "security")
   {
-    ret = processConfSectionSecurity(SectionAttributeTree);
+    ret = processConfSectionSecurity(section);
   }
   else
   {
-    std::cerr << "Wrong configuration Command: " << section << std::endl;
+    std::cerr << "Wrong configuration section: " << sectionName << std::endl;
   }
   return ret;
 }
 
 bool
-ConfFileProcessor::processConfSectionGeneral(boost::property_tree::ptree
-                                             SectionAttributeTree)
+ConfFileProcessor::processConfSectionGeneral(const ConfigSection& section)
 {
   try {
-    std::string network = SectionAttributeTree.get<string>("network");
-    std::string site = SectionAttributeTree.get<string>("site");
-    std::string router = SectionAttributeTree.get<string>("router");
+    std::string network = section.get<string>("network");
+    std::string site = section.get<string>("site");
+    std::string router = section.get<string>("router");
     ndn::Name networkName(network);
     if (!networkName.empty()) {
       m_nlsr.getConfParameter().setNetwork(networkName);
@@ -158,7 +154,7 @@
   }
 
   try {
-    int32_t lsaRefreshTime = SectionAttributeTree.get<int32_t>("lsa-refresh-time");
+    int32_t lsaRefreshTime = section.get<int32_t>("lsa-refresh-time");
     if (lsaRefreshTime >= LSA_REFRESH_TIME_MIN &&
         lsaRefreshTime <= LSA_REFRESH_TIME_MAX) {
       m_nlsr.getConfParameter().setLsaRefreshTime(lsaRefreshTime);
@@ -176,7 +172,7 @@
   }
 
   try {
-    std::string logLevel = SectionAttributeTree.get<string>("log-level");
+    std::string logLevel = section.get<string>("log-level");
     if ( boost::iequals(logLevel, "info") || boost::iequals(logLevel, "debug")) {
       m_nlsr.getConfParameter().setLogLevel(logLevel);
     }
@@ -192,7 +188,7 @@
   }
 
   try {
-    std::string logDir = SectionAttributeTree.get<string>("log-dir");
+    std::string logDir = section.get<string>("log-dir");
     if (boost::filesystem::exists(logDir)) {
       if (boost::filesystem::is_directory(logDir)) {
         std::string testFileName=logDir+"/test.log";
@@ -225,7 +221,7 @@
     return false;
   }
   try {
-    std::string seqDir = SectionAttributeTree.get<string>("seq-dir");
+    std::string seqDir = section.get<string>("seq-dir");
     if (boost::filesystem::exists(seqDir)) {
       if (boost::filesystem::is_directory(seqDir)) {
         std::string testFileName=seqDir+"/test.seq";
@@ -262,11 +258,10 @@
 }
 
 bool
-ConfFileProcessor::processConfSectionNeighbors(boost::property_tree::ptree
-                                           SectionAttributeTree)
+ConfFileProcessor::processConfSectionNeighbors(const ConfigSection& section)
 {
   try {
-    int retrials = SectionAttributeTree.get<int>("hello-retries");
+    int retrials = section.get<int>("hello-retries");
     if (retrials >= HELLO_RETRIES_MIN && retrials <= HELLO_RETRIES_MAX) {
       m_nlsr.getConfParameter().setInterestRetryNumber(retrials);
     }
@@ -282,7 +277,7 @@
     return false;
   }
   try {
-    int timeOut = SectionAttributeTree.get<int>("hello-timeout");
+    int timeOut = section.get<int>("hello-timeout");
     if (timeOut >= HELLO_TIMEOUT_MIN && timeOut <= HELLO_TIMEOUT_MAX) {
       m_nlsr.getConfParameter().setInterestResendTime(timeOut);
     }
@@ -297,7 +292,7 @@
     std::cerr << ex.what() << std::endl;
   }
   try {
-    int interval = SectionAttributeTree.get<int>("hello-interval");
+    int interval = section.get<int>("hello-interval");
     if (interval >= HELLO_INTERVAL_MIN && interval <= HELLO_INTERVAL_MAX) {
       m_nlsr.getConfParameter().setInfoInterestInterval(interval);
     }
@@ -311,13 +306,13 @@
   catch (const std::exception& ex) {
     std::cerr << ex.what() << std::endl;
   }
-  for (boost::property_tree::ptree::const_iterator tn =
-           SectionAttributeTree.begin(); tn != SectionAttributeTree.end(); ++tn) {
+  for (ConfigSection::const_iterator tn =
+           section.begin(); tn != section.end(); ++tn) {
 
     if (tn->first == "neighbor")
     {
       try {
-        boost::property_tree::ptree CommandAttriTree = tn->second;
+        ConfigSection CommandAttriTree = tn->second;
         std::string name = CommandAttriTree.get<std::string>("name");
         std::string faceUri = CommandAttriTree.get<std::string>("face-uri");
         double linkCost = CommandAttriTree.get<double>("link-cost",
@@ -342,12 +337,11 @@
 }
 
 bool
-ConfFileProcessor::processConfSectionHyperbolic(boost::property_tree::ptree
-                                                SectionAttributeTree)
+ConfFileProcessor::processConfSectionHyperbolic(const ConfigSection& section)
 {
   std::string state;
   try {
-    state= SectionAttributeTree.get<string>("state","off");
+    state= section.get<string>("state","off");
     if (boost::iequals(state, "off")) {
       m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_OFF);
     }
@@ -374,8 +368,8 @@
      * in the network may use hyperbolic routing calculation for FIB generation.
      * So each router need to advertise its hyperbolic coordinates in the network
      */
-    double radius = SectionAttributeTree.get<double>("radius");
-    double angle = SectionAttributeTree.get<double>("angle");
+    double radius = section.get<double>("radius");
+    double angle = section.get<double>("angle");
     if (!m_nlsr.getConfParameter().setCorR(radius)) {
       return false;
     }
@@ -392,12 +386,11 @@
 }
 
 bool
-ConfFileProcessor::processConfSectionFib(boost::property_tree::ptree
-                                         SectionAttributeTree)
+ConfFileProcessor::processConfSectionFib(const ConfigSection& section)
 {
   try {
     int maxFacesPerPrefixNumber =
-      SectionAttributeTree.get<int>("max-faces-per-prefix");
+      section.get<int>("max-faces-per-prefix");
     if (maxFacesPerPrefixNumber >= MAX_FACES_PER_PREFIX_MIN &&
         maxFacesPerPrefixNumber <= MAX_FACES_PER_PREFIX_MAX)
     {
@@ -417,11 +410,10 @@
 }
 
 bool
-ConfFileProcessor::processConfSectionAdvertising(boost::property_tree::ptree
-                                                 SectionAttributeTree)
+ConfFileProcessor::processConfSectionAdvertising(const ConfigSection& section)
 {
-  for (boost::property_tree::ptree::const_iterator tn =
-         SectionAttributeTree.begin(); tn != SectionAttributeTree.end(); ++tn) {
+  for (ConfigSection::const_iterator tn =
+         section.begin(); tn != section.end(); ++tn) {
    if (tn->first == "prefix") {
      try {
        std::string prefix = tn->second.data();
@@ -444,7 +436,7 @@
 }
 
 bool
-ConfFileProcessor::processConfSectionSecurity(boost::property_tree::ptree section)
+ConfFileProcessor::processConfSectionSecurity(const ConfigSection& section)
 {
   ConfigSection::const_iterator it = section.begin();
 
@@ -483,4 +475,4 @@
   return true;
 }
 
-}//namespace NLSR
+} // namespace nlsr
diff --git a/src/conf-file-processor.hpp b/src/conf-file-processor.hpp
index cc715b0..8fbf8e7 100644
--- a/src/conf-file-processor.hpp
+++ b/src/conf-file-processor.hpp
@@ -45,34 +45,33 @@
   processConfFile();
 
 private:
+  typedef boost::property_tree::ptree ConfigSection;
+
   bool
   load(std::istream& input);
 
   bool
-  processSection(const std::string& section,
-                 boost::property_tree::ptree SectionAttributeTree);
+  processSection(const std::string& sectionName, const ConfigSection& section);
 
   bool
-  processConfSectionGeneral(boost::property_tree::ptree SectionAttributeTree);
+  processConfSectionGeneral(const ConfigSection& section);
 
   bool
-  processConfSectionNeighbors(boost::property_tree::ptree SectionAttributeTree);
+  processConfSectionNeighbors(const ConfigSection& section);
 
   bool
-  processConfSectionHyperbolic(boost::property_tree::ptree SectionAttributeTree);
+  processConfSectionHyperbolic(const ConfigSection& section);
 
   bool
-  processConfSectionFib(boost::property_tree::ptree SectionAttributeTree);
+  processConfSectionFib(const ConfigSection& section);
 
   bool
-  processConfSectionAdvertising(boost::property_tree::ptree SectionAttributeTree);
+  processConfSectionAdvertising(const ConfigSection& section);
 
   bool
-  processConfSectionSecurity(boost::property_tree::ptree SectionAttributeTree);
+  processConfSectionSecurity(const ConfigSection& section);
 
 private:
-  typedef boost::property_tree::ptree ConfigSection;
-
   std::string m_confFileName;
   Nlsr& m_nlsr;
 };
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index c5aea44..55e8044 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -99,7 +99,7 @@
 bool
 Lsdb::installNameLsa(NameLsa& nlsa)
 {
-  ndn::time::seconds timeToExpire = ndn::time::seconds(m_lsaRefreshTime);
+  ndn::time::seconds timeToExpire = m_lsaRefreshTime;
   NameLsa* chkNameLsa = findNameLsa(nlsa.getKey());
   if (chkNameLsa == 0) {
     addNameLsa(nlsa);
@@ -305,7 +305,7 @@
 bool
 Lsdb::installCoordinateLsa(CoordinateLsa& clsa)
 {
-  ndn::time::seconds timeToExpire = ndn::time::seconds(m_lsaRefreshTime);
+  ndn::time::seconds timeToExpire = m_lsaRefreshTime;
   CoordinateLsa* chkCorLsa = findCoordinateLsa(clsa.getKey());
   if (chkCorLsa == 0) {
     _LOG_DEBUG("New Coordinate LSA. Adding to LSDB");
@@ -511,7 +511,7 @@
 bool
 Lsdb::installAdjLsa(AdjLsa& alsa)
 {
-  ndn::time::seconds timeToExpire = ndn::time::seconds(m_lsaRefreshTime);
+  ndn::time::seconds timeToExpire = m_lsaRefreshTime;
   AdjLsa* chkAdjLsa = findAdjLsa(alsa.getKey());
   if (chkAdjLsa == 0) {
     _LOG_DEBUG("New Adj LSA. Adding to LSDB");
@@ -614,7 +614,7 @@
 void
 Lsdb::setLsaRefreshTime(int lrt)
 {
-  m_lsaRefreshTime = lrt;
+  m_lsaRefreshTime = ndn::time::seconds(lrt);
 }
 
 void
@@ -644,7 +644,7 @@
         // schedule refreshing event again
         chkNameLsa->setExpiringEventId(scheduleNameLsaExpiration(chkNameLsa->getKey(),
                                                                  chkNameLsa->getLsSeqNo(),
-                                                                 ndn::time::seconds(m_lsaRefreshTime)));
+                                                                 m_lsaRefreshTime));
         // publish routing update
         //ndn::Name lsaPrefix = m_nlsr.getConfParameter().getLsaPrefix();
         //lsaPrefix.append(m_nlsr.getConfParameter().getRouterPrefix());
@@ -683,7 +683,7 @@
         // schedule refreshing event again
         chkAdjLsa->setExpiringEventId(scheduleAdjLsaExpiration(chkAdjLsa->getKey(),
                                                                chkAdjLsa->getLsSeqNo(),
-                                                               ndn::time::seconds(m_lsaRefreshTime)));
+                                                               m_lsaRefreshTime));
         // publish routing update
         //ndn::Name lsaPrefix = m_nlsr.getConfParameter().getLsaPrefix();
         //lsaPrefix.append(m_nlsr.getConfParameter().getRouterPrefix());
@@ -726,7 +726,7 @@
         chkCorLsa->setExpiringEventId(scheduleCoordinateLsaExpiration(
                                         chkCorLsa->getKey(),
                                         chkCorLsa->getLsSeqNo(),
-                                        ndn::time::seconds(m_lsaRefreshTime)));
+                                        m_lsaRefreshTime));
         // publish routing update
         //ndn::Name lsaPrefix = m_nlsr.getConfParameter().getLsaPrefix();
         //lsaPrefix.append(m_nlsr.getConfParameter().getRouterPrefix());
@@ -1015,4 +1015,4 @@
   return false;
 }
 
-}//namespace nlsr
+} // namespace nlsr
diff --git a/src/lsdb.hpp b/src/lsdb.hpp
index 64de8ec..6bfc849 100644
--- a/src/lsdb.hpp
+++ b/src/lsdb.hpp
@@ -218,7 +218,7 @@
   std::list<AdjLsa> m_adjLsdb;
   std::list<CoordinateLsa> m_corLsdb;
 
-  int m_lsaRefreshTime;
+  ndn::time::seconds m_lsaRefreshTime;
   std::string m_thisRouterPrefix;
 
 };