route: communicate routing changes using signals
The RoutingTable now has a signal that it emits upon finishing
calculation, which other modules can subscribe to. The NamePrefixTable
now references this emitted container to update its local copies of
routing information.
Change-Id: Id601776258ad0367cc47461ea8f86a710eada132
refs: #4249
diff --git a/src/route/name-prefix-table.hpp b/src/route/name-prefix-table.hpp
index a4dabc4..f4901ba 100644
--- a/src/route/name-prefix-table.hpp
+++ b/src/route/name-prefix-table.hpp
@@ -24,7 +24,7 @@
#include "name-prefix-table-entry.hpp"
#include "routing-table-pool-entry.hpp"
-
+#include "signals.hpp"
#include "test-access-control.hpp"
#include <list>
@@ -41,10 +41,9 @@
using NptEntryList = std::list<std::shared_ptr<NamePrefixTableEntry>>;
using const_iterator = NptEntryList::const_iterator;
- NamePrefixTable(Nlsr& nlsr)
- : m_nlsr(nlsr)
- {
- }
+ NamePrefixTable(Nlsr& nlsr, std::shared_ptr<AfterRoutingChange>& afterRoutingChangeSignal);
+
+ ~NamePrefixTable();
/*! \brief Adds a destination to the specified name prefix.
\param name The name prefix
@@ -78,14 +77,14 @@
/*! \brief Updates all routing information in the NPT.
- Naively iterates over all the NPT entries, then over each of their
- RoutingTablePoolEntries, passing the name/destination pair back to
- addEntry after updating the pool entry with new information. This
- ensures that the FIB is appropriately apprised of any changes to a
- prefix's preferred next hops.
+ Takes in a list of entries that are assumed to be exhaustive, and
+ updates each pool entry with the next hop information contained in
+ the corresponding entry in entries. If no entry is found, it is
+ assumed that the destination for that pool entry is inaccessible,
+ and its next hop information is deleted.
*/
void
- updateWithNewRoute();
+ updateWithNewRoute(const std::list<RoutingTableEntry>& entries);
/*! \brief Adds a pool entry to the pool.
\param rtpe The entry.
@@ -126,7 +125,7 @@
private:
Nlsr& m_nlsr;
-
+ ndn::util::signal::Connection m_afterRoutingChangeConnection;
};
inline NamePrefixTable::const_iterator