helper: Fixing bug with ndn::GlobalRoutingHelper
With certain metric parameters, the value was incorrectly wrapped
around zero, leading to incorrect route calculation (BoostGrapLibrary
was detecting negative edge weights).
diff --git a/helper/boost-graph-ndn-global-routing-helper.h b/helper/boost-graph-ndn-global-routing-helper.h
index a223a82..a85e9c9 100644
--- a/helper/boost-graph-ndn-global-routing-helper.h
+++ b/helper/boost-graph-ndn-global-routing-helper.h
@@ -221,8 +221,8 @@
bool>
{
bool
- operator () (property_traits< EdgeWeights >::reference a,
- property_traits< EdgeWeights >::reference b) const
+ operator () (tuple< ns3::Ptr<ns3::ndn::Face>, uint32_t, double > a,
+ tuple< ns3::Ptr<ns3::ndn::Face>, uint32_t, double > b) const
{
return a.get<1> () < b.get<1> ();
}
diff --git a/helper/ndn-global-routing-helper.cc b/helper/ndn-global-routing-helper.cc
index ca03ffa..00d2098 100644
--- a/helper/ndn-global-routing-helper.cc
+++ b/helper/ndn-global-routing-helper.cc
@@ -364,7 +364,7 @@
for (uint32_t faceId = 0; faceId < l3->GetNFaces (); faceId++)
{
originalMetric[faceId] = l3->GetFace (faceId)->GetMetric ();
- l3->GetFace (faceId)->SetMetric (std::numeric_limits<int16_t>::max ()-1); // value std::numeric_limits<int16_t>::max () MUST NOT be used (reserved)
+ l3->GetFace (faceId)->SetMetric (std::numeric_limits<uint16_t>::max ()-1); // value std::numeric_limits<uint16_t>::max () MUST NOT be used (reserved)
}
for (uint32_t enabledFaceId = 0; enabledFaceId < l3->GetNFaces (); enabledFaceId++)
diff --git a/model/ndn-face.h b/model/ndn-face.h
index 1fdc7f0..c2e3ca4 100644
--- a/model/ndn-face.h
+++ b/model/ndn-face.h
@@ -273,7 +273,7 @@
DataHandler m_upstreamDataHandler;
bool m_ifup;
uint32_t m_id; ///< \brief id of the interface in NDN stack (per-node uniqueness)
- uint32_t m_metric; ///< \brief metric of the face
+ uint16_t m_metric; ///< \brief metric of the face
uint32_t m_flags; ///< @brief faces flags (e.g., APPLICATION)
};