[ndnSIM] Adding new field to Interest packet
Spyridon (Spyros) Mastorakis
mastorakis at cs.ucla.edu
Sun Oct 15 19:21:13 PDT 2017
Hi,
have you modified the wireEncode and wireDecode methods to encode/decode the field to/from wire format?
Thanks,
Spyridon (Spyros) Mastorakis
Personal Website: http://cs.ucla.edu/~mastorakis/ <http://cs.ucla.edu/~mastorakis/>
Internet Research Laboratory
Computer Science Department
UCLA
> On Oct 15, 2017, at 4:28 PM, Mateus Sousa <mateus.aluufc at gmail.com> wrote:
>
> 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 <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 <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/ff055fb4/attachment-0001.html>
More information about the ndnSIM
mailing list