[ndnSIM] Adding new field to Interest packet

Mateus Sousa mateus.aluufc at gmail.com
Sun Oct 15 16:28:52 PDT 2017


Hi all,

I added a new field to Interest packet by following the discussions:
http://www.lists.cs.ucla.edu/pipermail/ndnsim/2015-July/002044.html and
http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-March/003481.html.

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).

However, the alterations aren't persistent. The field value turns into "0"
no matter what value I set.

Here goes my modifications:

*    src/Interest.cpp: *

    Interest&
    Interest::setNextForwarder(uint32_t next) {
           if (m_wire.hasWire() && m_nextForwarder.value_size() ==
sizeof(uint32_t)) {
            std::memcpy(const_cast<uint8_t*>(m_nextForwarder.value()),
&next, sizeof(next));
  }
  else {
    m_nextForwarder = makeBinaryBlock(tlv::NextForwarder,
                              reinterpret_cast<const uint8_t*>(&next),
                              sizeof(next));
    m_wire.reset();
  }
  return *this;
}

uint32_t
Interest::getNextForwarder() const{
  if (!m_nextForwarder.hasWire())
    const_cast<Interest*>(this)->setNextForwarder(9999);

  if (m_nextForwarder.value_size() == sizeof(uint32_t))
    return *reinterpret_cast<const uint32_t*>(m_nextForwarder.value());
  else {
    return readNonNegativeInteger(m_nextForwarder);
  }
}


*    encoding/tlv.h*
          NextForwarder = 33, // X- Mateus


Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20171015/c225fe6d/attachment.html>


More information about the ndnSIM mailing list