dtn::BlockInfo Class Reference

#include <BlockInfo.h>

Inheritance diagram for dtn::BlockInfo:

oasys::SerializableObject

List of all members.


Detailed Description

Class used to store unparsed bundle blocks and associated metadata about them.

Definition at line 33 of file BlockInfo.h.


Public Types

typedef
oasys::ScratchBuffer
< u_char *, 64 > 
DataBuffer
 To store the formatted block data, we use a scratch buffer with 64 bytes of static buffer space which should be sufficient to cover most blocks and avoid mallocs.

Public Member Functions

 BlockInfo (BlockProcessor *owner, const BlockInfo *source=NULL)
 Default constructor assigns the owner and optionally the BlockInfo source (i.e.
 BlockInfo (oasys::Builder &builder)
 Constructor for unserializing.
virtual void serialize (oasys::SerializeAction *action)
 Virtual from SerializableObject.
BlockProcessorowner () const
 Accessors.
const BlockInfosource () const
 Accessors.
const DataBuffercontents () const
 Accessors.
u_int32_t data_length () const
 Accessors.
u_int32_t data_offset () const
 Accessors.
u_int32_t full_length () const
 Accessors.
u_char * data () const
 Accessors.
bool complete () const
 Accessors.
bool primary_block () const
 Accessors.
bool payload_block () const
 Accessors.
bool last_block () const
 Accessors.
void set_complete (bool t)
 Mutating accessors.
void set_data_length (u_int32_t l)
 Mutating accessors.
void set_data_offset (u_int32_t o)
 Mutating accessors.
DataBufferwritable_contents ()
 Mutating accessors.
u_int8_t type () const
u_int8_t flags () const
void set_flag (u_int8_t flag)

Protected Attributes

BlockProcessorowner_
 Owner of this block.
u_int16_t owner_type_
 Extracted from owner.
const BlockInfosource_
 Owner of this block.
DataBuffer contents_
 Block contents with length set to the amount currently in the buffer.
u_int32_t data_length_
 Length of the block data (w/o preamble).
u_int32_t data_offset_
 Offset of first byte of the block data.
bool complete_
 Whether or not this block is complete.

Member Typedef Documentation

typedef oasys::ScratchBuffer<u_char*, 64> dtn::BlockInfo::DataBuffer

To store the formatted block data, we use a scratch buffer with 64 bytes of static buffer space which should be sufficient to cover most blocks and avoid mallocs.

Definition at line 38 of file BlockInfo.h.


Constructor & Destructor Documentation

dtn::BlockInfo::BlockInfo ( BlockProcessor owner,
const BlockInfo source = NULL 
)

Default constructor assigns the owner and optionally the BlockInfo source (i.e.

the block as it arrived off the wire)

Definition at line 26 of file BlockInfo.cc.

dtn::BlockInfo::BlockInfo ( oasys::Builder builder  ) 

Constructor for unserializing.

Definition at line 39 of file BlockInfo.cc.


Member Function Documentation

BlockProcessor* dtn::BlockInfo::owner (  )  const [inline]

Accessors.

Definition at line 48 of file BlockInfo.h.

References owner_.

Referenced by dtn::BundleProtocol::consume(), dtn::UnknownBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::init_block(), and dtn::UnknownBlockProcessor::prepare().

const BlockInfo* dtn::BlockInfo::source (  )  const [inline]

Accessors.

Definition at line 49 of file BlockInfo.h.

References source_.

Referenced by dtn::UnknownBlockProcessor::generate(), and dtn::APIBlockProcessor::generate().

const DataBuffer& dtn::BlockInfo::contents (  )  const [inline]

Accessors.

Definition at line 50 of file BlockInfo.h.

References contents_.

Referenced by dtn::PrimaryBlockProcessor::consume(), dtn::PayloadBlockProcessor::consume(), dtn::BundleProtocol::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), dtn::PayloadBlockProcessor::produce(), and dtn::BlockProcessor::produce().

