Follow ndn::Scheduler API changes

Switch from ndn::EventId to ndn::scheduler::EventId
and simplify some code.

Refs: #4883
Change-Id: Ifbd3b00da441ca0a277900265f8f6e31fdcebf2a
diff --git a/src/hello-protocol.cpp b/src/hello-protocol.cpp
index 67c948f..c068905 100644
--- a/src/hello-protocol.cpp
+++ b/src/hello-protocol.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California
  *
@@ -17,7 +17,6 @@
  * You should have received a copy of the GNU General Public License along with
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
-#include "hello-protocol.hpp"
 
 #include "hello-protocol.hpp"
 #include "nlsr.hpp"
@@ -91,10 +90,7 @@
 {
   NLSR_LOG_DEBUG("Scheduling HELLO Interests in " << ndn::time::seconds(seconds));
 
-  m_scheduler.scheduleEvent(ndn::time::seconds(seconds),
-                            [this] {
-                              sendScheduledInterest();
-                            });
+  m_scheduler.schedule(ndn::time::seconds(seconds), [this] { sendScheduledInterest(); });
 }
 
 void
diff --git a/src/lsa-segment-storage.cpp b/src/lsa-segment-storage.cpp
index 830906d..e7d6f2d 100644
--- a/src/lsa-segment-storage.cpp
+++ b/src/lsa-segment-storage.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018,  The University of Memphis,
+/*
+ * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -140,10 +140,8 @@
 {
   NLSR_LOG_TRACE("Scheduling LSA segment deletion for "
                  << lsaSegmentsKey << " in: " << expirationTime);
-  m_scheduler.scheduleEvent(expirationTime,
-                            [lsaSegmentsKey, this] {
-                              m_lsaSegments.erase(lsaSegmentsKey);
-                            });
+  m_scheduler.schedule(expirationTime,
+                       [lsaSegmentsKey, this] { m_lsaSegments.erase(lsaSegmentsKey); });
 }
 
 } // namespace nlsr
diff --git a/src/lsa.hpp b/src/lsa.hpp
index 54a2c75..13a5b6c 100644
--- a/src/lsa.hpp
+++ b/src/lsa.hpp
@@ -26,7 +26,6 @@
 #include "adjacent.hpp"
 #include "adjacency-list.hpp"
 
-#include <boost/cstdint.hpp>
 #include <ndn-cxx/util/scheduler.hpp>
 #include <ndn-cxx/util/time.hpp>
 #include <boost/tokenizer.hpp>
@@ -44,14 +43,6 @@
     MOCK
   };
 
-  Lsa()
-    : m_origRouter()
-    , m_lsSeqNo()
-    , m_expirationTimePoint()
-    , m_expiringEventId()
-  {
-  }
-
   virtual
   ~Lsa() = default;
 
@@ -98,12 +89,12 @@
   }
 
   void
-  setExpiringEventId(const ndn::EventId leei)
+  setExpiringEventId(ndn::scheduler::EventId eid)
   {
-    m_expiringEventId = leei;
+    m_expiringEventId = std::move(eid);
   }
 
-  ndn::EventId
+  ndn::scheduler::EventId
   getExpiringEventId() const
   {
     return m_expiringEventId;
@@ -151,17 +142,15 @@
 
 protected:
   ndn::Name m_origRouter;
-  uint32_t m_lsSeqNo;
+  uint32_t m_lsSeqNo = 0;
   ndn::time::system_clock::TimePoint m_expirationTimePoint;
-  ndn::EventId m_expiringEventId;
+  ndn::scheduler::EventId m_expiringEventId;
 };
 
 class NameLsa : public Lsa
 {
 public:
-  NameLsa()
-  {
-  }
+  NameLsa() = default;
 
   NameLsa(const ndn::Name& origR, uint32_t lsn,
           const ndn::time::system_clock::TimePoint& lt,
@@ -235,9 +224,7 @@
 public:
   typedef AdjacencyList::const_iterator const_iterator;
 
-  AdjLsa()
-  {
-  }
+  AdjLsa() = default;
 
   AdjLsa(const ndn::Name& origR, uint32_t lsn,
          const ndn::time::system_clock::TimePoint& lt,
@@ -320,10 +307,7 @@
 class CoordinateLsa : public Lsa
 {
 public:
-  CoordinateLsa()
-    : m_corRad(0)
-  {
-  }
+  CoordinateLsa() = default;
 
   CoordinateLsa(const ndn::Name& origR, uint32_t lsn,
                 const ndn::time::system_clock::TimePoint& lt,
@@ -349,13 +333,13 @@
   double
   getCorRadius() const
   {
-      return m_corRad;
+    return m_corRad;
   }
 
   void
   setCorRadius(double cr)
   {
-      m_corRad = cr;
+    m_corRad = cr;
   }
 
   const std::vector<double>
@@ -385,7 +369,7 @@
   serialize() const override;
 
 private:
-  double m_corRad;
+  double m_corRad = 0.0;
   std::vector<double> m_angles;
 
   friend std::ostream&
@@ -410,8 +394,8 @@
 } // namespace nlsr
 
 namespace std {
-  std::string
-  to_string(const nlsr::Lsa::Type& type);
+std::string
+to_string(const nlsr::Lsa::Type& type);
 } // namespace std
 
 #endif // NLSR_LSA_HPP
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 4159c4f..58963f4 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
@@ -85,11 +85,10 @@
                       uint64_t seqNo)
 {
   NLSR_LOG_DEBUG("Failed to fetch LSA: " << lsaName << ", Error code: " << errorCode
-                                                << ", Message: " << msg);
+                 << ", Message: " << msg);
 
   if (ndn::time::steady_clock::now() < deadline) {
-    SequenceNumberMap::const_iterator it = m_highestSeqNo.find(lsaName);
-
+    auto it = m_highestSeqNo.find(lsaName);
     if (it != m_highestSeqNo.end() && it->second == seqNo) {
       // If the SegmentFetcher failed due to an Interest timeout, it is safe to re-express
       // immediately since at the least the LSA Interest lifetime has elapsed.
@@ -101,8 +100,8 @@
         delay = ndn::time::seconds(0);
       }
 
-      m_scheduler.scheduleEvent(delay, std::bind(&Lsdb::expressInterest, this,
-                                                 interestName, retransmitNo + 1, deadline));
+      m_scheduler.schedule(delay, std::bind(&Lsdb::expressInterest, this,
+                                            interestName, retransmitNo + 1, deadline));
     }
   }
 }
@@ -132,12 +131,6 @@
   onContentValidated(data);
 }
 
-void
-Lsdb::cancelScheduleLsaExpiringEvent(ndn::EventId eid)
-{
-  m_scheduler.cancelEvent(eid);
-}
-
   /*! \brief Compares if a name LSA is the same as the one specified by key
 
     \param nlsa1 A name LSA object
@@ -167,13 +160,12 @@
 NameLsa*
 Lsdb::findNameLsa(const ndn::Name& key)
 {
-  std::list<NameLsa>::iterator it = std::find_if(m_nameLsdb.begin(),
-                                                 m_nameLsdb.end(),
-                                                 std::bind(nameLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_nameLsdb.begin(), m_nameLsdb.end(),
+                         std::bind(nameLsaCompareByKey, _1, key));
   if (it != m_nameLsdb.end()) {
-    return &(*it);
+    return &*it;
   }
-  return 0;
+  return nullptr;
 }
 
 bool
@@ -181,7 +173,7 @@
 {
   NameLsa* nameLsaCheck = findNameLsa(key);
   // Is the name in the LSDB
-  if (nameLsaCheck != 0) {
+  if (nameLsaCheck != nullptr) {
     // And the supplied seq no is the highest so far
     if (nameLsaCheck->getLsSeqNo() < seqNo) {
       return true;
@@ -193,12 +185,12 @@
   return true;
 }
 
-ndn::EventId
+ndn::scheduler::EventId
 Lsdb::scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
                                 const ndn::time::seconds& expTime)
 {
-  return m_scheduler.scheduleEvent(expTime + GRACE_PERIOD,
-                                   std::bind(&Lsdb::expireOrRefreshNameLsa, this, key, seqNo));
+  return m_scheduler.schedule(expTime + GRACE_PERIOD,
+                              std::bind(&Lsdb::expireOrRefreshNameLsa, this, key, seqNo));
 }
 
 bool
@@ -208,7 +200,7 @@
   ndn::time::seconds timeToExpire = m_lsaRefreshTime;
   NameLsa* chkNameLsa = findNameLsa(nlsa.getKey());
   // Determines if the name LSA is new or not.
-  if (chkNameLsa == 0) {
+  if (chkNameLsa == nullptr) {
     addNameLsa(nlsa);
     NLSR_LOG_DEBUG("New Name LSA");
     NLSR_LOG_DEBUG("Adding Name Lsa");
@@ -283,11 +275,10 @@
       }
 
       if (nlsa.getOrigRouter() != m_confParam.getRouterPrefix()) {
-        ndn::time::system_clock::Duration duration = nlsa.getExpirationTimePoint() -
-                                                     ndn::time::system_clock::now();
+        auto duration = nlsa.getExpirationTimePoint() - ndn::time::system_clock::now();
         timeToExpire = ndn::time::duration_cast<ndn::time::seconds>(duration);
       }
-      cancelScheduleLsaExpiringEvent(chkNameLsa->getExpiringEventId());
+      chkNameLsa->getExpiringEventId().cancel();
       chkNameLsa->setExpiringEventId(scheduleNameLsaExpiration(nlsa.getKey(),
                                                                nlsa.getLsSeqNo(),
                                                                timeToExpire));
@@ -301,10 +292,8 @@
 bool
 Lsdb::addNameLsa(NameLsa& nlsa)
 {
-  std::list<NameLsa>::iterator it = std::find_if(m_nameLsdb.begin(),
-                                                 m_nameLsdb.end(),
-                                                 std::bind(nameLsaCompareByKey, _1,
-                                                      nlsa.getKey()));
+  auto it = std::find_if(m_nameLsdb.begin(), m_nameLsdb.end(),
+                         std::bind(nameLsaCompareByKey, _1, nlsa.getKey()));
   if (it == m_nameLsdb.end()) {
     m_nameLsdb.push_back(nlsa);
     return true;
@@ -315,16 +304,15 @@
 bool
 Lsdb::removeNameLsa(const ndn::Name& key)
 {
-  std::list<NameLsa>::iterator it = std::find_if(m_nameLsdb.begin(),
-                                                 m_nameLsdb.end(),
-                                                 std::bind(nameLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_nameLsdb.begin(), m_nameLsdb.end(),
+                         std::bind(nameLsaCompareByKey, _1, key));
   if (it != m_nameLsdb.end()) {
     NLSR_LOG_DEBUG("Deleting Name Lsa");
-    (*it).writeLog();
+    it->writeLog();
     // If the requested name LSA is not ours, we also need to remove
     // its entries from the NPT.
-    if ((*it).getOrigRouter() != m_confParam.getRouterPrefix()) {
-      m_namePrefixTable.removeEntry((*it).getOrigRouter(), (*it).getOrigRouter());
+    if (it->getOrigRouter() != m_confParam.getRouterPrefix()) {
+      m_namePrefixTable.removeEntry(it->getOrigRouter(), it->getOrigRouter());
 
       for (const auto& name : it->getNpl().getNames()) {
         if (name != m_confParam.getRouterPrefix()) {
@@ -341,13 +329,9 @@
 bool
 Lsdb::doesNameLsaExist(const ndn::Name& key)
 {
-  std::list<NameLsa>::iterator it = std::find_if(m_nameLsdb.begin(),
-                                                 m_nameLsdb.end(),
-                                                 std::bind(nameLsaCompareByKey, _1, key));
-  if (it == m_nameLsdb.end()) {
-    return false;
-  }
-  return true;
+  auto it = std::find_if(m_nameLsdb.begin(), m_nameLsdb.end(),
+                         std::bind(nameLsaCompareByKey, _1, key));
+  return it != m_nameLsdb.end();
 }
 
 void
@@ -401,13 +385,12 @@
 CoordinateLsa*
 Lsdb::findCoordinateLsa(const ndn::Name& key)
 {
-  std::list<CoordinateLsa>::iterator it = std::find_if(m_corLsdb.begin(),
-                                                       m_corLsdb.end(),
-                                                       std::bind(corLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_corLsdb.begin(), m_corLsdb.end(),
+                         std::bind(corLsaCompareByKey, _1, key));
   if (it != m_corLsdb.end()) {
-    return &(*it);
+    return &*it;
   }
-  return 0;
+  return nullptr;
 }
 
 bool
@@ -415,7 +398,7 @@
 {
   CoordinateLsa* clsa = findCoordinateLsa(key);
   // Is the coordinate LSA in the LSDB already
-  if (clsa != 0) {
+  if (clsa != nullptr) {
     // And the seq no is newer (higher) than the current one
     if (clsa->getLsSeqNo() < seqNo) {
       return true;
@@ -431,13 +414,12 @@
   // \param key The name of the router that published the LSA.
   // \param seqNo the seq. no. associated with the LSA to check.
   // \param expTime How long to wait before triggering the event.
-ndn::EventId
+ndn::scheduler::EventId
 Lsdb::scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
                                       const ndn::time::seconds& expTime)
 {
-  return m_scheduler.scheduleEvent(expTime + GRACE_PERIOD,
-                                   std::bind(&Lsdb::expireOrRefreshCoordinateLsa,
-                                             this, key, seqNo));
+  return m_scheduler.schedule(expTime + GRACE_PERIOD,
+                              std::bind(&Lsdb::expireOrRefreshCoordinateLsa, this, key, seqNo));
 }
 
 bool
@@ -446,7 +428,7 @@
   ndn::time::seconds timeToExpire = m_lsaRefreshTime;
   CoordinateLsa* chkCorLsa = findCoordinateLsa(clsa.getKey());
   // Checking whether the LSA is new or not.
-  if (chkCorLsa == 0) {
+  if (chkCorLsa == nullptr) {
     NLSR_LOG_DEBUG("New Coordinate LSA. Adding to LSDB");
     NLSR_LOG_DEBUG("Adding Coordinate Lsa");
     clsa.writeLog();
@@ -487,11 +469,10 @@
       }
       // If this is an LSA from another router, refresh its expiration time.
       if (clsa.getOrigRouter() != m_confParam.getRouterPrefix()) {
-        ndn::time::system_clock::Duration duration = clsa.getExpirationTimePoint() -
-                                                     ndn::time::system_clock::now();
+        auto duration = clsa.getExpirationTimePoint() - ndn::time::system_clock::now();
         timeToExpire = ndn::time::duration_cast<ndn::time::seconds>(duration);
       }
-      cancelScheduleLsaExpiringEvent(chkCorLsa->getExpiringEventId());
+      chkCorLsa->getExpiringEventId().cancel();
       chkCorLsa->setExpiringEventId(scheduleCoordinateLsaExpiration(clsa.getKey(),
                                                                     clsa.getLsSeqNo(),
                                                                     timeToExpire));
@@ -505,10 +486,8 @@
 bool
 Lsdb::addCoordinateLsa(CoordinateLsa& clsa)
 {
-  std::list<CoordinateLsa>::iterator it = std::find_if(m_corLsdb.begin(),
-                                                       m_corLsdb.end(),
-                                                       std::bind(corLsaCompareByKey, _1,
-                                                                 clsa.getKey()));
+  auto it = std::find_if(m_corLsdb.begin(), m_corLsdb.end(),
+                         std::bind(corLsaCompareByKey, _1, clsa.getKey()));
   if (it == m_corLsdb.end()) {
     m_corLsdb.push_back(clsa);
     return true;
@@ -519,10 +498,9 @@
 bool
 Lsdb::removeCoordinateLsa(const ndn::Name& key)
 {
-  std::list<CoordinateLsa>::iterator it = std::find_if(m_corLsdb.begin(),
-                                                       m_corLsdb.end(),
-                                                       std::bind(corLsaCompareByKey,
-                                                                 _1, key));
+  auto it = std::find_if(m_corLsdb.begin(), m_corLsdb.end(),
+                         std::bind(corLsaCompareByKey, _1, key));
+
   if (it != m_corLsdb.end()) {
     NLSR_LOG_DEBUG("Deleting Coordinate Lsa");
     it->writeLog();
@@ -540,14 +518,9 @@
 bool
 Lsdb::doesCoordinateLsaExist(const ndn::Name& key)
 {
-  std::list<CoordinateLsa>::iterator it = std::find_if(m_corLsdb.begin(),
-                                                       m_corLsdb.end(),
-                                                       std::bind(corLsaCompareByKey,
-                                                                 _1, key));
-  if (it == m_corLsdb.end()) {
-    return false;
-  }
-  return true;
+  auto it = std::find_if(m_corLsdb.begin(), m_corLsdb.end(),
+                         std::bind(corLsaCompareByKey, _1, key));
+  return it != m_corLsdb.end();
 }
 
 void
@@ -591,7 +564,7 @@
   if (m_isBuildAdjLsaSheduled == false) {
     NLSR_LOG_DEBUG("Scheduling Adjacency LSA build in " << m_adjLsaBuildInterval);
 
-    m_scheduler.scheduleEvent(m_adjLsaBuildInterval, std::bind(&Lsdb::buildAdjLsa, this));
+    m_scheduler.schedule(m_adjLsaBuildInterval, [this] { buildAdjLsa(); });
     m_isBuildAdjLsaSheduled = true;
   }
 }
@@ -640,18 +613,15 @@
     m_isBuildAdjLsaSheduled = true;
     int schedulingTime = m_confParam.getInterestRetryNumber() *
                          m_confParam.getInterestResendTime();
-    m_scheduler.scheduleEvent(ndn::time::seconds(schedulingTime),
-                              std::bind(&Lsdb::buildAdjLsa, this));
+    m_scheduler.schedule(ndn::time::seconds(schedulingTime), [this] { buildAdjLsa(); });
   }
 }
 
 bool
 Lsdb::addAdjLsa(AdjLsa& alsa)
 {
-  std::list<AdjLsa>::iterator it = std::find_if(m_adjLsdb.begin(),
-                                                m_adjLsdb.end(),
-                                                std::bind(adjLsaCompareByKey, _1,
-                                                     alsa.getKey()));
+  auto it = std::find_if(m_adjLsdb.begin(), m_adjLsdb.end(),
+                         std::bind(adjLsaCompareByKey, _1, alsa.getKey()));
   if (it == m_adjLsdb.end()) {
     m_adjLsdb.push_back(alsa);
     // Add any new name prefixes to the NPT
@@ -669,21 +639,20 @@
 AdjLsa*
 Lsdb::findAdjLsa(const ndn::Name& key)
 {
-  std::list<AdjLsa>::iterator it = std::find_if(m_adjLsdb.begin(),
-                                                m_adjLsdb.end(),
-                                                std::bind(adjLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_adjLsdb.begin(), m_adjLsdb.end(),
+                         std::bind(adjLsaCompareByKey, _1, key));
   if (it != m_adjLsdb.end()) {
-    return &(*it);
+    return &*it;
   }
-  return 0;
+  return nullptr;
 }
 
 bool
 Lsdb::isAdjLsaNew(const ndn::Name& key, uint64_t seqNo)
 {
-  AdjLsa*  adjLsaCheck = findAdjLsa(key);
+  AdjLsa* adjLsaCheck = findAdjLsa(key);
   // If it is in the LSDB
-  if (adjLsaCheck != 0) {
+  if (adjLsaCheck != nullptr) {
     // And the supplied seq no is newer (higher) than the current one.
     if (adjLsaCheck->getLsSeqNo() < seqNo) {
       return true;
@@ -695,12 +664,12 @@
   return true;
 }
 
-ndn::EventId
+ndn::scheduler::EventId
 Lsdb::scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
                                const ndn::time::seconds& expTime)
 {
-  return m_scheduler.scheduleEvent(expTime + GRACE_PERIOD,
-                                   std::bind(&Lsdb::expireOrRefreshAdjLsa, this, key, seqNo));
+  return m_scheduler.schedule(expTime + GRACE_PERIOD,
+                              std::bind(&Lsdb::expireOrRefreshAdjLsa, this, key, seqNo));
 }
 
 bool
@@ -709,7 +678,7 @@
   ndn::time::seconds timeToExpire = m_lsaRefreshTime;
   AdjLsa* chkAdjLsa = findAdjLsa(alsa.getKey());
   // If this adj. LSA is not in the LSDB already
-  if (chkAdjLsa == 0) {
+  if (chkAdjLsa == nullptr) {
     NLSR_LOG_DEBUG("New Adj LSA. Adding to LSDB");
     NLSR_LOG_DEBUG("Adding Adj Lsa");
     alsa.writeLog();
@@ -721,8 +690,7 @@
                                                    ndn::time::system_clock::now();
       timeToExpire = ndn::time::duration_cast<ndn::time::seconds>(duration);
     }
-    scheduleAdjLsaExpiration(alsa.getKey(),
-                             alsa.getLsSeqNo(), timeToExpire);
+    scheduleAdjLsaExpiration(alsa.getKey(), alsa.getLsSeqNo(), timeToExpire);
   }
   else {
     if (chkAdjLsa->getLsSeqNo() < alsa.getLsSeqNo()) {
@@ -741,11 +709,10 @@
         m_routingTable.scheduleRoutingTableCalculation();
       }
       if (alsa.getOrigRouter() != m_confParam.getRouterPrefix()) {
-        ndn::time::system_clock::Duration duration = alsa.getExpirationTimePoint() -
-                                                     ndn::time::system_clock::now();
+        auto duration = alsa.getExpirationTimePoint() - ndn::time::system_clock::now();
         timeToExpire = ndn::time::duration_cast<ndn::time::seconds>(duration);
       }
-      cancelScheduleLsaExpiringEvent(chkAdjLsa->getExpiringEventId());
+      chkAdjLsa->getExpiringEventId().cancel();
       chkAdjLsa->setExpiringEventId(scheduleAdjLsaExpiration(alsa.getKey(),
                                                              alsa.getLsSeqNo(),
                                                              timeToExpire));
@@ -778,9 +745,9 @@
 bool
 Lsdb::removeAdjLsa(const ndn::Name& key)
 {
-  std::list<AdjLsa>::iterator it = std::find_if(m_adjLsdb.begin(),
-                                                m_adjLsdb.end(),
-                                                std::bind(adjLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_adjLsdb.begin(), m_adjLsdb.end(),
+                         std::bind(adjLsaCompareByKey, _1, key));
+
   if (it != m_adjLsdb.end()) {
     NLSR_LOG_DEBUG("Deleting Adj Lsa");
     it->writeLog();
@@ -796,13 +763,9 @@
 bool
 Lsdb::doesAdjLsaExist(const ndn::Name& key)
 {
-  std::list<AdjLsa>::iterator it = std::find_if(m_adjLsdb.begin(),
-                                                m_adjLsdb.end(),
-                                                std::bind(adjLsaCompareByKey, _1, key));
-  if (it == m_adjLsdb.end()) {
-    return false;
-  }
-  return true;
+  auto it = std::find_if(m_adjLsdb.begin(), m_adjLsdb.end(),
+                         std::bind(adjLsaCompareByKey, _1, key));
+  return it != m_adjLsdb.end();
 }
 
 const std::list<AdjLsa>&
@@ -825,7 +788,7 @@
   NLSR_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
   NameLsa* chkNameLsa = findNameLsa(lsaKey);
   // If this name LSA exists in the LSDB
-  if (chkNameLsa != 0) {
+  if (chkNameLsa != nullptr) {
     NLSR_LOG_DEBUG("LSA Exists with seq no: " << chkNameLsa->getLsSeqNo());
     // If its seq no is the one we are expecting.
     if (chkNameLsa->getLsSeqNo() == seqNo) {
@@ -868,7 +831,7 @@
   NLSR_LOG_DEBUG("LSA Key: " << lsaKey << " Seq No: " << seqNo);
   AdjLsa* chkAdjLsa = findAdjLsa(lsaKey);
   // If this is a valid LSA
-  if (chkAdjLsa != 0) {
+  if (chkAdjLsa != nullptr) {
     NLSR_LOG_DEBUG("LSA Exists with seq no: " << chkAdjLsa->getLsSeqNo());
     // And if it hasn't been updated for some other reason
     if (chkAdjLsa->getLsSeqNo() == seqNo) {
@@ -916,7 +879,7 @@
   NLSR_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
   CoordinateLsa* chkCorLsa = findCoordinateLsa(lsaKey);
   // Whether the LSA is in the LSDB or not.
-  if (chkCorLsa != 0) {
+  if (chkCorLsa != nullptr) {
     NLSR_LOG_DEBUG("LSA Exists with seq no: " << chkCorLsa->getLsSeqNo());
     // Whether the LSA has been updated without our knowledge.
     if (chkCorLsa->getLsSeqNo() == seqNo) {
diff --git a/src/lsdb.hpp b/src/lsdb.hpp
index 0ce9902..2c68906 100644
--- a/src/lsdb.hpp
+++ b/src/lsdb.hpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
@@ -277,7 +277,7 @@
     \param seqNo The seq. no. associated with the LSA.
     \param expTime How many seconds to wait before triggering the event.
    */
