[Nfd-dev] NDNLPv2: create lp::packet and add content

Eric Newberry enewberry at email.arizona.edu
Sat Jul 29 18:59:41 PDT 2017


Adhy,

A few questions:

Have you installed the recompiled version of NFD before starting the 
forwarder?

Are you running the producer and consumer on the same host, connected to 
the same instance of NFD? If not, do all intermediate forwarders also 
support CustomTag/CustomTagField?

Eric


On 07/27/2017 04:47 PM, Adhy Satya wrote:
> Dear list members,
>
> I wonder if you have a chance to look into this issue of the new field 
> I created in NDNLPv2. It seems that it's not being transferred to the 
> end host (maybe a wire encode problem?).
>
>
> Thank you
>
>
> On Fri, Jul 21, 2017 at 4:39 PM, Adhy Satya <adhysatya820 at gmail.com 
> <mailto:adhysatya820 at gmail.com>> wrote:
>
>     Just an update:
>     I was able to create a new field in the NDNLP packet.
>
>     I changed the following files:
>     "ndn-cxx/src/lp/fields.hpp"
>
>             typedef detail::FieldDecl<field_location_tags::Header,
>         uint64_t,
>         tlv::CustomTag> CustomTagField;
>             BOOST_CONCEPT_ASSERT((Field<CustomTagField>));
>             CustomTagField
>              > FieldSet;
>
>
>     "ndn-cxx/src/lp/tags.hpp"
>
>         typedef SimpleTag<uint64_t, 0x60000001> CustomTag;
>
>
>     "ndn-cxx/src/lp/tlv.hpp"
>
>         CustomTag= 901
>
>     compiled with ./waf
>
>     "NFD/daemon/face/generic-link-service.cpp"
>
>         void
>         GenericLinkService::encodeLocalFields(const ndn::TagHost&
>         netPkt, lp::Packet& lpPacket)
>         {
>           shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag =
>         netPkt.getTag<lp::IncomingFaceIdTag>();
>           if (incomingFaceIdTag != nullptr) {
>             lpPacket.add<lp::IncomingFaceIdField>(*incomingFaceIdTag);
>           }
>
>           shared_ptr<lp::CustomTag> customTag =
>         netPkt.getTag<lp::CustomTag>();
>           if (customTag != nullptr) {
>             lpPacket.add<lp::CustomTagField>(*customTag);
>           }
>         }
>
>
>     compiled with ./waf
>
>     "ndn-cxx/examples/consumer.cpp"
>
>             // Insert Packet Tag
>             interest.setTag(std::make_shared<lp::CustomTag>(54321));
>             std::cout << "Tag value: " <<
>         interest.getTag<lp::CustomTag>() << std::endl;
>
>             m_face.expressInterest(interest,
>          bind(&Consumer::onData, this,  _1, _2),
>          bind(&Consumer::onTimeout, this, _1));
>
>
>     and finally, on the producer app
>     "ndn-cxx/examples/producer.cpp"
>
>         onInterest(const InterestFilter& filter, const Interest& interest)
>           {
>             std::cout << "<< I: " << interest << std::endl;
>
>             // Read Packet Tag
>             std::shared_ptr<lp::CustomTag> tag =
>         interest.getTag<lp::CustomTag>();
>             std::cerr << "Tag from Consumer: " << tag << std::endl;
>
>
>     compiled with ./waf
>     and ran the applications, but the tag doesn't arrive at the producer:
>
>         << I:
>         /example/testApp/randomData?ndn.MustBeFresh=1&ndn.InterestLifetime=1000&ndn.Nonce=1547038398
>         Tag from Consumer: 0
>
>
>
>     Is there anything missing?
>
>
>     Thank you
>
>
>     On Thu, Jul 20, 2017 at 10:54 PM, Adhy Satya
>     <adhysatya820 at gmail.com <mailto:adhysatya820 at gmail.com>> wrote:
>
>         Hi,
>
>         Following the idea of exchanging information between the
>         consumer and the producer, what's the difference between
>         creating a ndn::lp::Packet or a ndn::TagHost? Which method
>         should I use?
>
>
>         I saw older posts (this
>         <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/2017-February/002260.html>,
>         and this
>         <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/2016-February/001536.html>),
>         but this methods are for CachePolicy and NextHopFaceIdTag. I
>         want to send a string "Hello" (type Name actually).
>
>         In line with what Ashlesh did, I added the following lines at
>         Consumer
>         (https://github.com/named-data/ndn-cxx/blob/master/examples/consumer.cpp#L42
>         <https://github.com/named-data/ndn-cxx/blob/master/examples/consumer.cpp#L42>),
>         but need help with the commented lines.
>
>             ndn::lp::Packet lpPacket;
>             // add string ("Hello") to lpPacket
>             // send lpPacket
>
>         And then I'll need to read that packet in the producer.
>
>
>         Thanks again for your help.
>
>
>
>
>
>
> _______________________________________________
> Nfd-dev mailing list
> Nfd-dev at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20170729/50696185/attachment-0001.html>


More information about the Nfd-dev mailing list