rib: Add periodic invalid face clean up

refs: #1744, #1875

Change-Id: I4e6780ef6abb95b2c4ad7c1e6291897693cb551a
diff --git a/rib/rib-manager.hpp b/rib/rib-manager.hpp
index dffb24a..1ca86cf 100644
--- a/rib/rib-manager.hpp
+++ b/rib/rib-manager.hpp
@@ -62,6 +62,8 @@
   explicit
   RibManager(ndn::Face& face);
 
+  ~RibManager();
+
   void
   registerWithNfd();
 
@@ -209,18 +211,24 @@
   listEntries(const Interest& request);
 
   void
+  scheduleActiveFaceFetch(const time::seconds& timeToWait);
+
+  void
   fetchActiveFaces();
 
   void
   fetchSegments(const Data& data, shared_ptr<ndn::OBufferStream> buffer);
 
   void
-  updateActiveFaces(shared_ptr<ndn::OBufferStream> buffer);
-
-  void
   onFetchFaceStatusTimeout();
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+  /** \param buffer Face dataset contents
+  */
+  void
+  removeInvalidFaces(shared_ptr<ndn::OBufferStream> buffer);
+
+PUBLIC_WITH_TESTS_ELSE_PRIVATE:
   Rib m_managedRib;
 
 private:
@@ -286,8 +294,13 @@
 
   static const Name FACES_LIST_DATASET_PREFIX;
 
-PUBLIC_WITH_TESTS_ELSE_PRIVATE:
-  std::set<int> activeFaces;
+  static const time::seconds ACTIVE_FACE_FETCH_INTERVAL;
+  EventId m_activeFaceFetchEvent;
+
+  typedef std::set<uint64_t> FaceIdSet;
+  /** \brief contains FaceIds with one or more Routes in the RIB
+  */
+  FaceIdSet m_registeredFaces;
 };
 
 } // namespace rib