IBR-DTNSuite
0.8
|
#include <MutualSerializer.h>
Public Member Functions | |
MutualSerializer (std::ostream &stream, const dtn::data::Block *ignore=NULL) | |
virtual | ~MutualSerializer () |
virtual Serializer & | operator<< (const dtn::data::PrimaryBlock &obj) |
virtual Serializer & | operator<< (const dtn::data::Block &obj) |
virtual size_t | getLength (const dtn::data::Bundle &obj) |
virtual size_t | getLength (const dtn::data::PrimaryBlock &obj) const |
virtual size_t | getLength (const dtn::data::Block &obj) const |
virtual Serializer & | operator<< (const u_int32_t value) |
virtual Serializer & | operator<< (const dtn::data::EID &value) |
virtual Serializer & | operator<< (const dtn::data::SDNV &value) |
virtual Serializer & | operator<< (const dtn::security::SecurityBlock::TLVList &list) |
Static Public Attributes | |
static const size_t | sdnv_size = 8 |
Serializes a bundle in mutable canonical form into a given stream. In mutable canonical form all SDNVs are unpacked to 8 byte values and all EID references are filled with the EID they point to. Every number is written in network byte order. Only payload related blocks are serialized. These are the payload block, the PayloadIntegrityBlock and the PayloadConfidentialBlock.
Definition at line 23 of file MutualSerializer.h.
dtn::security::MutualSerializer::MutualSerializer | ( | std::ostream & | stream, |
const dtn::data::Block * | ignore = NULL |
||
) |
Creates a MutualSerializer which will stream into stream
stream | the stream in which the mutable canonical form will be written into |
Definition at line 32 of file MutualSerializer.cpp.
dtn::security::MutualSerializer::~MutualSerializer | ( | ) | [virtual] |
does nothing
Definition at line 37 of file MutualSerializer.cpp.
size_t dtn::security::MutualSerializer::getLength | ( | const dtn::data::Bundle & | obj | ) | [virtual] |
Not implemented. This is only required by the interface.
Reimplemented from dtn::data::DefaultSerializer.
Definition at line 126 of file MutualSerializer.cpp.
Referenced by operator<<().
size_t dtn::security::MutualSerializer::getLength | ( | const dtn::data::PrimaryBlock & | obj | ) | const [virtual] |
Returns the length of the primary block in mutable canonical form.
obj | the primary block, of which the length shall be calculated |
Reimplemented from dtn::data::DefaultSerializer.
Definition at line 134 of file MutualSerializer.cpp.
References dtn::data::PrimaryBlock::_destination, dtn::data::PrimaryBlock::_reportto, dtn::data::PrimaryBlock::_source, dtn::data::EID::getString(), IBRCOMMON_LOGGER_DEBUG_ex, IBRCOMMON_LOGGER_ENDL, ibrcommon::Logger::LOGGER_DEBUG, and sdnv_size.
size_t dtn::security::MutualSerializer::getLength | ( | const dtn::data::Block & | obj | ) | const [virtual] |
Returns the length of the block in mutable canonical form.
obj | the block, of which the length shall be calculated |
Reimplemented from dtn::data::DefaultSerializer.
Definition at line 162 of file MutualSerializer.cpp.
References dtn::data::Block::_blocktype, dtn::data::Block::_eids, dtn::data::Block::BLOCK_CONTAINS_EIDS, dtn::data::Block::get(), dtn::data::Block::getLength(), dtn::security::SecurityBlock::getLength_mutable(), and sdnv_size.
dtn::data::Serializer & dtn::security::MutualSerializer::operator<< | ( | const dtn::data::PrimaryBlock & | obj | ) | [virtual] |
Serializes the primary block in mutable canonical form. The usual rules for mutable canonicalisation (network byte order, unpacked SDNV, full EIDs instead of references) apply here and some bits of the flags are set to zero during this operation.
Reimplemented from dtn::data::DefaultSerializer.
Definition at line 41 of file MutualSerializer.cpp.
References dtn::data::PrimaryBlock::_destination, dtn::data::PrimaryBlock::_lifetime, dtn::data::PrimaryBlock::_procflags, dtn::data::PrimaryBlock::_reportto, dtn::data::PrimaryBlock::_sequencenumber, dtn::data::PrimaryBlock::_source, dtn::data::DefaultSerializer::_stream, dtn::data::PrimaryBlock::_timestamp, and getLength().
dtn::data::Serializer & dtn::security::MutualSerializer::operator<< | ( | const dtn::data::Block & | obj | ) | [virtual] |
Serializes the block in mutable canonical form. The usual rules for mutable canonicalisation (network byte order, unpacked SDNV, full EIDs instead of references) apply here and some bits of the flags are set to zero during this operation.
Reimplemented from dtn::data::DefaultSerializer.
Definition at line 71 of file MutualSerializer.cpp.
References dtn::data::Block::_blocktype, dtn::data::Block::_eids, dtn::data::DefaultSerializer::_stream, dtn::data::Block::BLOCK_CONTAINS_EIDS, dtn::data::PayloadBlock::BLOCK_TYPE, dtn::data::Block::get(), dtn::data::Block::getLength(), dtn::security::SecurityBlock::getLength_mutable(), dtn::data::Block::getType(), dtn::security::SecurityBlock::PAYLOAD_CONFIDENTIAL_BLOCK, dtn::security::SecurityBlock::PAYLOAD_INTEGRITY_BLOCK, dtn::data::Block::serialize(), and dtn::security::SecurityBlock::serialize_mutable_without_security_result().
dtn::data::Serializer & dtn::security::MutualSerializer::operator<< | ( | const u_int32_t | value | ) | [virtual] |
Writes a u_int32_t into stream in network byte order.
stream | the stream in which shall be written |
value | the value to be written in network byte order |
Definition at line 196 of file MutualSerializer.cpp.
References dtn::data::DefaultSerializer::_stream.
dtn::data::Serializer & dtn::security::MutualSerializer::operator<< | ( | const dtn::data::EID & | value | ) | [virtual] |
Writes an EID to a stream in mutable form.
stream | the stream in which shall be written |
value | the EID which shall be written |
Definition at line 203 of file MutualSerializer.cpp.
References dtn::data::DefaultSerializer::_stream, and dtn::data::EID::getString().
dtn::data::Serializer & dtn::security::MutualSerializer::operator<< | ( | const dtn::data::SDNV & | value | ) | [virtual] |
Writes a SDNV to a stream in mutable form.
stream | the stream in which shall be written |
value | the SDNV which shall be written |
Definition at line 212 of file MutualSerializer.cpp.
References dtn::data::DefaultSerializer::_stream, dtn::data::SDNV::getValue(), and GUINT64_TO_BE.
dtn::data::Serializer & dtn::security::MutualSerializer::operator<< | ( | const dtn::security::SecurityBlock::TLVList & | list | ) | [virtual] |
Serialize a list of type-length-value entries.
list |
Definition at line 221 of file MutualSerializer.cpp.
References dtn::data::DefaultSerializer::_stream, dtn::security::SecurityBlock::TLVList::getLength(), and dtn::security::SecurityBlock::TLVList::toString().
const size_t dtn::security::MutualSerializer::sdnv_size = 8 [static] |
The size in bytes of a SDNV in mutable form in the stream
Definition at line 29 of file MutualSerializer.h.
Referenced by getLength(), and dtn::security::SecurityBlock::getLength_mutable().