Hello,
Am 07.11.2011 16:59, schrieb Carson Dunbar:
>
> If I do have a bundle, let's say the received.bundle from local, is
> there a way to split up its payload into smaller payloads and make
> each new payload its own bundle? My objective is to send in a file
> and then break it up into smaller payloads then choose among them to
> send to other nodes.
If the received.bundle variable is a object of type dtn::data::Bundle
(if not you have to load the bundle from the database first) you can
access the payload like this:
dtn::data::PayloadBlock &payload =
bundle.getBlock<dtn::data::PayloadBlock>();
To get the data itself you need to allocate and lock the stream
associated with it...
// get BLOB reference
ibrcommon::BLOB::Reference ref = b.getData();
// lock the stream - while we are between the curlies, the stream is locked.
{
ibrcommon::BLOB::iostream stream = ref.iostream();
[ ... read from / write to the stream .... ]
}
Once you got the stream you can do standard C++ streaming operations on it.
In your case I would read the from the stream continuously and generate
a bundle for each chunk while reading the stream.
Kind regards,
Johannes
--
Johannes Morgenroth Institut fuer Betriebssysteme und Rechnerverbund
Tel.: +49-531-391-3249 Muehlenpfordtstrasse 23
Fax.: +49-531-391-5936 TU Braunschweig D-38106 Braunschweig
--
!! This message is brought to you via the `ibr-dtn' mailing list.
!! Please do not reply to this message to unsubscribe. To unsubscribe or adjust
!! your settings, send a mail message to <ibr-dtn-request@ibr.cs.tu-bs.de>
!! or look at https://www.ibr.cs.tu-bs.de/mailman/listinfo/ibr-dtn.