[ndnSIM] How to count the forwarding hops of an Interest

Michał Król mharnen at gmail.com
Thu May 18 09:57:39 PDT 2017


As mentioned before, the hopcount is already there. Here's how to get it:

shared_ptr<ndn::lp::HopCountTag> hopCountTag = 
interest.getTag<ndn::lp::HopCountTag>();
int hopCount = 0;
if(hopCountTag != NULL){
         hopCount = *hopCountTag;

}


On 16/05/17 03:24, Z.Liao at memphis.edu (Zhuhua Liao (zliao)) wrote:
> Greetings All,
>      Now I have a question regarding how to count the forwarding hops of an Interest in ndnSIM.  I simply added the below codes, but it seems like I got the wrong forwarding hops:
>    1. added "interest->setTag(make_shared<lp::HopCountTag>(0));" for hopcount initialization at the function "SendPacket" in consumer.cpp;
>   2. added "interest.setTag(make_shared<lp::HopCountTag>(hopCount + 1))" for one hop increment when forwarding a time at the function "onIncomingInterest" in Forwarder.cpp.
>
> I do not know if you have a right solution to count the forwarding hops for an interest?
>
> Thanks!
>
> Zhuhua
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170516/44b79293/attachment.html>
>



More information about the ndnSIM mailing list