[ndnSIM] Find corresponding CS entry for the given data packet

潘庆超 15045081947 at 163.com
Sat Jul 2 02:44:42 PDT 2016


forwarder.cpp:there are two functions,
void find(const Interest& interest, const HitCallback& hitCallback, const MissCallback& missCallback) const ;
shared_ptr<Data> Lookup(shared_ptr<const Interest> interest);
What's the difference between them?

At 2016-07-01 22:22:57, "Junxiao Shi" <shijunxiao at email.arizona.edu> wrote:


Hi Qinchao

 

I understand your question as: given a ContentStore and a Data packet, determine whether the same Data packet already exists in the ContentStore.

This can be achieved as:

 

void

isDataInContentStore(const ndn::Data& data, const nfd::cs::Cs& cs,

                     std::function<void(bool)> cb)

{

  ndn::Name fullName = data.getFullName();

  ndn::Interest interest(fullName);

  cs.find(interest,

          bind([cb] { cb(true); }),

          bind([cb] { cb(false); }));

}

 

First we create an Interest that would match the specified Data packet if it exists in the CS; the Interest would not match any other Data packet because it contains the implicit digest. The CS is then queried with the Interest, and the result is returned asynchronously.

 

Yours, Junxiao

 

From: 潘庆超
Sent: Friday, July 1, 2016 07:06
To: ndnsim at lists.cs.ucla.edu
Subject: [ndnSIM] Find corresponding CS entry for the given data packet

 

hello ,i am doing some simulations about NDN . I have a problem. i want to know whether there are some contents in cs can match the given data packet when a node receive a data packet, how can i do ?

 


 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160702/733a9cbf/attachment.html>


More information about the ndnSIM mailing list