truedat101 / ccn4bnode

Provides a JS/native integration between ProjectCCNx and Node.js
4 stars 2 forks source link

Looking to Contribute #8

Open cScarlson opened 11 years ago

cScarlson commented 11 years ago

Hey truedat101,

Wanted to say keep up the good work - looks like its starting to come together nicely.

I wanted to formally let you know I plan to contribute, as I have some ideas that you may like. However, I'm still taking baby steps in CCNx and was hoping you could shed some insight.

As I said, I'm still warming up to the CCNx basics, so understanding these is essential. I have searched high and low to find out what the process for turning a Name-string into a CCNb-compatible format. My question is, if I have the Interest "ccnx:/PARC/readMe" - how do I prepare it to go over the wire via TCP? I just want to ping the CCNd and get a response of ANY kind.

Example:

  1. Take the ccnx Name (var name = 'ccnx:/PARC/readMe';), and split() on slash '/'.
  2. base64Encode name: name[1] = base64Encode(name[1]); name[2] = base64Encode(name[2]);
  3. Pack prefixes into XML: <...><...><component ...>name[1]...</...>
  4. XML to hex: var Interest = new hex(XML);
  5. Create buffer: var buf = new Buffer(16).fill(0);
  6. Write to buffer: buf.write(XML);
  7. Send to CCNd: tcp.write(buf);

As you can see, I'm in the weeds here, so ANY insight is greatly appreciated.

Much Appreciation,

Cody

truedat101 commented 11 years ago

Hi @cScarlson ! I'm flattered anyone is interested in this little project. I think you've hit the nail on the head. There are a bunch of things that aren't clear from a read of the Jacobson paper (around implementation) and reviewing the CCNx source which make adapting language binding to a new language tricky, and make migration to a new platform a bit of a challenge.

In CCN C code, this is a matter of creating an interest (as far as your questions). I'd suggest experimenting first with the basic utilities in the CCNx release (like ccnput, ccncat and ccnget). The source is there and you can start to get a feeling for how to use the utilities. You greater question is about the packet format. Rather than reinvent the over-the wire format in Javascript, I think the first goal I had was in the server portion of CCN4BNode api set to wrap the encoding of this data to send over the wire to a CCNd. From the client side I think there needs to be a definition of the common set of JS libs needed to support a solid CCNx client. These same libraries can end up getting re-used for different use cases, either for in the browser, for in a server side context, or possibly inside of a browser plugin.

I thought it might be useful to have a ccn4b client library to handle the backandforth translation of the stream data from its raw format into the XML encoding and then the ccnb format. That said, there are some fundamental architectural differences in the JS VM sandbox security model vs. what one can do from a rich client platform, like opening direct TCP sockets or sending UDP datagrams. I think we can achieve quite a bit piggy backing on the work down around Web Sockets (which I currently think to implement over SocketIO).

I'm happy to have any help and where ever your expertise may lie. Once complexity I've created here is that there are a bunch of projects here: ccn4b ccn4bnode ccn4bname.js

I envision there being some general ccn JS libs that would be geared towards client library usage or shared across client or server side. And there would be some node.js specific pieces that support this particular implementation.

Feel free to fork, and jump in and create issues in the issue tracker so we can map out the work.