u_int32_t dtn::BlockInfo::data_length (  )  const [inline]

Accessors.

Definition at line 51 of file BlockInfo.h.

References data_length_.

Referenced by dtn::PrimaryBlockProcessor::consume(), dtn::PreviousHopBlockProcessor::consume(), dtn::PayloadBlockProcessor::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), and dtn::BlockProcessor::generate_preamble().

u_int32_t dtn::BlockInfo::data_offset (  )  const [inline]

Accessors.

Definition at line 52 of file BlockInfo.h.

References data_offset_.

Referenced by dtn::PrimaryBlockProcessor::consume(), dtn::PayloadBlockProcessor::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), dtn::PreviousHopBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), dtn::BlockProcessor::init_block(), and dtn::PayloadBlockProcessor::produce().

u_int32_t dtn::BlockInfo::full_length (  )  const [inline]

Accessors.

Definition at line 53 of file BlockInfo.h.

References data_length_, and data_offset_.

Referenced by dtn::PrimaryBlockProcessor::consume(), dtn::PayloadBlockProcessor::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), and dtn::BlockProcessor::init_block().

u_char* dtn::BlockInfo::data (  )  const [inline]

Accessors.

Definition at line 54 of file BlockInfo.h.

References oasys::ScratchBuffer< _memory_t, _static_size >::buf(), contents_, and data_offset_.

Referenced by dtn::PreviousHopBlockProcessor::consume().

bool dtn::BlockInfo::complete (  )  const [inline]

Accessors.

Definition at line 55 of file BlockInfo.h.

References complete_.

Referenced by dtn::PrimaryBlockProcessor::consume(), dtn::PreviousHopBlockProcessor::consume(), dtn::PayloadBlockProcessor::consume(), dtn::BundleProtocol::consume(), dtn::BlockProcessor::consume(), and dtn::BlockProcessor::consume_preamble().

bool dtn::BlockInfo::primary_block (  )  const

Accessors.

Definition at line 88 of file BlockInfo.cc.

References dtn::BundleProtocol::PRIMARY_BLOCK, and type().

Referenced by dtn::BlockProcessor::finalize(), and dtn::BlockProcessor::validate().

bool dtn::BlockInfo::payload_block (  )  const

Accessors.

Definition at line 95 of file BlockInfo.cc.

References dtn::BundleProtocol::PAYLOAD_BLOCK, and type().

bool dtn::BlockInfo::last_block (  )  const

Accessors.

Definition at line 102 of file BlockInfo.cc.

References dtn::BundleProtocol::BLOCK_FLAG_LAST_BLOCK, and flags().

void dtn::BlockInfo::set_complete ( bool  t  )  [inline]

Mutating accessors.

Definition at line 62 of file BlockInfo.h.

References complete_.

Referenced by dtn::PayloadBlockProcessor::consume(), and dtn::BlockProcessor::consume().

void dtn::BlockInfo::set_data_length ( u_int32_t  l  )  [inline]

Mutating accessors.

Definition at line 63 of file BlockInfo.h.

References data_length_.

Referenced by dtn::BlockProcessor::consume_preamble(), dtn::PrimaryBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), and dtnsim::SimConvergenceLayer::send_bundle().

void dtn::BlockInfo::set_data_offset ( u_int32_t  o  )  [inline]

Mutating accessors.

Definition at line 64 of file BlockInfo.h.

References data_offset_.

Referenced by dtn::BlockProcessor::consume_preamble(), and dtn::BlockProcessor::generate_preamble().

DataBuffer* dtn::BlockInfo::writable_contents (  )  [inline]

Mutating accessors.

Definition at line 65 of file BlockInfo.h.

References contents_.

Referenced by dtn::PrimaryBlockProcessor::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), dtn::PrimaryBlockProcessor::generate(), dtn::PreviousHopBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), and dtn::BlockProcessor::init_block().

u_int8_t dtn::BlockInfo::type (  )  const

