[Ndn-lib] writing a code to create an Interest packet

Thompson, Jeff jefft0 at remap.UCLA.EDU
Mon Aug 1 02:43:24 PDT 2016


Hello Zeinab,

The TlvEncoder is an internal utility. It is not meant to be called directly by applications. You can encode an Interest using the wireEncode method as shown on the API page:
http://named-data.net/doc/ndn-ccl-api/interest.html#interest-wireencode-method

Here is an example program to encode an Interest:
https://github.com/named-data/jndn/blob/master/examples/src/net/named_data/jndn/tests/TestEncodeDecodeInterest.java#L234

If you need to add an ImplicitSha256DigestComponent to the name, see:
http://named-data.net/doc/ndn-ccl-api/name.html#name-appendimplicitsha256digest-method

Thank you,
- Jeff T

From: Ndn-lib <ndn-lib-bounces at lists.cs.ucla.edu<mailto:ndn-lib-bounces at lists.cs.ucla.edu>> on behalf of Zeinab Zali <zeinabzali at gmail.com<mailto:zeinabzali at gmail.com>>
Date: Monday, August 1, 2016 at 1:47:00
To: NDN Lib <ndn-lib at lists.cs.ucla.edu<mailto:ndn-lib at lists.cs.ucla.edu>>
Subject: [Ndn-lib] writing a code to create an Interest packet


Hi all,

I am confused with TlvEncoder and Bytebuffers. I want to write a simple java code to create a UDP packet that contained an Interest. I tried to use writeBlobTlv of class TlvEncoder in jndn package. But I don't understand if I should create the outer Tlv or the inner one. For example to create a name Tlv, should I create a TlvEncoder object for nameComponent and then another one for ImplicitSha256DigestComponent, and then a Name component? Would you please give me a simple example to create a Tlv with its sub Tlvs?

Thanks a lot.

Zeinab.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndn-lib/attachments/20160801/42a10eb9/attachment.html>


More information about the Ndn-lib mailing list