helper: ndn::GlobalRoutingHelper extension
Now CalculateRoutes and CalculateAllPossibleRoutes accept flag,
indicating whether to invalidate (default) or preserve existing routes
diff --git a/helper/ndn-global-routing-helper.cc b/helper/ndn-global-routing-helper.cc
index 6ecd944..04ecc6f 100644
--- a/helper/ndn-global-routing-helper.cc
+++ b/helper/ndn-global-routing-helper.cc
@@ -234,7 +234,7 @@
}
void
-GlobalRoutingHelper::CalculateRoutes ()
+GlobalRoutingHelper::CalculateRoutes (bool invalidatedRoutes/* = true*/)
{
/**
* Implementation of route calculation is heavily based on Boost Graph Library
@@ -278,7 +278,10 @@
// NS_LOG_DEBUG (predecessors.size () << ", " << distances.size ());
Ptr<Fib> fib = source->GetObject<Fib> ();
- fib->InvalidateAll ();
+ if (invalidatedRoutes)
+ {
+ fib->InvalidateAll ();
+ }
NS_ASSERT (fib != 0);
NS_LOG_DEBUG ("Reachability from Node: " << source->GetObject<Node> ()->GetId ());
@@ -324,7 +327,7 @@
}
void
-GlobalRoutingHelper::CalculateAllPossibleRoutes ()
+GlobalRoutingHelper::CalculateAllPossibleRoutes (bool invalidatedRoutes/* = true*/)
{
/**
* Implementation of route calculation is heavily based on Boost Graph Library
@@ -350,7 +353,10 @@
}
Ptr<Fib> fib = source->GetObject<Fib> ();
- fib->InvalidateAll ();
+ if (invalidatedRoutes)
+ {
+ fib->InvalidateAll ();
+ }
NS_ASSERT (fib != 0);
NS_LOG_DEBUG ("===========");
diff --git a/helper/ndn-global-routing-helper.h b/helper/ndn-global-routing-helper.h
index 53c7b15..fa7dabd 100644
--- a/helper/ndn-global-routing-helper.h
+++ b/helper/ndn-global-routing-helper.h
@@ -97,19 +97,23 @@
/**
* @brief Calculate for every node shortest path trees and install routes to all prefix origins
+ *
+ * @param invalidatedRoutes flag indicating whether existing routes should be invalidated or keps as is
*/
static void
- CalculateRoutes ();
+ CalculateRoutes (bool invalidatedRoutes = true);
/**
* @brief Calculate all possible next-hop independent alternative routes
*
+ * @param invalidatedRoutes flag indicating whether existing routes should be invalidated or keps as is
+ *
* Refer to the implementation for more details.
*
* Note that this method is highly experimental and should be used with caution (very time consuming).
*/
static void
- CalculateAllPossibleRoutes ();
+ CalculateAllPossibleRoutes (bool invalidatedRoutes = true);
private:
void