model: Change default behavior to cache unsolicited data from local applications
In many cases, when a real NDN application is written, it is desirable
to be able to push content to the local cache (e.g., "pre-publish").
http://redmine.named-data.net/projects/ndnsim refs #1002
diff --git a/model/fw/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
index 6bfee78..9d72e74 100644
--- a/model/fw/ndn-forwarding-strategy.cc
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -84,6 +84,11 @@
.AddTraceSource ("SatisfiedInterests", "SatisfiedInterests", MakeTraceSourceAccessor (&ForwardingStrategy::m_satisfiedInterests))
.AddTraceSource ("TimedOutInterests", "TimedOutInterests", MakeTraceSourceAccessor (&ForwardingStrategy::m_timedOutInterests))
+
+ .AddAttribute ("CacheUnsolicitedDataFromApps", "Cache unsolicited data that has been pushed from applications",
+ BooleanValue (true),
+ MakeBooleanAccessor (&ForwardingStrategy::m_cacheUnsolicitedDataFromApps),
+ MakeBooleanChecker ())
.AddAttribute ("CacheUnsolicitedData", "Cache overheard data that have not been requested",
BooleanValue (false),
@@ -234,7 +239,7 @@
{
bool cached = false;
- if (m_cacheUnsolicitedData)
+ if (m_cacheUnsolicitedData || (m_cacheUnsolicitedDataFromApps && (inFace->GetFlags () | Face::APPLICATION)))
{
FwHopCountTag hopCountTag;
diff --git a/model/fw/ndn-forwarding-strategy.h b/model/fw/ndn-forwarding-strategy.h
index a3fe5b5..f077332 100644
--- a/model/fw/ndn-forwarding-strategy.h
+++ b/model/fw/ndn-forwarding-strategy.h
@@ -476,6 +476,7 @@
Ptr<Fib> m_fib; ///< \brief FIB
Ptr<ContentStore> m_contentStore; ///< \brief Content store (for caching purposes only)
+ bool m_cacheUnsolicitedDataFromApps;
bool m_cacheUnsolicitedData;
bool m_detectRetransmissions;