[ndnSIM] OnData function.

ioannoa at scss.tcd.ie ioannoa at scss.tcd.ie
Thu Jul 11 05:47:28 PDT 2013


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, ,
header->GetTimeSinceBirth());//(+)
        if (cached == true)//(+)
            std::cout << "I've cached packet# " << origPacket->GetUid() <<
" on Node# " << node->GetId() << std::endl;//(+)
        else
            std::cout << "I haven't cached packet# " <<
origPacket->GetUid() << " on Node# " << node->GetId() <<
std::endl;//(+)
    }
    else
    {
        // 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);
    return;
  }
  else
........


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,
Andriana.




More information about the ndnSIM mailing list