Hello Shyam.

Please take a look at the API documentation in the Wiki:
http://trac.ibr.cs.tu-bs.de/project-cm-2012-ibrdtn/wiki/docs/api

Basically, you have to create a program that does something like this.
First it connects to the event API and monitor the QueueBundleEvent
(here done manually with telnet).

$ telnet localhost 4550
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
IBR-DTN 0.11.0 (build 12c7c23) API 1.0
protocol event
200 SWITCHED TO EVENT
Event: BundleReceivedEvent
Peer: dtn://syrah/test
Local: true
Source: dtn://syrah/test
Timestamp: 443112174
Sequencenumber: 1
Lifetime: 3600
Procflags: 144
Destination: dtn://test/test

Event: QueueBundleEvent
Source: dtn://syrah/test
Timestamp: 443112174
Sequencenumber: 1
Lifetime: 3600
Procflags: 144
Destination: dtn://test/test

Now, you can query the contents of that bundle in a second connection using
the extended API set and the "bundle load <timestamp> <sequencenumber> <source>"
command. The payload is base64 encoded.

$ telnet localhost 4550
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
IBR-DTN 0.11.0 (build 12c7c23) API 1.0
protocol extended
200 SWITCHED TO EXTENDED
bundle load 443112174 1 dtn://syrah/test
200 BUNDLE LOADED 443112174 1 dtn://syrah/test
bundle get     
200 BUNDLE GET 443112174 1 dtn://syrah/test
Processing flags: 144
Timestamp: 443112174
Sequencenumber: 1
Source: dtn://syrah/test
Destination: dtn://test/test
Reportto: dtn:none
Custodian: dtn:none
Lifetime: 3600
Blocks: 1

Block: 1
Flags: LAST_BLOCK
Length: 6
Encoding: base64

aGVsbG8K


While that may sound quite nice, I'm afraid to tell you, that I found a bug (while preparing this email) in the API which makes that approach useless on the current release 0.10.2. I will create a patch and submit it in the GIT repositories, but it will take some time until a new release will come out.

Kind regards,
Johannes Morgenroth


Am 15.01.2014 14:04, schrieb Shyam B:
Dear Johannes,

I believe this is similar to querying the DTN neighbors? This is what I did to query the DTN neighbors in python:

1) Query LOCALHOST and port 4550, via socket (fsock)
2) Read header [fsock.readline()] to listen to incoming information from socket.
3) Switch into management protocol mode by [sock.send("protocol management\n")]
4) Read protocol switch message [fsock.readline()]
5) Query neighbor list [sock.send("neighbor list\n")]
6) The data returned from the socket can now be filtered out to know the DTN neighbors. Works perfectly, no problem!!

However, this event mechanism you have mentioned is still a bit blurry to me, apologies. For the steps above:

- must I send "protocol extended" or "protocol event" for Step 3 mentioned above?
- When I send protocol extended, all I get is: 200 SWITCHED TO EXTENDED
- Reading from the socket hangs, because there isn't anything to read anymore.

Where am I going wrong. I just require the data of the crossed over bundles  via my current node.

Many thanks,
Shyam