<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Hi Junxiao and Spyros,</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">We went and implemented the steps specified in the <a href="https://lo.calho.st/networks/adding-custom-packet-fields-to-packets-in-ndnsim-2-3-without-forking-the-entire-repository/">link</a> and it compiled fine. But, when we run it, we get an error in the NetDeviceTransport::receiveFromNetDevice after the nfdPacket is created in <a href="https://github.com/named-data-ndnSIM/ndnSIM/blob/master/model/ndn-net-device-transport.cpp#L133">L133</a>.</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Code Snippet:</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">BlockHeader header;</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">packet-><span class="pl-c1">RemoveHeader</span>(header);</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"><span class="pl-k">auto</span> nfdPacket = <span class="pl-c1">Packet</span>(<span class="pl-c1">std::move</span>(header.<span class="pl-c1">getBlock</span>()));</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">::ndn::lp::Packet lpPacket = ::ndn::lp::Packet(nfdPacket.packet);<br /> if (sinrValue){<br />  lpPacket.add<lp::SinrTagField>(sinrValue);<br /> }</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"><span class="pl-c1">this</span>-><span class="pl-c1">receive</span>(<span class="pl-c1">std::move</span>(nfdPacket));<br />-----------------------------------------------------------------------------</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Error: (gdb trace attached)</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail:<br />:error_info_injector<std::length_error> >'<br />  what():  Field cannot be repeated</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">----------------------------------------------------------------------------</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">We intend to get the sinr of the incoming packet to the forwarding strategy of the same node (not propagate it to further nodes).</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Can you help us store the sinrvalue in the nfdPacket as a ndn Tag? I think we are missing some steps after lpPacket.</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Thank you for the help.</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Raj</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">On 2018-08-02 17:26, Junxiao Shi wrote:
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">Hi Thiago<br /> <br /> See<br /> <a href="https://lo.calho.st/networks/adding-custom-packet-fields-to-packets-in-ndnsim-2-3-without-forking-the-entire-repository/" target="_blank" rel="noreferrer">https://lo.calho.st/networks/adding-custom-packet-fields-to-packets-in-ndnsim-2-3-without-forking-the-entire-repository/</a><br /> Pay attention to the two sections about LinkService. Your tag got lost<br /> in that component.<br /> <br /> Yours, Junxiao<br /> <br /> On Thu, Aug 2, 2018 at 17:00 Thiago Teixeira <<a href="mailto:tteixeira@umass.edu">tteixeira@umass.edu</a>><br /> wrote:<br /> <br />
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">Hi Spyros,<br /> <br /> Thanks for your comments. We are able to read the tag in the<br /> net-device as expected.<br /> <br /> We then added a new NDNLP field and TLV to pass this value and later<br /> be able to read it in the strategy. More specifically, we added the<br /> following code in NetDeviceTransport::receiveFromNetDevice after the<br /> nfdPacket is created in L133 [1].<br /> <br /> ::ndn::lp::Packet lpPacket = ::ndn::lp::Packet(nfdPacket.packet);<br /> <br /> if (sinrValue){<br /> <br /> lpPacket.add<lp::SinrTagField>(sinrValue);<br /> <br /> }<br /> <br /> In our strategy, we are reading the tag in the afterReceiveInterest<br /> like this:<br /> <br /> auto sinrTag = interest.getTag<lp::SinrTag>();<br /> <br /> if (sinrTag != nullptr) {<br /> <br /> sinr = *sinrTag;<br /> <br /> }<br /> <br /> Though the value of sinr is always zero. Our suspicion is that the<br /> lpPacket is not being added to the nfdPacket when receive is called<br /> (below).<br /> <br /> this->receive(std::move(nfdPacket));<br /> <br /> We couldn’t find any topic or article related to this issue. Do<br /> you know how can we accomplish this?<br /> <br /> Cheers</blockquote>
 <br /> <br /> Links:<br /> ------<br /> [1]<br /> <a href="https://github.com/named-data-ndnSIM/ndnSIM/blob/master/model/ndn-net-device-transport.cpp#L133" target="_blank" rel="noreferrer">https://github.com/named-data-ndnSIM/ndnSIM/blob/master/model/ndn-net-device-transport.cpp#L133</a></blockquote>
</div>
</body></html>