#include <PrimaryBlockProcessor.h>
Classes | |
struct | PrimaryBlock |
The remainder of the fixed-length part of the primary bundle block that immediately follows the block length. More... | |
Public Member Functions | |
PrimaryBlockProcessor () | |
Constructor. | |
int | consume (Bundle *bundle, BlockInfo *block, u_char *buf, size_t len) |
Virtual from BlockProcessor. | |
bool | validate (const Bundle *bundle, BlockInfoVec *block_list, BlockInfo *block, status_report_reason_t *reception_reason, status_report_reason_t *deletion_reason) |
Virtual from BlockProcessor. | |
int | prepare (const Bundle *bundle, BlockInfoVec *xmit_blocks, const BlockInfo *source, const LinkRef &link, list_owner_t list) |
Virtual from BlockProcessor. | |
int | generate (const Bundle *bundle, BlockInfoVec *xmit_blocks, BlockInfo *block, const LinkRef &link, bool last) |
Virtual from BlockProcessor. | |
void | generate_primary (const Bundle *bundle, BlockInfoVec *xmit_blocks, BlockInfo *block) |
Virtual from BlockProcessor. | |
Protected Types | |
enum | bundle_processing_flag_t { BUNDLE_IS_FRAGMENT = 1 << 0, BUNDLE_IS_ADMIN = 1 << 1, BUNDLE_DO_NOT_FRAGMENT = 1 << 2, BUNDLE_CUSTODY_XFER_REQUESTED = 1 << 3, BUNDLE_SINGLETON_DESTINATION = 1 << 4, BUNDLE_ACK_BY_APP = 1 << 5, BUNDLE_UNUSED = 1 << 6 } |
Values for bundle processing flags that appear in the primary block. More... | |
class | BundleProtocol |
static size_t | get_primary_len (const Bundle *bundle, Dictionary *dict, PrimaryBlock *primary) |
static u_int64_t | format_bundle_flags (const Bundle *bundle) |
static void | parse_bundle_flags (Bundle *bundle, u_int64_t flags) |
static u_int64_t | format_cos_flags (const Bundle *bundle) |
static void | parse_cos_flags (Bundle *bundle, u_int64_t cos_flags) |
static u_int64_t | format_srr_flags (const Bundle *bundle) |
static void | parse_srr_flags (Bundle *bundle, u_int64_t srr_flags) |
Definition at line 30 of file PrimaryBlockProcessor.h.
enum dtn::PrimaryBlockProcessor::bundle_processing_flag_t [protected] |
Values for bundle processing flags that appear in the primary block.
BUNDLE_IS_FRAGMENT | |
BUNDLE_IS_ADMIN | |
BUNDLE_DO_NOT_FRAGMENT | |
BUNDLE_CUSTODY_XFER_REQUESTED | |
BUNDLE_SINGLETON_DESTINATION | |
BUNDLE_ACK_BY_APP | |
BUNDLE_UNUSED |
Definition at line 69 of file PrimaryBlockProcessor.h.
dtn::PrimaryBlockProcessor::PrimaryBlockProcessor | ( | ) |
int dtn::PrimaryBlockProcessor::consume | ( | Bundle * | bundle, | |
BlockInfo * | block, | |||
u_char * | buf, | |||
size_t | len | |||
) | [virtual] |
Virtual from BlockProcessor.
Reimplemented from dtn::BlockProcessor.
Definition at line 301 of file PrimaryBlockProcessor.cc.
References ASSERT, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::block_length, dtn::BlockInfo::complete(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::creation_sequence, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::creation_time, dtn::BundleProtocol::CURRENT_VERSION, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::custodian_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::custodian_ssp_offset, dtn::BlockInfo::data_length(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::dest_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::dest_ssp_offset, dtn::BlockInfoVec::dict(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::dictionary_length, dtn::Bundle::frag_offset(), dtn::BlockInfo::full_length(), dtn::Bundle::is_fragment(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::lifetime, dtn::log, log_err_p, dtn::Bundle::mutable_custodian(), dtn::Bundle::mutable_dest(), dtn::Bundle::mutable_recv_blocks(), dtn::Bundle::mutable_replyto(), dtn::Bundle::mutable_source(), dtn::Bundle::orig_length(), parse_bundle_flags(), parse_cos_flags(), parse_srr_flags(), PBP_READ_SDNV, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::processing_flags, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::replyto_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::replyto_ssp_offset, dtn::Bundle::set_creation_ts(), dtn::Bundle::set_expiration(), dtn::Bundle::set_frag_offset(), dtn::Bundle::set_orig_length(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::source_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::source_ssp_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::version, and dtn::BlockInfo::writable_contents().
u_int64_t dtn::PrimaryBlockProcessor::format_bundle_flags | ( | const Bundle * | bundle | ) | [static, protected] |
Helper functions to parse/format the primary block
Definition at line 41 of file PrimaryBlockProcessor.cc.
References dtn::Bundle::app_acked_rcpt(), BUNDLE_ACK_BY_APP, BUNDLE_CUSTODY_XFER_REQUESTED, BUNDLE_DO_NOT_FRAGMENT, BUNDLE_IS_ADMIN, BUNDLE_IS_FRAGMENT, BUNDLE_SINGLETON_DESTINATION, dtn::Bundle::custody_requested(), dtn::Bundle::do_not_fragment(), dtn::Bundle::is_admin(), dtn::Bundle::is_fragment(), and dtn::Bundle::singleton_dest().
Referenced by get_primary_len().
u_int64_t dtn::PrimaryBlockProcessor::format_cos_flags | ( | const Bundle * | bundle | ) | [static, protected] |
Helper functions to parse/format the primary block
Definition at line 115 of file PrimaryBlockProcessor.cc.
References dtn::Bundle::priority().
Referenced by get_primary_len().
u_int64_t dtn::PrimaryBlockProcessor::format_srr_flags | ( | const Bundle * | bundle | ) | [static, protected] |
Helper functions to parse/format the primary block
Definition at line 133 of file PrimaryBlockProcessor.cc.
References dtn::Bundle::custody_rcpt(), dtn::Bundle::deletion_rcpt(), dtn::Bundle::delivery_rcpt(), dtn::Bundle::forward_rcpt(), dtn::Bundle::receive_rcpt(), dtn::BundleProtocol::STATUS_CUSTODY_ACCEPTED, dtn::BundleProtocol::STATUS_DELETED, dtn::BundleProtocol::STATUS_DELIVERED, dtn::BundleProtocol::STATUS_FORWARDED, and dtn::BundleProtocol::STATUS_RECEIVED.
Referenced by get_primary_len().
int dtn::PrimaryBlockProcessor::generate | ( | const Bundle * | bundle, | |
BlockInfoVec * | xmit_blocks, | |||
BlockInfo * | block, | |||
const LinkRef & | link, | |||
bool | last | |||
) | [virtual] |
Virtual from BlockProcessor.
Implements dtn::BlockProcessor.
Definition at line 574 of file PrimaryBlockProcessor.cc.
References ASSERT, and BP_SUCCESS.
void dtn::PrimaryBlockProcessor::generate_primary | ( | const Bundle * | bundle, | |
BlockInfoVec * | xmit_blocks, | |||
BlockInfo * | block | |||
) |
Virtual from BlockProcessor.
Definition at line 595 of file PrimaryBlockProcessor.cc.
References ASSERT, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::block_length, buf, dtn::Bundle::creation_ts(), dtn::BundleProtocol::CURRENT_VERSION, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::custodian_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::custodian_ssp_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::dest_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::dest_ssp_offset, dtn::Dictionary::dict(), dtn::BlockInfoVec::dict(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::dictionary_length, dtn::Bundle::expiration(), dtn::Bundle::frag_offset(), get_primary_len(), dtn::Bundle::is_fragment(), len, dtn::Dictionary::length(), dtn::log, dtn::Bundle::orig_length(), PBP_WRITE_SDNV, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::processing_flags, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::replyto_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::replyto_ssp_offset, dtn::BundleTimestamp::seconds_, dtn::BundleTimestamp::seqno_, dtn::BlockInfo::set_data_length(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::source_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::source_ssp_offset, and dtn::BlockInfo::writable_contents().
Referenced by dtn::BundleProtocol::generate_blocks().
size_t dtn::PrimaryBlockProcessor::get_primary_len | ( | const Bundle * | bundle, | |
Dictionary * | dict, | |||
PrimaryBlock * | primary | |||
) | [static, protected] |
Helper functions to parse/format the primary block
Definition at line 177 of file PrimaryBlockProcessor.cc.
References dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::block_length, dtn::Bundle::bundleid(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::creation_sequence, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::creation_time, dtn::Bundle::creation_ts(), dtn::BundleProtocol::CURRENT_VERSION, dtn::Bundle::custodian(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::custodian_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::custodian_ssp_offset, dtn::Bundle::dest(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::dest_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::dest_ssp_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::dictionary_length, encoding_len(), dtn::Bundle::expiration(), format_bundle_flags(), format_cos_flags(), format_srr_flags(), dtn::Bundle::frag_offset(), dtn::Dictionary::get_offsets(), dtn::Bundle::is_fragment(), dtn::Dictionary::length(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::lifetime, dtn::log, dtn::Bundle::orig_length(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::processing_flags, dtn::Bundle::replyto(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::replyto_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::replyto_ssp_offset, dtn::BundleTimestamp::seconds_, dtn::BundleTimestamp::seqno_, dtn::Bundle::source(), dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::source_scheme_offset, dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::source_ssp_offset, and dtn::PrimaryBlockProcessor::PrimaryBlockProcessor::PrimaryBlock::version.
Referenced by generate_primary().
void dtn::PrimaryBlockProcessor::parse_bundle_flags | ( | Bundle * | bundle, | |
u_int64_t | flags | |||
) | [static, protected] |
Helper functions to parse/format the primary block
Definition at line 74 of file PrimaryBlockProcessor.cc.
References BUNDLE_ACK_BY_APP, BUNDLE_CUSTODY_XFER_REQUESTED, BUNDLE_DO_NOT_FRAGMENT, BUNDLE_IS_ADMIN, BUNDLE_IS_FRAGMENT, BUNDLE_SINGLETON_DESTINATION, dtn::Bundle::set_app_acked_rcpt(), dtn::Bundle::set_custody_requested(), dtn::Bundle::set_do_not_fragment(), dtn::Bundle::set_is_admin(), dtn::Bundle::set_is_fragment(), and dtn::Bundle::set_singleton_dest().
Referenced by consume().
void dtn::PrimaryBlockProcessor::parse_cos_flags | ( | Bundle * | bundle, | |
u_int64_t | cos_flags | |||
) | [static, protected] |
Helper functions to parse/format the primary block
Definition at line 126 of file PrimaryBlockProcessor.cc.
References dtn::Bundle::set_priority().
Referenced by consume().
void dtn::PrimaryBlockProcessor::parse_srr_flags | ( | Bundle * | bundle, | |
u_int64_t | srr_flags | |||
) | [static, protected] |
Helper functions to parse/format the primary block
Definition at line 157 of file PrimaryBlockProcessor.cc.
References dtn::Bundle::set_custody_rcpt(), dtn::Bundle::set_deletion_rcpt(), dtn::Bundle::set_delivery_rcpt(), dtn::Bundle::set_forward_rcpt(), dtn::Bundle::set_receive_rcpt(), dtn::BundleProtocol::STATUS_CUSTODY_ACCEPTED, dtn::BundleProtocol::STATUS_DELETED, dtn::BundleProtocol::STATUS_DELIVERED, dtn::BundleProtocol::STATUS_FORWARDED, and dtn::BundleProtocol::STATUS_RECEIVED.
Referenced by consume().
int dtn::PrimaryBlockProcessor::prepare | ( | const Bundle * | bundle, | |
BlockInfoVec * | xmit_blocks, | |||
const BlockInfo * | source, | |||
const LinkRef & | link, | |||
list_owner_t | list | |||
) | [virtual] |
Virtual from BlockProcessor.
Reimplemented from dtn::BlockProcessor.
Definition at line 274 of file PrimaryBlockProcessor.cc.
References dtn::Dictionary::add_eid(), ASSERT, dtn::BlockProcessor::BlockInfo, BP_SUCCESS, dtn::Bundle::custodian(), dtn::Bundle::dest(), dtn::BlockInfoVec::dict(), dtn::Bundle::replyto(), and dtn::Bundle::source().
bool dtn::PrimaryBlockProcessor::validate | ( | const Bundle * | bundle, | |
BlockInfoVec * | block_list, | |||
BlockInfo * | block, | |||
status_report_reason_t * | reception_reason, | |||
status_report_reason_t * | deletion_reason | |||
) | [virtual] |
Virtual from BlockProcessor.
Reimplemented from dtn::BlockProcessor.
Definition at line 493 of file PrimaryBlockProcessor.cc.
References dtn::Bundle::app_acked_rcpt(), dtn::Bundle::custodian(), dtn::Bundle::custody_rcpt(), dtn::Bundle::custody_requested(), dtn::Bundle::deletion_rcpt(), dtn::Bundle::delivery_rcpt(), dtn::Bundle::dest(), dtn::Bundle::do_not_fragment(), dtn::Bundle::forward_rcpt(), dtn::Bundle::is_admin(), dtn::log, log_err_p, dtn::EndpointID::NULL_EID(), dtn::BundleProtocol::REASON_BLOCK_UNINTELLIGIBLE, dtn::Bundle::receipt_requested(), dtn::Bundle::receive_rcpt(), dtn::Bundle::replyto(), dtn::Bundle::source(), and dtn::EndpointID::valid().
friend class BundleProtocol [friend] |
Helper functions to parse/format the primary block
Reimplemented from dtn::BlockProcessor.
Definition at line 104 of file PrimaryBlockProcessor.h.