model: New content store variations: support for content freshness
The following content store realizations now fully support freshness set
in ContentObjects:
- ns3::ndn::cs::Freshness::Lru
- ns3::ndn::cs::Freshness::Random
- ns3::ndn::cs::Freshness::Fifo
Example ndn-simple-with-content-freshness demonstrates basics of new
content stores.
diff --git a/apps/ndn-producer.cc b/apps/ndn-producer.cc
index 28c9551..4f7afc4 100644
--- a/apps/ndn-producer.cc
+++ b/apps/ndn-producer.cc
@@ -59,6 +59,10 @@
UintegerValue (1024),
MakeUintegerAccessor(&Producer::m_virtualPayloadSize),
MakeUintegerChecker<uint32_t>())
+ .AddAttribute ("Freshness", "Freshness of data packets, if 0, then unlimited freshness",
+ TimeValue (Seconds (0)),
+ MakeTimeAccessor (&Producer::m_freshness),
+ MakeTimeChecker ())
;
return tid;
@@ -114,6 +118,7 @@
static ContentObjectTail tail;
Ptr<ContentObjectHeader> header = Create<ContentObjectHeader> ();
header->SetName (Create<NameComponents> (interest->GetName ()));
+ header->SetFreshness (m_freshness);
NS_LOG_INFO ("node("<< GetNode()->GetId() <<") respodning with ContentObject:\n" << boost::cref(*header));