[ndnSIM] OnData function.
alexander.afanasyev at ucla.edu
Thu Jul 11 10:11:28 PDT 2013
This provision has been implemented in order to support simulation of scenarios when caching data packets, even if they were not requested, is highly desirable. For example, in vehicular environments it is important to cache unsolicited traffic information data, given its importance and intermittent connectivity. These actually is not enabled by default, and if you want this code be enabled, you need to configure CacheUnsolicitedData attribute of the forwarding strategy to yes.
There another use case of this code, for data packets that were received from the local application. All packets from local apps will be cached by default, even if they were not requested. In many cases it simplifies design of (more complex) NDN applications and aligns with the existing NDN implementations (CCNx project).
On Jul 11, 2013, at 5:47 AM, ioannoa at scss.tcd.ie wrote:
> Hello everyone,
> I was looking once again at the OnData function which handles a Content
> Object at each node and I was a bit confused with its code.
> It has a pitEntry == 0 and in that case it has to implement a caching
> action as well as a distinction between finding the content request in Pit
> or not. e.g.
> if (pitEntry == 0)
> bool cached = false;
> if (m_cacheUnsolicitedData || (m_cacheUnsolicitedDataFromApps &&
> (inFace->GetFlags () | Face::APPLICATION)))
> FwHopCountTag hopCountTag;
> Ptr<Packet> payloadCopy = payload->Copy ();
> payloadCopy->RemovePacketTag (hopCountTag);
> // Optimistically add or update entry in the content store
> cached = m_contentStore->Add (header, payloadCopy, ,
> if (cached == true)//(+)
> std::cout << "I've cached packet# " << origPacket->GetUid() <<
> " on Node# " << node->GetId() << std::endl;//(+)
> std::cout << "I haven't cached packet# " <<
> origPacket->GetUid() << " on Node# " << node->GetId() <<
> // Drop data packet if PIT entry is not found
> // (unsolicited data packets should not "poison" content store)
> //drop dulicated or not requested data packet
> m_dropData (header, payload, inFace);
> DidReceiveUnsolicitedData (inFace, header, payload, origPacket, cached);
> But, my question is why so since if pitEntry is 0 it means the specific
> Content Object has not been requested, hence the Content Object should be
> dropped anyway. Could someone please help me understand why?
> Kind regards,
More information about the ndnSIM