Epidemic routing and received bundles (technical problem)
Hi,
This is regarding Epidemic routing and receiving bundles. Using dtntrigger for example, one can receive the bundle targeted to a particular target node. I.e. When the bundle arrives at the target node, the target node has an immediate knowledge of it (using payload, eid) via script.
Consider the scenario where epidemic routing is used, and an *intermediate node* receives the bundle meant for a target node. Dtntrigger does not work in this case. My question is, how do I know that intermediate node has received a bundle (programmatically)? DTN daemon has this knowledge of received bundles by the intermediate node but, if an application running on this intermediate node wishes to know that some (external) bundle has been received, how would it know that. It is received into the 'bundles' directory, but I would like something like DTNTrigger for the intermediate node' knowledge! How can I achieve this?
This approach will be very helpful in my aerial application.
Thank you!
Hi Shyam,
if I understand you right, you want to wiretap all / specific crossing traffic like wireshark does?
IBR-DTN does not provide such mechanism to standard applications due to security reasons. But with the event API you can listen to QueueBundleEvent and then request that bundle ID using the standard API connection. At this time, there is no protection against reading non-local bundles via the extended protocol.
For the event API you switch into the right handler via "protocol event" and then you get the stream.
IBR-DTN 0.11.0 (build 4a406ca) API 1.0 protocol event 200 SWITCHED TO EVENT Event: BundleReceivedEvent Peer: dtn://syrah/test Local: true Source: dtn://syrah/test Timestamp: 442912579 Sequencenumber: 1 Lifetime: 3600 Procflags: 128 Destination: dtn://test/test
Event: QueueBundleEvent Source: dtn://syrah/test Timestamp: 442912579 Sequencenumber: 1 Lifetime: 3600 Procflags: 128 Destination: dtn://test/test
Kind regards, Johannes Morgenroth
Am 11.01.2014 02:57, schrieb Shyam B:
Hi,
This is regarding Epidemic routing and receiving bundles. Using dtntrigger for example, one can receive the bundle targeted to a particular target node. I.e. When the bundle arrives at the target node, the target node has an immediate knowledge of it (using payload, eid) via script.
Consider the scenario where epidemic routing is used, and an _intermediate node_ receives the bundle meant for a target node. Dtntrigger does not work in this case. My question is, how do I know that intermediate node has received a bundle (programmatically)? DTN daemon has this knowledge of received bundles by the intermediate node but, if an application running on this intermediate node wishes to know that some (external) bundle has been received, how would it know that. It is received into the 'bundles' directory, but I would like something like DTNTrigger for the intermediate node' knowledge! How can I achieve this?
This approach will be very helpful in my aerial application.
Thank you!
-- Best Regards, Shyam
Dear Johannes,
Thank you for the lead. Yes, you are right. I want to wiretap and get the knowledge of the crossing bundles (on say, an intermediate node having epidemic routing).
I looked up the internet, but I could not get a clear idea on how to use the QueueBundleEvent. Is that a plugin or do I have to register the event in the code directly? Where is the standard API connection? And what is an extended protocol?
Until now, I understand using the tools and have myself made changes to the Ibrdtn C++ tools and I understand workings of ibrdtnd.conf and reading the neighbors via localhost query. However, was curious where/how you got the 'stream' information? Is it the same way we query for the DTN neighbors (say, opening a socket using a python script)?
Thanks, Shyam
On Mon, Jan 13, 2014 at 8:20 AM, Johannes Morgenroth < morgenroth@ibr.cs.tu-bs.de> wrote:
Hi Shyam,
if I understand you right, you want to wiretap all / specific crossing traffic like wireshark does?
IBR-DTN does not provide such mechanism to standard applications due to security reasons. But with the event API you can listen to QueueBundleEvent and then request that bundle ID using the standard API connection. At this time, there is no protection against reading non-local bundles via the extended protocol.
For the event API you switch into the right handler via "protocol event" and then you get the stream.
IBR-DTN 0.11.0 (build 4a406ca) API 1.0 protocol event 200 SWITCHED TO EVENT Event: BundleReceivedEvent Peer: dtn://syrah/test Local: true Source: dtn://syrah/test Timestamp: 442912579 Sequencenumber: 1 Lifetime: 3600 Procflags: 128 Destination: dtn://test/test
Event: QueueBundleEvent Source: dtn://syrah/test Timestamp: 442912579 Sequencenumber: 1 Lifetime: 3600 Procflags: 128 Destination: dtn://test/test
Kind regards, Johannes Morgenroth
Am 11.01.2014 02:57, schrieb Shyam B:
Hi,
This is regarding Epidemic routing and receiving bundles. Using dtntrigger for example, one can receive the bundle targeted to a particular target node. I.e. When the bundle arrives at the target node, the target node has an immediate knowledge of it (using payload, eid) via script.
Consider the scenario where epidemic routing is used, and an *intermediate node* receives the bundle meant for a target node. Dtntrigger does not work in this case. My question is, how do I know that intermediate node has received a bundle (programmatically)? DTN daemon has this knowledge of received bundles by the intermediate node but, if an application running on this intermediate node wishes to know that some (external) bundle has been received, how would it know that. It is received into the 'bundles' directory, but I would like something like DTNTrigger for the intermediate node' knowledge! How can I achieve this?
This approach will be very helpful in my aerial application.
Thank you!
-- Best Regards, Shyam
Am 14.01.2014 13:22, schrieb Shyam B:
I looked up the internet, but I could not get a clear idea on how to use the QueueBundleEvent. Is that a plugin or do I have to register the event in the code directly?
That is an internal event of the daemon, which is exposed in the standard logging and available through the event API.
Where is the standard API connection? And what is an extended protocol? Until now, I understand using the tools and have myself made changes to the Ibrdtn C++ tools and I understand workings of ibrdtnd.conf and reading the neighbors via localhost query. However, was curious where/how you got the 'stream' information? Is it the same way we query for the DTN neighbors (say, opening a socket using a python script)?
Extended protocol is the standard API for applications. You use it by connecting with TCP to the daemon on port 4550 and then send the command "protocol extended" to change into that mode. The same way you can switch to other API protocols like "protocol management" and "protocol event". By using the management API you can query the neighbors.
Kind regards, Johannes Morgenroth
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
On Wed, Jan 15, 2014 at 12:31 PM, Johannes Morgenroth < morgenroth@ibr.cs.tu-bs.de> wrote:
Am 14.01.2014 13:22, schrieb Shyam B:
I looked up the internet, but I could not get a clear idea on how to use the QueueBundleEvent. Is that a plugin or do I have to register the event in the code directly?
That is an internal event of the daemon, which is exposed in the standard logging and available through the event API.
Where is the standard API connection? And what is an extended protocol? Until now, I understand using the tools and have myself made changes to the Ibrdtn C++ tools and I understand workings of ibrdtnd.conf and reading the neighbors via localhost query. However, was curious where/how you got the 'stream' information? Is it the same way we query for the DTN neighbors (say, opening a socket using a python script)?
Extended protocol is the standard API for applications. You use it by connecting with TCP to the daemon on port 4550 and then send the command "protocol extended" to change into that mode. The same way you can switch to other API protocols like "protocol management" and "protocol event". By using the management API you can query the neighbors.
Kind regards, Johannes Morgenroth
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:
- Query LOCALHOST and port 4550, via socket (fsock)
- 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
participants (2)
-
Johannes Morgenroth
-
Shyam B