These accessors need special case processing since the primary block doesn't have the fields in the same place.

Definition at line 53 of file BlockInfo.cc.

References dtn::BlockProcessor::block_type(), oasys::ScratchBuffer< _memory_t, _static_size >::buf(), contents_, oasys::ExpandableBuffer::len(), owner_, and dtn::BundleProtocol::PRIMARY_BLOCK.

Referenced by dtn::BundleProtocol::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), flags(), dtn::UnknownBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), payload_block(), and primary_block().

u_int8_t dtn::BlockInfo::flags (  )  const

These accessors need special case processing since the primary block doesn't have the fields in the same place.

Definition at line 68 of file BlockInfo.cc.

References ASSERT, oasys::ScratchBuffer< _memory_t, _static_size >::buf(), contents_, oasys::ExpandableBuffer::len(), dtn::BundleProtocol::PRIMARY_BLOCK, and type().

Referenced by dtn::BundleProtocol::consume(), dtn::BlockProcessor::finalize(), dtn::UnknownBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), last_block(), dtn::UnknownBlockProcessor::prepare(), dtn::UnknownBlockProcessor::validate(), and dtn::BlockProcessor::validate().

void dtn::BlockInfo::set_flag ( u_int8_t  flag  ) 

These accessors need special case processing since the primary block doesn't have the fields in the same place.

Definition at line 80 of file BlockInfo.cc.

References ASSERT, oasys::ScratchBuffer< _memory_t, _static_size >::buf(), contents_, and oasys::ExpandableBuffer::len().

void dtn::BlockInfo::serialize ( oasys::SerializeAction action  )  [virtual]

Virtual from SerializableObject.

Implements oasys::SerializableObject.

Definition at line 109 of file BlockInfo.cc.

References oasys::SerializeAction::action_code(), dtn::BundleProtocol::API_EXTENSION_BLOCK, ASSERT, dtn::BlockProcessor::block_type(), oasys::ScratchBuffer< _memory_t, _static_size >::buf(), complete_, contents_, data_length_, data_offset_, dtn::BundleProtocol::find_processor(), oasys::ExpandableBuffer::len(), owner_, owner_type_, oasys::SerializeAction::process(), oasys::ScratchBuffer< _memory_t, _static_size >::reserve(), oasys::ExpandableBuffer::set_len(), and oasys::Serialize::UNMARSHAL.


Member Data Documentation

BlockProcessor* dtn::BlockInfo::owner_ [protected]

Owner of this block.

Definition at line 79 of file BlockInfo.h.

Referenced by owner(), serialize(), and type().

u_int16_t dtn::BlockInfo::owner_type_ [protected]

Extracted from owner.

Definition at line 80 of file BlockInfo.h.

Referenced by serialize().

const BlockInfo* dtn::BlockInfo::source_ [protected]

Owner of this block.

Definition at line 81 of file BlockInfo.h.

Referenced by source().

DataBuffer dtn::BlockInfo::contents_ [protected]

Block contents with length set to the amount currently in the buffer.

Definition at line 82 of file BlockInfo.h.

Referenced by contents(), data(), flags(), serialize(), set_flag(), type(), and writable_contents().

u_int32_t dtn::BlockInfo::data_length_ [protected]

Length of the block data (w/o preamble).

Definition at line 84 of file BlockInfo.h.

Referenced by data_length(), full_length(), serialize(), and set_data_length().

u_int32_t dtn::BlockInfo::data_offset_ [protected]

Offset of first byte of the block data.

Definition at line 85 of file BlockInfo.h.

Referenced by data(), data_offset(), full_length(), serialize(), and set_data_offset().

bool dtn::BlockInfo::complete_ [protected]

Whether or not this block is complete.

Definition at line 86 of file BlockInfo.h.

Referenced by complete(), serialize(), and set_complete().


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 08:43:43 2007 for DTN Reference Implementation by  doxygen 1.5.3