build: Fix compilation on Ubuntu platform and add work-around for ndn-cxx regression
Note that on Ubuntu 12.04, either boost libraries or compiler needs to be upgraded.
Change-Id: I33f1089f961f99abf3d1803bf833e76ff7fb528d
Refs: #2379, #2380, #2382, #2381, #2383
diff --git a/helper/boost-graph-ndn-global-routing-helper.hpp b/helper/boost-graph-ndn-global-routing-helper.hpp
index 18a1a44..fe160f3 100644
--- a/helper/boost-graph-ndn-global-routing-helper.hpp
+++ b/helper/boost-graph-ndn-global-routing-helper.hpp
@@ -182,9 +182,9 @@
typedef readable_property_map_tag category;
};
-const property_traits<EdgeWeights>::value_type WeightZero(0, 0, 0.0);
+const property_traits<EdgeWeights>::value_type WeightZero(nullptr, 0, 0.0);
const property_traits<EdgeWeights>::value_type
- WeightInf(0, std::numeric_limits<uint16_t>::max(), 0.0);
+ WeightInf(nullptr, std::numeric_limits<uint16_t>::max(), 0.0);
struct WeightCompare : public std::binary_function<property_traits<EdgeWeights>::reference,
property_traits<EdgeWeights>::reference, bool> {
@@ -220,7 +220,7 @@
operator()(std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> a,
property_traits<EdgeWeights>::reference b) const
{
- if (std::get<0>(a) == 0)
+ if (std::get<0>(a) == nullptr)
return std::make_tuple(std::get<0>(b), std::get<1>(a) + std::get<1>(b),
std::get<2>(a) + std::get<2>(b));
else
@@ -270,7 +270,7 @@
get(const boost::EdgeWeights&, ns3::ndn::GlobalRouter::Incidency& edge)
{
if (std::get<1>(edge) == 0)
- return property_traits<EdgeWeights>::reference(0, 0, 0.0);
+ return property_traits<EdgeWeights>::reference(nullptr, 0, 0.0);
else {
return property_traits<EdgeWeights>::reference(std::get<1>(edge),
static_cast<uint16_t>(
@@ -305,13 +305,31 @@
typedef read_write_property_map_tag category;
};
+} // boost
+
+namespace std {
+template<>
+class numeric_limits<std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double>>
+{
+public:
+ typedef std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> value;
+ static value
+ max()
+ {
+ return boost::WeightInf;
+ }
+};
+}
+
+namespace boost {
+
inline std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double>
get(DistancesMap& map, ns3::Ptr<ns3::ndn::GlobalRouter> key)
{
boost::DistancesMap::iterator i = map.find(key);
if (i == map.end())
return std::tuple<std::shared_ptr<nfd::Face>, uint32_t,
- double>(0, std::numeric_limits<uint32_t>::max(), 0.0);
+ double>(nullptr, std::numeric_limits<uint32_t>::max(), 0.0);
else
return i->second;
}
diff --git a/helper/ndn-global-routing-helper.cpp b/helper/ndn-global-routing-helper.cpp
index e53c441..cf52c6f 100644
--- a/helper/ndn-global-routing-helper.cpp
+++ b/helper/ndn-global-routing-helper.cpp
@@ -213,7 +213,7 @@
}
void
-GlobalRoutingHelper::CalculateRoutes(bool invalidatedRoutes /* = true*/)
+GlobalRoutingHelper::CalculateRoutes()
{
/**
* Implementation of route calculation is heavily based on Boost Graph Library
@@ -253,19 +253,6 @@
Ptr<L3Protocol> L3protocol = (*node)->GetObject<L3Protocol>();
shared_ptr<nfd::Forwarder> forwarder = L3protocol->getForwarder();
- if (invalidatedRoutes) {
- std::vector<::nfd::fib::NextHop> NextHopList;
- for (nfd::Fib::const_iterator fibIt = forwarder->getFib().begin();
- fibIt != forwarder->getFib().end();) {
- NextHopList.clear();
- NextHopList = fibIt->getNextHops();
- ++fibIt;
- for (int i = 0; i < NextHopList.size(); i++) {
- NextHopList[i].setCost(std::numeric_limits<uint64_t>::max());
- }
- }
- }
-
NS_LOG_DEBUG("Reachability from Node: " << source->GetObject<Node>()->GetId());
for (const auto& dist : distances) {
if (dist.first == source)
@@ -291,7 +278,7 @@
}
void
-GlobalRoutingHelper::CalculateAllPossibleRoutes(bool invalidatedRoutes /* = true*/)
+GlobalRoutingHelper::CalculateAllPossibleRoutes()
{
/**
* Implementation of route calculation is heavily based on Boost Graph Library
@@ -318,19 +305,6 @@
Ptr<L3Protocol> L3protocol = (*node)->GetObject<L3Protocol>();
shared_ptr<nfd::Forwarder> forwarder = L3protocol->getForwarder();
- if (invalidatedRoutes) {
- std::vector<::nfd::fib::NextHop> NextHopList;
- for (nfd::Fib::const_iterator fibIt = forwarder->getFib().begin();
- fibIt != forwarder->getFib().end();) {
- NextHopList.clear();
- NextHopList = fibIt->getNextHops();
- ++fibIt;
- for (int i = 0; i < NextHopList.size(); i++) {
- NextHopList[i].setCost(std::numeric_limits<uint64_t>::max());
- }
- }
- }
-
NS_LOG_DEBUG("Reachability from Node: " << source->GetObject<Node>()->GetId() << " ("
<< Names::FindName(source->GetObject<Node>()) << ")");
diff --git a/helper/ndn-global-routing-helper.hpp b/helper/ndn-global-routing-helper.hpp
index 0e65810..b405838 100644
--- a/helper/ndn-global-routing-helper.hpp
+++ b/helper/ndn-global-routing-helper.hpp
@@ -96,26 +96,20 @@
/**
* @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(bool invalidatedRoutes = true);
+ CalculateRoutes();
/**
* @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(bool invalidatedRoutes = true);
+ CalculateAllPossibleRoutes();
private:
void