[ndnSIM] error : assignment of member 'ndn::Interest::TSI ' in read only object

SUBODH MISHRA 1911602 at iiitdmj.ac.in
Sat Nov 26 21:37:38 PST 2022


Thanks Alex for your valuable response. Inside the function
*Forwarder::onIncomingData
*how can I get the number of hops travelled by  matched INTEREST packet
from the PIT (matched with this incoming DATA packet which initializes
*Forwarder::onIncomingData*) as this function *Forwarder::onIncomingData *only
takes argument as reference of Data class and FaceEndpoint class.

Furthermore please elaborate if possible, to modified wire
encoding/decoding procedures.

Thanking you

On Sat, Nov 26, 2022 at 9:17 PM Alex Afanasyev <aa at cs.fiu.edu> wrote:

> 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.
>
> 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:
>
>   int hopCount = 0;
>   auto hopCountTag = data->getTag<lp::HopCountTag>();
>   if (hopCountTag != nullptr) { // e.g., packet came from local node's
> cache
>     hopCount = *hopCountTag;
>   }
>   NS_LOG_DEBUG("Hop count: " << hopCount);
>
> -
> Alex
>
>
> On Nov 26, 2022, at 11:32 PM, SUBODH MISHRA via ndnSIM <
> ndnsim at lists.cs.ucla.edu> wrote:
>
> Dear Researchers
> Greeting!
> I want to count the number  of intermediate nodes the interest packet
> passes before reaching the producer.
> So, I declared the function *IncrementTSI *in *Interest.hpp* as follows
>                                   *  void IncrementTSI() const;*
> I defined  this function in the *Interest.cpp* class to increment the
> private variable *TSI* of *Interest* class (*TSI *is initialized as 0
> from the consumer application) .The definition of *IncrementTSI  *in*
> Interest.cpp*is as follows;
>                              *void Interest:: IncrementTSI() const*
> *                               {*
> *                                   TSI = TSI +1;*
> *                                } *
> In the *Forwarder::onIncomingInterest* function I simply called this *IncrementTSI
> () *to increment the value of *TSI * to record the number of nodes
> travelled by the *Interest * packet before reaching the producer:-
>
>   *interest.IncrementTSI();*
>
> It throws the following error:-
> error: assignment of member 'ndn::Interest::TSI' in read-only object
> 399| TSI = TSI+1;
>
> Please help me to remove this error
>
> Thanks & Regards
> Subodh Mishra
>
> Research Scholar (Ph.D),
> Department of Computer Science and Engineering,
> PDPM-Indian Institute of Information Technology,
> Design and Manufacturing, Jabalpur
>
> Email: 1911602 [at] iiitdmj [dot] ac [dot] in ,
>            subodhkmishra [at] gmail [dot] com
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> https://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>
>
>

-- 
Thanks & Regards,
Subodh Mishra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20221127/bf3a78ac/attachment-0001.html>


More information about the ndnSIM mailing list