[Nfd-dev] [Ndn-interest] [ndn-cxx][mini-NDN][General] Printing some information
Alex Afanasyev
aa at CS.UCLA.EDU
Mon Sep 12 13:11:33 PDT 2016
(Moved to nfd-dev@ mailing list)
> On Sep 12, 2016, at 7:13 AM, bertolin at eurecom.fr wrote:
>
> Good morning at all and thank you again for the help that I am receiving by your community.
> I spent some time, without success, in trying to print the following information (I am working in miniNDN:
>
> 1) The Content of the Data.
> If I print the packet, I obtain:
> Name: /mat/try/normandie/%FC%00%05%3CO%E0%D0%FC%D7
> MetaInfo: ContentType: 0, FreshnessPeriod: 10000 milliseconds
> Content: (size: 6)
> Signature: (type: 1, value_length: 256)
>
> So I manage to play with the blocks and the buffers, but the documentation is not really verbose. However, I though to write:
>
> void onData(const Interest& interest, const Data& data) {
> log << "Data received correctly" << std::endl;
> log << data << endl;
>
> //take block
> ndn::Block x = data.getContent();
>
> //take buffer
> shared_ptr<const Buffer> buffer = x.getBuffer();
You should never use this one. This one gets the internal buffer.
>
> //take string
> std::string content((char*)buffer.get(), 6);
> log << content << endl;
> }
>
> But on my log file I obtained just not-printable random characters! Where did I wrong?
std::string value(data.getContent().value_begin(), data.getContent().value_end());
// or if the above fails, std::string value((char*)data.getContent().value(), data.getContent().value_size());
>
> 2) the PIT table of a node. I did not find any with nfd-status and other commands. Is it possible in principle ?
Yes. For now, we don't have visualization of PIT. In principle it is possible, just need definition of what should be the output format and making the implementation.
> 3) Finallyh, I would like to concentrate here another question a bit different. Working with miniNDN, I would like to build the following topology:
> Consume <-------> gateway <-------> Producer.
> I already wrote my version of consumer and producer, with the callback onInterest, onData etc.. But with the gateway, conceptually how should I structure the program that works on this node?
>
> Thank you for you help, I say it again it so I will not fill up the mailing list with just "thank you" answers :)
> Matteo
>
> -------------------------------------------------------------------------------
> This message was sent using EURECOM Webmail: http://webmail.eurecom.fr
>
>
> _______________________________________________
> Ndn-interest mailing list
> Ndn-interest at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20160912/237c1230/attachment.bin>
More information about the Nfd-dev
mailing list