[Nfd-dev] Adding a new field into data with help of Tag

Eric Newberry enewberry at email.arizona.edu
Thu Jan 4 18:19:03 PST 2018


I believe the 832 TLV-TYPE you used below overlaps with the existing 
CongestionMark TLV-TYPE (also 832). What release of ndn-cxx and NFD are 
you modifying? If it's 0.5.1 or later, this field should be present.

Eric


On 01/04/2018 07:13 PM, 小杰许 wrote:
> Thanks for your reply!
> Actually, I have done this steps before, but it didn't work and I 
> still meet the problem.
>
> I modified these files.
>
> A、in ndn-cxx/src/lp
> 1、fields.hpp
> typedef FieldDecl<field_location_tags::Header,
>                   uint64_t,
>                   tlv::CustomMark> CustomMarkField;
> BOOST_CONCEPT_ASSERT((Field<CustomMarkField>));
>
>
>   CustomMarkField,
>
>   > FieldSet;
>
> 2、tags.hpp
> typedef SimpleTag<uint64_t, 0x60000002> CustomMarkTag;
>
> 3、tlv.hpp
>  CustomMark = 832,
>
> B、in ndn-cxx/src
> face.cpp
> extractLpLocalFields(NetPkt& netPacket, const lp::Packet& lpPacket)
> {
>   .......
>   addTagFromField<lp::CustomMarkTag, lp::CustomMarkField>(netPacket, 
> lpPacket);
> }
>  C、ndn-cxx/src/detail
> face-impl.hpp
>
> void
>   asyncPutData(const Data& data)
>   {
>     .........
>     addFieldFromTag<lp::CongestionMarkField, 
> lp::CongestionMarkTag>(lpPacket, data);
>     addFieldFromTag<lp::CustomMarkField, lp::CustomMarkTag>(lpPacket, 
> data);
>
>     .........
>   }
>
> D、NFD/daemon/face
> generic-link-service.cpp
>
> encodeLpFields
>
> void
> GenericLinkService::encodeLpFields(const ndn::PacketBase& netPkt, 
> lp::Packet& lpPacket)
> {
>   ......
>     shared_ptr<lp::CustomMarkTag> customMarkTag = 
> netPkt.getTag<lp::CustomMarkTag>();
>   if (customMarkTag != nullptr) {
> lpPacket.add<lp::customMarkField>(*customMarkTag);
>   }
> .....
> }
>
> decodeData
>
> void
> GenericLinkService::decodeData(const Block& netPkt, const lp::Packet& 
> firstPkt)
> {
>   ......
>
>     if (firstPkt.has<lp::CustomMarkField>()) {
> data->setTag(make_shared<lp::CustomMarkTag>(firstPkt.get<lp::CustomMarkField>()));
>   }
>
>  ......
> }
>
> That's all I have done. But I still get the error when I compile NFD. 
> Here is beginning of the error:
>
>
>
> Waf: Entering directory `/home/icpclient1/NFD/build'
> [ 73/157] Compiling daemon/face/generic-link-service.cpp
> In file included from /usr/local/include/ndn-cxx/lp/packet.hpp:25:0,
>                  from ../daemon/face/lp-fragmenter.hpp:31,
>                  from ../daemon/face/generic-link-service.hpp:30,
>                  from ../daemon/face/generic-link-service.cpp:26:
> /usr/local/include/ndn-cxx/lp/fields.hpp:78:19: error: ‘CustomMark’ is 
> not a member of ‘ndn::lp::tlv’
>                    tlv::CustomMark> CustomMarkField;
>                    ^
> /usr/local/include/ndn-cxx/lp/fields.hpp:78:19: error: ‘CustomMark’ is 
> not a member of ‘ndn::lp::tlv’
> /usr/local/include/ndn-cxx/lp/fields.hpp:78:33: error: template 
> argument 3 is invalid
>                    tlv::CustomMark> CustomMarkField;
>
> Do I miss  some steps? Can you give me some suggestions? Thanks.
>
> Yours,
> Junjie Xu
>
>
>
> 2018-01-05 3:00 GMT+08:00 Eric Newberry <enewberry at email.arizona.edu 
> <mailto:enewberry at email.arizona.edu>>:
>
>     Junjie,
>
>     In order for the tag to be encoded and decoded properly by the
>     LinkService, you need to assign it a TLV-TYPE in ndn-cxx's source
>     file lp/tlv.hpp. For example, the NextHopFaceId tag has a TLV-TYPE
>     of 816.
>
>     Eric
>
>
>     On 01/04/2018 02:40 AM, 小杰许 wrote:
>>     I meet some problems when I try to add a new field in data in
>>     NFD-dev by using tags. And I found
>>     someone have met the same problems before.
>>
>>     here is the website of of the problem
>>     http://www.lists.cs.ucla.edu/pipermail/nfd-dev/2017-August/002611.html
>>     <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/2017-August/002611.html>
>>     I follow all the steps above, defined LpHeaderField. defined Tag,
>>     assigned a tag number, but with CacheMarkTag instead. Then I
>>     compile ndn-cxx, it works well.
>>     But when I modify my NFD LinkService to encode and decode the new
>>     tag.
>>     I get the error "error: ‘XXXTag’ is not a member of
>>     "ndn::lp::tlv" and other errors. Can you give me some advices?
>>     Looking forward to your reply.
>>     Yours,
>>     Junjie Xu
>>
>>
>>     _______________________________________________
>>     Nfd-dev mailing list
>>     Nfd-dev at lists.cs.ucla.edu <mailto:Nfd-dev at lists.cs.ucla.edu>
>>     http://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev
>>     <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/20180104/61fbd244/attachment.html>


More information about the Nfd-dev mailing list