<div dir="ltr"><div>I fixed the error by imitating the Nonce field and it works. <br><br></div>Thank you very much for your time and patience.   <br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-16 23:29 GMT-03:00 Spyridon (Spyros) Mastorakis <span dir="ltr"><<a href="mailto:mastorakis@cs.ucla.edu" target="_blank">mastorakis@cs.ucla.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div><br></div><div>I would suggest that you add the new field as an NDNLP tag instead:</div><div><br></div><div><a href="https://lo.calho.st/networks/adding-custom-packet-fields-to-packets-in-ndnsim-2-3-without-forking-the-entire-repository/" target="_blank">https://lo.calho.st/networks/<wbr>adding-custom-packet-fields-<wbr>to-packets-in-ndnsim-2-3-<wbr>without-forking-the-entire-<wbr>repository/</a></div><div><br></div><div>Thanks,</div><div><br><div>
<div><div><div><span style="float:none;display:inline!important">Spyridon (Spyros) Mastorakis</span><br><span style="float:none;display:inline!important">Personal Website: </span><a href="http://cs.ucla.edu/~mastorakis/" target="_blank">http://cs.ucla.edu/~<wbr>mastorakis/</a><br><span style="float:none;display:inline!important">Internet Research Laboratory</span><br><span style="float:none;display:inline!important">Computer Science Department</span><br><span style="float:none;display:inline!important">UCLA</span></div></div></div>
</div>
<br><div><blockquote type="cite"><div>On Oct 16, 2017, at 4:44 AM, Mateus Sousa <<a href="mailto:mateus.aluufc@gmail.com" target="_blank">mateus.aluufc@gmail.com</a>> wrote:</div><br class="m_-1101538737427467005Apple-interchange-newline"><div><div dir="ltr"><div><div><div><b>wireDEcode (before nonce): </b><br><br>  //////////////////////////////<wbr>//////////<br>  // Mateus UFBA-Brazil-2017<br>  //////////////////////////////<wbr>//////////<br>  // NextForwarder<br>  m_nextForwarder = m_wire.get(tlv::NextForwarder)<wbr>;<br>  m_lastForwarder = m_wire.get(tlv::LastForwarder)<wbr>;<br><br>  //////////////////////////////<wbr>//////////<br>  //          END MATEUS<br>  //////////////////////////////<wbr>//////////<br><br></div><b>wireEncode:<br><br></b>  //////////////////////////////<wbr>////////////////////<br>  // My modifications (Mateus)<br>  //////////////////////////////<wbr>////////////////////<br>  getNextForwarder();<br>  getLastForwarder();<br>  totalLength += encoder.prependBlock(m_<wbr>lastForwarder);<br>  totalLength += encoder.prependBlock(m_<wbr>nextForwarder);<br>  //////////////////////////////<wbr>////////////////////<br><br></div>I tried to copy the Nonce settings. <br><br></div>Thanks,<br><div><div><br><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-15 23:21 GMT-03:00 Spyridon (Spyros) Mastorakis <span dir="ltr"><<a href="mailto:mastorakis@cs.ucla.edu" target="_blank">mastorakis@cs.ucla.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div><br></div><div>have you modified the wireEncode and wireDecode methods to encode/decode the field to/from wire format?</div><div><br></div><div>Thanks,</div><div><br><div>
<div><div><div><span style="float:none;display:inline!important">Spyridon (Spyros) Mastorakis</span><br><span style="float:none;display:inline!important">Personal Website: </span><a href="http://cs.ucla.edu/~mastorakis/" target="_blank">http://cs.ucla.edu/~m<wbr>astorakis/</a><br><span style="float:none;display:inline!important">Internet Research Laboratory</span><br><span style="float:none;display:inline!important">Computer Science Department</span><br><span style="float:none;display:inline!important">UCLA</span></div><div><br></div></div></div></div><div><div class="m_-1101538737427467005h5"><div><blockquote type="cite"><div>On Oct 15, 2017, at 4:28 PM, Mateus Sousa <<a href="mailto:mateus.aluufc@gmail.com" target="_blank">mateus.aluufc@gmail.com</a>> wrote:</div><br class="m_-1101538737427467005m_-1204199762260539453Apple-interchange-newline"><div><div dir="ltr">Hi all,<br><br>I added a new field to Interest packet by following the discussions: <a href="http://www.lists.cs.ucla.edu/pipermail/ndnsim/2015-July/002044.html" target="_blank">http://www.lists.cs.ucla.edu/p<wbr>ipermail/ndnsim/2015-July/0020<wbr>44.html</a> and <a href="http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-March/003481.html" target="_blank">http://www.lists.cs.ucla.edu/p<wbr>ipermail/ndnsim/2017-March/003<wbr>481.html</a>.<br><br>I created the field "NextForwarder" to point what node is the next forwarder to the interest. This field should be updated at every node (here is the problem). <br><br>However, the alterations aren't persistent. The field value turns into "0" no matter what value I set.<br><br>Here goes my modifications:<br><br><b>    src/Interest.cpp: </b><br>                <br>    Interest&<br>    Interest::setNextForwarder(uin<wbr>t32_t next) {<br>           if (m_wire.hasWire() && m_nextForwarder.value_size() == sizeof(uint32_t)) {<br>            std::memcpy(const_cast<uint8_t<wbr>*>(m_nextForwarder.value()), &next, sizeof(next));<br>  }<br>  else {<br>    m_nextForwarder = makeBinaryBlock(tlv::NextForwa<wbr>rder,<br>                              reinterpret_cast<const uint8_t*>(&next),<br>                              sizeof(next));<br>    m_wire.reset();<br>  }<br>  return *this;<br>}<br><br>uint32_t<br>Interest::getNextForwarder() const{<br>  if (!m_nextForwarder.hasWire())<br>    const_cast<Interest*>(this)->s<wbr>etNextForwarder(9999);<br><br>  if (m_nextForwarder.value_size() == sizeof(uint32_t))<br>    return *reinterpret_cast<const uint32_t*>(m_nextForwarder.val<wbr>ue());<br>  else {<br>    return readNonNegativeInteger(m_nextF<wbr>orwarder);<br>  }<br>}<br><br><br><b>    encoding/tlv.h</b><br>          NextForwarder = 33, // X- Mateus<br><br><br>Thanks in advance.<br></div><br></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>
</div></blockquote></div><br></div></div></blockquote></div><br></div>