<div dir="ltr">Thanks Alex for your valuable response. Inside the function <b>Forwarder::onIncomingData </b>how can I get the number of hops travelled by  matched INTEREST packet from the PIT (matched with this incoming DATA packet which initializes <b>Forwarder::onIncomingData</b>) as this function <b>Forwarder::onIncomingData </b>only takes argument as reference of Data class and FaceEndpoint class. <div><br></div><div>Furthermore please elaborate if possible, to modified wire encoding/decoding procedures.<br></div><div><br></div><div>Thanking you</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Nov 26, 2022 at 9:17 PM Alex Afanasyev <<a href="mailto:aa@cs.fiu.edu">aa@cs.fiu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>It will not work the way you are trying to do it.  The variable you declared is just for the instance of the Interest on a specific simulated node.  As soon as you send this interest further, it is sent as wire encoded packet and there are no traces of your variable, unless you modified wire encoding/decoding procedures to include it.<div><br></div><div>There is, actually, already a hop count info that is associated with each Interest and Data packet.  You can simply access it to get the information you need:</div><div><br></div><div><div><font face="Monaco"><span style="font-style:normal">  int hopCount = 0;</span></font></div><div><font face="Monaco"><span style="font-style:normal">  auto hopCountTag = data->getTag<lp::HopCountTag>();</span></font></div><div><font face="Monaco"><span style="font-style:normal">  if (hopCountTag != nullptr) { // e.g., packet came from local node's cache</span></font></div><div><font face="Monaco"><span style="font-style:normal">    hopCount = *hopCountTag;</span></font></div><div><font face="Monaco"><span style="font-style:normal">  }</span></font></div><div><font face="Monaco"><span style="font-style:normal">  NS_LOG_DEBUG("Hop count: " << hopCount);</span></font></div><div><br></div><div>-</div><div>Alex</div><div><br></div><div><br><blockquote type="cite"><div>On Nov 26, 2022, at 11:32 PM, SUBODH MISHRA via ndnSIM <<a href="mailto:ndnsim@lists.cs.ucla.edu" target="_blank">ndnsim@lists.cs.ucla.edu</a>> wrote:</div><br><div><div dir="ltr">Dear Researchers<br clear="all"><div>Greeting!</div><div>I want to count the number  of intermediate nodes the interest packet  passes before reaching the producer.</div><div>So, I declared the function <b>IncrementTSI </b>in <b>Interest.hpp</b> as follows</div>                                  <i>  void IncrementTSI() const;</i><div>I defined  this function in the <b>Interest.cpp</b> class to increment the private variable <b>TSI</b> of <b>Interest</b> class (<b>TSI </b>is initialized as 0 from the consumer application) .The definition of <b>IncrementTSI  </b>in<b> Interest.cpp</b>is as follows;</div><div>                             <i>void Interest:: IncrementTSI() const</i></div><div><i>                               {</i></div><div><i>                                   TSI = TSI +1;</i></div><div><i>                                } </i></div><div>In the <b>Forwarder::onIncomingInterest</b> function I simply called this <b>IncrementTSI () </b>to increment the value of <b>TSI </b> to record the number of nodes travelled by the <b>Interest </b> packet before reaching the producer:-</div><div>       </div><div>  <i>interest.IncrementTSI();</i></div><div><br></div><div>It throws the following error:-</div><div><font color="#ff0000">error: assignment of member 'ndn::Interest::TSI' in read-only object</font></div><div><font color="#ff0000">399| TSI = TSI+1;</font></div><div><br></div><div>Please help me to remove this error</div><div><br><div dir="ltr"><div dir="ltr"><div style="color:rgb(34,34,34)">Thanks & Regards<br></div><div><font color="#444444" face="georgia, serif" size="4">Subodh Mishra</font></div><div style="color:rgb(34,34,34)"><br></div><div style="color:rgb(34,34,34)"><div dir="ltr" style="color:rgb(136,136,136);font-size:12.8px"><font face="times new roman, serif"><span style="font-size:small">Research Scholar (Ph.D),</span><br></font></div><div style="color:rgb(136,136,136);font-size:12.8px"><font size="2" face="times new roman, serif">Department of Computer Science and Engineering,</font></div><div dir="ltr" style="color:rgb(136,136,136);font-size:12.8px"><font size="2" face="times new roman, serif">PDPM-Indian Institute of Information Technology, </font></div><div dir="ltr" style="color:rgb(136,136,136);font-size:12.8px"><font size="2" face="times new roman, serif">Design and Manufacturing, Jabalpur</font></div><div dir="ltr" style="color:rgb(136,136,136);font-size:12.8px"><br></div></div><div style="color:rgb(34,34,34);font-size:12.8px"><font>Email: 1911602 [at] iiitdmj [dot] ac [dot] in ,</font></div><div style="color:rgb(34,34,34);font-size:12.8px"><font>           subodhkmishra [at] gmail [dot] com</font></div></div></div></div></div>
_______________________________________________<br>ndnSIM mailing list<br><a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank">ndnSIM@lists.cs.ucla.edu</a><br><a href="https://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" target="_blank">https://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a><br></div></blockquote></div><br></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div style="color:rgb(34,34,34)">Thanks & Regards,</div><div><font color="#444444" face="comic sans ms, sans-serif" size="4">Subodh Mishra</font></div></div></div>