<div dir="ltr"><div><div>Thanks to Junxiao and DJEMAA ,</div><div>Junxiao's suggestion is possibly the best, I tried and tested it and it works very well.<br></div><div><br></div><div>I also tried the method provided in the aforesaid <a href="https://www.programmersought.com/article/14675398024/">link</a>, and it works!</div><div>I had committed a few mistakes that led me into other results.</div><div>(Like:</div><div>Messing up wire en/decode methods.</div><div>And although I did tweak the consumer.cpp's sendPacket() method <br></div><div>(for initializing the field (whose value was added through SetAttribute feature of helpers))<br></div><div>but I noticed later that ndn-consumer-zipf-mandelbrot.cpp overrides this function and that was</div><div>creating all the confusion.)<br></div><div><br></div><div>For future reference if anyone struggles with this problem following are the best ways:</div><ul><li>Easiest is to (like Junxiao said)  put the field in Name or application parameter.</li><li>The tag method also works perfectly but it is too much efforts (Check this <a href="https://lo.calho.st/posts/ndnsim-custom-fields/">link</a>)</li><li>The proper method provided <a href="https://www.programmersought.com/article/14675398024/">here</a> also works perfectly (and is less hassle than tag method)<br></li></ul></div><div class="gmail_quote"><div class="gmail_attr">Thanking all of you again</div><div class="gmail_attr">Prajjwal Singh</div><div class="gmail_attr"><br></div><div dir="ltr" class="gmail_attr">On Wed, 5 May 2021, 06:28 Junxiao Shi, <<a href="mailto:shijunxiao@email.arizona.edu" target="_blank">shijunxiao@email.arizona.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 dir="auto">Hi DJEMAA<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr"><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 dir="ltr"><div>If the packet length doesn't matter in your configuration, I advise you to add a Tag instead of a new Field to your packet, since according to ndnSIM design, the tag resides only in the memory. </div><div>Also, a Tag can be easily managed directly in the NFD machinery (forwarder class), contrary to a new field in either Interest or Data packets which are generally static objects.</div></div></blockquote></div><div dir="auto"><br></div><div dir="auto">ndnSIM doesn't support ns3::Tag (the kind described in ns-3 model library <a href="https://www.nsnam.org/docs/release/3.33/models/html/packets.html#adding-and-removing-tags" rel="noreferrer" target="_blank">https://www.nsnam.org/docs/release/3.33/models/html/packets.html#adding-and-removing-tags</a> ).</div><div dir="auto">Subclasses of ndn::Tag are completely different from ns3::Tag. This includes the HopCountTag. They must be encoded into the packet buffer to have any effect.</div><div dir="auto"><br></div><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div style="font-family:sans-serif;font-size:12.8px" dir="auto"><br></div><div style="font-family:sans-serif;font-size:12.8px" dir="auto">The main problem is that if i have the following topology</div><div style="font-family:sans-serif;font-size:12.8px" dir="auto">A--B--C--D </div><div style="font-family:sans-serif;font-size:12.8px" dir="auto">(Where A is the Consumer and D is the Producer, and B and C are routers)</div><div style="font-family:sans-serif;font-size:12.8px" dir="auto">Then by the solution given in the above link the custom field set in A's generated Interest packet is reset to default value by B when it forwards the interest to C.  </div><div style="font-family:sans-serif;font-size:12.8px" dir="auto">How can I make it carry the value intended by A?</div></div></blockquote></div></blockquote></div><div dir="auto"><br></div><div dir="auto">A <i>forwarded</i> Interest is actually a different packet from the original: Name, CanBePrefix, MustBeFresh, ApplicationParameters are copied over, InterestLifetime, Nonce, HopLimit are modified, and other fields may be discarded.</div><div dir="auto"><br></div><div dir="auto">As I said previously, it's best to include the information as part of the Name or ApplicationParameters, which is supported universally.</div><div dir="auto"><br></div><div dir="auto">While NDN protocol allows having unrecognized non-critical fields in the Interest packet, the protocol is vague on whether and what to preserve during forwarding.</div><div dir="auto">So far, as long as Name, CanBePrefix, MustBeFresh, ApplicationParameters, and any fields that appear after ApplicationParameters are preserved, the forwarder implementation would be interoperable.</div><div dir="auto"><br></div><div dir="auto">Yours, Junxiao</div><div class="gmail_quote" dir="auto"></div></div>
</blockquote></div>
</div>