-  ndn::EventId
+  ndn::scheduler::EventId
   scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
                             const ndn::time::seconds& expTime);
 
@@ -294,22 +294,21 @@
     \param seqNo The sequence number of the LSA to check.
     \param expTime The number of seconds to wait before triggering the event.
   */
-  ndn::EventId
+  ndn::scheduler::EventId
   scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
                            const ndn::time::seconds& expTime);
 
 private:
-
   void
   expireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo);
 
-  ndn::EventId
+  ndn::scheduler::EventId
   scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
                                   const ndn::time::seconds& expTime);
 
   void
   expireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
-                                uint64_t seqNo);
+                               uint64_t seqNo);
 
 private:
 
@@ -379,10 +378,6 @@
   ndn::time::system_clock::TimePoint
   getLsaExpirationTimePoint();
 
-  /*! \brief Cancels an event in the event scheduler. */
-  void
-  cancelScheduleLsaExpiringEvent(ndn::EventId eid);
-
 public:
   static const ndn::Name::Component NAME_COMPONENT;
 
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 78e6d0c..4dc536a 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
@@ -561,7 +561,7 @@
 {
   NLSR_LOG_DEBUG("Scheduling Dataset Fetch in " << m_confParam.getFaceDatasetFetchInterval());
 
-  m_scheduler.scheduleEvent(m_confParam.getFaceDatasetFetchInterval(),
+  m_scheduler.schedule(m_confParam.getFaceDatasetFetchInterval(),
     [this] {
       this->initializeFaces(
         [this] (const std::vector<ndn::nfd::FaceStatus>& faces) {
diff --git a/src/route/fib-entry.hpp b/src/route/fib-entry.hpp
index 2d653ad..248c0fd 100644
--- a/src/route/fib-entry.hpp
+++ b/src/route/fib-entry.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018,  The University of Memphis,
+/*
+ * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -30,18 +30,11 @@
 class FibEntry
 {
 public:
-  FibEntry()
-    : m_name()
-    , m_seqNo(1)
-    , m_nexthopList()
-  {
-  }
+  FibEntry() = default;
 
   FibEntry(const ndn::Name& name)
-    : m_seqNo(1)
-    , m_nexthopList()
+    : m_name(name)
   {
-    m_name = name;
   }
 
   const ndn::Name&
@@ -57,12 +50,12 @@
   }
 
   void
-  setRefreshEventId(ndn::EventId id)
+  setRefreshEventId(ndn::scheduler::EventId id)
   {
-    m_refreshEventId = id;
+    m_refreshEventId = std::move(id);
   }
 
-  ndn::EventId
+  ndn::scheduler::EventId
   getRefreshEventId() const
   {
     return m_refreshEventId;
@@ -93,8 +86,8 @@
 
 private:
   ndn::Name m_name;
-  ndn::EventId m_refreshEventId;
-  int32_t m_seqNo;
+  ndn::scheduler::EventId m_refreshEventId;
+  int32_t m_seqNo = 1;
   NexthopList m_nexthopList;
 };
 
diff --git a/src/route/fib.cpp b/src/route/fib.cpp
index 1da774b..5966108 100644
--- a/src/route/fib.cpp
+++ b/src/route/fib.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California
  *
@@ -49,7 +49,7 @@
 Fib::remove(const ndn::Name& name)
 {
   NLSR_LOG_DEBUG("Fib::remove called");
-  std::map<ndn::Name, FibEntry>::iterator it = m_table.find(name);
+  auto it = m_table.find(name);
 
   // Only unregister the prefix if it ISN'T a neighbor.
   if (it != m_table.end() && isNotNeighbor((it->second).getName())) {
@@ -96,12 +96,11 @@
   unsigned int nFaces = 0;
 
   // Create a list of next hops to be installed with length == maxFaces
-  for (NexthopList::iterator it = allHops.cbegin(); it != allHops.cend() && nFaces < maxFaces;
-       ++it, ++nFaces) {
+  for (auto it = allHops.cbegin(); it != allHops.cend() && nFaces < maxFaces; ++it, ++nFaces) {
     hopsToAdd.addNextHop(*it);
   }
 
-  std::map<ndn::Name, FibEntry>::iterator entryIt = m_table.find(name);
+  auto entryIt = m_table.find(name);
 
   // New FIB entry that has nextHops
   if (entryIt == m_table.end() && hopsToAdd.size() != 0) {
@@ -236,7 +235,7 @@
   NLSR_LOG_DEBUG(message << ": " << commandSuccessResult.getName() <<
                  " Face Uri: " << faceUri << " faceId: " << commandSuccessResult.getFaceId());
 
-  AdjacencyList::iterator adjacent = m_adjacencyList.findAdjacent(faceUri);
+  auto adjacent = m_adjacencyList.findAdjacent(faceUri);
   if (adjacent != m_adjacencyList.end()) {
     adjacent->setFaceId(commandSuccessResult.getFaceId());
   }
@@ -311,29 +310,24 @@
     .setStrategy(strategy);
 
   m_controller.start<ndn::nfd::StrategyChoiceSetCommand>(parameters,
-                                                         std::bind(&Fib::onSetStrategySuccess, this, _1,
-                                                              "Successfully set strategy choice"),
+                                                         std::bind(&Fib::onSetStrategySuccess, this, _1),
                                                          std::bind(&Fib::onSetStrategyFailure, this, _1,
-                                                              parameters,
-                                                              count,
-                                                              "Failed to set strategy choice"));
+                                                                   parameters, count));
 }
 
 void
-Fib::onSetStrategySuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
-                         const std::string& message)
+Fib::onSetStrategySuccess(const ndn::nfd::ControlParameters& commandSuccessResult)
 {
-  NLSR_LOG_DEBUG(message << ": " << commandSuccessResult.getStrategy() <<
+  NLSR_LOG_DEBUG("Successfully set strategy choice: " << commandSuccessResult.getStrategy() <<
                  " for name: " << commandSuccessResult.getName());
 }
 
 void
 Fib::onSetStrategyFailure(const ndn::nfd::ControlResponse& response,
                           const ndn::nfd::ControlParameters& parameters,
-                          uint32_t count,
-                          const std::string& message)
+                          uint32_t count)
 {
-  NLSR_LOG_DEBUG(message << ": " << parameters.getStrategy() <<
+  NLSR_LOG_DEBUG("Failed to set strategy choice: " << parameters.getStrategy() <<
                  " for name: " << parameters.getName());
   if (count < 3) {
     setStrategy(parameters.getName(), parameters.getStrategy().toUri(), count + 1);
@@ -347,9 +341,9 @@
                  " Seq Num: " << entry.getSeqNo() <<
                  " in " << m_refreshTime << " seconds");
 
-  entry.setRefreshEventId(m_scheduler.scheduleEvent(ndn::time::seconds(m_refreshTime),
-                                                    std::bind(&Fib::refreshEntry, this,
-                                                              entry.getName(), refreshCallback)));
+  entry.setRefreshEventId(m_scheduler.schedule(ndn::time::seconds(m_refreshTime),
+                                               std::bind(&Fib::refreshEntry, this,
+                                                         entry.getName(), refreshCallback)));
 }
 
 void
@@ -362,16 +356,13 @@
 Fib::cancelEntryRefresh(const FibEntry& entry)
 {
   NLSR_LOG_DEBUG("Canceling refresh for " << entry.getName() << " Seq Num: " << entry.getSeqNo());
-
-  m_scheduler.cancelEvent(entry.getRefreshEventId());
-  entry.getRefreshEventId().reset();
+  entry.getRefreshEventId().cancel();
 }
 
 void
 Fib::refreshEntry(const ndn::Name& name, afterRefreshCallback refreshCb)
 {
-  std::map<ndn::Name, FibEntry>::iterator it = m_table.find(name);
-
+  auto it = m_table.find(name);
   if (it == m_table.end()) {
     return;
   }
diff --git a/src/route/fib.hpp b/src/route/fib.hpp
index 012d61d..2d4f47f 100644
--- a/src/route/fib.hpp
+++ b/src/route/fib.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  The University of Memphis,
+ * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -191,16 +191,14 @@
   /*! \brief Log a successful strategy setting.
    */
   void
-  onSetStrategySuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
-                       const std::string& message);
+  onSetStrategySuccess(const ndn::nfd::ControlParameters& commandSuccessResult);
 
   /*! \brief Retry a strategy setting up to three (3) times.
    */
   void
   onSetStrategyFailure(const ndn::nfd::ControlResponse& response,
                        const ndn::nfd::ControlParameters& parameters,
-                       uint32_t count,
-                       const std::string& message);
+                       uint32_t count);
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
   /*! \brief Schedule a refresh event for an entry.
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 4e2fa86..f0e4aac 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California
  *
@@ -160,12 +160,9 @@
 void
 RoutingTable::scheduleRoutingTableCalculation()
 {
-  if (m_isRouteCalculationScheduled != true) {
+  if (!m_isRouteCalculationScheduled) {
     NLSR_LOG_DEBUG("Scheduling routing table calculation in " << m_routingCalcInterval);
-
-    m_scheduler.scheduleEvent(m_routingCalcInterval,
-                              std::bind(&RoutingTable::calculate, this));
-
+    m_scheduler.schedule(m_routingCalcInterval, [this] { calculate(); });
     m_isRouteCalculationScheduled = true;
   }
 }
@@ -182,7 +179,7 @@
   NLSR_LOG_DEBUG("Adding " << nh << " for destination: " << destRouter);
 
   RoutingTableEntry* rteChk = findRoutingTableEntry(destRouter);
-  if (rteChk == 0) {
+  if (rteChk == nullptr) {
     RoutingTableEntry rte(destRouter);
     rte.getNexthopList().addNextHop(nh);
     m_rTable.push_back(rte);
@@ -195,14 +192,12 @@
 RoutingTableEntry*
 RoutingTable::findRoutingTableEntry(const ndn::Name& destRouter)
 {
-  std::list<RoutingTableEntry>::iterator it = std::find_if(m_rTable.begin(),
-                                                           m_rTable.end(),
-                                                           std::bind(&routingTableEntryCompare,
-                                                                     _1, destRouter));
+  auto it = std::find_if(m_rTable.begin(), m_rTable.end(),
+                         std::bind(&routingTableEntryCompare, _1, destRouter));
   if (it != m_rTable.end()) {
     return &(*it);
   }
-  return 0;
+  return nullptr;
 }
 
 void
@@ -230,17 +225,15 @@
 {
   NLSR_LOG_DEBUG("Adding " << nh << " to dry table for destination: " << destRouter);
 
-  std::list<RoutingTableEntry>::iterator it = std::find_if(m_dryTable.begin(),
-                                                           m_dryTable.end(),
-                                                           std::bind(&routingTableEntryCompare,
-                                                                     _1, destRouter));
+  auto it = std::find_if(m_dryTable.begin(), m_dryTable.end(),
+                         std::bind(&routingTableEntryCompare, _1, destRouter));
   if (it == m_dryTable.end()) {
     RoutingTableEntry rte(destRouter);
     rte.getNexthopList().addNextHop(nh);
     m_dryTable.push_back(rte);
   }
   else {
-    (*it).getNexthopList().addNextHop(nh);
+    it->getNexthopList().addNextHop(nh);
   }
 }