IBR-DTNSuite  0.10
dtn::data::Block Class Referenceabstract

#include <Block.h>

Inheritance diagram for dtn::data::Block:
Inheritance graph
Collaboration diagram for dtn::data::Block:
Collaboration graph

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
}
 
typedef std::list< dtn::data::EIDeid_list
 

Public Member Functions

virtual ~Block ()
 
Blockoperator= (const Block &block)
 
bool operator== (const block_t &id) const
 
virtual void addEID (const dtn::data::EID &eid)
 
virtual void clearEIDs ()
 
virtual const eid_listgetEIDList () const
 
const block_tgetType () const
 
void set (ProcFlags flag, const bool &value)
 
bool get (ProcFlags flag) const
 
const Bitset< ProcFlags > & getProcessingFlags () const
 
virtual std::ostream & serialize (std::ostream &stream, Length &length) const =0
 
virtual std::istream & deserialize (std::istream &stream, const Length &length)=0
 
virtual Length getLength () const =0
 
virtual Length getLength_strict () const
 
virtual std::ostream & serialize_strict (std::ostream &stream, Length &length) const
 

Protected Member Functions

 Block (block_t blocktype)
 

Protected Attributes

block_t _blocktype
 
eid_list _eids
 

Friends

class BundleBuilder
 

Detailed Description

Definition at line 39 of file Block.h.

Member Typedef Documentation

Definition at line 55 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 44 of file Block.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file Block.cpp.

dtn::data::Block::Block ( block_t  blocktype)
protected

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

Parameters
blocktypeThe type of the block.

Definition at line 32 of file Block.cpp.

Member Function Documentation

void dtn::data::Block::addEID ( const dtn::data::EID eid)
virtual
void dtn::data::Block::clearEIDs ( )
virtual

Definition at line 64 of file Block.cpp.

References _eids, BLOCK_CONTAINS_EIDS, and dtn::data::Bitset< E >::setBit().

Referenced by dtn::security::SecurityBlock::decryptBlock().

Here is the call graph for this function:

virtual std::istream& dtn::data::Block::deserialize ( std::istream &  stream,
const Length length 
)
pure virtual
Length dtn::data::Block::getLength_strict ( ) const
virtual

Return the length of the payload in strict format

Reimplemented in dtn::data::AgeBlock, and dtn::data::TrackingBlock.

Definition at line 92 of file Block.cpp.

References getLength().

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

Here is the call graph for this function:

Block & dtn::data::Block::operator= ( const Block block)

assignment operator

Definition at line 41 of file Block.cpp.

References _eids, dtn::data::Bitset< E >::getBit(), LAST_BLOCK, and dtn::data::Bitset< E >::setBit().

Here is the call graph for this function:

bool dtn::data::Block::operator== ( const block_t id) const

allow comparison with the block type only

Definition at line 51 of file Block.cpp.

References _blocktype.

std::ostream & dtn::data::Block::serialize_strict ( std::ostream &  stream,
Length length 
) const
virtual

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

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

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

Definition at line 97 of file Block.cpp.

References serialize().

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

Here is the call graph for this function:

Friends And Related Function Documentation

friend class BundleBuilder
friend

Definition at line 41 of file Block.h.

Member Data Documentation

block_t dtn::data::Block::_blocktype
protected

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