Search code examples
xml-parsingbufferpacket

How to Parse a CCNx ContentObject/Interest from and to CCNb Binary


I am using the new CCNx internet protocol. It uses ccn-packets to transmit data ~'just the same as an IP-packet', except that the packet has a different format.

Basically, I have successfully constructed a ccnx "Interest" (what is sent out) packet and I'm getting a real/successful response from the CCNd ("CCN-Daemon").

The response comes back as a data-buffer (typedArray) as I'm using a tcp-socket to send the Interest.

I am using NodeJS/JavaScript, but this is beside the point.

It seems that I will be getting the byte-numeral (I guess a decimal val) and mapping that numVal to the "DTAGS" to see what kind of XML-Tag is in play.

Essentially, I want to parse a CCNx-"ContentObject"-response to find its XML-representation.

*Here are some relevant resources:

the index: http://www.ccnx.org/releases/latest/doc/technical/

Interests: http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html

CCNb Binary-Format: http://www.ccnx.org/releases/latest/doc/technical/BinaryEncoding.html

DTAG Values: http://www.ccnx.org/releases/latest/doc/technical/DTAG.html

ContentObjects: http://www.ccnx.org/releases/latest/doc/technical/ContentObject.html*

NOTE:

I'm sure some of you will tell/ask me:

CCNx has a 'C' and a 'Java' lib! -- Why don't you just use those?!!!

I must understand this for a number of reasons not necessary for this discussion.

There's also a JavaScript library already out there (remap/NDN-JS, CCN4B, etc) -- use that!!!

This lib is very basic and I plan to create a lib with a little more syntactical sugar (essential of why I need to learn!)

If anyone has successfully parsed a CCNx-ContentObject, Interest, knows how to, or knows what the docs are describing to do -- PLEASE (please!!!) shed some light on the subject, any light at all.

Tons of 'pre-appreciation'

Cody


Solution

  • Just to close the loop here: These are indeed parsed by the NDN.JS library; feel free to email the authors if you need support on it.

    The canonical version is https://github.com/named-data/ndn-js with some more recent bug fixes in the refactor branch. (The refactor branch should work in Node.js as well as in browsers.)

    cheers,

    Jeff - UCLA NDN team