[ndnSIM] How to trace the interest accessing each node?

Alex Afanasyev alexander.afanasyev at ucla.edu
Thu May 30 09:55:06 PDT 2013


Hi Saran,

Checking type of the packet is possible, but it should be done only for debug purposes.  To enable it, you need to call 
Packet::EnableChecking ();
Packet::EnablePrinting ();

I'm not sure which one, but some of these two methods enable tracking of meta information alongside each packet.

But taking step back. If I were to track characteristic of interest/data traffic on different nodes, I would do it on a little bit higher lever: in forwarding strategy / forwarding strategy extension.  The reason is that forwarding strategy is the last one who actually knows if packet is Interest or Data.  Moreover, you can do it in non-intrusive manner (=without modifying ndnSIM code) by creating a custom strategy class and overriding a couple of methods:
- OnInterest to get hold on all received interests
- DidSendOutInterest to get hold on all forwarded interests
- OnData, DidSendOutData the same thing, but for data

Taking step forward :)  If you still want to observe packets on Face level, you can use helper method: ndn::HeaderHelper::GetNdnHeaderType(packet)  which will return INTEREST_NDNSIM (=2) or CONTENT_OBJECT_NDNSIM (=3).  However, if you want to know prefix after you discover the type, you would need to do something like this:

if (ndn::HeaderHelper::GetNdnHeaderType(packet) == INTEREST_NDNSIM)
{
   Interest interest;
   packet->PeekHeader (interest);

   cout << interest->GetName () << endl;
   // or something else
}

This would be unnecessary if you observe packets on strategy layer, since each event that I listed above will give you reference to parsed interest or data packet.

---
Alex

On May 30, 2013, at 12:15 AM, Saran Tarnoi <sarantarnoi at gmail.com> wrote:

> Dear All,
> 
> I just found that I should use the Interest and ContentObject Constructors to keep the header of a packet.
> In addition, to check whether the considering packet is Interest or Data, I can simply check the packet's size.
> However, If there is any more direct way to do so, please let me know.
> Thanks a lot,
> 
> Regards,
> Saran Tarnoi
> 
> ---------- Forwarded message ----------
> From: Saran Tarnoi <sarantarnoi at gmail.com>
> Date: 2013/5/30
> Subject: How to trace the interest accessing each node?
> To: Alex Afanasyev <alexander.afanasyev at ucla.edu>, ndnsim at lists.cs.ucla.edu
> 
> 
> Dear Alex and All,
> 
> I would like to record the interests and their numbers that access each node.
> Specifically, I want to study the characteristic of the interest traffic at different nodes.
> I tried observing the received packets at each face in ndn:Face but I could neither get the header nor type of the packet.
> I followed this code (http://polythinking.wordpress.com/2012/05/30/ns-3-network-simulator-how-to-find-a-specific-header-in-packet-in-ns-3/) but it didn't work.
> 
> To add header to a packet, we can do:
> packet->AddHeader (interestHeader);
> 
> Is there any way to do:
> packet->GetContentName (); 
> packet->GetType ();
> and get the output like:
> "/prefix/0"
> "Interest or Data"
> ?
> 
> Would you kindly tell me how can I get that information?
> Thanks in advance for your time.
> 
> -- 
> Regards,
> Saran Tarnoi
> Graduate Student
> Department of Informatics
> The Graduate University for Advanced Studies (Sokendai)
> Tokyo, Japan
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

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


More information about the ndnSIM mailing list