#include <BlockInfo.h>
Inheritance diagram for dtn::BlockInfo:
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. | |
BlockProcessor * | owner () const |
Accessors. | |
const BlockInfo * | source () const |
Accessors. | |
const DataBuffer & | contents () 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. | |
DataBuffer * | writable_contents () |
Mutating accessors. | |
u_int8_t | type () const |
These accessors need special case processing since the primary block doesn't have the fields in the same place. | |
u_int8_t | flags () const |
These accessors need special case processing since the primary block doesn't have the fields in the same place. | |
void | 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. | |
Protected Attributes | |
BlockProcessor * | owner_ |
Owner of this block. | |
u_int16_t | owner_type_ |
Extracted from owner. | |
const BlockInfo * | source_ |
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. |
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.
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 | ) |
BlockProcessor* dtn::BlockInfo::owner | ( | ) | const [inline] |
Accessors.
Definition at line 48 of file BlockInfo.h.
References owner_.
Referenced by 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::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::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(), and dtn::BlockProcessor::generate_preamble().
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::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::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.
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] |
const BlockInfo* dtn::BlockInfo::source_ [protected] |
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().