Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends

dtn::data::Block Class Reference

#include <Block.h>

Inherited by dtn::data::AgeBlock, dtn::data::CustodySignalBlock, dtn::data::ExtensionBlock, dtn::data::PayloadBlock, dtn::data::StatusReportBlock, dtn::security::SecurityBlock, and StreamBlock.

List of all members.

Public Types

enum  ProcFlags {
  REPLICATE_IN_EVERY_FRAGMENT = 1, TRANSMIT_STATUSREPORT_IF_NOT_PROCESSED = 1 << 0x01, DELETE_BUNDLE_IF_NOT_PROCESSED = 1 << 0x02, LAST_BLOCK = 1 << 0x03,
  DISCARD_IF_NOT_PROCESSED = 1 << 0x04, FORWARDED_WITHOUT_PROCESSED = 1 << 0x05, BLOCK_CONTAINS_EIDS = 1 << 0x06
}

Public Member Functions

virtual ~Block ()
virtual void addEID (const dtn::data::EID &eid)
virtual std::list< dtn::data::EIDgetEIDList () const
char getType () const
void set (ProcFlags flag, const bool &value)
bool get (ProcFlags flag) const

Protected Member Functions

 Block (char blocktype)
virtual size_t getLength () const =0
virtual size_t getLength_strict () const
virtual std::ostream & serialize_strict (std::ostream &stream) const
virtual std::ostream & serialize (std::ostream &stream) const =0
virtual std::istream & deserialize (std::istream &stream)=0

Protected Attributes

char _blocktype
size_t _blocksize
std::list< dtn::data::EID_eids

Friends

class Bundle
class DefaultSerializer
class dtn::security::StrictSerializer
class dtn::security::MutualSerializer
class DefaultDeserializer
class SeparateSerializer
class SeparateDeserializer

Detailed Description

Definition at line 31 of file Block.h.


Member Enumeration Documentation

Enumerator:
REPLICATE_IN_EVERY_FRAGMENT 
TRANSMIT_STATUSREPORT_IF_NOT_PROCESSED 
DELETE_BUNDLE_IF_NOT_PROCESSED 
LAST_BLOCK 
DISCARD_IF_NOT_PROCESSED 
FORWARDED_WITHOUT_PROCESSED 
BLOCK_CONTAINS_EIDS 

Definition at line 42 of file Block.h.


Constructor & Destructor Documentation

dtn::data::Block::~Block (  )  [virtual]

Definition at line 23 of file Block.cpp.

dtn::data::Block::Block ( char  blocktype  )  [protected]

The constructor of this class is protected to prevent instantiation of this abstract class.

Parameters:
blocktype The type of the block.

Definition at line 18 of file Block.cpp.


Member Function Documentation

void dtn::data::Block::addEID ( const dtn::data::EID eid  )  [virtual]
virtual std::istream& dtn::data::Block::deserialize ( std::istream &  stream  )  [protected, pure virtual]

Deserialize the derived block payload.

Parameters:
stream A input stream to deserialize from.
Returns:
The same reference as given with the stream parameter.

Implemented in dtn::data::AgeBlock, dtn::data::CustodySignalBlock, dtn::data::ExtensionBlock, dtn::data::PayloadBlock, dtn::data::StatusReportBlock, dtn::security::PayloadIntegrityBlock, dtn::security::SecurityBlock, and StreamBlock.

Referenced by dtn::data::SeparateDeserializer::operator>>(), and dtn::data::DefaultDeserializer::operator>>().

bool dtn::data::Block::get ( ProcFlags  flag  )  const
std::list< dtn::data::EID > dtn::data::Block::getEIDList (  )  const [virtual]
virtual size_t dtn::data::Block::getLength (  )  const [protected, pure virtual]
size_t dtn::data::Block::getLength_strict (  )  const [protected, virtual]

Return the length of the payload in strict format

Reimplemented in dtn::data::AgeBlock.

Definition at line 57 of file Block.cpp.

References getLength().

Referenced by dtn::security::StrictSerializer::operator<<().

Here is the call graph for this function:

char dtn::data::Block::getType (  )  const [inline]
virtual std::ostream& dtn::data::Block::serialize ( std::ostream &  stream  )  const [protected, pure virtual]

Serialize the derived block payload.

Parameters:
stream A output stream to serialize into.
Returns:
The same reference as given with the stream parameter.

Implemented in dtn::data::AgeBlock, dtn::data::CustodySignalBlock, dtn::data::ExtensionBlock, dtn::data::PayloadBlock, dtn::data::StatusReportBlock, dtn::security::SecurityBlock, and StreamBlock.

Referenced by dtn::security::MutualSerializer::operator<<(), dtn::data::SeparateSerializer::operator<<(), dtn::data::DefaultSerializer::operator<<(), and serialize_strict().

std::ostream & dtn::data::Block::serialize_strict ( std::ostream &  stream  )  const [protected, virtual]

Serialize the block in a strict way. Dynamic fields are set to the last deserialized value.

Parameters:
stream the stream to be written into
Returns:
the same stream as the parameter for chaining

Reimplemented in dtn::data::AgeBlock, and dtn::security::SecurityBlock.

Definition at line 62 of file Block.cpp.

References serialize().

Referenced by dtn::security::StrictSerializer::operator<<().

Here is the call graph for this function:

void dtn::data::Block::set ( ProcFlags  flag,
const bool &  value 
)

Friends And Related Function Documentation

friend class Bundle [friend]

Definition at line 33 of file Block.h.

friend class DefaultDeserializer [friend]

Definition at line 37 of file Block.h.

friend class DefaultSerializer [friend]

Definition at line 34 of file Block.h.

friend class dtn::security::MutualSerializer [friend]

Definition at line 36 of file Block.h.

friend class dtn::security::StrictSerializer [friend]

Definition at line 35 of file Block.h.

friend class SeparateDeserializer [friend]

Definition at line 39 of file Block.h.

friend class SeparateSerializer [friend]

Definition at line 38 of file Block.h.


Member Data Documentation

size_t dtn::data::Block::_blocksize [protected]
char dtn::data::Block::_blocktype [protected]
std::list<dtn::data::EID> dtn::data::Block::_eids [protected]

The documentation for this class was generated from the following files: