[ndnSIM] Adding custom field to data packet

Lynch Christopher chlynch at tcd.ie
Wed Mar 18 04:06:58 PDT 2020


Hi all,

I'm aware that this has been asked many times before but I can't seem to
figure out where I'm going wrong. I want to add a custom field to the data
packet class to indicate whether a packet has been pushed.

I have performed the following steps

1. Add pushed member variable to data class with getter and setter methods
2. Add pushed member variable to meta-info class with getter and setter
methods
3. Add new type to tlv.hpp for pushedData field.
3. Edit wireEncode and wireDecode functions in meta-info class to include
encoding and decoding for new custom field. In this case, I use the
prependEmptyBlock function from the blockHelper class.

My changes compile and run fine, but the freshnessPeriod field of the data
packet class is now incorrect after decoding. values range anywhere between
0 to 5205428264770612480. Here are some debug lines.

*"+24.571161426s 46 ndn.Producer:OnInterest(): [DEBUG] data freshness=1000
milliseconds"*
*"+24.572752627s 0 RepeatingConsumer:OnData(): [DEBUG] << D: /cam
freshness=3856880632320 milliseconds"*
*"+24.738112185s 3 RepeatingConsumer:OnData(): [DEBUG] << D: /cam
freshness=5205428264770612480 milliseconds"*

Here are links to the relevant changes if interested:
https://github.com/ChrisLynch96/ndn-cxx/blob/push-data/ndn-cxx/encoding/tlv.hpp#L88
https://github.com/ChrisLynch96/ndn-cxx/blob/push-data/ndn-cxx/data.hpp#L222-L229
https://github.com/ChrisLynch96/ndn-cxx/blob/push-data/ndn-cxx/data.hpp#L222-L226
https://github.com/ChrisLynch96/ndn-cxx/blob/push-data/ndn-cxx/meta-info.hpp#L225
https://github.com/ChrisLynch96/ndn-cxx/blob/push-data/ndn-cxx/meta-info.cpp#L66-L72
https://github.com/ChrisLynch96/ndn-cxx/blob/push-data/ndn-cxx/meta-info.cpp#L162-L165
https://github.com/ChrisLynch96/ndn-cxx/blob/push-data/ndn-cxx/meta-info.cpp#L219-L225
https://github.com/ChrisLynch96/ndn-cxx/blob/push-data/ndn-cxx/meta-info.cpp#L219-L225

I've come across these threads when searching for answers:
https://www.lists.cs.ucla.edu/pipermail/ndnsim/2019-October/005579.html
https://www.lists.cs.ucla.edu/pipermail/ndnsim/2015-July/002044.html
https://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-November/004277.html
https://www.lists.cs.ucla.edu/pipermail/ndnsim/2019-October/005577.html

I would note that
https://lo.calho.st/networks/adding-custom-packet-fields-to-packets-in-ndnsim-2-3-without-forking-the-entire-repository/
does
not exist anymore.

Any help is greatly appreciated.

Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20200318/5bb875c6/attachment.html>


More information about the ndnSIM mailing list