IBR-DTNSuite
0.8
|
#include <CompressedPayloadBlock.h>
Classes | |
class | Factory |
Public Types | |
enum | COMPRESS_ALGS { COMPRESSION_UNKNOWN = 0, COMPRESSION_ZLIB = 1, COMPRESSION_BZ2 = 2 } |
Public Member Functions | |
CompressedPayloadBlock () | |
virtual | ~CompressedPayloadBlock () |
virtual size_t | getLength () const |
virtual std::ostream & | serialize (std::ostream &stream, size_t &length) const |
virtual std::istream & | deserialize (std::istream &stream, const size_t length) |
void | setAlgorithm (COMPRESS_ALGS alg) |
COMPRESS_ALGS | getAlgorithm () const |
void | setOriginSize (size_t s) |
size_t | getOriginSize () const |
Static Public Member Functions | |
static void | compress (dtn::data::Bundle &b, COMPRESS_ALGS alg) |
static void | extract (dtn::data::Bundle &b) |
Static Public Attributes | |
static const char | BLOCK_TYPE = 202 |
Definition at line 20 of file CompressedPayloadBlock.h.
Definition at line 33 of file CompressedPayloadBlock.h.
Definition at line 27 of file CompressedPayloadBlock.cpp.
Referenced by dtn::data::CompressedPayloadBlock::Factory::create().
Definition at line 32 of file CompressedPayloadBlock.cpp.
void dtn::data::CompressedPayloadBlock::compress | ( | dtn::data::Bundle & | b, |
CompressedPayloadBlock::COMPRESS_ALGS | alg | ||
) | [static] |
Definition at line 74 of file CompressedPayloadBlock.cpp.
References ibrcommon::BLOB::create(), dtn::data::PayloadBlock::getBLOB(), dtn::data::Bundle::getBlock(), dtn::data::PayloadBlock::getLength(), dtn::data::Bundle::insert(), ibrcommon::BLOB::iostream::iostream(), ibrcommon::BLOB::Reference::iostream(), dtn::data::Bundle::push_front(), dtn::data::Bundle::remove(), setAlgorithm(), and setOriginSize().
Referenced by dtn::api::ApiServer::processIncomingBundle().
std::istream & dtn::data::CompressedPayloadBlock::deserialize | ( | std::istream & | stream, |
const size_t | length | ||
) | [virtual] |
Deserialize the derived block payload.
stream | A input stream to deserialize from. |
Implements dtn::data::Block.
Definition at line 47 of file CompressedPayloadBlock.cpp.
void dtn::data::CompressedPayloadBlock::extract | ( | dtn::data::Bundle & | b | ) | [static] |
Definition at line 105 of file CompressedPayloadBlock.cpp.
References ibrcommon::BLOB::create(), getAlgorithm(), dtn::data::Bundle::getBlock(), dtn::data::Bundle::insert(), ibrcommon::BLOB::iostream::iostream(), and dtn::data::Bundle::remove().
Referenced by dtn::core::BundleCore::processBlocks().
Definition at line 59 of file CompressedPayloadBlock.cpp.
References dtn::data::SDNV::getValue().
Referenced by extract().
size_t dtn::data::CompressedPayloadBlock::getLength | ( | ) | const [virtual] |
Return the length of the payload, if this were an abstract block. It is the length put in the third field, after block type and processing flags.
Implements dtn::data::Block.
Definition at line 36 of file CompressedPayloadBlock.cpp.
References dtn::data::SDNV::getLength().
size_t dtn::data::CompressedPayloadBlock::getOriginSize | ( | ) | const |
Definition at line 69 of file CompressedPayloadBlock.cpp.
References dtn::data::SDNV::getValue().
std::ostream & dtn::data::CompressedPayloadBlock::serialize | ( | std::ostream & | stream, |
size_t & | length | ||
) | const [virtual] |
Serialize the derived block payload.
stream | A output stream to serialize into. |
Implements dtn::data::Block.
Definition at line 41 of file CompressedPayloadBlock.cpp.
Definition at line 54 of file CompressedPayloadBlock.cpp.
Referenced by compress().
void dtn::data::CompressedPayloadBlock::setOriginSize | ( | size_t | s | ) |
Definition at line 64 of file CompressedPayloadBlock.cpp.
Referenced by compress().
const char dtn::data::CompressedPayloadBlock::BLOCK_TYPE = 202 [static] |
Definition at line 31 of file CompressedPayloadBlock.h.
Referenced by dtn::core::BundleCore::processBlocks().