#include <BlockInfo.h>
Public Types | |
enum | list_owner_t { LIST_NONE = 0x00, LIST_RECEIVED = 0x01, LIST_API = 0x02, LIST_EXT = 0x03, LIST_XMIT = 0x04 } |
List owner indicator (not transmitted). More... | |
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. | |
BlockInfo (const BlockInfo &bi) | |
Copy constructor to increment refcount for locals_. | |
virtual | ~BlockInfo () |
Virtual destructor. | |
virtual void | serialize (oasys::SerializeAction *action) |
Virtual from SerializableObject. | |
BlockProcessor * | owner () const |
Accessors. | |
const BlockInfo * | source () const |
Accessors. | |
const EndpointIDVector & | eid_list () const |
Accessors. | |
const DataBuffer & | contents () const |
Accessors. | |
BP_Local * | locals () 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 | reloaded () const |
Accessors. | |
bool | last_block () const |
Accessors. | |
void | set_owner (BlockProcessor *o) |
Mutating accessors. | |
void | set_eid_list (const EndpointIDVector &l) |
Mutating 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. | |
void | set_locals (BP_Local *l) |
Mutating accessors. | |
void | add_eid (EndpointID e) |
Mutating accessors. | |
void | set_reloaded (bool t) |
Mutating accessors. | |
int | type () const |
u_int64_t | flags () const |
void | set_flag (u_int64_t flag) |
Protected Attributes | |
BlockProcessor * | owner_ |
Owner of this block. | |
u_int16_t | owner_type_ |
Extracted from owner. | |
const BlockInfo * | source_ |
Owner of this block. | |
EndpointIDVector | eid_list_ |
List of EIDs used in this block. | |
DataBuffer | contents_ |
Block contents with length set to the amount currently in the buffer. | |
BP_LocalRef | locals_ |
Local variable storage for block processor. | |
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. | |
bool | reloaded_ |
Whether or not this block is reloaded from store (set in reload_post_process of the BlockProcessor classes). |
Definition at line 38 of file BlockInfo.h.
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 43 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 31 of file BlockInfo.cc.
References eid_list_.
dtn::BlockInfo::BlockInfo | ( | oasys::Builder & | builder | ) |
dtn::BlockInfo::BlockInfo | ( | const BlockInfo & | bi | ) |
dtn::BlockInfo::~BlockInfo | ( | ) | [virtual] |
void dtn::BlockInfo::add_eid | ( | EndpointID | e | ) | [inline] |
Mutating accessors.
Definition at line 96 of file BlockInfo.h.
References eid_list_.
Referenced by dtn::SessionBlockProcessor::generate(), and dtn::SequenceIDBlockProcessor::generate().
bool dtn::BlockInfo::complete | ( | ) | const [inline] |
Accessors.
Definition at line 83 of file BlockInfo.h.
References complete_.
Referenced by dtn::SessionBlockProcessor::consume(), dtn::SequenceIDBlockProcessor::consume(), dtn::PrimaryBlockProcessor::consume(), dtn::PreviousHopBlockProcessor::consume(), dtn::PayloadBlockProcessor::consume(), dtn::MetadataBlockProcessor::consume(), dtn::BundleProtocol::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::MetadataBlockProcessor::parse_metadata(), dtn::FragmentManager::try_to_convert_to_fragment(), and dtn::PayloadBlockProcessor::validate().
const DataBuffer& dtn::BlockInfo::contents | ( | ) | const [inline] |
Accessors.
Definition at line 75 of file BlockInfo.h.
References contents_.
Referenced by dtn::PayloadBlockProcessor::consume(), dtn::BundleProtocol::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), dtn::MetadataBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), dtn::PayloadBlockProcessor::mutate(), dtn::BlockProcessor::mutate(), dtn::PayloadBlockProcessor::process(), dtn::BlockProcessor::process(), dtn::PayloadBlockProcessor::produce(), and dtn::BlockProcessor::produce().
u_char* dtn::BlockInfo::data | ( | ) | const [inline] |
Accessors.
Definition at line 81 of file BlockInfo.h.
References contents_, and data_offset_.
Referenced by dtn::SessionBlockProcessor::consume(), dtn::SequenceIDBlockProcessor::consume(), dtn::PreviousHopBlockProcessor::consume(), dtn::MetadataBlockProcessor::parse_metadata(), and type().
u_int32_t dtn::BlockInfo::data_length | ( | ) | const [inline] |
Accessors.
Definition at line 77 of file BlockInfo.h.
References data_length_.
Referenced by dtn::SequenceIDBlockProcessor::consume(), dtn::PrimaryBlockProcessor::consume(), dtn::PreviousHopBlockProcessor::consume(), dtn::PayloadBlockProcessor::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), dtn::MetadataBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), dtn::MetadataBlockProcessor::parse_metadata(), dtn::FragmentManager::try_to_convert_to_fragment(), and dtn::PayloadBlockProcessor::validate().
u_int32_t dtn::BlockInfo::data_offset | ( | ) | const [inline] |
Accessors.
Definition at line 78 of file BlockInfo.h.
References data_offset_.
Referenced by dtn::PayloadBlockProcessor::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), dtn::SessionBlockProcessor::generate(), dtn::SequenceIDBlockProcessor::generate(), dtn::PreviousHopBlockProcessor::generate(), dtn::MetadataBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), dtn::BlockProcessor::init_block(), dtn::PayloadBlockProcessor::mutate(), dtn::MetadataBlockProcessor::parse_metadata(), dtn::PayloadBlockProcessor::process(), dtn::PayloadBlockProcessor::produce(), dtn::FragmentManager::try_to_convert_to_fragment(), and dtn::PayloadBlockProcessor::validate().
const EndpointIDVector& dtn::BlockInfo::eid_list | ( | ) | const [inline] |
Accessors.
Definition at line 74 of file BlockInfo.h.
References eid_list_.
Referenced by dtn::SessionBlockProcessor::consume(), dtn::SequenceIDBlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), and dtn::BlockProcessor::generate_preamble().
u_int64_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 118 of file BlockInfo.cc.
References ASSERT, contents_, decode(), dtn::BundleProtocol::PRIMARY_BLOCK, and type().
Referenced by dtn::BundleProtocol::consume(), dtn::BlockProcessor::finalize(), dtn::UnknownBlockProcessor::generate(), dtn::MetadataBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), dtn::MetadataBlockProcessor::handle_error(), last_block(), dtn::UnknownBlockProcessor::prepare(), dtn::MetadataBlockProcessor::prepare(), dtn::FragmentManager::proactively_fragment(), dtn::UnknownBlockProcessor::validate(), and dtn::BlockProcessor::validate().
u_int32_t dtn::BlockInfo::full_length | ( | ) | const [inline] |
Accessors.
Definition at line 79 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().
bool dtn::BlockInfo::last_block | ( | ) | const |
Accessors.
Definition at line 142 of file BlockInfo.cc.
References dtn::BundleProtocol::BLOCK_FLAG_LAST_BLOCK, contents_, and flags().
Referenced by dtn::FragmentManager::try_to_convert_to_fragment(), and dtn::FragmentManager::try_to_reactively_fragment().
BP_Local* dtn::BlockInfo::locals | ( | ) | const [inline] |
Accessors.
Definition at line 76 of file BlockInfo.h.
References locals_.
Referenced by dtn::MetadataBlockProcessor::generate(), dtn::MetadataBlockProcessor::prepare(), and dtn::MetadataBlockProcessor::validate().
BlockProcessor* dtn::BlockInfo::owner | ( | ) | const [inline] |
Accessors.
Definition at line 72 of file BlockInfo.h.
References owner_.
Referenced by dtn::BundleProtocol::consume(), dtn::UnknownBlockProcessor::generate(), dtn::MetadataBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::init_block(), dtn::MetadataBlockProcessor::parse_metadata(), dtn::UnknownBlockProcessor::prepare(), dtn::MetadataBlockProcessor::prepare(), and dtn::MetadataBlockProcessor::validate().
bool dtn::BlockInfo::reloaded | ( | ) | const [inline] |
void dtn::BlockInfo::serialize | ( | oasys::SerializeAction * | action | ) | [virtual] |
Virtual from SerializableObject.
Definition at line 155 of file BlockInfo.cc.
References dtn::BundleProtocol::API_EXTENSION_BLOCK, complete_, contents_, data_length_, data_offset_, eid_list_, dtn::BundleProtocol::find_processor(), owner_, and owner_type_.
void dtn::BlockInfo::set_complete | ( | bool | t | ) | [inline] |
Mutating accessors.
Definition at line 91 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 92 of file BlockInfo.h.
References data_length_.
Referenced by dtn::BlockProcessor::consume_preamble(), dtn::BlockProcessor::generate_preamble(), dtn::PrimaryBlockProcessor::generate_primary(), and dtnsim::SimLink::start_next_bundle().
void dtn::BlockInfo::set_data_offset | ( | u_int32_t | o | ) | [inline] |
Mutating accessors.
Definition at line 93 of file BlockInfo.h.
References data_offset_.
Referenced by dtn::BlockProcessor::consume_preamble(), and dtn::BlockProcessor::generate_preamble().
void dtn::BlockInfo::set_eid_list | ( | const EndpointIDVector & | l | ) | [inline] |
Mutating accessors.
Definition at line 90 of file BlockInfo.h.
References eid_list_.
Referenced by dtn::BlockProcessor::consume_preamble(), and dtn::UnknownBlockProcessor::generate().
void dtn::BlockInfo::set_flag | ( | u_int64_t | flag | ) |
These accessors need special case processing since the primary block doesn't have the fields in the same place.
Definition at line 133 of file BlockInfo.cc.
References ASSERT, contents_, encode(), and encoding_len().
void dtn::BlockInfo::set_locals | ( | BP_Local * | l | ) |
Mutating accessors.
Definition at line 87 of file BlockInfo.cc.
References locals_.
Referenced by dtn::MetadataBlockProcessor::parse_metadata().
void dtn::BlockInfo::set_owner | ( | BlockProcessor * | o | ) | [inline] |
void dtn::BlockInfo::set_reloaded | ( | bool | t | ) | [inline] |
Mutating accessors.
Definition at line 97 of file BlockInfo.h.
References reloaded_.
Referenced by dtn::BlockProcessor::reload_post_process().
const BlockInfo* dtn::BlockInfo::source | ( | ) | const [inline] |
Accessors.
Definition at line 73 of file BlockInfo.h.
References source_.
Referenced by dtn::UnknownBlockProcessor::generate(), dtn::MetadataBlockProcessor::generate(), and dtn::APIBlockProcessor::generate().
int 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 94 of file BlockInfo.cc.
References dtn::BundleProtocol::API_EXTENSION_BLOCK, ASSERT, dtn::BlockProcessor::block_type(), contents_, data(), owner_, dtn::BundleProtocol::PRIMARY_BLOCK, and dtn::BundleProtocol::UNKNOWN_BLOCK.
Referenced by dtn::BundleProtocol::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::finalize(), flags(), dtn::UnknownBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), dtn::MetadataBlockProcessor::parse_metadata(), dtn::UnknownBlockProcessor::prepare(), dtn::MetadataBlockProcessor::prepare(), dtn::FragmentManager::proactively_fragment(), dtn::MetadataBlockProcessor::validate(), and dtn::BlockProcessor::validate().
DataBuffer* dtn::BlockInfo::writable_contents | ( | ) | [inline] |
Mutating accessors.
Definition at line 94 of file BlockInfo.h.
References contents_.
Referenced by dtn::PrimaryBlockProcessor::consume(), dtn::BlockProcessor::consume(), dtn::BlockProcessor::consume_preamble(), dtn::UnknownBlockProcessor::generate(), dtn::SessionBlockProcessor::generate(), dtn::SequenceIDBlockProcessor::generate(), dtn::PreviousHopBlockProcessor::generate(), dtn::MetadataBlockProcessor::generate(), dtn::APIBlockProcessor::generate(), dtn::BlockProcessor::generate_preamble(), dtn::PrimaryBlockProcessor::generate_primary(), and dtn::BlockProcessor::init_block().
bool dtn::BlockInfo::complete_ [protected] |
Whether or not this block is complete.
Definition at line 120 of file BlockInfo.h.
Referenced by complete(), serialize(), and set_complete().
DataBuffer dtn::BlockInfo::contents_ [protected] |
Block contents with length set to the amount currently in the buffer.
Definition at line 115 of file BlockInfo.h.
Referenced by contents(), data(), flags(), last_block(), 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 118 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 119 of file BlockInfo.h.
Referenced by data(), data_offset(), full_length(), serialize(), and set_data_offset().
EndpointIDVector dtn::BlockInfo::eid_list_ [protected] |
List of EIDs used in this block.
Definition at line 114 of file BlockInfo.h.
Referenced by add_eid(), BlockInfo(), eid_list(), serialize(), and set_eid_list().
BP_LocalRef dtn::BlockInfo::locals_ [protected] |
Local variable storage for block processor.
Definition at line 117 of file BlockInfo.h.
Referenced by locals(), and set_locals().
BlockProcessor* dtn::BlockInfo::owner_ [protected] |
Owner of this block.
Definition at line 111 of file BlockInfo.h.
Referenced by owner(), serialize(), set_owner(), and type().
u_int16_t dtn::BlockInfo::owner_type_ [protected] |
bool dtn::BlockInfo::reloaded_ [protected] |
Whether or not this block is reloaded from store (set in reload_post_process of the BlockProcessor classes).
Definition at line 121 of file BlockInfo.h.
Referenced by reloaded(), and set_reloaded().
const BlockInfo* dtn::BlockInfo::source_ [protected] |