Important change to FloodingStrategy: by default it will perform
flooding without attempting to forward interest only to a green face
If "smart" flooding is necessary, ns3::CcnxFib::SmartFlooding attribute
should be set to true.
diff --git a/model/ccnx-flooding-strategy.cc b/model/ccnx-flooding-strategy.cc
index 182381e..5448006 100644
--- a/model/ccnx-flooding-strategy.cc
+++ b/model/ccnx-flooding-strategy.cc
@@ -27,6 +27,7 @@
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
+#include "ns3/boolean.h"
#include <boost/ref.hpp>
#include <boost/foreach.hpp>
@@ -49,6 +50,12 @@
.SetGroupName ("Ccnx")
.SetParent <CcnxForwardingStrategy> ()
.AddConstructor <CcnxFloodingStrategy> ()
+
+ .AddAttribute ("SmartFlooding",
+ "If true then if a GREEN face exists, Interests will be sent only to such face (!only to one green face!)",
+ BooleanValue (false),
+ MakeBooleanAccessor (&CcnxFloodingStrategy::m_smartFlooding),
+ MakeBooleanChecker ())
;
return tid;
}
@@ -65,18 +72,22 @@
{
NS_LOG_FUNCTION (this);
- // Try to work out with just green faces
- bool greenOk = PropagateInterestViaGreen (pitEntry, incomingFace, header, packet);
- if (greenOk)
- return true;
+ if (m_smartFlooding)
+ {
+ // Try to work out with just green faces
+ bool greenOk = PropagateInterestViaGreen (pitEntry, incomingFace, header, packet);
+ if (greenOk)
+ return true;
+
+ // boo... :(
+ }
- // boo... :(
int propagatedCount = 0;
BOOST_FOREACH (const CcnxFibFaceMetric &metricFace, pitEntry.m_fibEntry.m_faces.get<i_metric> ())
{
NS_LOG_DEBUG ("Trying " << boost::cref(metricFace));
- if (metricFace.m_status == CcnxFibFaceMetric::NDN_FIB_RED) // all non-read faces are in front
+ if (metricFace.m_status == CcnxFibFaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
break;
if (metricFace.m_face == incomingFace)
diff --git a/model/ccnx-flooding-strategy.h b/model/ccnx-flooding-strategy.h
index 8be12e9..750f21c 100644
--- a/model/ccnx-flooding-strategy.h
+++ b/model/ccnx-flooding-strategy.h
@@ -51,6 +51,9 @@
const Ptr<CcnxFace> &incomingFace,
Ptr<CcnxInterestHeader> &header,
const Ptr<const Packet> &packet);
+
+private:
+ bool m_smartFlooding;
};
} //namespace ns3